igc.h 224 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884
  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: igc.h
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Interface decriptions for the igc library. This file was created by the ATL wizard.
  10. **
  11. ** History:
  12. */
  13. #ifndef IGC_H
  14. #define IGC_H
  15. const float c_fPedestalOffset = 2000.0f;
  16. const float c_fFlagOffset = 50.0f;
  17. const int c_maxLaunchSlots = 6;
  18. const int c_maxLandSlots = 4;
  19. const int c_maxLandPlanes = 6;
  20. const int c_maxShipLandSlots = 2;
  21. const int c_maxShipLaunchSlots = 2;
  22. typedef int ExplosionType;
  23. const ExplosionType c_etMine = 1;
  24. const ExplosionType c_etMissile = 2;
  25. const ExplosionType c_etProjectile = 2; //Intentional duplication
  26. const ExplosionType c_etSmallShip = 3;
  27. const ExplosionType c_etProbe = 3; //Intentional duplication
  28. const ExplosionType c_etBigShip = 4;
  29. const ExplosionType c_etSmallStation = 5;
  30. const ExplosionType c_etAsteroid = 6;
  31. const ExplosionType c_etLargeStation = 7;
  32. typedef char DamageResult;
  33. const DamageResult c_drKilled = 1;
  34. const DamageResult c_drHullDamage = 2;
  35. const DamageResult c_drShieldDamage = 3;
  36. const DamageResult c_drNoDamage = 4;
  37. const int c_tsmaskNothing = 0;
  38. const int c_tsmaskSelected = 0x01;
  39. const int c_tsmaskSubject = 0x02;
  40. const int c_tsmaskLegalObject = 0x04;
  41. typedef short FloatConstantID;
  42. const FloatConstantID c_fcidLensMultiplier = 0;
  43. const FloatConstantID c_fcidRadiusUniverse = 1;
  44. const FloatConstantID c_fcidOutOfBounds = 2;
  45. const FloatConstantID c_fcidExitWarpSpeed = 3;
  46. const FloatConstantID c_fcidExitStationSpeed = 4;
  47. const FloatConstantID c_fcidDownedShield = 5;
  48. const FloatConstantID c_fcidSecondsBetweenPaydays = 6;
  49. const FloatConstantID c_fcidCapacityHe3 = 7;
  50. const FloatConstantID c_fcidValueHe3 = 8;
  51. const FloatConstantID c_fcidAmountHe3 = 9;
  52. const FloatConstantID c_fcidMountRate = 10;
  53. const FloatConstantID c_fcidStartingMoney = 11;
  54. const FloatConstantID c_fcidWinTheGameMoney = 12;
  55. const FloatConstantID c_fcidRipcordTime = 13;
  56. const FloatConstantID c_fcidHe3Regeneration = 14;
  57. const FloatConstantID c_fcidPointsWarp = 15;
  58. const FloatConstantID c_fcidPointsAsteroid = 16;
  59. const FloatConstantID c_fcidPointsTech = 17;
  60. const FloatConstantID c_fcidPointsMiner = 18;
  61. const FloatConstantID c_fcidPointsBuilder = 19;
  62. const FloatConstantID c_fcidPointsLayer = 20;
  63. const FloatConstantID c_fcidPointsCarrier = 21;
  64. const FloatConstantID c_fcidPointsPlayer = 22;
  65. const FloatConstantID c_fcidPointsBaseKill = 23;
  66. const FloatConstantID c_fcidPointsBaseCapture = 24;
  67. const FloatConstantID c_fcidPointsFlags = 25;
  68. const FloatConstantID c_fcidPointsArtifacts = 26;
  69. const FloatConstantID c_fcidPointsRescues = 27;
  70. const FloatConstantID c_fcidRatingAdd = 28;
  71. const FloatConstantID c_fcidRatingDivide = 29;
  72. const FloatConstantID c_fcidIncome = 30;
  73. const FloatConstantID c_fcidLifepodEndurance = 31;
  74. const FloatConstantID c_fcidWarpBombDelay = 32;
  75. const FloatConstantID c_fcidLifepodCost = 33;
  76. const FloatConstantID c_fcidTurretCost = 34;
  77. const FloatConstantID c_fcidDroneCost = 35;
  78. const FloatConstantID c_fcidPlayerCost = 36;
  79. const FloatConstantID c_fcidBaseClusterCost = 37;
  80. const FloatConstantID c_fcidClusterDivisor = 38;
  81. const FloatConstantID c_fcidMax = 40;
  82. //
  83. // Note: if you add or change any new ObjectTypes, then please notify
  84. // Mark C or John T so that AGCIDL.idl will be updated.
  85. //
  86. //
  87. typedef short ObjectType;
  88. const ObjectType OT_invalid = -1;
  89. const ObjectType OT_modelBegin = 0;
  90. const ObjectType OT_ship = 0; //All classes derived from model
  91. const ObjectType OT_station = 1;
  92. const ObjectType OT_missile = 2;
  93. const ObjectType OT_mine = 3;
  94. const ObjectType OT_probe = 4;
  95. const ObjectType OT_asteroid = 5;
  96. const ObjectType OT_projectile = 6;
  97. const ObjectType OT_warp = 7;
  98. const ObjectType OT_treasure = 8; //All of the above are models
  99. const ObjectType OT_buoy = 9;
  100. const ObjectType OT_chaff = 10;
  101. const ObjectType OT_buildingEffect = 11;
  102. const ObjectType OT_modelEnd = 11;
  103. const ObjectType OT_side = 12;
  104. const ObjectType OT_cluster = 13;
  105. const ObjectType OT_bucket = 14;
  106. const ObjectType OT_partBegin = 15;
  107. const ObjectType OT_weapon = 15;
  108. const ObjectType OT_shield = 16;
  109. const ObjectType OT_cloak = 17;
  110. const ObjectType OT_pack = 18;
  111. const ObjectType OT_afterburner = 19;
  112. const ObjectType OT_launcherBegin = 20;
  113. const ObjectType OT_magazine = 20;
  114. const ObjectType OT_dispenser = 21;
  115. const ObjectType OT_launcherEnd = 21;
  116. const ObjectType OT_partEnd = 21;
  117. const ObjectType OT_staticBegin = 22;
  118. const ObjectType OT_projectileType = 22; //All static objects
  119. const ObjectType OT_missileType = 23;
  120. const ObjectType OT_mineType = 24;
  121. const ObjectType OT_probeType = 25;
  122. const ObjectType OT_chaffType = 26;
  123. const ObjectType OT_civilization = 27;
  124. const ObjectType OT_treasureSet = 28;
  125. const ObjectType OT_bucketStart = 29;
  126. const ObjectType OT_hullType = 29;
  127. const ObjectType OT_partType = 30;
  128. const ObjectType OT_stationType = 31;
  129. const ObjectType OT_development = 32;
  130. const ObjectType OT_droneType = 33;
  131. const ObjectType OT_bucketEnd = 33;
  132. const ObjectType OT_staticEnd = 33;
  133. const ObjectType OT_constants = 34;
  134. const ObjectType OT_allsrvUser = 35; // used by the admin object model
  135. const ObjectType OT_Max = 36;// don't put anything after this
  136. // OT_Max should be less then 256 for
  137. // AGC event firing.
  138. const __int64 c_maskStaticTypes = (__int64(1) << __int64(OT_projectileType)) |
  139. (__int64(1) << __int64(OT_treasureSet)) |
  140. (__int64(1) << __int64(OT_hullType)) |
  141. (__int64(1) << __int64(OT_partType)) |
  142. (__int64(1) << __int64(OT_missileType)) |
  143. (__int64(1) << __int64(OT_mineType)) |
  144. (__int64(1) << __int64(OT_probeType)) |
  145. (__int64(1) << __int64(OT_civilization)) |
  146. (__int64(1) << __int64(OT_stationType)) |
  147. (__int64(1) << __int64(OT_development)) |
  148. (__int64(1) << __int64(OT_droneType)) |
  149. (__int64(1) << __int64(OT_chaffType)) |
  150. (__int64(1) << __int64(OT_constants));
  151. const __int64 c_maskMapTypes = (__int64(1) << __int64(OT_asteroid)) |
  152. (__int64(1) << __int64(OT_station)) |
  153. (__int64(1) << __int64(OT_cluster)) |
  154. (__int64(1) << __int64(OT_mine)) |
  155. (__int64(1) << __int64(OT_probe)) |
  156. (__int64(1) << __int64(OT_treasure)) |
  157. (__int64(1) << __int64(OT_warp));
  158. class Geo;
  159. class ThingGeo;
  160. class ThingGeoSite;
  161. class GroupGeo;
  162. class BuildEffectGeo;
  163. class PosterImage;
  164. class DamageTrackSet;
  165. class DamageTrack;
  166. class DamageBucket;
  167. typedef Slist_utl<DamageBucket*> DamageBucketList;
  168. typedef Slink_utl<DamageBucket*> DamageBucketLink;
  169. typedef short ForceEffectID;
  170. const ForceEffectID c_maxEffect = 10;
  171. const ForceEffectID effectFire = 0;
  172. const ForceEffectID effectBounce = 1;
  173. const ForceEffectID effectExplode = 2;
  174. typedef short VisualEffectID;
  175. const ForceEffectID effectJiggle = 0;
  176. typedef short TrekKey;
  177. const TrekKey TK_NoKeyMapping = -1; // Key not mapped to anything
  178. const TrekKey TK_NextCommMsg = 0; // Scroll focus to next chat message in buffer
  179. const TrekKey TK_PrevCommMsg = 1; // Scroll focus to previous chat message in buffer
  180. const TrekKey TK_PrevWeapon = 2; // Select the previous weapon from inventory
  181. const TrekKey TK_NextWeapon = 3; // Select the next weapon from inventory
  182. const TrekKey TK_ToggleGroupFire = 4; // Toggle all weapons firing together
  183. const TrekKey TK_PrevPart = 5; // Select the previous part from inventory
  184. const TrekKey TK_NextPart = 6; // Select the next part from inventory
  185. const TrekKey TK_MountPart = 7; // Mount the selected part
  186. const TrekKey TK_ReplacePart = 8; // Replace the selected part
  187. const TrekKey TK_UnmountPart = 9; // Unmount the selected part
  188. const TrekKey TK_DropPart = 10; // Drop the selected part
  189. const TrekKey TK_ZoomOut = 11; // Zoom out
  190. const TrekKey TK_ZoomIn = 12; // Zoom in
  191. const TrekKey TK_PitchUp = 17; // Turn the nose of the ship up
  192. const TrekKey TK_PitchDown = 18; // Turn the nose of the ship down
  193. const TrekKey TK_YawLeft = 19; // Turn the nose of the ship left
  194. const TrekKey TK_YawRight = 20; // Turn the nose of the ship right
  195. const TrekKey TK_RollLeft = 21; // Roll the ship to the left
  196. const TrekKey TK_RollRight = 22; // Roll the ship to the right
  197. const TrekKey TK_FOVOut = 23; // Adjust frame-of-view wider
  198. const TrekKey TK_FOVIn = 24; // Adjust frame-of-view narrower
  199. const TrekKey TK_MainMenu = 25; // View the main menu
  200. const TrekKey TK_ViewFrontLeft = 26; // Look forward to the left
  201. const TrekKey TK_ViewFrontRight = 27; // Look forward to the right
  202. const TrekKey TK_ViewLeft = 28; // Look to the left
  203. const TrekKey TK_ViewRight = 29; // Look to the right
  204. const TrekKey TK_ViewExternal = 30; // View the ship from outside
  205. const TrekKey TK_ViewFlyby = 31; // View an animated flyby of the ship
  206. const TrekKey TK_ViewMissile = 32; // View from the missile camera
  207. const TrekKey TK_ViewTarget = 33; // View the targeted item
  208. const TrekKey TK_ViewChase = 34; // View the ship from a chase position
  209. const TrekKey TK_ViewTurret = 35; // View from the ship's turret
  210. const TrekKey TK_ViewBase = 36; // View from the base
  211. const TrekKey TK_ViewSector = 37; // View the sector map
  212. const TrekKey TK_ViewCommand = 38; // Display a tactical view of the sector
  213. const TrekKey TK_CycleChatMsgs = 39; // Currently does nothing
  214. const TrekKey TK_AcceptCommand = 40; // Accept pending command
  215. const TrekKey TK_ClearCommand = 41; // Clear current command
  216. const TrekKey TK_RejectCommand = 42; // current target == current command
  217. const TrekKey TK_ToggleAutoPilot = 43; // Activate autopilot
  218. const TrekKey TK_ThrustLeft = 44; // Apply thrust to cause ship to move left
  219. const TrekKey TK_ThrustRight = 45; // Apply thrust to cause ship to move right
  220. const TrekKey TK_ThrustUp = 46; // Apply thrust to cause ship to move up
  221. const TrekKey TK_ThrustDown = 47; // Apply thrust to cause ship to move down
  222. const TrekKey TK_ThrustForward = 48; // Apply thrust to cause ship to move forward
  223. const TrekKey TK_ThrustBackward = 49; // Apply thrust to cause ship to move backward
  224. const TrekKey TK_FireBooster = 50; // Fire booster rockets
  225. const TrekKey TK_ConModeGameState = 51; // Game State Console Mode
  226. const TrekKey TK_QuickChatMenu = 52; // Bring up quick chat menu
  227. const TrekKey TK_ToggleLODSlider = 53; // Toggle the LOD Slider
  228. const TrekKey TK_StartChat = 54; // Start a chat message
  229. const TrekKey TK_FireWeapon = 55; // Fire the selected weapon
  230. const TrekKey TK_FireMissile = 56; // Fire the selected missile
  231. const TrekKey TK_LockVector = 57; // Lock the current heading and speed
  232. const TrekKey TK_ThrottleUp = 58; // Increase the ship speed
  233. const TrekKey TK_ThrottleDown = 59; // Decrease the ship speed
  234. const TrekKey TK_ThrottleZero = 60; // Shut down engine
  235. const TrekKey TK_Throttle33 = 61; // Throttle at one-third
  236. const TrekKey TK_Throttle66 = 62; // Throttle at two-thirds
  237. const TrekKey TK_ThrottleFull = 63; // Throttle at full
  238. const TrekKey TK_ToggleBooster = 64; // Toggle booster rocket on/off
  239. const TrekKey TK_LODUp = 65; // Move the LOD scale higher
  240. const TrekKey TK_LODDown = 66; // Move the LOD scale lower
  241. const TrekKey TK_ConModeCombat = 67; // Sets console mode to combat
  242. const TrekKey TK_ConModeCommand = 68; // Sets console mode to command view
  243. const TrekKey TK_ConModeNav = 69; // Sets console mode to navigation
  244. const TrekKey TK_ConModeInventory = 70; // Sets console mode to inventory
  245. const TrekKey TK_ConModeInvest = 71; // Sets console mode to investments
  246. const TrekKey TK_ConModeTeam = 72; // Sets console mode to the team pane
  247. const TrekKey TK_ViewRear = 73; // Sets the camera to point directly back
  248. const TrekKey TK_Target = 74; // Target next object (any type)
  249. const TrekKey TK_TargetNearest = 75; // Target nearest object (any type)
  250. const TrekKey TK_TargetPrev = 76; // Target previous object (any type)
  251. const TrekKey TK_TargetFriendly = 77; // Target next friendly ship
  252. const TrekKey TK_TargetFriendlyNearest = 78; // Target nearest friendly ship
  253. const TrekKey TK_TargetFriendlyPrev = 79; // Target previous friendly ship
  254. const TrekKey TK_TargetEnemy = 80; // Target next enemy ship
  255. const TrekKey TK_TargetEnemyNearest = 81; // Target nearest enemy ship
  256. const TrekKey TK_TargetEnemyPrev = 82; // Target previous enemy ship
  257. const TrekKey TK_TargetEnemyBase = 83; // Targets the nearest enemy base
  258. const TrekKey TK_TargetEnemyBaseNearest = 84; // Targets the nearest (any) object
  259. const TrekKey TK_TargetEnemyBasePrev = 85; // Targets the nearest enemy ship
  260. const TrekKey TK_TargetFriendlyBase = 86; // Targets the nearest friendly ship
  261. const TrekKey TK_TargetFriendlyBaseNearest = 87; // Targets the nearest object within a cone ahead
  262. const TrekKey TK_TargetFriendlyBasePrev = 88; // Target previous friendly base
  263. const TrekKey TK_TargetCommand = 89; // Target the object of current command
  264. const TrekKey TK_TargetCenter = 90; // Target ship straight ahead
  265. const TrekKey TK_TargetHostile = 91; // Target the ship causing most recent damage
  266. const TrekKey TK_Suicide = 92; // Kill yourself
  267. const TrekKey TK_ToggleGrid = 93; // Toggle visible grid in combat view
  268. const TrekKey TK_ToggleCloak = 94; // Toggle cloaking
  269. const TrekKey TK_DropMine = 95; // Drop a minefield
  270. const TrekKey TK_Ripcord = 96; // Ripcord
  271. const TrekKey TK_ViewRearLeft = 97; // Look back and to the left
  272. const TrekKey TK_ViewRearRight = 99; // Look back and to the right
  273. const TrekKey TK_Obsolete1 = 99; // Not used - feel free to reuse
  274. const TrekKey TK_TargetSelf =100; // Target myself
  275. const TrekKey TK_ToggleCollisions =101; // Toggle collision detection
  276. const TrekKey TK_OccupyNextTurret =102; // Occupy the next available turret position
  277. const TrekKey TK_TargetNothing =103; // Reset target so that nothing is targeted
  278. const TrekKey TK_MatchSpeed =104; // Match speed with target
  279. const TrekKey TK_ChatPageUp =105; // Scroll the chat pane one page up
  280. const TrekKey TK_ChatPageDown =106; // Scroll the chat pane one page down
  281. const TrekKey TK_ViewExternalOrbit =107; // Orbit the camera around the ship
  282. const TrekKey TK_ViewExternalStation =108; // Have the camera face the station through the ship
  283. const TrekKey TK_QuickChat1 =109; // Send quick chat 1
  284. const TrekKey TK_QuickChat2 =110; // Send quick chat 2
  285. const TrekKey TK_QuickChat3 =111; // Send quick chat 3
  286. const TrekKey TK_QuickChat4 =112; // Send quick chat 4
  287. const TrekKey TK_QuickChat5 =113; // Send quick chat 5
  288. const TrekKey TK_QuickChat6 =114; // Send quick chat 6
  289. const TrekKey TK_QuickChat7 =115; // Send quick chat 7
  290. const TrekKey TK_QuickChat8 =116; // Send quick chat 8
  291. const TrekKey TK_QuickChat9 =117; // Send quick chat 9
  292. const TrekKey TK_QuickChat0 =118; // Send quick chat 10
  293. const TrekKey TK_DebugTest1 = 119; // DebugTest1
  294. const TrekKey TK_DebugTest2 = 120; // DebugTest2
  295. const TrekKey TK_DebugTest3 = 121; // DebugTest3
  296. const TrekKey TK_DebugTest4 = 122; // DebugTest4
  297. const TrekKey TK_DebugTest5 = 123; // DebugTest5
  298. const TrekKey TK_DebugTest6 = 124; // DebugTest6
  299. const TrekKey TK_DebugTest7 = 125; // DebugTest7
  300. const TrekKey TK_DebugTest8 = 126; // DebugTest8
  301. const TrekKey TK_DebugTest9 = 127; // DebugTest9
  302. const TrekKey TK_DropChaff = 128; // Drop Chaff
  303. const TrekKey TK_ToggleCommand = 129; // Toggle command mode 3/4 vs. top down
  304. const TrekKey TK_SwapWeapon1 = 130; // Swap the current weapon with cargo
  305. const TrekKey TK_SwapWeapon2 = 131; // Swap the current weapon with cargo
  306. const TrekKey TK_SwapWeapon3 = 132; // Swap the current weapon with cargo
  307. const TrekKey TK_SwapWeapon4 = 133; // Swap the current weapon with cargo
  308. const TrekKey TK_SwapTurret1 = 134; // Swap the current weapon with cargo
  309. const TrekKey TK_SwapTurret2 = 135; // Swap the current weapon with cargo
  310. const TrekKey TK_SwapTurret3 = 136; // Swap the current weapon with cargo
  311. const TrekKey TK_SwapTurret4 = 137; // Swap the current weapon with cargo
  312. const TrekKey TK_SwapMissile = 138; // Swap the current item with cargo
  313. const TrekKey TK_SwapChaff = 139; // Swap the current item with cargo
  314. const TrekKey TK_SwapShield = 140; // Swap the current item with cargo
  315. const TrekKey TK_SwapCloak = 141; // Swap the current item with cargo
  316. const TrekKey TK_SwapAfterburner = 142; // Swap the current item with cargo
  317. const TrekKey TK_SwapMine = 143; // Swap the current item with cargo
  318. const TrekKey TK_NextCargo = 144; // Rotate the selected cargo item
  319. const TrekKey TK_ToggleWeapon1 = 145; // select the weapon for singe fire or group fire
  320. const TrekKey TK_ToggleWeapon2 = 146; // select the weapon for singe fire or group fire
  321. const TrekKey TK_ToggleWeapon3 = 147; // select the weapon for singe fire or group fire
  322. const TrekKey TK_ToggleWeapon4 = 148; // select the weapon for singe fire or group fire
  323. const TrekKey TK_DropCargo = 154; // drop the current cargo item
  324. const TrekKey TK_Reload = 155;
  325. const TrekKey TK_ExecuteCommand = 156; // accept and activate autopilot
  326. const TrekKey TK_PauseTM = 157; // pause training missions
  327. const TrekKey TK_TargetEnemyBomber = 158;
  328. const TrekKey TK_TargetEnemyFighter = 159;
  329. const TrekKey TK_TargetEnemyConstructor = 160;
  330. const TrekKey TK_TargetEnemyMiner = 161;
  331. const TrekKey TK_TargetEnemyMajorBase = 162;
  332. const TrekKey TK_TargetFriendlyBomber = 163;
  333. const TrekKey TK_TargetFriendlyFighter = 164;
  334. const TrekKey TK_TargetFriendlyConstructor = 165;
  335. const TrekKey TK_TargetFriendlyMiner = 166;
  336. const TrekKey TK_TargetFriendlyLifepod = 167;
  337. const TrekKey TK_TargetFriendlyMajorBase = 168;
  338. const TrekKey TK_TargetFlag = 169;
  339. const TrekKey TK_TargetArtifact = 170;
  340. const TrekKey TK_TargetEnemyBomberNearest = 171;
  341. const TrekKey TK_TargetEnemyFighterNearest = 172;
  342. const TrekKey TK_TargetEnemyConstructorNearest = 173;
  343. const TrekKey TK_TargetEnemyMinerNearest = 174;
  344. const TrekKey TK_TargetEnemyMajorBaseNearest = 175;
  345. const TrekKey TK_TargetFriendlyBomberNearest = 176;
  346. const TrekKey TK_TargetFriendlyFighterNearest = 177;
  347. const TrekKey TK_TargetFriendlyConstructorNearest = 178;
  348. const TrekKey TK_TargetFriendlyMinerNearest = 179;
  349. const TrekKey TK_TargetFriendlyLifepodNearest = 180;
  350. const TrekKey TK_TargetFriendlyMajorBaseNearest = 181;
  351. const TrekKey TK_TargetFlagNearest = 182;
  352. const TrekKey TK_TargetArtifactNearest = 183;
  353. const TrekKey TK_TargetEnemyBomberPrev = 184;
  354. const TrekKey TK_TargetEnemyFighterPrev = 185;
  355. const TrekKey TK_TargetEnemyConstructorPrev = 186;
  356. const TrekKey TK_TargetEnemyMinerPrev = 187;
  357. const TrekKey TK_TargetEnemyMajorBasePrev = 188;
  358. const TrekKey TK_TargetFriendlyBomberPrev = 189;
  359. const TrekKey TK_TargetFriendlyFighterPrev = 190;
  360. const TrekKey TK_TargetFriendlyConstructorPrev = 191;
  361. const TrekKey TK_TargetFriendlyMinerPrev = 192;
  362. const TrekKey TK_TargetFriendlyLifepodPrev = 193;
  363. const TrekKey TK_TargetFriendlyMajorBasePrev = 194;
  364. const TrekKey TK_TargetFlagPrev = 195;
  365. const TrekKey TK_TargetArtifactPrev = 196;
  366. const TrekKey TK_TargetWarp = 197;
  367. const TrekKey TK_TargetWarpNearest = 198;
  368. const TrekKey TK_TargetWarpPrev = 199;
  369. // debugging keys
  370. const TrekKey TK_SkipTMGoal = 200; // skip a training mission goal
  371. const TrekKey TK_IncreaseTMClockSpeed = 201; // increase clock speed in training missions
  372. const TrekKey TK_DecreaseTMClockSpeed = 202; // decrease clock speed in training missions
  373. const TrekKey TK_ResetTMClockSpeed = 203; // reset clock speed in training missions
  374. const TrekKey TK_Help = 204; // help
  375. const TrekKey TK_CycleRadar = 205; // help
  376. const TrekKey TK_ConModeMiniTeam = 206; // Sets console mode to the mini-team pane
  377. const TrekKey TK_CommandFinishTM = 207;
  378. const TrekKey TK_RollModifier = 208;
  379. const TrekKey TK_TrackCommandView = 209;
  380. const TrekKey TK_ConModeTeleport = 210;
  381. const TrekKey TK_ToggleMouse = 211;
  382. const TrekKey TK_PromoteTurret1 = 212; // Swap the current weapon with cargo
  383. const TrekKey TK_PromoteTurret2 = 213; // Swap the current weapon with cargo
  384. const TrekKey TK_PromoteTurret3 = 214; // Swap the current weapon with cargo
  385. const TrekKey TK_PromoteTurret4 = 215; // Swap the current weapon with cargo
  386. const TrekKey TK_VoteYes = 216; // Vote Yes on the current issue
  387. const TrekKey TK_VoteNo = 217; // Vote No on the current issue
  388. const TrekKey TK_Max = 218; // Must be last trekkey
  389. typedef short SoundID;
  390. typedef short VoiceID;
  391. #define DEFSOUND(id) id##Sound,
  392. enum {
  393. lastDynamicSound = 1000,
  394. #include "sounds.h"
  395. };
  396. #undef DEFSOUND
  397. //Redefined data types (so we can change them later)
  398. const int NA = -1; // meaning unspecified, none, or all.
  399. typedef long MissionID;
  400. //*ID are unique IDs for something
  401. typedef short ObjectID;
  402. typedef ObjectID BucketID;
  403. typedef ObjectID PartID;
  404. typedef ObjectID ShipID;
  405. typedef ObjectID BuoyID;
  406. typedef ObjectID AsteroidID;
  407. typedef ObjectID HullID;
  408. typedef ObjectID StationTypeID;
  409. typedef ObjectID DroneTypeID;
  410. typedef ObjectID DevelopmentID;
  411. typedef ObjectID SectorID;
  412. typedef ObjectID WarpID;
  413. typedef ObjectID ProjectileTypeID;
  414. typedef ObjectID TreasureID;
  415. typedef ObjectID SideID;
  416. typedef ObjectID StationID;
  417. typedef ObjectID MissileID;
  418. typedef ObjectID ChaffID;
  419. typedef ObjectID MineID;
  420. typedef ObjectID ProbeID;
  421. typedef ObjectID ExpendableTypeID;
  422. typedef ObjectID CivID;
  423. typedef ObjectID MunitionID;
  424. typedef ObjectID TreasureSetID;
  425. typedef int SquadID;
  426. typedef ObjectID WingID;
  427. const WingID c_widMax = 10;
  428. const SideID c_cSidesMax = 6;
  429. extern const char* c_pszWingName[c_widMax];
  430. const DevelopmentID c_didTeamMoney = 1;
  431. const SideID SIDE_TEAMLOBBY = -2;
  432. typedef BYTE Cookie;
  433. //"Enumerated" types which probably should be something other than integers
  434. //This has to be signed so that NA means NA
  435. typedef unsigned char ModelAttributes;
  436. const ModelAttributes c_mtNotPickable = 0x01; //User can never pick the object
  437. const ModelAttributes c_mtScanner = 0x02; //Can see other objects
  438. const ModelAttributes c_mtPredictable = 0x04; //Send this object to a team when it is seen for the 1st time
  439. const ModelAttributes c_mtSeenBySide = 0x08; //Need to track its visibility wrt side
  440. const ModelAttributes c_mtStatic = 0x10; //Can move
  441. const ModelAttributes c_mtDamagable = 0x20; //Can take damage
  442. const ModelAttributes c_mtHitable = 0x40; //Goes into the collision KD tree
  443. const ModelAttributes c_mtCastRay = 0x80; //casts a ray for purposes of collisions
  444. typedef short EquipmentType; // this is PartTypeID in the database
  445. const EquipmentType ET_ChaffLauncher = 0;
  446. const EquipmentType ET_Weapon = 1;
  447. const EquipmentType ET_Magazine = 2;
  448. const EquipmentType ET_Dispenser = 3;
  449. const EquipmentType ET_Shield = 4;
  450. const EquipmentType ET_Cloak = 5;
  451. const EquipmentType ET_Pack = 6;
  452. const EquipmentType ET_Afterburner = 7;
  453. const EquipmentType ET_MAX = 8;
  454. typedef char PackType;
  455. const PackType c_packAmmo = 0;
  456. const PackType c_packFuel = 1;
  457. typedef char BuoyType;
  458. const BuoyType c_buoyWaypoint = 0;
  459. const BuoyType c_buoyCluster = 1;
  460. typedef unsigned char DamageTypeID;
  461. typedef unsigned char DefenseTypeID;
  462. const DamageTypeID c_dmgidNoWarn = 0x20;
  463. const DamageTypeID c_dmgidNoDebris = 0x40;
  464. const DamageTypeID c_dmgidNoFlare = 0x80;
  465. const DamageTypeID c_dmgidMask = 0x1f;
  466. const DamageTypeID c_dmgidCollision = c_dmgidNoDebris | c_dmgidNoFlare | c_dmgidNoWarn;
  467. const DamageTypeID c_dmgidMax = 20;
  468. const DefenseTypeID c_defidAsteroid = 0;
  469. const DefenseTypeID c_defidMax = 20;
  470. typedef int TechTreeBit;
  471. const TechTreeBit c_ttbShipyardAllowed = 1;
  472. const TechTreeBit c_ttbExpansionAllowed = 2;
  473. const TechTreeBit c_ttbTacticalAllowed = 3;
  474. const TechTreeBit c_ttbSupremacyAllowed = 4;
  475. // these #defs need to be modified when the number of bits changes
  476. const TechTreeBit c_ttbMax = 400;
  477. #define CbTechBits 400 // keep in sync w/ TechBits sql data type
  478. #define CbTechBitName 40
  479. #define cTechs 400
  480. typedef short GlobalAttributeID;
  481. typedef short GlobalAttribute;
  482. const GlobalAttribute c_gaMaxSpeed = 0; //Implemented
  483. const GlobalAttribute c_gaThrust = 1; //I
  484. const GlobalAttribute c_gaTurnRate = 2; //I
  485. const GlobalAttribute c_gaTurnTorque = 3; //I
  486. const GlobalAttribute c_gaMaxArmorStation = 4; //I
  487. const GlobalAttribute c_gaArmorRegenerationStation = 5; //I
  488. const GlobalAttribute c_gaMaxShieldStation = 6; //I
  489. const GlobalAttribute c_gaShieldRegenerationStation = 7; //I
  490. const GlobalAttribute c_gaMaxArmorShip = 8; //I
  491. const GlobalAttribute c_gaMaxShieldShip = 9; //I
  492. const GlobalAttribute c_gaShieldRegenerationShip = 10; //I
  493. const GlobalAttribute c_gaScanRange = 11; //I
  494. const GlobalAttribute c_gaSignature = 12; //I
  495. const GlobalAttribute c_gaMaxEnergy = 13; //I
  496. const GlobalAttribute c_gaSpeedAmmo = 14; //I
  497. const GlobalAttribute c_gaLifespanEnergy = 15; //I
  498. const GlobalAttribute c_gaTurnRateMissile = 16; //I
  499. const GlobalAttribute c_gaMiningRate = 17; //I
  500. const GlobalAttribute c_gaMiningYield = 18; //I
  501. const GlobalAttribute c_gaMiningCapacity = 19; //I
  502. const GlobalAttribute c_gaRipcordTime = 20; //I
  503. const GlobalAttribute c_gaDamageGuns = 21; //I
  504. const GlobalAttribute c_gaDamageMissiles = 22; //I
  505. const GlobalAttribute c_gaDevelopmentCost = 23; //I
  506. const GlobalAttribute c_gaDevelopmentTime = 24; //I
  507. const GlobalAttribute c_gaMax = 25;
  508. typedef unsigned char StationClassID;
  509. const StationClassID c_scStarbase = 0;
  510. const StationClassID c_scGarrison = 1;
  511. const StationClassID c_scShipyard = 2;
  512. const StationClassID c_scRipcord = 3;
  513. const StationClassID c_scMining = 4;
  514. const StationClassID c_scResearch = 5;
  515. const StationClassID c_scOrdinance = 6;
  516. const StationClassID c_scElectronics = 7;
  517. typedef char WarningMask;
  518. const WarningMask c_wmOutOfBounds = 0x01;
  519. const WarningMask c_wmCrowdedSector = 0x02;
  520. typedef char BuyableGroupID;
  521. /*
  522. · Max Speed: Up the sides maximum speed
  523. · Rate of Yaw: Increase angle of turn per sec
  524. · Rate of Pitch: Increase angle of turn per sec
  525. · Rate of acceleration: Increase your acceleration
  526. · Energy level: Boosts available energy for firing weapons and other stuff.
  527. · Energy Level recharge rate: Faster recharge rate
  528. · Mounts: Give ships bigger carrying capabilities.
  529. · Shield strength: Better shields more hp
  530. · Shield Recharge: Better recharge.
  531. · Hull strength: Better Armor more hp
  532. · Afterburner fuel efficiency: More miles per gallon
  533. · Afterburner speed multiplier: Top speed enhanced
  534. · Signature: Dampens your global signature.
  535. · Scan Range: Ups the area by an amount
  536. · Space station shield strength: More hit points.
  537. · Space station hull strength: More hull hit points
  538. · Miner productivity: Increase the dollar amount given to players at the completion of a round trip.
  539. · Weapon Cost: Make all weapons a little cheaper
  540. · Equipment Cost: make all equipment cheaper
  541. · Ship Cost: Make ships cheaper
  542. · Missile Speed/Accuracy?/Recalc time: A global attribute to improve Missiles chance of hitting.
  543. · Projectile Damage: Ups damage
  544. · Missile Damage: Ups damage
  545. · Weapon Range: Improves distance
  546. · Drone targeting : Improves accuracy
  547. · Auto turret accuracy rating.: Improves accuracy (possibly same as above.)
  548. */
  549. enum STAGE // Keep in sync with AGCGameStage in AGCIDL.h
  550. {
  551. STAGE_NOTSTARTED,
  552. STAGE_STARTING,
  553. STAGE_STARTED,
  554. STAGE_OVER,
  555. STAGE_TERMINATE
  556. };
  557. /*
  558. ** PilotType ... these are the various automatic pilots that can be plugged into a ship
  559. */
  560. typedef unsigned char PilotType;
  561. const PilotType c_ptMiner = 0;
  562. const PilotType c_ptWingman = 2;
  563. const PilotType c_ptLayer = 5;
  564. const PilotType c_ptBuilder = 6;
  565. const PilotType c_ptCarrier = 9;
  566. const PilotType c_ptPlayer = 10;
  567. const PilotType c_ptCheatPlayer = 11;
  568. const unsigned char c_ucRenderNone = 0x00;
  569. const unsigned char c_ucRenderTrail = 0x01;
  570. const unsigned char c_ucRenderAll = 0x02;
  571. const unsigned char c_ucRadarOnScreenLarge = 0;
  572. const unsigned char c_ucRadarOnScreenSmall = 1;
  573. const unsigned char c_ucRadarOffScreen = 2;
  574. typedef short PartMask;
  575. typedef short AbilityBitMask;
  576. typedef AbilityBitMask HullAbilityBitMask;
  577. const HullAbilityBitMask c_habmBoard = 0x01;
  578. const HullAbilityBitMask c_habmRescue = 0x02;
  579. const HullAbilityBitMask c_habmLifepod = 0x04;
  580. const HullAbilityBitMask c_habmCaptureThreat = 0x08;
  581. const HullAbilityBitMask c_habmLandOnCarrier = 0x10;
  582. const HullAbilityBitMask c_habmNoRipcord = 0x20;
  583. const HullAbilityBitMask c_habmIsRipcordTarget = 0x40;
  584. const HullAbilityBitMask c_habmFighter = 0x80;
  585. const HullAbilityBitMask c_habmRemoteLeadIndicator = 0x100;
  586. const HullAbilityBitMask c_habmThreatToStation = 0x200;
  587. const HullAbilityBitMask c_habmCarrier = 0x400;
  588. const HullAbilityBitMask c_habmLeadIndicator = 0x800;
  589. const HullAbilityBitMask c_habmIsLtRipcordTarget = 0x1000;
  590. const HullAbilityBitMask c_habmCanLtRipcord = 0x2000;
  591. const HullAbilityBitMask c_habmMiner = 0x4000;
  592. const HullAbilityBitMask c_habmBuilder = (short)0x8000;
  593. typedef AbilityBitMask StationAbilityBitMask;
  594. const StationAbilityBitMask c_sabmUnload = 0x01; //Ability to offload mined minerals
  595. const StationAbilityBitMask c_sabmStart = 0x02; // start the game at this station
  596. const StationAbilityBitMask c_sabmRestart = 0x04; // restart after dying
  597. const StationAbilityBitMask c_sabmRipcord = 0x08; // teleport to the station
  598. const StationAbilityBitMask c_sabmCapture = 0x10; // be captured
  599. const StationAbilityBitMask c_sabmLand = 0x20; // land at
  600. const StationAbilityBitMask c_sabmRepair = 0x40; // get repaired
  601. const StationAbilityBitMask c_sabmRemoteLeadIndicator = 0x80; // shows up in the loadout menu of stations
  602. const StationAbilityBitMask c_sabmReload = 0x100; // free fuel and ammo on launch
  603. const StationAbilityBitMask c_sabmFlag = 0x200; // counts for victory
  604. const StationAbilityBitMask c_sabmPedestal = 0x400; // be a pedestal for a flag
  605. const StationAbilityBitMask c_sabmTeleportUnload = 0x800; // be a pedestal for a flag
  606. const StationAbilityBitMask c_sabmCapLand = 0x1000; // land capital ships
  607. const StationAbilityBitMask c_sabmRescue = 0x2000; // rescue pods
  608. const StationAbilityBitMask c_sabmRescueAny = 0x4000; // not used (but reserved for pods)
  609. typedef AbilityBitMask AsteroidAbilityBitMask;
  610. const AsteroidAbilityBitMask c_aabmMineHe3 = 0x01; //Has minable ore of some type (all mutually exclusive)
  611. const AsteroidAbilityBitMask c_aabmMineLotsHe3 = 0x02;
  612. const AsteroidAbilityBitMask c_aabmMineGold = 0x04;
  613. const AsteroidAbilityBitMask c_aabmBuildable = 0x08; //Buildings can be built on it
  614. const AsteroidAbilityBitMask c_aabmSpecial = 0x10; //Special buildings can be built on it
  615. typedef TLargeBitMask<c_ttbMax> TechTreeBitMask;
  616. typedef AbilityBitMask ExpendableAbilityBitMask;
  617. const ExpendableAbilityBitMask c_eabmCapture = 0x01;
  618. const ExpendableAbilityBitMask c_eabmWarpBomb = 0x02;
  619. const ExpendableAbilityBitMask c_eabmQuickReady = 0x08;
  620. const ExpendableAbilityBitMask c_eabmRipcord = 0x10;
  621. const ExpendableAbilityBitMask c_eabmShootStations = 0x20;
  622. const ExpendableAbilityBitMask c_eabmShootShips = 0x40;
  623. const ExpendableAbilityBitMask c_eabmShootMissiles = 0x80;
  624. const ExpendableAbilityBitMask c_eabmShootOnlyTarget = 0x1000;
  625. const ExpendableAbilityBitMask c_eabmRescue = c_sabmRescue; //0x2000 Rescue lifepods that collide with it
  626. const ExpendableAbilityBitMask c_eabmRescueAny = c_sabmRescueAny; //0x4000 Rescue any lifepod that collide with it
  627. enum ShipControlStateIGC
  628. {
  629. selectedWeaponOneIGC = 1,
  630. selectedWeaponTwoIGC = 2 * selectedWeaponOneIGC, //2 bits of weapon selection
  631. selectedWeaponMaskIGC = (2 * selectedWeaponTwoIGC) - 1,
  632. selectedWeaponShiftIGC = 0,
  633. coastButtonIGC = 2 * selectedWeaponTwoIGC, //Vector lock
  634. backwardButtonIGC = 2 * coastButtonIGC, //Thrust back
  635. forwardButtonIGC = 4 * coastButtonIGC, // forward
  636. leftButtonIGC = 8 * coastButtonIGC, // left
  637. rightButtonIGC = 16 * coastButtonIGC, // right
  638. upButtonIGC = 32 * coastButtonIGC, // up
  639. downButtonIGC = 64 * coastButtonIGC, // down
  640. afterburnerButtonIGC = 128 * coastButtonIGC, // with afterburners
  641. drillingMaskIGC = 256 * coastButtonIGC, //on rails to avoid collisions
  642. cloakActiveIGC = 512 * coastButtonIGC, //Activating the cloak
  643. unused0000001IGC = 1024 * coastButtonIGC, //no longer used ... reuse?
  644. miningMaskIGC = 2048 * coastButtonIGC, //Play mine effect
  645. buttonsMaskIGC = 4095 * coastButtonIGC, //12 possible state buttons
  646. oneWeaponIGC = 2 * miningMaskIGC,
  647. allWeaponsIGC = 2 * oneWeaponIGC,
  648. weaponsMaskIGC = 3 * oneWeaponIGC, //2 possible weapon buttons
  649. //High word: these are not transmitted as part of the state mask
  650. missileFireIGC = 0x10000, //Trying to shoot missiles
  651. mineFireIGC = 2 * missileFireIGC, // mines
  652. chaffFireIGC = 2 * mineFireIGC, // chaff
  653. wantsToMineMaskIGC = 2 * chaffFireIGC, //wants to mine an asteroid
  654. buildingMaskIGC = 2 * wantsToMineMaskIGC //in the process of building at an asteroid
  655. };
  656. // No "*Types" please if the VALUE of variable is a not a type of something! :-)
  657. // ships have a capacity, and mounted parts use up that capacity (drain)
  658. typedef float HitPoints;
  659. typedef int Money;
  660. typedef char Mount;
  661. typedef char Command;
  662. typedef short RankID;
  663. const Mount c_maxCargo = 5;
  664. const Mount c_mountNA = -c_maxCargo - 1;
  665. const Command c_cmdQueued = 0;
  666. const Command c_cmdAccepted = 1;
  667. const Command c_cmdCurrent = 2;
  668. const Command c_cmdPlan = 3;
  669. const Command c_cmdMax = 4;
  670. typedef unsigned char Axis;
  671. const Axis c_axisYaw = 0;
  672. const Axis c_axisPitch = 1;
  673. const Axis c_axisRoll = 2;
  674. const Axis c_axisThrottle = 3;
  675. const Axis c_axisMax = 4;
  676. //Constants used to avoid having to allocate arrays.
  677. const Mount c_maxUnmannedWeapons = 4;
  678. const Mount c_maxMountedWeapons = 8;
  679. struct CommandData
  680. {
  681. char szVerb[c_cbFileName];
  682. char szAccepted[c_cbFileName];
  683. char szQueued[c_cbFileName];
  684. enum Match
  685. {
  686. c_mNone, c_mPartial, c_mComplete
  687. };
  688. Match MatchCommand(const char* szString) const
  689. {
  690. assert (szString);
  691. const char* p1 = szString;
  692. const char* p2 = szVerb;
  693. while ((*p1 != '\0') && (*p2 != '\0'))
  694. {
  695. if (tolower(*p1) != tolower(*p2))
  696. return c_mNone;
  697. p1++;
  698. p2++;
  699. }
  700. return ((*p1 == '\0') && (*p2 == '\0')) ? c_mComplete : c_mPartial;
  701. }
  702. };
  703. //Must agree to CommandID constants
  704. typedef char CommandID;
  705. const CommandID c_cidDoNothing = -3;
  706. const CommandID c_cidMyAccepted = -2;
  707. const CommandID c_cidNone = -1;
  708. const CommandID c_cidDefault = 0;
  709. const CommandID c_cidAttack = 1;
  710. const CommandID c_cidCapture = 2;
  711. const CommandID c_cidDefend = 3;
  712. const CommandID c_cidPickup = 4;
  713. const CommandID c_cidGoto = 5;
  714. const CommandID c_cidRepair = 6;
  715. const CommandID c_cidJoin = 7;
  716. const CommandID c_cidMine = 8;
  717. const CommandID c_cidBuild = 9;
  718. const CommandID c_cidMax = 10;
  719. extern const CommandData c_cdAllCommands[c_cidMax];
  720. struct GlobalAttributeSet
  721. {
  722. public:
  723. GlobalAttributeSet(void)
  724. {
  725. //Initialize();
  726. }
  727. void Initialize(void)
  728. {
  729. for (int i = 0; (i < c_gaMax); i++)
  730. m_attributes[i] = 1.0f;
  731. }
  732. void Set(const float* a)
  733. {
  734. for (int i = 0; (i < c_gaMax); i++)
  735. m_attributes[i] = a[i];
  736. }
  737. void Apply(const GlobalAttributeSet& gas)
  738. {
  739. for (int i = 0; (i < c_gaMax); i++)
  740. {
  741. assert (m_attributes[i] > 0.0f);
  742. assert (m_attributes[i] < 100.0f);
  743. assert (gas.m_attributes[i] > 0.0f);
  744. assert (gas.m_attributes[i] < 100.0f);
  745. m_attributes[i] *= gas.m_attributes[i];
  746. }
  747. }
  748. float GetAttribute(GlobalAttribute ga) const
  749. {
  750. assert (m_attributes[ga] > 0.0f);
  751. assert (m_attributes[ga] < 100.0f);
  752. return m_attributes[ga];
  753. }
  754. void SetAttribute(GlobalAttribute ga, float v)
  755. {
  756. m_attributes[ga] = v;
  757. }
  758. bool operator == (const GlobalAttributeSet& gas) const
  759. {
  760. for (int i = 0; (i < c_gaMax); i++)
  761. {
  762. if (m_attributes[i] != gas.m_attributes[i])
  763. return false;
  764. }
  765. return true;
  766. }
  767. private:
  768. float m_attributes[c_gaMax];
  769. };
  770. typedef short MapMakerID;
  771. const MapMakerID c_mmSingleRing = 0;
  772. const MapMakerID c_mmDoubleRing = 1;
  773. const MapMakerID c_mmPinWheel = 2;
  774. const MapMakerID c_mmDiamondRing = 3;
  775. const MapMakerID c_mmSnowFlake = 4;
  776. const MapMakerID c_mmSplitBase = 5;
  777. const MapMakerID c_mmBrawl = 6;
  778. const MapMakerID c_mmBigRing = 7;
  779. const MapMakerID c_mmHiLo = 8;
  780. const MapMakerID c_mmHiHigher = 9;
  781. const MapMakerID c_mmStar = 10;
  782. const MapMakerID c_mmInsideOut = 11;
  783. const MapMakerID c_mmGrid = 12;
  784. const MapMakerID c_mmEastWest = 13;
  785. const MapMakerID c_mmLargeSplit = 14;
  786. const MapMakerID c_mmMax = 15;
  787. const int c_cbGameName = 65;
  788. const int c_cbGamePassword = 17;
  789. //------------------------------------------------------------------------------
  790. // for now, there is only one static data core, and this is its name
  791. //------------------------------------------------------------------------------
  792. #define IGC_STATIC_CORE_FILENAME "static_core"
  793. #define IGC_ENCRYPT_CORE_FILENAME "zone_core"
  794. const float c_fMissionBriefingCountdown = 15.0f; // seconds
  795. const int c_cUnlimitedLives = 0x7fff;
  796. //Forward definitions of interfaces
  797. struct MissionParams;
  798. class ThingSite;
  799. class ClusterSite;
  800. class CstaticIGC;
  801. class IIgcSite;
  802. class ImissionIGC;
  803. class IbaseIGC;
  804. class ImodelIGC;
  805. class IbuoyIGC;
  806. class IdamageIGC;
  807. class IscannerIGC;
  808. class IshipIGC;
  809. class IprojectileIGC;
  810. class IstationIGC;
  811. class IbuyableIGC;
  812. class IprojectileTypeIGC;
  813. class ItypeIGC;
  814. class IexpendableTypeIGC;
  815. class ImissileTypeIGC;
  816. class ImineTypeIGC;
  817. class IprobeTypeIGC;
  818. class IchaffTypeIGC;
  819. class IhullTypeIGC;
  820. class IpartTypeIGC;
  821. class IlauncherTypeIGC;
  822. class IpartIGC;
  823. class IweaponIGC;
  824. class IshieldIGC;
  825. class IcloakIGC;
  826. class IafterburnerIGC;
  827. class IpackIGC;
  828. class IlauncherIGC;
  829. class ImagazineIGC;
  830. class IdispenserIGC;
  831. class ImissileIGC;
  832. class ImineIGC;
  833. class IprobeIGC;
  834. class ImunitionIGC;
  835. class IbuildingEffectIGC;
  836. class IclusterIGC;
  837. class IasteroidIGC;
  838. class IwarpIGC;
  839. class ItreasureIGC;
  840. class IsideIGC;
  841. class IcivilizationIGC;
  842. class IstationTypeIGC;
  843. class IdroneTypeIGC;
  844. class IdevelopmentIGC;
  845. class IbucketIGC;
  846. class ItreasureSetIGC;
  847. struct WarpBomb
  848. {
  849. Time timeExplosion;
  850. ImissileTypeIGC* pmt;
  851. };
  852. typedef Slist_utl<WarpBomb> WarpBombList;
  853. typedef Slink_utl<WarpBomb> WarpBombLink;
  854. class ImapMakerIGC
  855. {
  856. public:
  857. static const char* IsValid(const MissionParams * pmp);
  858. static void Create(Time now,
  859. const MissionParams* pmp,
  860. ImissionIGC* pmission);
  861. virtual MapMakerID GetMapMakerID() const = 0;
  862. virtual VOID SetMapMakerID(MapMakerID mbID) = 0;
  863. virtual char const* GetName(void) const = 0;
  864. virtual void SetName(const char* newVal) = 0;
  865. virtual VOID GenerateMission(Time now,
  866. const MissionParams* pmp,
  867. ImissionIGC* pMission) = 0;
  868. };
  869. struct MissionParams
  870. {
  871. //------------------------------------------------------------------------------
  872. // If you add or remove properties, please update
  873. // AGCGameParameters.cpp, AGCGameParameters.h, and AGCIDL.h.
  874. //
  875. //------------------------------------------------------------------------------
  876. char strGameName[c_cbGameName]; //Name of game
  877. char szIGCStaticFile[c_cbFileName]; //Name of static IGC file
  878. char szCustomMapFile[c_cbFileName]; //Name of custom Map file; used only if not blank
  879. char strGamePassword[c_cbGamePassword]; //Password
  880. bool bEjectPods : 1; //Are eject pods used
  881. bool bInvulnerableStations : 1; //Do station NOT take damage
  882. bool bShowMap : 1; //Show all warps at the start of the game
  883. bool bAllowPrivateTeams : 1;
  884. bool bAllowEmptyTeams : 1; //Allow teams without players
  885. bool bAllowDevelopments : 1; //Allow investment in tech
  886. bool bAllowShipyardPath : 1; //Allow building Shipyards
  887. bool bAllowTacticalPath : 1; //Allow building Tactical Labs
  888. bool bAllowSupremacyPath : 1; //Allow building Supremacy Centers
  889. bool bAllowExpansionPath : 1; //Allow building Expansion Complexes
  890. bool bPowerUps : 1; //Create treasure when a ship is destroyed
  891. bool bAllowDefections : 1; //Allow players to switch from one team to another
  892. bool bAllowJoiners : 1; //Allow players to join a game in progress
  893. bool bLockLobby : 1; //Prevent new players from joining a game
  894. bool bLockSides : 1; //Prevent players from switching sides
  895. bool bLockTeamSettings : 1; //Prevent players from changing team attributes like name
  896. bool bLockGameOpen : 1; //Prevent players from limiting the size of the game
  897. bool bStations : 1; //??
  898. bool bScoresCount : 1; //??
  899. bool bSquadGame : 1; //??
  900. bool bDrones : 1; //??
  901. bool iResources : 1; //??
  902. bool bResourceAmountsVisible : 1; //??
  903. bool bRandomWormholes : 1; //??
  904. bool bNoTeams : 1; //??
  905. bool bShowHomeSector : 1; //Show everything in a player's home sector at start of game
  906. bool bAllowFriendlyFire : 1; //Allow friends to damage friends
  907. bool bObjectModelCreated : 1; //Was this game created by admin tools or the server app?
  908. bool bLobbiedGame : 1; //Is this game listed in an internet lobby?
  909. bool bClubGame : 1; //Is this game on the zone club?
  910. bool bAutoStart : 1; //Does the game start automatically when all sides are ready?
  911. bool bAutoRestart : 1; //Does the game restart automatically
  912. bool bAllowRestart : 1; //Can the game be restarted at all?
  913. float fGoalTeamMoney; //Cost of win the game tech = fGoalTeamMoney * WinTheGameMoney, 0 == no win the game tech
  914. int verIGCcore; //this is set only by the server, so the client can know whether it needs to get a new igc static core
  915. float nPlayerSectorTreasureRate; //# of treasures that generate/second in player sectors
  916. float nNeutralSectorTreasureRate; // neutral
  917. float dtGameLength; //Seconds till end of game, 0 == no limit
  918. float fHe3Density; //Mulitplier on He3 found at asteroids
  919. Money m_killPenalty; //Not used
  920. Money m_killReward; //Not used
  921. Money m_ejectPenalty; //Not used
  922. Money m_ejectReward; //Not used
  923. Time timeStart; //Time at which the game started
  924. float fStartCountdown; //Countdown (seconds) between automatically restarting missions
  925. float fRestartCountdown; //Countdown (seconds) between automatically restarting missions
  926. CivID rgCivID[c_cSidesMax]; //IDs within the szIGCCore data set
  927. short iGoalConquestPercentage; //% of flagged stations that need to be held to win the game
  928. short iGoalTerritoryPercentage; //sole control of % of territories
  929. short iGoalArtifactsPercentage; //Not used
  930. short nGoalFlagsCount; //# of enemy flags returned to station to win
  931. short nGoalArtifactsCount; //# of neutral artifacts returned to station to win
  932. short nGoalTeamKills; //Number of kills required to end the game
  933. short tsiPlayerStart; //Treasure index for random treasures that start in player sectors. NA == none
  934. short tsiNeutralStart; // neutral
  935. short tsiPlayerRegenerate; //Treasure index for random treasures that spawn in player sectors, NA = none
  936. short tsiNeutralRegenerate; // neutral
  937. float fStartingMoney; //Multiplier on team starting money
  938. short iLives; //Player must die more than this number of times to be exit, c_cUnlimitedLives = unlimited
  939. MapMakerID mmMapType; //Map type
  940. short iMapSize; //Not used
  941. short iRandomEncounters; //Use to indicate how many alephs are randomly removed
  942. short bNeutralSectors; //Not used
  943. short iAlephPositioning; //Not used
  944. short iAlephsPerSector; //Not used
  945. short nTeams; //Number of sides in the game
  946. short iMinRank; //Minimum player rank
  947. short iMaxRank; //Maximum player rank
  948. int nInvitationListID; // zero means no invitation required
  949. short iMaxImbalance; //Maximum allowed difference between smallest and largest team
  950. short nPlayerSectorAsteroids; //# generic asteroids in player sector
  951. short nNeutralSectorAsteroids; // neutral
  952. short nPlayerSectorTreasures; //# of treasures placed in player sector to start with
  953. short nNeutralSectorTreasures; // neutral
  954. short nPlayerSectorMineableAsteroids; //# of He3 asteroids in player sector
  955. short nNeutralSectorMineableAsteroids; // neutral
  956. short nPlayerSectorSpecialAsteroids; //# of special asteroids (C, U or Si) in player sector
  957. short nNeutralSectorSpecialAsteroids; // neutral
  958. unsigned char nMinPlayersPerTeam; //Min players on team
  959. unsigned char nMaxPlayersPerTeam; //Max players on team
  960. char nInitialMinersPerTeam; //Number of miners to start the game with
  961. char nMaxMinersPerTeam; //Maximum # of miners a team is allowed to control
  962. short nTotalMaxPlayersPerGame; //Maximum # of players per game (mostly used for StandAlone server)
  963. MissionParams()
  964. {
  965. Reset();
  966. }
  967. void Reset(void)
  968. {
  969. ZeroMemory(this, sizeof(*this));
  970. //
  971. // default to reasonable values
  972. //
  973. strcpy(strGameName, "Uninitialized Game Name");
  974. szIGCStaticFile[0] = '\0';
  975. m_killPenalty = 0;
  976. m_killReward = 0;
  977. m_ejectPenalty = 0;
  978. m_ejectReward = 0;
  979. bEjectPods = true ;
  980. bInvulnerableStations = false;
  981. bAllowPrivateTeams = true ;
  982. bAllowEmptyTeams = false;
  983. bShowMap = false;
  984. bAllowDevelopments = true ;
  985. bAllowShipyardPath = true ;
  986. bAllowTacticalPath = true ;
  987. bAllowSupremacyPath = true ;
  988. bAllowExpansionPath = true ;
  989. bPowerUps = true ;
  990. bAllowJoiners = true ;
  991. bLockLobby = false;
  992. bLockSides = false;
  993. bLockTeamSettings = false;
  994. bAllowDefections = false;
  995. bStations = true ;
  996. bScoresCount = false;
  997. bSquadGame = false;
  998. bDrones = true ;
  999. iResources = 0;
  1000. bResourceAmountsVisible = true ;
  1001. bRandomWormholes = true ;
  1002. bNoTeams = false;
  1003. bShowHomeSector = false;
  1004. bObjectModelCreated = false;
  1005. bLobbiedGame = false;
  1006. bClubGame = false;
  1007. bAutoStart = false;
  1008. bAutoRestart = false;
  1009. bAllowRestart = true;
  1010. nInvitationListID = 0;
  1011. fStartCountdown = 15.0f;
  1012. fRestartCountdown = 60.0f;
  1013. //
  1014. // Assign to NA for now, this cues the mission maker to reset it later
  1015. //
  1016. for (int iSide = 0; iSide < c_cSidesMax; iSide++)
  1017. {
  1018. rgCivID[iSide] = NA;
  1019. }
  1020. fHe3Density = 1.0f;
  1021. fStartingMoney = 1.0f;
  1022. fGoalTeamMoney = 0;
  1023. tsiPlayerStart = 1;
  1024. tsiNeutralStart = 1;
  1025. tsiPlayerRegenerate = 1;
  1026. tsiNeutralRegenerate = 1;
  1027. iLives = c_cUnlimitedLives;
  1028. nGoalTeamKills = 0;
  1029. mmMapType = c_mmHiLo;
  1030. iMapSize = 0;
  1031. iRandomEncounters = 0;
  1032. bNeutralSectors = true;
  1033. iAlephPositioning = 0;
  1034. iAlephsPerSector = 0;
  1035. nTeams = 2;
  1036. iMinRank = -1;
  1037. iMaxRank = 1000;
  1038. iMaxImbalance = 1;
  1039. dtGameLength = 0.0f;
  1040. iGoalConquestPercentage = 100;
  1041. iGoalTerritoryPercentage = 100;
  1042. iGoalArtifactsPercentage = 100;
  1043. nGoalFlagsCount = 0;
  1044. nGoalArtifactsCount = 0;
  1045. bShowHomeSector = false;
  1046. nPlayerSectorAsteroids = 20;
  1047. nNeutralSectorAsteroids = 20;
  1048. nPlayerSectorTreasures = 0;
  1049. nNeutralSectorTreasures = 5;
  1050. nPlayerSectorTreasureRate = 0.2f / 60.0f; //0.2 per minute == 0.2/60 per second
  1051. nNeutralSectorTreasureRate = 0.5f / 60.0f;
  1052. nPlayerSectorMineableAsteroids = 2;
  1053. nNeutralSectorMineableAsteroids = 4;
  1054. nPlayerSectorSpecialAsteroids = 1;
  1055. nNeutralSectorSpecialAsteroids = 1;
  1056. nInitialMinersPerTeam = 1;
  1057. nMaxMinersPerTeam = 4;
  1058. nMinPlayersPerTeam = 7;
  1059. nMaxPlayersPerTeam = 15;
  1060. nTotalMaxPlayersPerGame = 0x7FFF;
  1061. }
  1062. const char* Invalid(bool bFromClient = false) const
  1063. {
  1064. // do some data validation... should do this is a cleaner way
  1065. if (bFromClient)
  1066. {
  1067. if ((nMaxPlayersPerTeam > 100) ||
  1068. (nMaxPlayersPerTeam < 1))
  1069. {
  1070. return "Maximum number of players must be between 1 and 100.";
  1071. }
  1072. else if (IsNoWinningConditionsGame())
  1073. {
  1074. return "You must choose one or more winning conditions.";
  1075. }
  1076. else if (bAutoRestart || (bObjectModelCreated && bClubGame) || bAllowEmptyTeams)
  1077. {
  1078. return "HACK: one or more admin-only flags are set.";
  1079. }
  1080. }
  1081. if (nInitialMinersPerTeam > nMaxMinersPerTeam)
  1082. {
  1083. return "Initial miners per team must be less than max miners per team.";
  1084. }
  1085. else if (nMaxMinersPerTeam > 10)
  1086. {
  1087. return "Max miners per team must be less than or equal to 10.";
  1088. }
  1089. else if (nNeutralSectorSpecialAsteroids > 9)
  1090. {
  1091. return "NeutralSectorSpecialAsteroids must be less than 10.";
  1092. }
  1093. else if (nPlayerSectorSpecialAsteroids > 9)
  1094. {
  1095. return "PlayerSectorSpecialAsteroids must be less than 10.";
  1096. }
  1097. else if (nNeutralSectorMineableAsteroids > 9)
  1098. {
  1099. return "NeutralSectorMineableAsteroids must be less than 10.";
  1100. }
  1101. else if (nPlayerSectorMineableAsteroids > 9)
  1102. {
  1103. return "PlayerSectorMineableAsteroids must be less than 10.";
  1104. }
  1105. else if (nNeutralSectorTreasureRate > 1.0f/60.0f)
  1106. {
  1107. return "NeutralSectorTreasureRate must be less than 1/60.";
  1108. }
  1109. else if (nPlayerSectorTreasureRate > 1.0f/60.0f)
  1110. {
  1111. return "PlayerSectorTreasureRate must be less than 1/60.";
  1112. }
  1113. else if (nNeutralSectorTreasures > 20)
  1114. {
  1115. return "NeutralSectorTreasures must be less than 21.";
  1116. }
  1117. else if (nPlayerSectorTreasures > 20)
  1118. {
  1119. return "PlayerSectorTreasures must be less than 21.";
  1120. }
  1121. else if (nNeutralSectorAsteroids > 40)
  1122. {
  1123. return "NeutralSectorAsteroids must be less than 40.";
  1124. }
  1125. else if (nPlayerSectorAsteroids > 40)
  1126. {
  1127. return "PlayerSectorAsteroids must be less than 40.";
  1128. }
  1129. else if ((nGoalArtifactsCount < 0) || (nGoalArtifactsCount > 100))
  1130. {
  1131. return "GoalArtifactsCount must be between 0% and 100%.";
  1132. }
  1133. else if ((nGoalFlagsCount < 0) || (nGoalFlagsCount > 100))
  1134. {
  1135. return "GoalFlagsCount must be between 0% and 100%.";
  1136. }
  1137. else if ((fHe3Density < 0.0f) || (fHe3Density > 9.0f))
  1138. {
  1139. return "He3Density must be between 0 and 9.";
  1140. }
  1141. else if ((fGoalTeamMoney < 0.0f) || (fGoalTeamMoney > 9.0f))
  1142. {
  1143. return "GoalTeamMoney must be between 0 and 9.";
  1144. }
  1145. else if ((fStartingMoney < 0.0f) || (fStartingMoney > 9.0f))
  1146. {
  1147. return "StartingMoney must be between 0 and 9.";
  1148. }
  1149. else if (NULL == memchr(strGameName, 0, c_cbGameName))
  1150. {
  1151. return "invalid game name";
  1152. }
  1153. else if (NULL == memchr(szIGCStaticFile, 0, c_cbFileName))
  1154. {
  1155. return "invalid IGC static file name";
  1156. }
  1157. else if (NULL == memchr(szCustomMapFile, 0, c_cbFileName))
  1158. {
  1159. return "invalid IGC static file name";
  1160. }
  1161. else if (NULL == memchr(strGamePassword, 0, c_cbGamePassword))
  1162. {
  1163. return "invalid IGC static file name";
  1164. }
  1165. else if ((nTeams > 6) || (nTeams < 2))
  1166. {
  1167. return "Number of teams must be between 2 and 6.";
  1168. }
  1169. else if (nTotalMaxPlayersPerGame < 1)
  1170. {
  1171. return "Number of players per game must be greater than 0.";
  1172. }
  1173. else if ((nMaxPlayersPerTeam > 200) ||
  1174. (nMaxPlayersPerTeam < 1))
  1175. {
  1176. return "Maximum number of players must be between 1 and 200.";
  1177. }
  1178. else if (nMinPlayersPerTeam < 1)
  1179. {
  1180. return "Minimum number of players must be 1 or greater.";
  1181. }
  1182. else if (nMinPlayersPerTeam > nMaxPlayersPerTeam)
  1183. {
  1184. return "Minimum number of players must not be greater than the maximum number of players.";
  1185. }
  1186. else if (bScoresCount && bAllowDefections)
  1187. {
  1188. return "Scores can't be counted for a game where defections are allowed; "
  1189. "please turn off defections or stats count.";
  1190. }
  1191. else if (bScoresCount && nMinPlayersPerTeam < 5)
  1192. {
  1193. return "Scores can't be counted for a game with less than 5 players per team; "
  1194. "please increase the minimum players per team or turn stats count off.";
  1195. }
  1196. else if (IsConquestGame() && bInvulnerableStations)
  1197. {
  1198. return "You can't play a conquest game with invulnerable stations; "
  1199. "You must disable the conquest winning condition or turn off "
  1200. "the invulnerable stations option.";
  1201. }
  1202. else if (IsProsperityGame() && !bAllowDevelopments)
  1203. {
  1204. return "You can't play a prosperity game with developments turned off; "
  1205. "You must disable the prosperity winning condition or turn on "
  1206. "developments.";
  1207. }
  1208. else if (nPlayerSectorTreasureRate > 0.01 || nNeutralSectorTreasureRate > 0.01)
  1209. {
  1210. return "Treasure rate(s) too high; max is 0.01";
  1211. }
  1212. else if (IsTerritoryGame())
  1213. {
  1214. if (mmMapType == c_mmBrawl)
  1215. return "Brawl maps can not have a territory win condition";
  1216. else if ((nTeams == 2) &&
  1217. ((mmMapType == c_mmSingleRing) ||
  1218. (mmMapType == c_mmDoubleRing)))
  1219. return "Small maps can not have a territory win condition";
  1220. }
  1221. return ImapMakerIGC::IsValid(this);
  1222. }
  1223. //
  1224. // Winning Condition Info
  1225. //
  1226. bool IsConquestGame() const
  1227. {
  1228. return iGoalConquestPercentage != 0;
  1229. }
  1230. bool IsTerritoryGame() const
  1231. {
  1232. return iGoalTerritoryPercentage != 100;
  1233. }
  1234. bool IsDeathMatchGame() const
  1235. {
  1236. return nGoalTeamKills != 0;
  1237. }
  1238. bool IsCountdownGame() const
  1239. {
  1240. return dtGameLength != 0.0f;
  1241. }
  1242. bool IsProsperityGame() const
  1243. {
  1244. return fGoalTeamMoney != 0;
  1245. }
  1246. bool IsArtifactsGame() const
  1247. {
  1248. return (nGoalArtifactsCount != 0);
  1249. }
  1250. bool IsFlagsGame() const
  1251. {
  1252. return (nGoalFlagsCount != 0);
  1253. }
  1254. bool IsNoWinningConditionsGame() const
  1255. {
  1256. return !(IsConquestGame() ||
  1257. IsDeathMatchGame() ||
  1258. IsCountdownGame() ||
  1259. IsProsperityGame() ||
  1260. IsArtifactsGame() ||
  1261. IsTerritoryGame() ||
  1262. IsFlagsGame());
  1263. }
  1264. float GetCountDownTime() const
  1265. {
  1266. return dtGameLength;
  1267. }
  1268. int GetConquestPercentage() const
  1269. {
  1270. return iGoalConquestPercentage;
  1271. }
  1272. int GetTerritoryPercentage() const
  1273. {
  1274. return iGoalTerritoryPercentage;
  1275. }
  1276. short GetDeathMatchKillLimit() const
  1277. {
  1278. return nGoalTeamKills;
  1279. }
  1280. int GetArtifactsPercentage() const
  1281. {
  1282. return iGoalArtifactsPercentage;
  1283. }
  1284. };
  1285. //Utility data structures
  1286. typedef Slist_utl<IpartIGC*> PartListIGC;
  1287. typedef Slink_utl<IpartIGC*> PartLinkIGC;
  1288. typedef Slist_utl<IclusterIGC*> ClusterListIGC;
  1289. typedef Slink_utl<IclusterIGC*> ClusterLinkIGC;
  1290. typedef Slist_utl<IshipIGC*> ShipListIGC;
  1291. typedef Slink_utl<IshipIGC*> ShipLinkIGC;
  1292. typedef Slist_utl<IscannerIGC*> ScannerListIGC;
  1293. typedef Slink_utl<IscannerIGC*> ScannerLinkIGC;
  1294. typedef Slist_utl<IpartTypeIGC*> PartTypeListIGC;
  1295. typedef Slink_utl<IpartTypeIGC*> PartTypeLinkIGC;
  1296. typedef Slist_utl<ItreasureSetIGC*> TreasureSetListIGC;
  1297. typedef Slink_utl<ItreasureSetIGC*> TreasureSetLinkIGC;
  1298. typedef Slist_utl<IprojectileTypeIGC*> ProjectileTypeListIGC;
  1299. typedef Slink_utl<IprojectileTypeIGC*> ProjectileTypeLinkIGC;
  1300. typedef Slist_utl<ImissileIGC*> MissileListIGC;
  1301. typedef Slink_utl<ImissileIGC*> MissileLinkIGC;
  1302. typedef Slist_utl<ImineIGC*> MineListIGC;
  1303. typedef Slink_utl<ImineIGC*> MineLinkIGC;
  1304. typedef Slist_utl<IprobeIGC*> ProbeListIGC;
  1305. typedef Slink_utl<IprobeIGC*> ProbeLinkIGC;
  1306. typedef Slist_utl<IhullTypeIGC*> HullTypeListIGC;
  1307. typedef Slink_utl<IhullTypeIGC*> HullTypeLinkIGC;
  1308. typedef Slist_utl<IcivilizationIGC*> CivilizationListIGC;
  1309. typedef Slink_utl<IcivilizationIGC*> CivilizationLinkIGC;
  1310. typedef Slist_utl<IstationTypeIGC*> StationTypeListIGC;
  1311. typedef Slink_utl<IstationTypeIGC*> StationTypeLinkIGC;
  1312. typedef Slist_utl<IdroneTypeIGC*> DroneTypeListIGC;
  1313. typedef Slink_utl<IdroneTypeIGC*> DroneTypeLinkIGC;
  1314. typedef Slist_utl<IdevelopmentIGC*> DevelopmentListIGC;
  1315. typedef Slink_utl<IdevelopmentIGC*> DevelopmentLinkIGC;
  1316. typedef Slist_utl<IsideIGC*> SideListIGC;
  1317. typedef Slink_utl<IsideIGC*> SideLinkIGC;
  1318. typedef Slist_utl<ImissileTypeIGC*> MissileTypeListIGC;
  1319. typedef Slink_utl<ImissileTypeIGC*> MissileTypeLinkIGC;
  1320. typedef Slist_utl<IexpendableTypeIGC*> ExpendableTypeListIGC;
  1321. typedef Slink_utl<IexpendableTypeIGC*> ExpendableTypeLinkIGC;
  1322. typedef Slist_utl<ImodelIGC*> ModelListIGC;
  1323. typedef Slink_utl<ImodelIGC*> ModelLinkIGC;
  1324. typedef Slist_utl<IwarpIGC*> WarpListIGC;
  1325. typedef Slink_utl<IwarpIGC*> WarpLinkIGC;
  1326. typedef Slist_utl<IstationIGC*> StationListIGC;
  1327. typedef Slink_utl<IstationIGC*> StationLinkIGC;
  1328. typedef Slist_utl<IbucketIGC*> BucketListIGC;
  1329. typedef Slink_utl<IbucketIGC*> BucketLinkIGC;
  1330. typedef Slist_utl<IasteroidIGC*> AsteroidListIGC;
  1331. typedef Slink_utl<IasteroidIGC*> AsteroidLinkIGC;
  1332. typedef Slist_utl<ItreasureIGC*> TreasureListIGC;
  1333. typedef Slink_utl<ItreasureIGC*> TreasureLinkIGC;
  1334. typedef Slist_utl<IbuoyIGC*> BuoyListIGC;
  1335. typedef Slink_utl<IbuoyIGC*> BuoyLinkIGC;
  1336. typedef Slist_utl<IbaseIGC*> BaseListIGC;
  1337. typedef Slink_utl<IbaseIGC*> BaseLinkIGC;
  1338. struct ControlData
  1339. {
  1340. float jsValues[4]; //yaw, pitch, roll, throttle
  1341. inline void Reset(void)
  1342. {
  1343. jsValues[c_axisYaw] = jsValues[c_axisPitch] = jsValues[c_axisRoll] = 0.0f;
  1344. jsValues[c_axisThrottle] = -1.0f;
  1345. }
  1346. };
  1347. #pragma pack(push, 1)
  1348. struct PartData
  1349. {
  1350. PartID partID;
  1351. short amount;
  1352. Mount mountID;
  1353. };
  1354. struct Stockpile
  1355. {
  1356. TRef<IbuyableIGC> buyable;
  1357. short count;
  1358. };
  1359. struct ExpandedPartData : public PartData
  1360. {
  1361. BytePercentage fractionMounted;
  1362. };
  1363. #pragma pack(pop)
  1364. typedef Slist_utl<Stockpile> StockpileList;
  1365. typedef Slink_utl<Stockpile> StockpileLink;
  1366. struct HardpointData
  1367. {
  1368. //float minDot; //Manned turrets only
  1369. SoundID interiorSound;
  1370. SoundID turnSound;
  1371. char frameName[c_cbFileName];
  1372. //char hudName[c_cbFileName];
  1373. char locationAbreviation[c_cbLocAbrev];
  1374. PartMask partMask;
  1375. bool bFixed;
  1376. };
  1377. struct AsteroidDef
  1378. {
  1379. float ore;
  1380. float oreMax;
  1381. AsteroidAbilityBitMask aabmCapabilities;
  1382. AsteroidID asteroidID;
  1383. HitPoints hitpoints;
  1384. short radius;
  1385. char modelName[c_cbFileName];
  1386. char textureName[c_cbFileName];
  1387. char iconName[c_cbFileName];
  1388. };
  1389. struct WarpDef
  1390. {
  1391. WarpID warpID;
  1392. WarpID destinationID;
  1393. short radius;
  1394. char textureName[c_cbFileName];
  1395. char iconName[c_cbFileName];
  1396. };
  1397. //Exported data structures ... these data structures define the data used by Initialize()
  1398. //for the various classes.
  1399. struct DataClusterIGC
  1400. {
  1401. unsigned int starSeed;
  1402. Vector lightDirection;
  1403. D3DCOLOR lightColor;
  1404. float screenX;
  1405. float screenY;
  1406. SectorID clusterID;
  1407. short nDebris;
  1408. short nStars;
  1409. char name[c_cbName];
  1410. char posterName[c_cbFileName];
  1411. char planetName[c_cbFileName];
  1412. BytePercentage planetSinLatitude;
  1413. BytePercentage planetLongitude;
  1414. unsigned char planetRadius;
  1415. bool activeF;
  1416. bool bHomeSector;
  1417. };
  1418. struct DataBuyableIGC
  1419. {
  1420. Money price;
  1421. DWORD timeToBuild;
  1422. char modelName[c_cbFileName + 1]; // because we allow a 1 character prefix
  1423. char iconName[c_cbFileName];
  1424. char name[c_cbName];
  1425. char description[c_cbDescription];
  1426. BuyableGroupID groupID;
  1427. TechTreeBitMask ttbmRequired;
  1428. TechTreeBitMask ttbmEffects;
  1429. };
  1430. const int c_cMaxPreferredPartTypes = 14;
  1431. struct DataHullTypeIGC : public DataBuyableIGC
  1432. {
  1433. float mass;
  1434. float signature;
  1435. float speed;
  1436. float maxTurnRates[3]; //yaw, pitch, roll
  1437. float turnTorques[3]; //yaw, pitch, roll
  1438. float thrust;
  1439. float sideMultiplier;
  1440. float backMultiplier;
  1441. float scannerRange;
  1442. float maxFuel;
  1443. float ecm;
  1444. float length;
  1445. float maxEnergy;
  1446. float rechargeRate;
  1447. float ripcordSpeed;
  1448. float ripcordCost;
  1449. short maxAmmo;
  1450. HullID hullID;
  1451. HullID successorHullID;
  1452. Mount maxWeapons;
  1453. Mount maxFixedWeapons;
  1454. HitPoints hitPoints;
  1455. short hardpointOffset;
  1456. DefenseTypeID defenseType;
  1457. short capacityMagazine;
  1458. short capacityDispenser;
  1459. short capacityChaffLauncher;
  1460. PartID preferredPartsTypes[c_cMaxPreferredPartTypes];
  1461. HullAbilityBitMask habmCapabilities;
  1462. char textureName[c_cbFileName];
  1463. //char pilotHUDName[c_cbFileName];
  1464. //char observerHUDName[c_cbFileName];
  1465. PartMask pmEquipment[ET_MAX];
  1466. SoundID interiorSound;
  1467. SoundID exteriorSound;
  1468. SoundID mainThrusterInteriorSound;
  1469. SoundID mainThrusterExteriorSound;
  1470. SoundID manuveringThrusterInteriorSound;
  1471. SoundID manuveringThrusterExteriorSound;
  1472. // HardpointData[] comes here
  1473. };
  1474. struct DataPartTypeIGC : public DataBuyableIGC
  1475. {
  1476. float mass;
  1477. float signature;
  1478. PartID partID;
  1479. PartID successorPartID;
  1480. EquipmentType equipmentType;
  1481. PartMask partMask;
  1482. char inventoryLineMDL[c_cbFileName];
  1483. };
  1484. struct DataWeaponTypeIGC : public DataPartTypeIGC
  1485. {
  1486. float dtimeReady;
  1487. float dtimeBurst;
  1488. float energyPerShot;
  1489. float dispersion;
  1490. short cAmmoPerShot;
  1491. ProjectileTypeID projectileTypeID;
  1492. SoundID activateSound;
  1493. SoundID singleShotSound;
  1494. SoundID burstSound;
  1495. };
  1496. struct DataShieldTypeIGC : public DataPartTypeIGC
  1497. {
  1498. float rateRegen;
  1499. float maxStrength;
  1500. DefenseTypeID defenseType;
  1501. SoundID activateSound;
  1502. SoundID deactivateSound;
  1503. };
  1504. struct DataCloakTypeIGC : public DataPartTypeIGC
  1505. {
  1506. float energyConsumption;
  1507. float maxCloaking;
  1508. float onRate;
  1509. float offRate;
  1510. SoundID engageSound;
  1511. SoundID disengageSound;
  1512. };
  1513. struct DataAfterburnerTypeIGC : public DataPartTypeIGC
  1514. {
  1515. float fuelConsumption;
  1516. float maxThrust;
  1517. float onRate;
  1518. float offRate;
  1519. SoundID interiorSound;
  1520. SoundID exteriorSound;
  1521. };
  1522. struct DataPackTypeIGC : public DataPartTypeIGC
  1523. {
  1524. PackType packType;
  1525. short amount;
  1526. };
  1527. struct DataLauncherTypeIGC
  1528. {
  1529. short amount;
  1530. PartID partID;
  1531. PartID successorPartID;
  1532. short launchCount;
  1533. ObjectID expendabletypeID;
  1534. char inventoryLineMDL[c_cbFileName];
  1535. };
  1536. struct DataAsteroidIGC
  1537. {
  1538. float signature;
  1539. Vector position;
  1540. Vector up;
  1541. Vector forward;
  1542. Rotation rotation;
  1543. AsteroidDef asteroidDef;
  1544. SectorID clusterID;
  1545. char name[c_cbName];
  1546. BytePercentage fraction;
  1547. };
  1548. struct DataObjectIGC
  1549. {
  1550. D3DCOLORVALUE color;
  1551. float radius;
  1552. float rotation;
  1553. char modelName[c_cbFileName];
  1554. char textureName[c_cbFileName];
  1555. };
  1556. struct DataBuoyIGC
  1557. {
  1558. Vector position;
  1559. SectorID clusterID;
  1560. BuoyType type;
  1561. BuoyID buoyID;
  1562. DataBuoyIGC (void) {buoyID = NA;}
  1563. };
  1564. struct DataProjectileTypeIGC : public DataObjectIGC
  1565. {
  1566. float power;
  1567. float blastPower;
  1568. float blastRadius;
  1569. float speed;
  1570. float lifespan;
  1571. ProjectileTypeID projectileTypeID;
  1572. DamageTypeID damageType;
  1573. bool absoluteF;
  1574. bool bDirectional;
  1575. float width;
  1576. SoundID ambientSound;
  1577. };
  1578. struct LauncherDef : public DataBuyableIGC
  1579. {
  1580. float signature;
  1581. float mass;
  1582. PartMask partMask;
  1583. short expendableSize;
  1584. };
  1585. struct DataExpendableTypeIGC : public DataObjectIGC
  1586. {
  1587. float loadTime;
  1588. float lifespan;
  1589. float signature;
  1590. LauncherDef launcherDef;
  1591. HitPoints hitPoints;
  1592. DefenseTypeID defenseType;
  1593. ExpendableTypeID expendabletypeID;
  1594. AbilityBitMask eabmCapabilities;
  1595. char iconName[c_cbFileName];
  1596. };
  1597. struct DataMissileTypeIGC : public DataExpendableTypeIGC
  1598. {
  1599. float acceleration;
  1600. float turnRate;
  1601. float initialSpeed;
  1602. //float armTime;
  1603. float lockTime;
  1604. float readyTime;
  1605. float maxLock;
  1606. float chaffResistance;
  1607. float dispersion;
  1608. float lockAngle;
  1609. float power;
  1610. float blastPower;
  1611. float blastRadius;
  1612. float width;
  1613. DamageTypeID damageType;
  1614. bool bDirectional;
  1615. SoundID launchSound;
  1616. SoundID ambientSound;
  1617. };
  1618. struct DataMineTypeIGC : public DataExpendableTypeIGC
  1619. {
  1620. float radius;
  1621. float power;
  1622. float endurance;
  1623. DamageTypeID damageType;
  1624. };
  1625. struct DataChaffTypeIGC : public DataExpendableTypeIGC
  1626. {
  1627. float chaffStrength;
  1628. };
  1629. struct DataProbeTypeIGC : public DataExpendableTypeIGC
  1630. {
  1631. float scannerRange;
  1632. float dtimeBurst;
  1633. float dispersion;
  1634. float accuracy;
  1635. short ammo;
  1636. ProjectileTypeID projectileTypeID;
  1637. SoundID ambientSound;
  1638. float dtRipcord;
  1639. };
  1640. struct DataPartIGC
  1641. {
  1642. IpartTypeIGC* partType;
  1643. };
  1644. struct DataProjectileIGC
  1645. {
  1646. Vector velocity;
  1647. Vector forward;
  1648. float lifespan;
  1649. ProjectileTypeID projectileTypeID;
  1650. };
  1651. struct DataMissileIGC
  1652. {
  1653. Vector position;
  1654. Vector velocity;
  1655. Vector forward;
  1656. ImissileTypeIGC* pmissiletype;
  1657. IshipIGC* pLauncher;
  1658. ImodelIGC* pTarget;
  1659. IclusterIGC* pCluster;
  1660. float lock;
  1661. MissileID missileID;
  1662. bool bDud;
  1663. };
  1664. struct DataSideIGC
  1665. {
  1666. char name[c_cbName];
  1667. CivID civilizationID;
  1668. SideID sideID;
  1669. TechTreeBitMask ttbmInitialTechs;
  1670. TechTreeBitMask ttbmDevelopmentTechs;
  1671. GlobalAttributeSet gasAttributes;
  1672. Color color;
  1673. float fTimeEndured;
  1674. short nFlags;
  1675. short nArtifacts;
  1676. short nKills;
  1677. short nEjections;
  1678. short nDeaths;
  1679. short nBaseKills;
  1680. short nBaseCaptures;
  1681. SquadID squadID;
  1682. unsigned char conquest;
  1683. unsigned char territory;
  1684. };
  1685. struct DataCivilizationIGC
  1686. {
  1687. float incomeMoney;
  1688. float bonusMoney;
  1689. char name[c_cbName];
  1690. char iconName[c_cbFileName];
  1691. char hudName[c_cbFileName];
  1692. TechTreeBitMask ttbmBaseTechs;
  1693. TechTreeBitMask ttbmNoDevTechs;
  1694. GlobalAttributeSet gasBaseAttributes;
  1695. HullID lifepod;
  1696. CivID civilizationID;
  1697. StationTypeID initialStationTypeID;
  1698. };
  1699. typedef char TreasureCode;
  1700. const TreasureCode c_tcPart = 1;
  1701. const TreasureCode c_tcPowerup = 2;
  1702. const TreasureCode c_tcDevelopment = 3;
  1703. const TreasureCode c_tcCash = 4;
  1704. const TreasureCode c_tcFlag = 5;
  1705. typedef ObjectID PowerupCode;
  1706. const PowerupCode c_pcHull = 0x01;
  1707. const PowerupCode c_pcShield = 0x02;
  1708. const PowerupCode c_pcEnergy = 0x04;
  1709. const PowerupCode c_pcFuel = 0x08;
  1710. const PowerupCode c_pcAmmo = 0x10;
  1711. struct TreasureData
  1712. {
  1713. ObjectID treasureID;
  1714. TreasureCode treasureCode;
  1715. unsigned char chance;
  1716. };
  1717. struct DataTreasureSetIGC
  1718. {
  1719. char name[c_cbName];
  1720. TreasureSetID treasureSetID;
  1721. short nTreasureData;
  1722. bool bZoneOnly;
  1723. TreasureData* treasureData0(void)
  1724. {
  1725. return (TreasureData*)(this + 1);
  1726. }
  1727. };
  1728. #pragma pack(push, 1)
  1729. class ShipLoadout
  1730. {
  1731. public:
  1732. HullID hullID;
  1733. ExpandedPartData* PartData0(void) const
  1734. {
  1735. return (ExpandedPartData*)(this + 1);
  1736. }
  1737. ExpandedPartData* PartDataN(short cb) const
  1738. {
  1739. return (ExpandedPartData*)(((char*)this) + cb);
  1740. }
  1741. };
  1742. class CompactOrientation
  1743. {
  1744. public:
  1745. void Set(const Orientation& orientation)
  1746. {
  1747. Quaternion q(orientation);
  1748. assert (q.GetA() >= 0.0f);
  1749. m_qa = (unsigned short)(q.GetA() * 65535.0f + 0.5f);
  1750. m_qx = short(q.GetX() * 32767.0f);
  1751. m_qy = short(q.GetY() * 32767.0f);
  1752. m_qz = short(q.GetZ() * 32767.0f);
  1753. }
  1754. void Export(Orientation* pOrientation) const
  1755. {
  1756. if ((m_qa != 0) || (m_qx != 0) || (m_qy != 0) || (m_qz != 0))
  1757. {
  1758. Quaternion q(float(m_qa) / 65535.0f,
  1759. float(m_qx) / 32767.0f,
  1760. float(m_qy) / 32767.0f,
  1761. float(m_qz) / 32767.0f);
  1762. *pOrientation = q;
  1763. }
  1764. else
  1765. pOrientation->Reset();
  1766. }
  1767. void Validate(void) const
  1768. {
  1769. ZRetailAssert ((m_qa != 0) || (m_qx != 0) || (m_qy != 0) || (m_qz != 0));
  1770. }
  1771. private:
  1772. unsigned short m_qa;
  1773. short m_qx, m_qy, m_qz;
  1774. };
  1775. class CompactTime //2 bytes
  1776. {
  1777. private:
  1778. short m_timeOffset;
  1779. public:
  1780. void Set(Time timeBase, Time timeNow)
  1781. {
  1782. long delta = (long)(timeBase.clock() - timeNow.clock());
  1783. m_timeOffset = (short)delta;
  1784. assert (m_timeOffset == delta);
  1785. }
  1786. void Export(Time timeBase, Time* timeNow) const
  1787. {
  1788. *timeNow = (DWORD)((long)(timeBase.clock()) - (long)m_timeOffset);
  1789. }
  1790. };
  1791. class CompactPosition //6 bytes
  1792. {
  1793. private:
  1794. short m_deltaXYZ[3];
  1795. //Come up with a more (space) efficient means of storing a position near another position
  1796. //Displacement(delta) = delta * |delta| / K*K
  1797. //
  1798. //Delta(displacement) = +- sqrt(|displacement|) * K
  1799. //
  1800. //If delta max is 32767 (short) and K is 120 then
  1801. // Displacement(32766) = 74556.3
  1802. // Displacement(32767) = 74560.9
  1803. //
  1804. // Displacement(0) = 0
  1805. // Displacement(1) = 1/(120^2)
  1806. //
  1807. // Delta(1000) = 3795
  1808. // Displacement(3795) = 1000.14 error of 0.14 units
  1809. // Displacement(3796) = 1000.67 maximum error of 0.40 units
  1810. // so ... out to distances of out to 1000 from the reference point, accuracy will be within 0.5 units
  1811. static float Displacement(short delta)
  1812. {
  1813. float fDelta = float(delta);
  1814. return fDelta * fDelta / ((fDelta > 0.0f) ? (120.0f * 120.0f) : -(120.0f * 120.0f));
  1815. }
  1816. static short Delta(float displacement)
  1817. {
  1818. double sad = sqrt(fabs(displacement));
  1819. if (sad > double(0x7fff) / 120.0f)
  1820. {
  1821. return (displacement > 0.0f)
  1822. ? 0x7fff
  1823. : -(0x7fff);
  1824. }
  1825. else
  1826. return (displacement > 0.0f)
  1827. ? short(sad * 120.0 + 0.5)
  1828. : short(sad * -120.0 - 0.5);
  1829. }
  1830. public:
  1831. void Set(const Vector& pReference, const Vector& p)
  1832. {
  1833. m_deltaXYZ[0] = Delta(p.x - pReference.x);
  1834. m_deltaXYZ[1] = Delta(p.y - pReference.y);
  1835. m_deltaXYZ[2] = Delta(p.z - pReference.z);
  1836. }
  1837. void Export(const Vector& pReference, Vector* p) const
  1838. {
  1839. p->x = pReference.x + Displacement(m_deltaXYZ[0]);
  1840. p->y = pReference.y + Displacement(m_deltaXYZ[1]);
  1841. p->z = pReference.z + Displacement(m_deltaXYZ[2]);
  1842. }
  1843. };
  1844. class CompactState //2 bytes
  1845. {
  1846. private:
  1847. unsigned short m_state;
  1848. public:
  1849. void Set(int stateM)
  1850. {
  1851. m_state = (unsigned short)stateM;
  1852. }
  1853. void Export(int* pStateM) const
  1854. {
  1855. *pStateM = (int)((unsigned int)m_state);
  1856. }
  1857. };
  1858. class CompactVelocity //5 bytes
  1859. {
  1860. private:
  1861. unsigned short m_speed; //low order 13 bits. High order bits are sign for x, y, z
  1862. BytePercentage m_xVelocity, m_yVelocity, m_zVelocity;
  1863. public:
  1864. void Set(const Vector& v)
  1865. {
  1866. float speed = v.Length();
  1867. if (speed < 1.0f)
  1868. {
  1869. m_speed = 0;
  1870. }
  1871. else
  1872. {
  1873. assert (speed < 1000.0f);
  1874. m_speed = ((unsigned short)(speed * 8.0f)) |
  1875. ((unsigned short)(v.x >= 0.0f ? 0 : 0x2000)) |
  1876. ((unsigned short)(v.y >= 0.0f ? 0 : 0x4000)) |
  1877. ((unsigned short)(v.z >= 0.0f ? 0 : 0x8000));
  1878. m_xVelocity = (float)fabs(v.x / speed);
  1879. m_yVelocity = (float)fabs(v.y / speed);
  1880. m_zVelocity = (float)fabs(v.z / speed);
  1881. }
  1882. }
  1883. void Export(Vector* pVelocity) const
  1884. {
  1885. float speed = 0.125f * (float)(m_speed & 0x1fff);
  1886. pVelocity->x = m_xVelocity * ((m_speed & 0x2000) ? -speed : speed);
  1887. pVelocity->y = m_yVelocity * ((m_speed & 0x4000) ? -speed : speed);
  1888. pVelocity->z = m_zVelocity * ((m_speed & 0x8000) ? -speed : speed);
  1889. }
  1890. };
  1891. class CompactTurnRates //3 bytes
  1892. {
  1893. private:
  1894. char m_turnRates[3];
  1895. public:
  1896. void Set(const float turnRates[3])
  1897. {
  1898. for (Axis i = c_axisYaw; (i <= c_axisRoll); i++)
  1899. m_turnRates[i] = (char)floor(turnRates[i] * 127.0f / (2.0f * pi) + 0.5f);
  1900. }
  1901. void Export(float turnRates[3]) const
  1902. {
  1903. for (Axis i = c_axisYaw; (i <= c_axisRoll); i++)
  1904. turnRates[i] = ((float)(m_turnRates[i])) * (2.0f * pi) / 127.0f;
  1905. }
  1906. };
  1907. class CompactControlData //4 bytes
  1908. {
  1909. private:
  1910. char m_jsValues[c_axisMax]; //joystick settings
  1911. public:
  1912. void Set(const ControlData& cd)
  1913. {
  1914. for (Axis i = c_axisYaw; (i <= c_axisThrottle); i++)
  1915. m_jsValues[i] = (char)floor(cd.jsValues[i] * 127.0f + 0.5f);
  1916. }
  1917. void Export(ControlData* cd) const
  1918. {
  1919. for (Axis i = c_axisYaw; (i <= c_axisThrottle); i++)
  1920. cd->jsValues[i] = float(m_jsValues[i]) / 127.0f;
  1921. }
  1922. };
  1923. class CompactShipFractions //5 bytes
  1924. {
  1925. private:
  1926. BytePercentage m_bpHullFraction; //1
  1927. BytePercentage m_bpShieldFraction; //1
  1928. BytePercentage m_bpAmmo; //1
  1929. BytePercentage m_bpFuel; //1
  1930. BytePercentage m_bpEnergy; //1
  1931. public:
  1932. void SetHullFraction(float hf)
  1933. {
  1934. m_bpHullFraction = hf;
  1935. }
  1936. float GetHullFraction(void) const
  1937. {
  1938. return m_bpHullFraction;
  1939. }
  1940. void SetShieldFraction(float sf)
  1941. {
  1942. m_bpShieldFraction = sf;
  1943. }
  1944. float GetShieldFraction(void) const
  1945. {
  1946. return (float)m_bpShieldFraction;
  1947. }
  1948. void SetFuel(float maxFuel, float fuel)
  1949. {
  1950. m_bpFuel = maxFuel == 0.0f ? 0.0f : (fuel / maxFuel);
  1951. }
  1952. float GetFuel(float maxFuel) const
  1953. {
  1954. return m_bpFuel * maxFuel;
  1955. }
  1956. void SetAmmo(short maxAmmo, short ammo)
  1957. {
  1958. m_bpAmmo = maxAmmo == 0 ? BytePercentage(0.0f) : BytePercentage(float(ammo) / float(maxAmmo));
  1959. }
  1960. short GetAmmo(short maxAmmo) const
  1961. {
  1962. return short(m_bpAmmo * float(maxAmmo));
  1963. }
  1964. void SetEnergy(float maxEnergy, float energy)
  1965. {
  1966. m_bpEnergy = maxEnergy == 0.0f ? BytePercentage(0.0f) : BytePercentage(energy / maxEnergy);
  1967. }
  1968. float GetEnergy(float maxEnergy) const
  1969. {
  1970. return m_bpEnergy * maxEnergy;
  1971. }
  1972. };
  1973. class ServerLightShipUpdate //8 bytes
  1974. {
  1975. public:
  1976. ShipID shipID; //2
  1977. CompactState stateM; //2
  1978. CompactControlData controls; //4
  1979. };
  1980. class ServerHeavyShipUpdate : public ServerLightShipUpdate //38 bytes
  1981. {
  1982. public:
  1983. CompactTime time; //2
  1984. CompactPosition position; //6
  1985. CompactOrientation orientation; //8
  1986. CompactVelocity velocity; //5
  1987. CompactTurnRates turnRates; //3
  1988. CompactShipFractions fractions; //5
  1989. BytePercentage power; //1
  1990. };
  1991. class ServerSingleShipUpdate : public ServerLightShipUpdate //46 bytes
  1992. {
  1993. public:
  1994. Time time; //4
  1995. Vector position; //12
  1996. CompactOrientation orientation; //8
  1997. CompactVelocity velocity; //5
  1998. CompactTurnRates turnRates; //3
  1999. CompactShipFractions fractions; //5
  2000. BytePercentage power; //1
  2001. };
  2002. class ClientShipUpdate //33 bytes
  2003. {
  2004. public:
  2005. Time time; //4
  2006. Vector position; //12
  2007. CompactOrientation orientation; //8
  2008. CompactState stateM; //2
  2009. CompactControlData controls; //4
  2010. CompactVelocity velocity; //5
  2011. CompactTurnRates turnRates; //3
  2012. BytePercentage power; //1
  2013. };
  2014. class ClientActiveTurretUpdate //12 bytes
  2015. {
  2016. public:
  2017. Time time; //4
  2018. CompactControlData controls; //4
  2019. CompactOrientation orientation; //8
  2020. };
  2021. class ServerActiveTurretUpdate //16 bytes
  2022. {
  2023. public:
  2024. ShipID shipID; //2
  2025. CompactTime time; //2
  2026. CompactControlData controls; //4
  2027. CompactOrientation orientation; //8
  2028. };
  2029. #pragma pack(pop)
  2030. struct DataShipIGC
  2031. {
  2032. DWORD dwPrivate;
  2033. short partsOffset;
  2034. HullID hullID;
  2035. ShipID shipID;
  2036. char name[c_cbName];
  2037. Mount nParts;
  2038. SideID sideID;
  2039. //WingID wingID;
  2040. PilotType pilotType;
  2041. AbilityBitMask abmOrders;
  2042. ObjectID baseObjectID;
  2043. short nDeaths;
  2044. short nEjections;
  2045. short nKills;
  2046. };
  2047. struct DataWarpIGC
  2048. {
  2049. WarpDef warpDef;
  2050. char name[c_cbName];
  2051. Vector position;
  2052. Vector forward;
  2053. Rotation rotation;
  2054. float signature;
  2055. SectorID clusterID;
  2056. };
  2057. struct DataTreasureIGC
  2058. {
  2059. Vector p0;
  2060. Vector v0;
  2061. float lifespan;
  2062. Time time0;
  2063. ObjectID objectID;
  2064. TreasureID treasureID;
  2065. SectorID clusterID;
  2066. short amount;
  2067. TreasureCode treasureCode;
  2068. bool createNow;
  2069. };
  2070. struct DataMunitionExport
  2071. {
  2072. unsigned char lifespan;
  2073. char dx;
  2074. char dy;
  2075. char dz;
  2076. };
  2077. struct DataMunitionIGC
  2078. {
  2079. ImineIGC* pmine;
  2080. IclusterIGC* pcluster;
  2081. IsideIGC* pside;
  2082. Vector position;
  2083. Time timeExpire;
  2084. MunitionID munitionID;
  2085. };
  2086. struct DataMineBase
  2087. {
  2088. Vector p0;
  2089. Time time0;
  2090. MineID mineID;
  2091. bool exportF;
  2092. };
  2093. struct DataMineIGC : public DataMineBase
  2094. {
  2095. ImineTypeIGC* pminetype;
  2096. IshipIGC* pshipLauncher;
  2097. IsideIGC* psideLauncher;
  2098. IclusterIGC* pcluster;
  2099. };
  2100. struct DataMineExport : public DataMineBase
  2101. {
  2102. SectorID clusterID;
  2103. ExpendableTypeID minetypeID;
  2104. ShipID launcherID;
  2105. SideID sideID;
  2106. BytePercentage fraction;
  2107. bool createNow;
  2108. };
  2109. struct DataBuildingEffectBase
  2110. {
  2111. Time timeStart;
  2112. float radiusAsteroid;
  2113. float radiusStation;
  2114. Vector positionStart;
  2115. Vector positionStop;
  2116. };
  2117. struct DataBuildingEffectIGC : DataBuildingEffectBase
  2118. {
  2119. IclusterIGC* pcluster;
  2120. IshipIGC* pshipBuilder;
  2121. IasteroidIGC* pasteroid;
  2122. IstationIGC* pstation;
  2123. };
  2124. struct DataBuildingEffectExport : DataBuildingEffectBase
  2125. {
  2126. SectorID clusterID;
  2127. AsteroidID asteroidID;
  2128. Color color;
  2129. };
  2130. struct DataProbeBase
  2131. {
  2132. Vector p0;
  2133. Time time0;
  2134. ProbeID probeID;
  2135. bool exportF;
  2136. };
  2137. struct DataProbeIGC : public DataProbeBase
  2138. {
  2139. IprobeTypeIGC* pprobetype;
  2140. IsideIGC* pside;
  2141. IclusterIGC* pcluster;
  2142. IshipIGC* pship;
  2143. ImodelIGC* pmodelTarget;
  2144. };
  2145. struct DataProbeExport : public DataProbeBase
  2146. {
  2147. ExpendableTypeID probetypeID;
  2148. SideID sideID;
  2149. SectorID clusterID;
  2150. ShipID shipID;
  2151. ObjectType otTarget;
  2152. ObjectID oidTarget;
  2153. bool createNow;
  2154. };
  2155. struct DataChaffIGC
  2156. {
  2157. Vector p0;
  2158. Vector v0;
  2159. Time time0;
  2160. IclusterIGC* pcluster;
  2161. IchaffTypeIGC* pchafftype;
  2162. };
  2163. struct DataStationIGC
  2164. {
  2165. Vector position;
  2166. Vector up;
  2167. Vector forward;
  2168. Rotation rotation;
  2169. SectorID clusterID;
  2170. SideID sideID;
  2171. StationID stationID;
  2172. StationTypeID stationTypeID;
  2173. BytePercentage bpHull;
  2174. BytePercentage bpShield;
  2175. char name[c_cbName];
  2176. };
  2177. struct DataStationTypeIGC : public DataBuyableIGC
  2178. {
  2179. float signature;
  2180. float maxArmorHitPoints;
  2181. float maxShieldHitPoints;
  2182. float armorRegeneration;
  2183. float shieldRegeneration;
  2184. float scannerRange;
  2185. Money income;
  2186. float radius;
  2187. TechTreeBitMask ttbmLocal;
  2188. StationTypeID stationTypeID;
  2189. StationTypeID successorStationTypeID;
  2190. DefenseTypeID defenseTypeArmor;
  2191. DefenseTypeID defenseTypeShield;
  2192. StationAbilityBitMask sabmCapabilities;
  2193. AsteroidAbilityBitMask aabmBuild;
  2194. StationClassID classID;
  2195. DroneTypeID constructionDroneTypeID;
  2196. SoundID constructorNeedRockSound;
  2197. SoundID constructorUnderAttackSound;
  2198. SoundID constructorDestroyedSound;
  2199. SoundID completionSound;
  2200. SoundID interiorSound;
  2201. SoundID exteriorSound;
  2202. SoundID interiorAlertSound;
  2203. SoundID underAttackSound;
  2204. SoundID criticalSound;
  2205. SoundID destroyedSound;
  2206. SoundID capturedSound;
  2207. SoundID enemyCapturedSound;
  2208. SoundID enemyDestroyedSound;
  2209. char textureName[c_cbFileName];
  2210. char builderName[c_cbName];
  2211. };
  2212. struct DataDevelopmentIGC : public DataBuyableIGC
  2213. {
  2214. GlobalAttributeSet gas;
  2215. DevelopmentID developmentID;
  2216. SoundID completionSound;
  2217. };
  2218. struct DataDroneTypeIGC : public DataBuyableIGC
  2219. {
  2220. float shootSkill;
  2221. float moveSkill;
  2222. float bravery;
  2223. PilotType pilotType;
  2224. HullID hullTypeID;
  2225. DroneTypeID droneTypeID;
  2226. ExpendableTypeID etidLaid;
  2227. };
  2228. struct DataBucketIGC
  2229. {
  2230. IbuyableIGC* buyable;
  2231. IsideIGC* side;
  2232. };
  2233. struct ExplosionData
  2234. {
  2235. float amount;
  2236. float radius;
  2237. int explosionType;
  2238. Time time;
  2239. Vector position;
  2240. DamageTypeID damageType;
  2241. ImodelIGC* launcher;
  2242. };
  2243. //
  2244. // PLEASE! Update HandleCOMChatEvents in FedSrv.cpp if you change this enum
  2245. //
  2246. enum ChatTarget // if you change this please update AGCChatTarget in AGCIDL.idl
  2247. {
  2248. CHAT_EVERYONE = 0, CHAT_LEADERS, CHAT_ADMIN, CHAT_SHIP,
  2249. CHAT_TEAM, CHAT_INDIVIDUAL, CHAT_INDIVIDUAL_NOFILTER, CHAT_WING, CHAT_INDIVIDUAL_ECHO, //require objectID to be set
  2250. CHAT_ALL_SECTOR, CHAT_FRIENDLY_SECTOR, //ditto
  2251. CHAT_GROUP, CHAT_GROUP_NOECHO, //client only ... get translated into multiple sends
  2252. CHAT_NOSELECTION,
  2253. CHAT_MAX,
  2254. };
  2255. //Interfaces ....
  2256. class IstaticIGC
  2257. {
  2258. public:
  2259. virtual ~IstaticIGC(void) {};
  2260. virtual void Initialize(void) = 0;
  2261. virtual void Terminate(void) = 0;
  2262. virtual float GetFloatConstant(FloatConstantID fcid) const = 0;
  2263. virtual void SetFloatConstant(FloatConstantID fcid, float f) = 0;
  2264. virtual float GetDamageConstant(DamageTypeID dmgid, DefenseTypeID defid) const = 0;
  2265. virtual void SetDamageConstant(DamageTypeID dmgid, DefenseTypeID defid, float f) = 0;
  2266. virtual const void* GetConstants(void) const = 0;
  2267. virtual void SetConstants(const void* pf) = 0;
  2268. virtual int GetSizeOfConstants(void) const = 0;
  2269. virtual void AddDroneType(IdroneTypeIGC* dt) = 0;
  2270. virtual void DeleteDroneType(IdroneTypeIGC* dt) = 0;
  2271. virtual IdroneTypeIGC* GetDroneType(DroneTypeID id) const = 0;
  2272. virtual const DroneTypeListIGC* GetDroneTypes(void) const = 0;
  2273. virtual void AddDevelopment(IdevelopmentIGC* d) = 0;
  2274. virtual void DeleteDevelopment(IdevelopmentIGC* d) = 0;
  2275. virtual IdevelopmentIGC* GetDevelopment(DevelopmentID id) const = 0;
  2276. virtual const DevelopmentListIGC* GetDevelopments(void) const = 0;
  2277. virtual void AddStationType(IstationTypeIGC* st) = 0;
  2278. virtual void DeleteStationType(IstationTypeIGC* st) = 0;
  2279. virtual IstationTypeIGC* GetStationType(StationTypeID id) const = 0;
  2280. virtual const StationTypeListIGC* GetStationTypes(void) const = 0;
  2281. virtual void AddCivilization(IcivilizationIGC* c) = 0;
  2282. virtual void DeleteCivilization(IcivilizationIGC* c) = 0;
  2283. virtual IcivilizationIGC* GetCivilization(CivID id) const = 0;
  2284. virtual const CivilizationListIGC* GetCivilizations(void) const = 0;
  2285. virtual void AddHullType(IhullTypeIGC* ht) = 0;
  2286. virtual void DeleteHullType(IhullTypeIGC* ht) = 0;
  2287. virtual IhullTypeIGC* GetHullType(HullID id) const = 0;
  2288. virtual const HullTypeListIGC* GetHullTypes(void) const = 0;
  2289. virtual void AddExpendableType(IexpendableTypeIGC* mt) = 0;
  2290. virtual void DeleteExpendableType(IexpendableTypeIGC* mt) = 0;
  2291. virtual IexpendableTypeIGC* GetExpendableType(ExpendableTypeID id) const = 0;
  2292. virtual const ExpendableTypeListIGC* GetExpendableTypes(void) const = 0;
  2293. virtual void AddPartType(IpartTypeIGC* pt) = 0;
  2294. virtual void DeletePartType(IpartTypeIGC* pt) = 0;
  2295. virtual IpartTypeIGC* GetPartType(PartID id) const = 0;
  2296. virtual const PartTypeListIGC* GetPartTypes(void) const = 0;
  2297. virtual void AddProjectileType(IprojectileTypeIGC* pt) = 0;
  2298. virtual void DeleteProjectileType(IprojectileTypeIGC* pt) = 0;
  2299. virtual IprojectileTypeIGC* GetProjectileType(ProjectileTypeID id) const = 0;
  2300. virtual const ProjectileTypeListIGC* GetProjectileTypes(void) const = 0;
  2301. virtual void AddTreasureSet(ItreasureSetIGC* pt) = 0;
  2302. virtual void DeleteTreasureSet(ItreasureSetIGC* pt) = 0;
  2303. virtual ItreasureSetIGC* GetTreasureSet(TreasureSetID id) const = 0;
  2304. virtual const TreasureSetListIGC* GetTreasureSets(void) const = 0;
  2305. virtual IpartTypeIGC* GetAmmoPack(void) const = 0;
  2306. virtual IpartTypeIGC* GetFuelPack(void) const = 0;
  2307. };
  2308. const int c_cbSideName = 40;
  2309. class ImissionIGC : public IstaticIGC
  2310. {
  2311. public:
  2312. virtual int Export(__int64 maskTypes,
  2313. char* pdata) const = 0;
  2314. virtual void Import(Time now,
  2315. __int64 maskTypes,
  2316. char* pdata,
  2317. int datasize) = 0;
  2318. virtual MissionID GetMissionID(void) const = 0;
  2319. virtual void SetMissionID(MissionID mid) = 0;
  2320. virtual void Initialize(Time now, IIgcSite* pIgcSite) = 0;
  2321. virtual void Terminate(void) = 0;
  2322. virtual void Update(Time now) = 0;
  2323. virtual IIgcSite* GetIgcSite(void) const = 0;
  2324. virtual IbaseIGC* CreateObject(Time now, ObjectType objectID,
  2325. const void* data, int dataSize) = 0;
  2326. virtual ImodelIGC* GetModel(ObjectType type, ObjectID id) const = 0;
  2327. virtual IbaseIGC* GetBase(ObjectType type, ObjectID id) const = 0;
  2328. virtual DamageTrack* CreateDamageTrack(void) = 0;
  2329. virtual void AddSide(IsideIGC* s) = 0;
  2330. virtual void DeleteSide(IsideIGC* s) = 0;
  2331. virtual IsideIGC* GetSide(SideID sideID) const = 0;
  2332. virtual const SideListIGC* GetSides(void) const = 0;
  2333. virtual void AddCluster(IclusterIGC* c) = 0;
  2334. virtual void DeleteCluster(IclusterIGC* c) = 0;
  2335. virtual IclusterIGC* GetCluster(SectorID clusterID) const = 0;
  2336. virtual const ClusterListIGC* GetClusters(void) const = 0;
  2337. virtual void AddShip(IshipIGC* s) = 0;
  2338. virtual void DeleteShip(IshipIGC* s) = 0;
  2339. virtual IshipIGC* GetShip(ShipID shipID) const = 0;
  2340. virtual const ShipListIGC* GetShips(void) const = 0;
  2341. virtual void AddStation(IstationIGC* s) = 0;
  2342. virtual void DeleteStation(IstationIGC* s) = 0;
  2343. virtual IstationIGC* GetStation(StationID stationID) const = 0;
  2344. virtual const StationListIGC* GetStations(void) const = 0;
  2345. virtual void AddAsteroid(IasteroidIGC* p) = 0;
  2346. virtual void DeleteAsteroid(IasteroidIGC* p) = 0;
  2347. virtual IasteroidIGC* GetAsteroid(AsteroidID asteroidID) const = 0;
  2348. virtual const AsteroidListIGC* GetAsteroids(void) const = 0;
  2349. virtual void AddWarp(IwarpIGC* w) = 0;
  2350. virtual void DeleteWarp(IwarpIGC* w) = 0;
  2351. virtual IwarpIGC* GetWarp(WarpID warpID) const = 0;
  2352. virtual const WarpListIGC* GetWarps(void) const = 0;
  2353. virtual void AddBuoy(IbuoyIGC* t) = 0;
  2354. virtual void DeleteBuoy(IbuoyIGC* t) = 0;
  2355. virtual IbuoyIGC* GetBuoy(BuoyID buoyID) const = 0;
  2356. virtual const BuoyListIGC* GetBuoys(void) const = 0;
  2357. virtual void AddTreasure(ItreasureIGC* t) = 0;
  2358. virtual void DeleteTreasure(ItreasureIGC* t) = 0;
  2359. virtual ItreasureIGC* GetTreasure(TreasureID treasureID) const = 0;
  2360. virtual const TreasureListIGC* GetTreasures(void) const = 0;
  2361. virtual void AddMine(ImineIGC* ms) = 0;
  2362. virtual void DeleteMine(ImineIGC* m) = 0;
  2363. virtual ImineIGC* GetMine(MineID mineID) const = 0;
  2364. virtual const MineListIGC* GetMines(void) const = 0;
  2365. virtual void AddProbe(IprobeIGC* ms) = 0;
  2366. virtual void DeleteProbe(IprobeIGC* m) = 0;
  2367. virtual IprobeIGC* GetProbe(ProbeID probeID) const = 0;
  2368. virtual const ProbeListIGC* GetProbes(void) const = 0;
  2369. virtual IpartIGC* CreatePart(Time now,
  2370. IpartTypeIGC* ppt) = 0;
  2371. virtual BuoyID GenerateNewBuoyID(void) = 0;
  2372. virtual ShipID GenerateNewShipID(void) = 0;
  2373. virtual AsteroidID GenerateNewAsteroidID(void) = 0;
  2374. virtual StationID GenerateNewStationID(void) = 0;
  2375. virtual TreasureID GenerateNewTreasureID(void) = 0;
  2376. virtual MineID GenerateNewMineID(void) = 0;
  2377. virtual ProbeID GenerateNewProbeID(void) = 0;
  2378. virtual MissileID GenerateNewMissileID(void) = 0;
  2379. virtual void SetMissionStage(STAGE st) = 0;
  2380. virtual STAGE GetMissionStage() = 0;
  2381. virtual void EnterGame(void) = 0;
  2382. virtual void UpdateSides(Time now,
  2383. const MissionParams * pmp,
  2384. const char sideNames[c_cSidesMax][c_cbSideName]) = 0;
  2385. virtual void ResetMission() = 0;
  2386. virtual void GenerateMission(Time now,
  2387. const MissionParams * pmp,
  2388. TechTreeBitMask* pttbmShouldOverride,
  2389. TechTreeBitMask * pttbmOverrideValue) = 0;
  2390. virtual void GenerateTreasure(Time now,
  2391. IclusterIGC* pcluster,
  2392. short tsi) = 0;
  2393. virtual void SetPrivateData(DWORD dwPrivate) = 0;
  2394. virtual DWORD GetPrivateData(void) const = 0;
  2395. virtual Time GetLastUpdate(void) const = 0;
  2396. virtual const MissionParams* GetMissionParams(void) const = 0;
  2397. virtual void SetMissionParams(const MissionParams* pmp) = 0;
  2398. virtual void SetStartTime(Time timeStart) = 0;
  2399. //Warning these should never be called except from LoadIGCStaticCore
  2400. virtual CstaticIGC* GetStaticCore(void) const = 0;
  2401. virtual void SetStaticCore(CstaticIGC* pStatic) = 0;
  2402. virtual short GetReplayCount(void) const = 0;
  2403. virtual const char* GetContextName(void) = 0;
  2404. };
  2405. class IbaseIGC : public IObject
  2406. {
  2407. public:
  2408. virtual HRESULT Initialize(ImissionIGC* pMission, Time now, const void* data, int length) = 0;
  2409. virtual void Terminate(void) = 0;
  2410. virtual void Update(Time now) {}
  2411. //Exporting an object which doesn't support export is also bad.
  2412. virtual int Export(void* data) const { assert (false); return -1;}
  2413. // GetUniqueID() is provided for convenience because AGC uses GetObjectType and GetObjectID often.
  2414. virtual int GetUniqueID(void) const { return GetObjectType() | (GetObjectID() << 16); }
  2415. virtual ObjectType GetObjectType(void) const = 0;
  2416. //Calling either of these methods on something that doesn't have either an object ID or a mission is bad.
  2417. virtual ObjectID GetObjectID(void) const { assert (false); return NA;}
  2418. virtual ImissionIGC* GetMission(void) const { assert (false); return NULL; }
  2419. };
  2420. class ItypeIGC : public IbaseIGC
  2421. {
  2422. public:
  2423. virtual const void* GetData(void) const = 0;
  2424. };
  2425. class AttachSite : public IObject
  2426. {
  2427. public:
  2428. virtual ~AttachSite(void) {}
  2429. virtual void Terminate(void) {}
  2430. virtual void AddExplosion(ImodelIGC* pmodel, int type) {}
  2431. virtual void AddExplosion(const Vector& vecPosition, float scale, int type) {}
  2432. virtual void AddPulse (float fExplodeTime, const Vector& vecPosition, float fRadius, const Color& color) {}
  2433. virtual void AddThingSite(ThingSite* thing) {}
  2434. virtual void DeleteThingSite(ThingSite* thing) {}
  2435. };
  2436. class ThingSite : public AttachSite
  2437. {
  2438. public:
  2439. virtual void Purge(void) {}
  2440. virtual Vector GetChildModelOffset(const ZString& strFrame) { return Vector(0, 0, 0); }
  2441. virtual Vector GetChildOffset(const ZString& strFrame) { return Vector(0, 0, 0); }
  2442. virtual void AddHullHit(const Vector& vecPosition, const Vector& vecNormal) {}
  2443. virtual void AddFlare(Time ptime, const Vector& vecPosition, int id, const Vector* ellipseEquation) {}
  2444. virtual void AddMuzzleFlare(const Vector& vecEmissionPoint, float duration) {}
  2445. virtual void SetVisible(unsigned char render) {}
  2446. virtual void SetAfterburnerThrust (const Vector& direction, float power) {}
  2447. virtual void SetAfterburnerSmokeSize (float size) {}
  2448. virtual void SetAfterburnerFireDuration (float duration) {}
  2449. virtual void SetAfterburnerSmokeDuration (float duration) {}
  2450. virtual void AddDamage (const Vector& vecDamagePosition, float fDamageFraction) {}
  2451. virtual void RemoveDamage (float fDamageFraction) {}
  2452. virtual void SetTimeUntilRipcord (float fTimeUntilTeleport) {}
  2453. virtual void SetTimeUntilAleph (float fTimeUntilTeleport) {}
  2454. virtual const Point& GetScreenPosition(void) const { const static Point pointZero(0.0f,0.0f);
  2455. return pointZero; }
  2456. virtual float GetDistanceToEdge(void) { return 0.0f; }
  2457. virtual float GetScreenRadius(void) {return 1.0f; }
  2458. virtual unsigned char GetRadarState(void) { return c_ucRadarOnScreenLarge; }
  2459. virtual ThingGeo* GetThingGeo(void) { return NULL; }
  2460. virtual Geo* GetGeo(void) { return NULL; }
  2461. virtual void SetPosition(const Vector& position) {}
  2462. virtual float GetRadius(void) { return 1.0f; }
  2463. virtual void SetRadius(float r) { }
  2464. virtual void SetOrientation(const Orientation& orientation) {}
  2465. virtual void Spin(float r) {}
  2466. virtual void SetTexture(const char* pszTextureName) {}
  2467. virtual void SetTrailColor(const Color& c) {}
  2468. virtual HRESULT LoadDecal(const char* textureName, bool bDirectional, float width) { return S_OK; }
  2469. virtual HRESULT LoadModel(int options, const char* modelName, const char* textureName) { return S_OK; }
  2470. virtual HRESULT LoadAleph(const char* textureName) { return S_OK; }
  2471. virtual HRESULT LoadEffect(const Color& color) { return S_OK; }
  2472. virtual void SetColors(float aInner, float fInner, float fOuter) {}
  2473. virtual HRESULT LoadMine(const char* textureName, float strength, float radius) { return S_OK; }
  2474. virtual void SetMineStrength(float strength) {}
  2475. virtual void SetCluster(ImodelIGC* pmodel,
  2476. IclusterIGC* pcluster) {};
  2477. virtual void UpdateSideVisibility(ImodelIGC* pmodel,
  2478. IclusterIGC* pcluster) {}
  2479. virtual bool GetSideVisibility(IsideIGC* side) { return false; }
  2480. virtual void SetSideVisibility(IsideIGC* side,
  2481. bool fVisible) {}
  2482. virtual void ActivateBolt(void) {}
  2483. virtual void DeactivateBolt(void) {}
  2484. virtual int GetMask(void) const {return 0;}
  2485. virtual void SetMask(int mask) {};
  2486. virtual void OrMask(int mask) {};
  2487. virtual void AndMask(int mask) {};
  2488. virtual void XorMask(int mask) {};
  2489. };
  2490. class ImodelIGC : public IbaseIGC
  2491. {
  2492. public:
  2493. virtual Time GetLastUpdate(void) const = 0;
  2494. virtual void SetLastUpdate(Time now) = 0;
  2495. virtual void SetMission(ImissionIGC* pmission) = 0;
  2496. virtual void LoadCVH(const char* pszFileName,
  2497. const char* iconName,
  2498. ModelAttributes attributes,
  2499. HitTestShape htsDefault = c_htsSphere) = 0;
  2500. virtual HRESULT LoadEffect(const Color& color,
  2501. ModelAttributes attributes) = 0;
  2502. virtual HRESULT LoadWarp(const char* textureName,
  2503. const char* iconName,
  2504. ModelAttributes attributes) = 0;
  2505. virtual HRESULT LoadMine(const char* textureName,
  2506. float strength,
  2507. float radius,
  2508. const char* iconName,
  2509. ModelAttributes attributes) = 0;
  2510. virtual HRESULT LoadDecal(const char* textureName,
  2511. const char* iconName,
  2512. const Color& color,
  2513. bool bDirectional,
  2514. float width,
  2515. ModelAttributes attributes,
  2516. HitTestShape htsDefault = c_htsPoint) = 0;
  2517. virtual HRESULT Load(int options,
  2518. const char* model,
  2519. const char* texture,
  2520. const char* iconName,
  2521. ModelAttributes attributes) = 0;
  2522. virtual bool GetVisibleF(void) const = 0;
  2523. virtual void SetVisibleF(bool visibleF) = 0;
  2524. virtual void SetRender(unsigned char render) = 0;
  2525. virtual bool SeenBySide(IsideIGC* side) const = 0;
  2526. virtual void UpdateSeenBySide(void) = 0;
  2527. virtual void SetSideVisibility(IsideIGC* side, bool fVisible) = 0;
  2528. virtual ThingSite* GetThingSite(void) const = 0;
  2529. virtual void FreeThingSite(void) = 0;
  2530. virtual const Vector& GetPosition(void) const = 0;
  2531. virtual void SetPosition(const Vector& newVal) = 0;
  2532. virtual const Vector& GetVelocity(void) const = 0;
  2533. virtual void SetVelocity(const Vector& newVal) = 0;
  2534. virtual const Orientation& GetOrientation(void) const = 0;
  2535. virtual void SetOrientation(const Orientation& newVal) = 0;
  2536. virtual const Rotation& GetRotation(void) const = 0;
  2537. virtual void SetRotation(const Rotation& newVal) = 0;
  2538. virtual float GetRadius(void) const = 0;
  2539. virtual void SetRadius(float newVal) = 0;
  2540. virtual ModelAttributes GetAttributes(void) const = 0;
  2541. virtual IsideIGC* GetSide(void) const = 0;
  2542. virtual void SetSide(IsideIGC* newVal) = 0;
  2543. virtual float GetMass(void) const = 0;
  2544. virtual void SetMass(float newVal) = 0;
  2545. virtual IclusterIGC* GetCluster(void) const = 0;
  2546. virtual void SetCluster(IclusterIGC* pVal) = 0;
  2547. virtual char const* GetName(void) const = 0;
  2548. virtual void SetName(const char* newVal) = 0;
  2549. virtual void SetSecondaryName(const char* newVal) = 0;
  2550. virtual float GetSignature(void) const = 0;
  2551. virtual void SetSignature(float newVal) = 0;
  2552. virtual void ChangeSignature(float delta) = 0;
  2553. virtual void SetTexture(const char* pszTextureName) = 0;
  2554. virtual void Move(float t) = 0;
  2555. virtual void Move(void) = 0;
  2556. virtual void SetBB(Time tStart, Time tStop, float dt) = 0;
  2557. virtual HitTest* GetHitTest(void) const = 0;
  2558. virtual void HandleCollision(Time timeCollision,
  2559. float tCollision,
  2560. const CollisionEntry& entry,
  2561. ImodelIGC* pModel) = 0;
  2562. virtual IObject* GetIcon(void) const = 0;
  2563. virtual void SetIcon(IObject* picon) = 0;
  2564. virtual SideID GetFlag(void) const { return NA; };
  2565. virtual void SetFlag(SideID sideID) { assert (false); }
  2566. virtual const DamageBucketList* GetDamageBuckets(void) const = 0;
  2567. virtual void AddDamageBucket(DamageBucket* db) = 0;
  2568. virtual void DeleteDamageBucket(DamageBucket* db) = 0;
  2569. };
  2570. class IdamageIGC : public ImodelIGC
  2571. {
  2572. public:
  2573. virtual DamageResult ReceiveDamage(DamageTypeID type,
  2574. float amount,
  2575. Time timeCollision,
  2576. const Vector& position1,
  2577. const Vector& position2,
  2578. ImodelIGC* launcher) = 0;
  2579. virtual float GetFraction(void) const = 0;
  2580. virtual void SetFraction(float newVal) = 0;
  2581. virtual float GetHitPoints(void) const = 0;
  2582. };
  2583. class IscannerIGC : public IdamageIGC
  2584. {
  2585. public:
  2586. virtual bool InScannerRange(ImodelIGC* pModel) const = 0;
  2587. virtual bool CanSee(ImodelIGC* pModel) const = 0;
  2588. };
  2589. typedef int ShipUpdateStatus;
  2590. const ShipUpdateStatus c_susOutOfDate = 0;
  2591. const ShipUpdateStatus c_susInvalid = -2;
  2592. const ShipUpdateStatus c_susRejected = -1;
  2593. const ShipUpdateStatus c_susAccepted = 1;
  2594. class IshipIGC : public IscannerIGC
  2595. {
  2596. public:
  2597. virtual void SetObjectID(ObjectID id) {}
  2598. virtual Money GetValue(void) const = 0;
  2599. virtual IstationIGC* GetStation(void) const = 0;
  2600. virtual void SetStation(IstationIGC* s) = 0;
  2601. virtual void Reset(bool bFull) = 0;
  2602. virtual float GetTorqueMultiplier(void) const = 0;
  2603. virtual float GetCurrentTurnRate(Axis axis) const = 0;
  2604. virtual void SetCurrentTurnRate(Axis axis, float newVal) = 0;
  2605. virtual const IhullTypeIGC* GetHullType(void) const = 0;
  2606. virtual IhullTypeIGC* GetBaseHullType(void) const = 0;
  2607. virtual void SetBaseHullType(IhullTypeIGC* newVal) = 0;
  2608. virtual void SetMission(ImissionIGC* pMission) = 0;
  2609. //Note ... the next two methods should never be called from outside IGC
  2610. virtual void AddPart(IpartIGC* part) = 0;
  2611. virtual void DeletePart(IpartIGC* part) = 0;
  2612. virtual const PartListIGC* GetParts(void) const = 0;
  2613. virtual IpartIGC* GetMountedPart(EquipmentType type, Mount mountID) const = 0;
  2614. //Note ... the next method should never be called from outside IGC
  2615. virtual void MountPart(IpartIGC* p, Mount mountNew, Mount* pmountOld) = 0;
  2616. virtual short GetAmmo(void) const = 0;
  2617. virtual void SetAmmo(short amount) = 0;
  2618. virtual float GetFuel(void) const = 0;
  2619. virtual void SetFuel(float newVal) = 0;
  2620. virtual float GetEnergy(void) const = 0;
  2621. virtual void SetEnergy(float newVal) = 0;
  2622. virtual float GetCloaking(void) const = 0;
  2623. virtual void SetCloaking(float newVal) = 0;
  2624. virtual bool GetVectorLock(void) const = 0;
  2625. virtual void SetVectorLock(bool bVectorLock) = 0;
  2626. virtual const ControlData& GetControls(void) const = 0;
  2627. virtual void SetControls(const ControlData& newVal) = 0;
  2628. virtual bool fRipcordActive(void) const = 0;
  2629. virtual float GetRipcordTimeLeft(void) const = 0;
  2630. virtual void ResetRipcordTimeLeft(void) = 0;
  2631. virtual const Vector& GetEngineVector(void) const = 0;
  2632. virtual int GetStateM(void) const = 0;
  2633. virtual void SetStateM(int newVal) = 0;
  2634. virtual void SetStateBits(int mask, int newBits) = 0;
  2635. virtual ImodelIGC* GetCommandTarget(Command i) const = 0;
  2636. virtual CommandID GetCommandID(Command i) const = 0;
  2637. virtual void SetCommand(Command i, ImodelIGC* target, CommandID cid) = 0;
  2638. virtual void PreplotShipMove(Time timeStop) = 0;
  2639. virtual void PlotShipMove(Time timeStop) = 0;
  2640. virtual void ExecuteShipMove(Time timeStop) = 0;
  2641. virtual void ExecuteShipMove(Time timeStart,
  2642. Time timeStop,
  2643. Vector* pVelocity,
  2644. Orientation* pOrientation) = 0;
  2645. virtual void ExecuteTurretMove(Time timeStart,
  2646. Time timeStop,
  2647. Orientation* pOrientation) = 0;
  2648. virtual bool EquivalentShip(IshipIGC* pship) const = 0;
  2649. virtual short ExportShipLoadout(ShipLoadout* ploadout) = 0;
  2650. virtual void ProcessShipLoadout(short cbLoadout,
  2651. const ShipLoadout* ploadout,
  2652. bool bReady) = 0;
  2653. virtual bool PurchaseShipLoadout(short cbLoadout,
  2654. const ShipLoadout* ploadout) = 0; //Returns true is entire purchase is OK
  2655. virtual void ExportFractions(CompactShipFractions* pfractions) const = 0;
  2656. virtual void ExportShipUpdate(ServerLightShipUpdate* pshipupdate) const = 0;
  2657. virtual void ExportShipUpdate(Time timeReference,
  2658. const Vector& positionReference,
  2659. ServerHeavyShipUpdate* pshipupdate) const = 0;
  2660. virtual void ExportShipUpdate(ServerSingleShipUpdate* pshipupdate) const = 0;
  2661. virtual void ExportShipUpdate(ClientShipUpdate* pshipupdate) const = 0;
  2662. virtual void ExportShipUpdate(ClientActiveTurretUpdate* patu) const = 0;
  2663. virtual void ProcessFractions(const CompactShipFractions& fractions) = 0;
  2664. virtual ShipUpdateStatus ProcessShipUpdate(const ServerLightShipUpdate& shipupdate) = 0;
  2665. virtual ShipUpdateStatus ProcessShipUpdate(Time timeReference,
  2666. Vector positionReference,
  2667. const ServerHeavyShipUpdate& shipupdate) = 0;
  2668. virtual ShipUpdateStatus ProcessShipUpdate(const ClientShipUpdate& shipupdate) = 0;
  2669. virtual ShipUpdateStatus ProcessShipUpdate(const ServerSingleShipUpdate& shipupdate,
  2670. bool bOrient = true) = 0;
  2671. virtual ShipUpdateStatus ProcessShipUpdate(Time timeReference,
  2672. const ServerActiveTurretUpdate& shipupdate) = 0;
  2673. virtual ShipUpdateStatus ProcessShipUpdate(const ClientActiveTurretUpdate& shipupdate) = 0;
  2674. virtual void SetPrivateData(DWORD dwPrivate) = 0;
  2675. virtual DWORD GetPrivateData(void) const = 0;
  2676. virtual void ReInitialize(DataShipIGC * dataShip, Time now) = 0;
  2677. virtual Mount HitTreasure(TreasureCode treasureCode, ObjectID objectID, short amount) = 0;
  2678. virtual ImissileIGC* GetLastMissileFired(void) const = 0;
  2679. virtual void SetLastMissileFired(ImissileIGC* pmissile) = 0;
  2680. virtual void Promote(void) = 0;
  2681. virtual void SetParentShip(IshipIGC* pship) = 0;
  2682. virtual IshipIGC* GetParentShip(void) const = 0;
  2683. virtual Mount GetTurretID(void) const = 0;
  2684. virtual void SetTurretID(Mount turretID) = 0;
  2685. virtual IshipIGC* GetGunner(Mount turretID) const = 0;
  2686. virtual const ShipListIGC* GetChildShips(void) const = 0;
  2687. virtual void Complain(SoundID sid, const char* pszMsg) = 0;
  2688. virtual short GetKills(void) const = 0;
  2689. virtual void SetKills(short n) = 0;
  2690. virtual void AddKill(void) = 0;
  2691. virtual short GetDeaths(void) const = 0;
  2692. virtual void SetDeaths(short n) = 0;
  2693. virtual void AddDeath(void) = 0;
  2694. virtual short GetEjections(void) const = 0;
  2695. virtual void SetEjections(short n) = 0;
  2696. virtual void AddEjection(void) = 0;
  2697. virtual float GetExperienceMultiplier(void) const = 0;
  2698. virtual float GetExperience(void) const = 0;
  2699. virtual void SetExperience(float) = 0;
  2700. virtual void AddExperience(void) = 0;
  2701. //These two methods are never called from outside of CshipIGC
  2702. virtual void AddChildShip(IshipIGC* pship) = 0;
  2703. virtual void DeleteChildShip(IshipIGC* pship) = 0;
  2704. virtual IshipIGC* GetSourceShip(void) = 0;
  2705. virtual IpartIGC* CreateAndAddPart(const PartData* ppd) = 0;
  2706. virtual IpartIGC* CreateAndAddPart(IpartTypeIGC* ppt, Mount mount, short amount) = 0;
  2707. virtual WingID GetWingID(void) const = 0;
  2708. virtual void SetWingID(WingID wid) = 0;
  2709. virtual PilotType GetPilotType(void) const = 0;
  2710. virtual AbilityBitMask GetOrdersABM(void) const = 0;
  2711. virtual bool GetAutopilot(void) const = 0;
  2712. virtual void SetAutopilot(bool bAutopilot) = 0;
  2713. virtual bool LegalCommand(CommandID cid) const = 0;
  2714. virtual bool LegalCommand(CommandID cid,
  2715. ImodelIGC* pmodel) const = 0;
  2716. virtual IshipIGC* GetAutoDonate(void) const = 0;
  2717. virtual void SetAutoDonate(IshipIGC* pship) = 0;
  2718. virtual ImodelIGC* GetRipcordModel(void) const = 0;
  2719. virtual void SetRipcordModel(ImodelIGC* pmodel) = 0;
  2720. virtual ImodelIGC* FindRipcordModel(IclusterIGC* pcluster) = 0;
  2721. virtual float GetRipcordDebt(void) const = 0;
  2722. virtual void AdjustRipcordDebt(float delta) = 0;
  2723. virtual DamageTrack* GetDamageTrack(void) = 0;
  2724. virtual void CreateDamageTrack(void) = 0;
  2725. virtual void DeleteDamageTrack(void) = 0;
  2726. virtual void ResetDamageTrack(void) = 0;
  2727. virtual void AddMineDamage(DamageTypeID type,
  2728. float amount,
  2729. Time timeCollision,
  2730. ImodelIGC* pmodelLauncher,
  2731. const Vector& position1,
  2732. const Vector& position2) = 0;
  2733. virtual void ApplyMineDamage(void) = 0;
  2734. virtual CommandID GetDefaultOrder(ImodelIGC* pmodel) = 0;
  2735. virtual bool OkToLaunch(Time now) = 0;
  2736. virtual bool PickDefaultOrder(IclusterIGC* pcluster, const Vector& position, bool bDocked = true) = 0;
  2737. virtual bool IsGhost(void) const = 0;
  2738. virtual float GetEndurance(void) const = 0;
  2739. virtual bool InGarage(IshipIGC* pship, float tCollision) const = 0;
  2740. virtual bool IsUsingAreaOfEffectWeapon(void) const = 0;
  2741. virtual short GetLaunchSlot(void) = 0;
  2742. virtual WarningMask GetWarningMask(void) const = 0;
  2743. virtual void SetWarningMaskBit(WarningMask wm) = 0;
  2744. virtual void ClearWarningMaskBit(WarningMask wm) = 0;
  2745. //Special methods that work only if the ship is piloted by a particular pilot type
  2746. //Builders & Layers
  2747. virtual void SetBaseData(IbaseIGC* pbase) = 0;
  2748. virtual IbaseIGC* GetBaseData(void) const = 0;
  2749. //Miners
  2750. virtual float GetOre(void) const = 0;
  2751. };
  2752. class IbuoyIGC : public ImodelIGC
  2753. {
  2754. public:
  2755. virtual void AddConsumer(void) = 0;
  2756. virtual void ReleaseConsumer(void) = 0;
  2757. virtual BuoyType GetBuoyType(void) = 0;
  2758. };
  2759. class IchaffIGC : public ImodelIGC
  2760. {
  2761. public:
  2762. };
  2763. class IprojectileIGC : public ImodelIGC
  2764. {
  2765. public:
  2766. virtual IprojectileTypeIGC* GetProjectileType(void) const = 0;
  2767. virtual ImodelIGC* GetLauncher(void) const = 0;
  2768. virtual void SetLauncher(ImodelIGC* newVal) = 0;
  2769. virtual void SetGunner(IshipIGC* pship) = 0;
  2770. };
  2771. class ImissileIGC : public IdamageIGC
  2772. {
  2773. public:
  2774. virtual ImissileTypeIGC* GetMissileType(void) const = 0;
  2775. virtual IshipIGC* GetLauncher(void) const = 0;
  2776. virtual ImodelIGC* GetTarget(void) const = 0;
  2777. virtual void SetTarget(ImodelIGC* newVal) = 0;
  2778. virtual float GetLock(void) const = 0;
  2779. virtual void Explode(const Vector& position) = 0;
  2780. virtual void Disarm(void) = 0;
  2781. };
  2782. class ImineIGC : public ImodelIGC
  2783. {
  2784. public:
  2785. virtual ImineTypeIGC* GetMineType(void) const = 0;
  2786. virtual IshipIGC* GetLauncher(void) const = 0;
  2787. virtual void SetCreateNow (void) = 0;
  2788. virtual float GetStrength(void) const = 0;
  2789. virtual void ReduceStrength(float amount) = 0;
  2790. virtual float GetTimeFraction(void) const = 0;
  2791. };
  2792. class IbuildingEffectIGC : public IdamageIGC
  2793. {
  2794. public:
  2795. virtual void BuilderTerminated(void) = 0;
  2796. virtual IasteroidIGC* GetAsteroid(void) const = 0;
  2797. virtual void MakeUnhitable(void) = 0;
  2798. virtual void AsteroidUpdate(Time now) = 0;
  2799. };
  2800. class IprobeIGC : public IscannerIGC
  2801. {
  2802. public:
  2803. virtual IprobeTypeIGC* GetProbeType(void) const = 0;
  2804. virtual IprojectileTypeIGC* GetProjectileType(void) const = 0;
  2805. virtual const Vector& GetEmissionPt(void) const = 0;
  2806. virtual float GetProjectileLifespan(void) const = 0;
  2807. virtual float GetLifespan(void) const = 0;
  2808. virtual float GetDtBurst(void) const = 0;
  2809. virtual float GetAccuracy(void) const = 0;
  2810. virtual bool GetCanRipcord(float ripcordspeed = -1.0f) const = 0;
  2811. virtual float GetRipcordDelay(void) const = 0;
  2812. virtual SoundID GetAmbientSound(void) const = 0;
  2813. virtual void SetCreateNow (void) = 0;
  2814. virtual float GetTimeFraction(void) const = 0;
  2815. };
  2816. class IstationIGC : public IscannerIGC
  2817. {
  2818. public:
  2819. virtual void AddShip(IshipIGC* s) = 0;
  2820. virtual void DeleteShip(IshipIGC* s) = 0;
  2821. virtual IshipIGC* GetShip(ShipID shipID) const = 0;
  2822. virtual const ShipListIGC* GetShips(void) const = 0;
  2823. virtual void RepairAndRefuel(IshipIGC* pship) const = 0;
  2824. virtual void Launch(IshipIGC* pship) = 0;
  2825. virtual bool InGarage(IshipIGC* pship, const Vector& position) = 0;
  2826. virtual float GetShieldFraction(void) const = 0;
  2827. virtual void SetShieldFraction(float sf) = 0;
  2828. virtual const IstationTypeIGC* GetStationType(void) const = 0;
  2829. virtual IstationTypeIGC* GetBaseStationType(void) const = 0;
  2830. virtual void SetBaseStationType(IstationTypeIGC* pst) = 0;
  2831. virtual bool CanBuy(const IbuyableIGC* b) const = 0;
  2832. virtual bool IsObsolete(IbuyableIGC* b) const = 0;
  2833. virtual IbuyableIGC* GetSuccessor(IbuyableIGC* b) const = 0;
  2834. virtual IpartTypeIGC* GetSimilarPart(IpartTypeIGC* ppt) const = 0;
  2835. virtual void SetLastDamageReport(Time timeLastDamage) = 0;
  2836. virtual Time GetLastDamageReport(void) const = 0;
  2837. virtual SoundID GetInteriorSound() const = 0;
  2838. virtual SoundID GetExteriorSound() const = 0;
  2839. };
  2840. class IbuyableIGC : public ItypeIGC
  2841. {
  2842. public:
  2843. virtual const char* GetName(void) const = 0;
  2844. virtual const char* GetIconName(void) const = 0;
  2845. virtual const char* GetDescription(void) const = 0;
  2846. virtual const char* GetModelName(void) const = 0;
  2847. virtual const TechTreeBitMask& GetRequiredTechs(void) const = 0;
  2848. virtual const TechTreeBitMask& GetEffectTechs(void) const = 0;
  2849. virtual Money GetPrice(void) const = 0;
  2850. virtual DWORD GetTimeToBuild(void) const = 0;
  2851. virtual BuyableGroupID GetGroupID(void) const = 0;
  2852. };
  2853. class IdevelopmentIGC : public IbuyableIGC
  2854. {
  2855. public:
  2856. virtual const GlobalAttributeSet& GetGlobalAttributeSet(void) const = 0;
  2857. virtual bool GetTechOnly(void) const = 0;
  2858. virtual bool IsObsolete(const TechTreeBitMask& ttbm) const = 0;
  2859. virtual SoundID GetCompletionSound() const = 0;
  2860. };
  2861. class IdroneTypeIGC : public IbuyableIGC
  2862. {
  2863. public:
  2864. virtual HullID GetHullTypeID(void) const = 0;
  2865. virtual PilotType GetPilotType(void) const = 0;
  2866. virtual float GetShootSkill(void) const = 0;
  2867. virtual float GetMoveSkill(void) const = 0;
  2868. virtual float GetBravery(void) const = 0;
  2869. virtual IexpendableTypeIGC* GetLaidExpendable(void) const = 0;
  2870. };
  2871. class IstationTypeIGC : public IbuyableIGC
  2872. {
  2873. public:
  2874. virtual HitPoints GetMaxArmorHitPoints(void) const = 0;
  2875. virtual DefenseTypeID GetArmorDefenseType(void) const = 0;
  2876. virtual HitPoints GetMaxShieldHitPoints(void) const = 0;
  2877. virtual DefenseTypeID GetShieldDefenseType(void) const = 0;
  2878. virtual float GetArmorRegeneration(void) const = 0;
  2879. virtual float GetShieldRegeneration(void) const = 0;
  2880. virtual float GetSignature(void) const = 0;
  2881. virtual float GetRadius(void) const = 0;
  2882. virtual float GetScannerRange(void) const = 0;
  2883. virtual const TechTreeBitMask& GetLocalTechs(void) const = 0;
  2884. virtual Money GetIncome(void) const = 0;
  2885. virtual StationAbilityBitMask GetCapabilities(void) const = 0;
  2886. virtual bool HasCapability(StationAbilityBitMask habm) const = 0;
  2887. virtual const char* GetTextureName(void) const = 0;
  2888. virtual const char* GetBuilderName(void) const = 0;
  2889. virtual IstationTypeIGC* GetSuccessorStationType(const IsideIGC* pside) = 0;
  2890. virtual AsteroidAbilityBitMask GetBuildAABM(void) const = 0;
  2891. virtual int GetLaunchSlots(void) const = 0;
  2892. virtual const Vector& GetLaunchPosition(int slotID) const = 0;
  2893. virtual const Vector& GetLaunchDirection(int slotID) const = 0;
  2894. virtual int GetLandSlots(void) const = 0;
  2895. virtual int GetCapLandSlots(void) const = 0;
  2896. virtual int GetLandPlanes(int slotID) const = 0;
  2897. virtual const Vector& GetLandPosition(int slotID, int planeID) const = 0;
  2898. virtual const Vector& GetLandDirection(int slotID, int planeID) const = 0;
  2899. virtual SoundID GetInteriorSound() const = 0;
  2900. virtual SoundID GetInteriorAlertSound() const = 0;
  2901. virtual SoundID GetExteriorSound() const = 0;
  2902. virtual SoundID GetConstructorNeedRockSound() const = 0;
  2903. virtual SoundID GetConstructorUnderAttackSound() const = 0;
  2904. virtual SoundID GetConstructorDestroyedSound() const = 0;
  2905. virtual SoundID GetCompletionSound() const = 0;
  2906. virtual SoundID GetUnderAttackSound() const = 0;
  2907. virtual SoundID GetCriticalSound() const = 0;
  2908. virtual SoundID GetDestroyedSound() const = 0;
  2909. virtual SoundID GetCapturedSound() const = 0;
  2910. virtual SoundID GetEnemyCapturedSound() const = 0;
  2911. virtual SoundID GetEnemyDestroyedSound() const = 0;
  2912. virtual StationClassID GetClassID() const = 0;
  2913. virtual IdroneTypeIGC* GetConstructionDroneType(void) const = 0;
  2914. };
  2915. class IbucketIGC : public IbuyableIGC
  2916. {
  2917. public:
  2918. virtual IbuyableIGC* GetBuyable(void) const = 0;
  2919. virtual IsideIGC* GetSide(void) const = 0;
  2920. virtual void SetPrice(Money m) = 0;
  2921. virtual int GetPercentBought(void) const = 0;
  2922. virtual int GetPercentComplete(void) const = 0;
  2923. virtual bool GetCompleteF(void) const = 0;
  2924. virtual void ForceComplete(Time now) = 0;
  2925. virtual DWORD GetTime(void) const = 0;
  2926. virtual Money GetMoney(void) const = 0;
  2927. virtual void SetTimeAndMoney(DWORD dwTime, Money money) = 0;
  2928. virtual Money AddMoney(Money m) = 0;
  2929. virtual void SetEmpty(void) = 0;
  2930. virtual ObjectType GetBucketType(void) const = 0;
  2931. virtual IbucketIGC* GetPredecessor(void) const = 0;
  2932. };
  2933. class IprojectileTypeIGC : public ItypeIGC
  2934. {
  2935. public:
  2936. virtual float GetPower(void) const = 0;
  2937. virtual float GetBlastPower(void) const = 0;
  2938. virtual float GetBlastRadius(void) const = 0;
  2939. virtual float GetSpeed(void) const = 0;
  2940. virtual bool GetAbsoluteF(void) const = 0;
  2941. virtual char const* GetModelName(void) const = 0;
  2942. virtual char const* GetModelTexture(void) const = 0;
  2943. virtual float GetLifespan(void) const = 0;
  2944. virtual float GetRadius(void) const = 0;
  2945. virtual float GetRotation(void) const = 0;
  2946. virtual D3DCOLORVALUE GetColor(void) const = 0;
  2947. virtual DamageTypeID GetDamageType(void) const = 0;
  2948. virtual SoundID GetAmbientSound(void) const = 0;
  2949. };
  2950. class IexpendableTypeIGC : public ItypeIGC
  2951. {
  2952. public:
  2953. virtual const LauncherDef* GetLauncherDef(void) const = 0;
  2954. virtual EquipmentType GetEquipmentType(void) const = 0;
  2955. virtual float GetLoadTime(void) const = 0;
  2956. virtual float GetMass(void) const = 0;
  2957. virtual float GetSignature(void) const = 0;
  2958. virtual HitPoints GetHitPoints(void) const = 0;
  2959. virtual DefenseTypeID GetDefenseType(void) const = 0;
  2960. virtual float GetLifespan(void) const = 0;
  2961. virtual char const* GetName(void) const = 0;
  2962. virtual char const* GetModelName(void) const = 0;
  2963. virtual char const* GetModelTexture(void) const = 0;
  2964. virtual float GetRadius(void) const = 0;
  2965. virtual ExpendableAbilityBitMask GetCapabilities(void) const = 0;
  2966. virtual bool HasCapability(ExpendableAbilityBitMask habm) const = 0;
  2967. };
  2968. class ImissileTypeIGC : public IexpendableTypeIGC
  2969. {
  2970. public:
  2971. virtual float GetAcceleration(void) const = 0;
  2972. virtual float GetTurnRate(void) const = 0;
  2973. virtual float GetInitialSpeed(void) const = 0;
  2974. //virtual float GetArmTime(void) const = 0;
  2975. virtual float GetMaxLock(void) const = 0;
  2976. virtual float GetChaffResistance(void) const = 0;
  2977. virtual float GetLockTime(void) const = 0;
  2978. virtual float GetReadyTime(void) const = 0;
  2979. virtual float GetDispersion(void) const = 0;
  2980. virtual float GetLockAngle(void) const = 0;
  2981. virtual float GetPower(void) const = 0;
  2982. virtual float GetBlastPower(void) const = 0;
  2983. virtual float GetBlastRadius(void) const = 0;
  2984. virtual DamageTypeID GetDamageType(void) const = 0;
  2985. virtual SoundID GetLaunchSound(void) const = 0;
  2986. virtual SoundID GetAmbientSound(void) const = 0;
  2987. };
  2988. class ImineTypeIGC : public IexpendableTypeIGC
  2989. {
  2990. public:
  2991. virtual float GetPower(void) const = 0;
  2992. virtual float GetEndurance(void) const = 0;
  2993. virtual DamageTypeID GetDamageType(void) const = 0;
  2994. };
  2995. class IchaffTypeIGC : public IexpendableTypeIGC
  2996. {
  2997. public:
  2998. virtual float GetChaffStrength(void) const = 0;
  2999. };
  3000. class IprobeTypeIGC : public IexpendableTypeIGC
  3001. {
  3002. public:
  3003. virtual float GetScannerRange(void) const = 0;
  3004. virtual float GetDtBurst(void) const = 0;
  3005. virtual float GetDispersion(void) const = 0;
  3006. virtual float GetAccuracy(void) const = 0;
  3007. virtual short GetAmmo(void) const = 0;
  3008. virtual IprojectileTypeIGC* GetProjectileType(void) const = 0;
  3009. virtual const Vector& GetEmissionPt(void) const = 0;
  3010. virtual float GetRipcordDelay(void) const = 0;
  3011. virtual SoundID GetAmbientSound(void) const = 0;
  3012. };
  3013. class IhullTypeIGC : public IbuyableIGC
  3014. {
  3015. public:
  3016. virtual float GetLength(void) const = 0;
  3017. virtual float GetMaxSpeed(void) const = 0;
  3018. virtual float GetMaxTurnRate(Axis axis) const = 0;
  3019. virtual float GetTurnTorque(Axis axis) const = 0;
  3020. virtual float GetThrust(void) const = 0;
  3021. virtual float GetSideMultiplier(void) const = 0;
  3022. virtual float GetBackMultiplier(void) const = 0;
  3023. virtual float GetScannerRange(void) const = 0;
  3024. virtual float GetMaxEnergy(void) const = 0;
  3025. virtual float GetRechargeRate(void) const = 0;
  3026. virtual HitPoints GetHitPoints(void) const = 0;
  3027. virtual DefenseTypeID GetDefenseType(void) const = 0;
  3028. virtual PartMask GetPartMask(EquipmentType et, Mount mountID) const = 0;
  3029. virtual short GetCapacity(EquipmentType et) const = 0;
  3030. virtual Mount GetMaxWeapons(void) const = 0;
  3031. virtual Mount GetMaxFixedWeapons(void) const = 0;
  3032. virtual const HardpointData& GetHardpointData(Mount hardpointID) const = 0;
  3033. virtual bool CanMount(IpartTypeIGC* ppt, Mount mountID) const = 0;
  3034. virtual const char* GetTextureName(void) const = 0;
  3035. virtual const Vector& GetCockpit(void) const = 0;
  3036. virtual float GetMass(void) const = 0;
  3037. virtual float GetSignature(void) const = 0;
  3038. virtual HullAbilityBitMask GetCapabilities(void) const = 0;
  3039. virtual bool HasCapability(HullAbilityBitMask habm) const = 0;
  3040. virtual const Vector& GetWeaponPosition(Mount mount) const = 0;
  3041. virtual const Orientation& GetWeaponOrientation(Mount mount) const = 0;
  3042. virtual float GetScale() const = 0;
  3043. virtual short GetMaxAmmo(void) const = 0;
  3044. virtual float GetMaxFuel(void) const = 0;
  3045. virtual float GetECM(void) const = 0;
  3046. virtual float GetRipcordSpeed(void) const = 0;
  3047. virtual float GetRipcordCost(void) const = 0;
  3048. virtual IhullTypeIGC* GetSuccessorHullType(void) const = 0;
  3049. //virtual const char* GetPilotHUDName(void) const = 0;
  3050. //virtual const char* GetObserverHUDName(void) const = 0;
  3051. virtual SoundID GetInteriorSound(void) const = 0;
  3052. virtual SoundID GetExteriorSound(void) const = 0;
  3053. virtual SoundID GetMainThrusterInteriorSound(void) const = 0;
  3054. virtual SoundID GetMainThrusterExteriorSound(void) const = 0;
  3055. virtual SoundID GetManuveringThrusterInteriorSound(void) const = 0;
  3056. virtual SoundID GetManuveringThrusterExteriorSound(void) const = 0;
  3057. virtual const PartTypeListIGC* GetPreferredPartTypes(void) const = 0;
  3058. virtual IObject* GetIcon(void) const = 0;
  3059. virtual int GetLaunchSlots(void) const = 0;
  3060. virtual const Vector& GetLaunchPosition(int slotID) const = 0;
  3061. virtual const Vector& GetLaunchDirection(int slotID) const = 0;
  3062. virtual int GetLandSlots(void) const = 0;
  3063. virtual int GetLandPlanes(int slotID) const = 0;
  3064. virtual const Vector& GetLandPosition(int slotID, int planeID) const = 0;
  3065. virtual const Vector& GetLandDirection(int slotID, int planeID) const = 0;
  3066. };
  3067. class IpartTypeIGC : public IbuyableIGC
  3068. {
  3069. public:
  3070. virtual EquipmentType GetEquipmentType(void) const = 0;
  3071. virtual PartMask GetPartMask(void) const = 0;
  3072. virtual float GetMass(void) const = 0;
  3073. virtual float GetSignature(void) const = 0;
  3074. virtual IpartTypeIGC* GetSuccessorPartType(void) const = 0;
  3075. virtual const char* GetInventoryLineMDLName(void) const = 0;
  3076. static const char* GetEquipmentTypeName(EquipmentType et);
  3077. virtual short GetAmount(IshipIGC* pship) const { return 1; }
  3078. };
  3079. class IlauncherTypeIGC : public IpartTypeIGC
  3080. {
  3081. public:
  3082. static bool IsLauncherType(EquipmentType et)
  3083. {
  3084. return (et == ET_ChaffLauncher) ||
  3085. (et == ET_Magazine) ||
  3086. (et == ET_Dispenser);
  3087. }
  3088. virtual IexpendableTypeIGC* GetExpendableType(void) const = 0;
  3089. virtual short GetLaunchCount (void) const = 0;
  3090. };
  3091. class IpartIGC : public IbaseIGC
  3092. {
  3093. public:
  3094. virtual EquipmentType GetEquipmentType(void) const = 0;
  3095. virtual IpartTypeIGC* GetPartType(void) const = 0;
  3096. virtual IshipIGC* GetShip(void) const = 0;
  3097. virtual void SetShip(IshipIGC* newVal, Mount mount) = 0;
  3098. virtual Mount GetMountID(void) const = 0;
  3099. virtual void SetMountID(Mount newVal) = 0;
  3100. virtual bool fActive(void) const = 0;
  3101. virtual void Activate(void) = 0;
  3102. virtual void Deactivate(void) = 0;
  3103. virtual float GetMass(void) const = 0;
  3104. virtual Money GetPrice(void) const = 0;
  3105. virtual float GetMountedFraction(void) const = 0;
  3106. virtual void SetMountedFraction(float f) = 0;
  3107. virtual void Arm(void) = 0;
  3108. virtual short GetAmount(void) const { return 1; }
  3109. virtual void SetAmount(short a) {}
  3110. };
  3111. class IweaponIGC : public IpartIGC
  3112. {
  3113. public:
  3114. virtual IprojectileTypeIGC* GetProjectileType(void) const = 0;
  3115. virtual short GetAmmoPerShot(void) const = 0;
  3116. virtual float GetLifespan(void) const = 0;
  3117. virtual float GetDtBurst(void) const = 0;
  3118. virtual const Vector& GetPosition(void) const = 0;
  3119. virtual IshipIGC* GetGunner(void) const = 0;
  3120. virtual void SetGunner(IshipIGC* newVal) = 0;
  3121. virtual bool fFiringShot(void) const = 0;
  3122. virtual bool fFiringBurst(void) const = 0;
  3123. virtual SoundID GetActivateSound(void) const = 0;
  3124. virtual SoundID GetSingleShotSound(void) const = 0;
  3125. virtual SoundID GetBurstSound(void) const = 0;
  3126. };
  3127. class IshieldIGC : public IpartIGC
  3128. {
  3129. public:
  3130. virtual float GetRegeneration(void) const = 0;
  3131. virtual float GetMaxStrength(void) const = 0;
  3132. virtual DefenseTypeID GetDefenseType(void) const = 0;
  3133. virtual float GetFraction(void) const = 0;
  3134. virtual void SetFraction(float newVal) = 0;
  3135. virtual float ApplyDamage(Time timeCollision,
  3136. DamageTypeID type,
  3137. float amount,
  3138. const Vector& deltaP) = 0;
  3139. };
  3140. class IcloakIGC : public IpartIGC
  3141. {
  3142. public:
  3143. virtual float GetEnergyConsumption(void) const = 0;
  3144. virtual float GetMaxCloaking(void) const = 0;
  3145. virtual float GetOnRate(void) const = 0;
  3146. virtual float GetOffRate(void) const = 0;
  3147. virtual SoundID GetEngageSound() const = 0;
  3148. virtual SoundID GetDisengageSound() const = 0;
  3149. };
  3150. class IafterburnerIGC : public IpartIGC
  3151. {
  3152. public:
  3153. virtual float GetFuelConsumption(void) const = 0;
  3154. virtual float GetMaxThrust(void) const = 0;
  3155. virtual float GetOnRate(void) const = 0;
  3156. virtual float GetOffRate(void) const = 0;
  3157. virtual void IncrementalUpdate(Time lastUpdate, Time now, bool bUseFuel) = 0;
  3158. virtual float GetPower(void) const = 0;
  3159. virtual void SetPower(float p) = 0;
  3160. virtual SoundID GetInteriorSound(void) const = 0;
  3161. virtual SoundID GetExteriorSound(void) const = 0;
  3162. };
  3163. class IpackIGC : public IpartIGC
  3164. {
  3165. public:
  3166. virtual PackType GetPackType(void) const = 0;
  3167. };
  3168. class IlauncherIGC : public IpartIGC
  3169. {
  3170. public:
  3171. static bool IsLauncher(ObjectType type)
  3172. {
  3173. return ((type == OT_magazine) || (type == OT_dispenser));
  3174. }
  3175. virtual const Vector& GetEmissionPt(void) const = 0;
  3176. virtual void SetTimeFired(Time now) = 0;
  3177. virtual Time GetTimeLoaded(void) const = 0;
  3178. virtual void SetTimeLoaded(Time tl) = 0;
  3179. virtual void ResetTimeLoaded(void) = 0;
  3180. virtual float GetArmedFraction(void) = 0;
  3181. };
  3182. class ImagazineIGC : public IlauncherIGC
  3183. {
  3184. public:
  3185. virtual ImissileTypeIGC* GetMissileType(void) const = 0;
  3186. virtual short GetLaunchCount (void) const = 0;
  3187. virtual float GetLock(void) const = 0;
  3188. virtual void SetLock(float l) = 0;
  3189. };
  3190. class IdispenserIGC : public IlauncherIGC
  3191. {
  3192. public:
  3193. virtual IexpendableTypeIGC* GetExpendableType(void) const = 0;
  3194. };
  3195. class IclusterIGC : public IbaseIGC
  3196. {
  3197. public:
  3198. virtual const char* GetName(void) const = 0;
  3199. virtual Time GetLastUpdate(void) const = 0;
  3200. virtual void SetLastUpdate(Time now) = 0;
  3201. //Note: the Add/Delete methods should never be called from outside IGC -- that is handled automatically
  3202. virtual void AddModel(ImodelIGC* modelNew) = 0;
  3203. virtual void DeleteModel(ImodelIGC* modelOld) = 0;
  3204. virtual ImodelIGC* GetModel(const char* name) const = 0;
  3205. virtual const ModelListIGC* GetModels(void) const = 0;
  3206. virtual const ModelListIGC* GetPickableModels(void) const = 0;
  3207. virtual void AddWarp(IwarpIGC* warpNew) = 0;
  3208. virtual void DeleteWarp(IwarpIGC* warpOld) = 0;
  3209. virtual const WarpListIGC* GetWarps(void) const = 0;
  3210. virtual void AddMine(ImineIGC* ms) = 0;
  3211. virtual void DeleteMine(ImineIGC* m) = 0;
  3212. virtual ImineIGC* GetMine(MineID mineID) const = 0;
  3213. virtual const MineListIGC* GetMines(void) const = 0;
  3214. virtual void AddMissile(ImissileIGC* ms) = 0;
  3215. virtual void DeleteMissile(ImissileIGC* m) = 0;
  3216. virtual ImissileIGC* GetMissile(MissileID missileID) const = 0;
  3217. virtual const MissileListIGC* GetMissiles(void) const = 0;
  3218. virtual void AddProbe(IprobeIGC* ms) = 0;
  3219. virtual void DeleteProbe(IprobeIGC* m) = 0;
  3220. virtual IprobeIGC* GetProbe(ProbeID probeID) const = 0;
  3221. virtual const ProbeListIGC* GetProbes(void) const = 0;
  3222. virtual float GetScreenX(void) const = 0;
  3223. virtual float GetScreenY(void) const = 0;
  3224. virtual void SetActive(bool bActive) = 0;
  3225. virtual void AddStation(IstationIGC* stationNew) = 0;
  3226. virtual void DeleteStation(IstationIGC* stationOld) = 0;
  3227. virtual IstationIGC* GetStation(StationID stationID) const = 0;
  3228. virtual const StationListIGC* GetStations(void) const = 0;
  3229. virtual void AddShip(IshipIGC* shipNew) = 0;
  3230. virtual void DeleteShip(IshipIGC* shipOld) = 0;
  3231. virtual IshipIGC* GetShip(ShipID shipID) const = 0;
  3232. virtual const ShipListIGC* GetShips(void) const = 0;
  3233. virtual void AddAsteroid(IasteroidIGC* asteroidNew) = 0;
  3234. virtual void DeleteAsteroid(IasteroidIGC* asteroidOld) = 0;
  3235. virtual IasteroidIGC* GetAsteroid(AsteroidID asteroidID) const = 0;
  3236. virtual const AsteroidListIGC* GetAsteroids(void) const = 0;
  3237. virtual void AddTreasure(ItreasureIGC* treasureNew) = 0;
  3238. virtual void DeleteTreasure(ItreasureIGC* treasureOld) = 0;
  3239. virtual ItreasureIGC* GetTreasure(TreasureID treasureID) const = 0;
  3240. virtual const TreasureListIGC* GetTreasures(void) const = 0;
  3241. virtual ClusterSite* GetClusterSite(void) const = 0;
  3242. virtual IbuildingEffectIGC* CreateBuildingEffect(Time now,
  3243. IasteroidIGC* pasteroid,
  3244. IstationIGC* pstation,
  3245. IshipIGC* pshipBuilder,
  3246. float radiusAsteroid,
  3247. float radiusStation,
  3248. const Vector& positionStart,
  3249. const Vector& positionStop) = 0;
  3250. virtual short GetNstars(void) const = 0;
  3251. virtual short GetNdebris(void) const = 0;
  3252. virtual unsigned int GetStarSeed(void) const = 0;
  3253. virtual const Vector& GetLightDirection(void) const = 0;
  3254. virtual Color GetLightColor(void) const = 0;
  3255. virtual Color GetLightColorAlt(void) const = 0;
  3256. virtual float GetBidirectionalAmbientLevel(void) const = 0;
  3257. virtual float GetAmbientLevel(void) const = 0;
  3258. virtual void RecalculateCollisions(float tOffset,
  3259. ImodelIGC* pModel1,
  3260. ImodelIGC* pModel2) = 0;
  3261. virtual ExplosionData* CreateExplosion(DamageTypeID damageType,
  3262. float amount,
  3263. float radius,
  3264. int explosionType,
  3265. Time time,
  3266. const Vector& position,
  3267. ImodelIGC* pLauncher) = 0;
  3268. virtual const char* GetPosterName(void) const = 0;
  3269. virtual void SetPrivateData(DWORD dwPrivate) = 0;
  3270. virtual DWORD GetPrivateData(void) const = 0;
  3271. virtual void FlushCollisionQueue(void) = 0;
  3272. virtual void MakeModelStatic(ImodelIGC* pmodel) = 0;
  3273. virtual void MakeModelUnhitable(ImodelIGC* pmodel) = 0;
  3274. virtual void FreeThingSite(ModelAttributes mt, ImodelIGC* pmodel, HitTest* pht) = 0;
  3275. virtual bool GetHomeSector(void) const = 0;
  3276. virtual float GetPendingTreasures(void) const = 0;
  3277. virtual void SetPendingTreasures(float fpt) = 0;
  3278. virtual float GetCost(void) const = 0;
  3279. };
  3280. class IasteroidIGC : public IdamageIGC
  3281. {
  3282. public:
  3283. virtual float GetOre(void) const = 0;
  3284. virtual void SetOre(float newVal) = 0;
  3285. virtual float MineOre(float dt) = 0;
  3286. virtual AsteroidAbilityBitMask GetCapabilities(void) const = 0;
  3287. virtual bool HasCapability(AsteroidAbilityBitMask aabm) const = 0;
  3288. virtual IbuildingEffectIGC* GetBuildingEffect(void) const = 0;
  3289. virtual void SetBuildingEffect(IbuildingEffectIGC* pbe) = 0;
  3290. static const char* GetTypeName(AsteroidAbilityBitMask aabm);
  3291. static const char* GetTypePrefix(int index);
  3292. static const AsteroidDef& GetTypeDefaults(int index);
  3293. static int NumberSpecialAsteroids(const MissionParams* pmp);
  3294. static int GetSpecialAsterioid(const MissionParams* pmp, int index);
  3295. static int GetRandomType(AsteroidAbilityBitMask aabm);
  3296. };
  3297. class IwarpIGC : public ImodelIGC
  3298. {
  3299. public:
  3300. virtual IwarpIGC* GetDestination(void) = 0; //Intentionally not const since we cache the destination
  3301. virtual void AddBomb(Time timeExplode,
  3302. ImissileTypeIGC* pmt) = 0;
  3303. virtual const WarpBombList* GetBombs(void) const = 0;
  3304. };
  3305. class ItreasureIGC : public ImodelIGC
  3306. {
  3307. public:
  3308. virtual TreasureCode GetTreasureCode(void) const = 0;
  3309. virtual IbuyableIGC* GetBuyable(void) const = 0;
  3310. virtual ObjectID GetTreasureID(void) const = 0;
  3311. virtual void SetTreasureID(ObjectID newVal) = 0;
  3312. virtual short GetAmount(void) const = 0;
  3313. virtual void SetAmount(short a) = 0;
  3314. virtual void ResetExpiration(Time now) = 0;
  3315. virtual void SetCreateNow (void) = 0;
  3316. };
  3317. class IsideIGC : public IbaseIGC
  3318. {
  3319. public:
  3320. virtual IcivilizationIGC* GetCivilization(void) const = 0;
  3321. virtual void SetCivilization(IcivilizationIGC* pciv) = 0;
  3322. virtual void DestroyBuckets(void) = 0;
  3323. virtual void CreateBuckets(void) = 0;
  3324. virtual void SetName(const char* newVal) = 0;
  3325. virtual const char* GetName(void) const = 0;
  3326. virtual SquadID GetSquadID() const = 0;
  3327. virtual void SetSquadID(SquadID squadID) = 0;
  3328. virtual const TechTreeBitMask GetTechs(void) const = 0;
  3329. virtual const TechTreeBitMask& GetBuildingTechs(void) const = 0;
  3330. virtual void ResetBuildingTechs(void) = 0;
  3331. virtual void SetBuildingTechs(const TechTreeBitMask& ttbm) = 0;
  3332. virtual const TechTreeBitMask& GetDevelopmentTechs(void) const = 0;
  3333. virtual void SetDevelopmentTechs(const TechTreeBitMask& ttbm) = 0;
  3334. virtual bool ApplyDevelopmentTechs(const TechTreeBitMask& ttbm) = 0;
  3335. virtual const TechTreeBitMask& GetInitialTechs(void) const = 0;
  3336. virtual void SetInitialTechs(const TechTreeBitMask& ttbm) = 0;
  3337. virtual void UpdateInitialTechs(void) = 0;
  3338. virtual const TechTreeBitMask& GetUltimateTechs(void) const = 0;
  3339. virtual void AddStation(IstationIGC* s) = 0;
  3340. virtual void DeleteStation(IstationIGC* s) = 0;
  3341. virtual IstationIGC* GetStation(StationID id) const = 0;
  3342. virtual const StationListIGC* GetStations(void) const = 0;
  3343. virtual void AddShip(IshipIGC* s) = 0;
  3344. virtual void DeleteShip(IshipIGC* s) = 0;
  3345. virtual IshipIGC* GetShip(ShipID id) const = 0;
  3346. virtual const ShipListIGC* GetShips(void) const = 0;
  3347. virtual void AddBucket(IbucketIGC* s) = 0;
  3348. virtual void DeleteBucket(IbucketIGC* s) = 0;
  3349. virtual IbucketIGC* GetBucket(BucketID bucketID) const = 0;
  3350. virtual const BucketListIGC* GetBuckets(void) const = 0;
  3351. virtual bool CanBuy(const IbuyableIGC* b) const = 0;
  3352. virtual const GlobalAttributeSet& GetGlobalAttributeSet(void) const = 0;
  3353. virtual void SetGlobalAttributeSet(const GlobalAttributeSet& gas) = 0;
  3354. virtual void ApplyGlobalAttributeSet(const GlobalAttributeSet& gas) = 0;
  3355. virtual void ResetGlobalAttributeSet(void) = 0;
  3356. virtual bool GetActiveF(void) const = 0;
  3357. virtual void SetActiveF(bool activeF) = 0;
  3358. virtual const Color& GetColor(void) const = 0;
  3359. virtual void SetPrivateData(DWORD dwPrivate) = 0;
  3360. virtual DWORD GetPrivateData(void) const = 0;
  3361. virtual short GetKills(void) const = 0;
  3362. virtual void AddKill(void) = 0;
  3363. virtual short GetDeaths(void) const = 0;
  3364. virtual void AddDeath(void) = 0;
  3365. virtual short GetEjections(void) const = 0;
  3366. virtual void AddEjection(void) = 0;
  3367. virtual short GetBaseKills(void) const = 0;
  3368. virtual void AddBaseKill(void) = 0;
  3369. virtual short GetBaseCaptures(void) const = 0;
  3370. virtual void AddBaseCapture(void) = 0;
  3371. virtual void Reset(void) = 0;
  3372. virtual void AddToStockpile(IbuyableIGC* b, short count = 1) = 0;
  3373. virtual short RemoveFromStockpile(IbuyableIGC* b, short count = 1) = 0;
  3374. virtual short GetStockpile(IbuyableIGC* b) const = 0;
  3375. virtual const StockpileList* GetStockpile(void) const = 0;
  3376. //
  3377. // Game state
  3378. //
  3379. virtual unsigned char GetConquestPercent(void) const = 0;
  3380. virtual void SetConquestPercent(unsigned char newVal) = 0;
  3381. virtual unsigned char GetTerritoryCount(void) const = 0;
  3382. virtual void SetTerritoryCount(unsigned char newVal) = 0;
  3383. virtual short GetFlags(void) const = 0;
  3384. virtual void SetFlags(short newVal) = 0;
  3385. virtual short GetArtifacts(void) const = 0;
  3386. virtual void SetArtifacts(short newVal) = 0;
  3387. virtual float GetTimeEndured() const = 0;
  3388. virtual void SetTimeEndured(float fSeconds) = 0;
  3389. virtual long GetProsperityPercentBought(void) const = 0;
  3390. virtual long GetProsperityPercentComplete(void) const = 0;
  3391. };
  3392. class IcivilizationIGC : public IbaseIGC
  3393. {
  3394. public:
  3395. virtual const char* GetName(void) const = 0;
  3396. virtual const char* GetIconName(void) const = 0;
  3397. virtual const char* GetHUDName(void) const = 0;
  3398. virtual IhullTypeIGC* GetLifepod(void) const = 0;
  3399. virtual IstationTypeIGC* GetInitialStationType(void) const = 0;
  3400. virtual const TechTreeBitMask& GetBaseTechs(void) const = 0;
  3401. virtual const TechTreeBitMask& GetNoDevTechs(void) const = 0;
  3402. virtual const GlobalAttributeSet& GetBaseAttributes(void) const = 0;
  3403. virtual float GetBonusMoney(void) const = 0;
  3404. virtual float GetIncomeMoney(void) const = 0;
  3405. };
  3406. class ItreasureSetIGC : public IbaseIGC
  3407. {
  3408. public:
  3409. virtual const char* GetName(void) const = 0;
  3410. virtual bool GetZoneOnly(void) const = 0;
  3411. virtual void AddTreasureData(TreasureCode tc, ObjectID oid, unsigned char chance) = 0;
  3412. virtual const TreasureData& GetRandomTreasureData(void) const = 0;
  3413. };
  3414. typedef short AssetMask;
  3415. const AssetMask c_amFighter = 0x01;
  3416. const AssetMask c_amMiner = 0x02;
  3417. const AssetMask c_amBuilder = 0x04;
  3418. const AssetMask c_amStation = 0x08;
  3419. const AssetMask c_amEnemyFighter = 0x10;
  3420. const AssetMask c_amEnemyMiner = 0x20;
  3421. const AssetMask c_amEnemyBuilder = 0x40;
  3422. const AssetMask c_amEnemyAPC = 0x80;
  3423. const AssetMask c_amEnemyStation = 0x100;
  3424. const AssetMask c_amEnemyCapital = 0x200;
  3425. const AssetMask c_amEnemyCarrier = 0x400;
  3426. const AssetMask c_amCarrier = 0x800;
  3427. const AssetMask c_amEnemyTeleport = 0x1000;
  3428. const AssetMask c_amEnemyTeleportShip = 0x2000;
  3429. const AssetMask c_amEnemyBomber = 0x4000;
  3430. typedef short ClusterWarning;
  3431. const ClusterWarning c_cwNoThreat = 0;
  3432. const ClusterWarning c_cwEnemyFighterInCluster = 1;
  3433. const ClusterWarning c_cwEnemyMinerInCluster = 2;
  3434. const ClusterWarning c_cwEnemyBuilderInCluster = 3;
  3435. const ClusterWarning c_cwCombatInCluster = 4;
  3436. const ClusterWarning c_cwMinerThreatened = 5;
  3437. const ClusterWarning c_cwBuilderThreatened = 6;
  3438. const ClusterWarning c_cwCarrierThreatened = 7;
  3439. const ClusterWarning c_cwBomberInCluster = 8;
  3440. const ClusterWarning c_cwEnemyCarrierInCluster = 9;
  3441. const ClusterWarning c_cwCapitalInCluster = 10;
  3442. const ClusterWarning c_cwTeleportInCluster = 11;
  3443. const ClusterWarning c_cwTransportInCluster = 12;
  3444. const ClusterWarning c_cwStationThreatened = 13;
  3445. const ClusterWarning c_cwStationTeleportThreat = 14;
  3446. const ClusterWarning c_cwStationCaptureThreat = 15;
  3447. const ClusterWarning c_cwMax = 16;
  3448. ClusterWarning GetClusterWarning(AssetMask am, bool bInvulnerableStations);
  3449. const char* GetClusterWarningText(ClusterWarning cw);
  3450. typedef char ShipState;
  3451. const ShipState c_ssDead = 1; //A nice enumeration of all the things it could have been doing
  3452. const ShipState c_ssDocked = 2; //when it was last seen (if only briefly)
  3453. const ShipState c_ssFlying = 3;
  3454. const ShipState c_ssObserver = 4;
  3455. const ShipState c_ssTurret = 5;
  3456. class ShipStatus
  3457. {
  3458. public:
  3459. ShipStatus(void)
  3460. {
  3461. Reset();
  3462. }
  3463. void Reset(void)
  3464. {
  3465. m_hullID = NA;
  3466. m_sectorID = NA;
  3467. m_stationID = NA;
  3468. m_state = c_ssDead;
  3469. m_unknown = true;
  3470. m_detected = false;
  3471. }
  3472. bool operator != (const ShipStatus& ss)
  3473. {
  3474. return (m_hullID != ss.m_hullID) ||
  3475. (m_sectorID != ss.m_sectorID) ||
  3476. (m_stationID != ss.m_stationID) ||
  3477. (m_unknown != ss.m_unknown) ||
  3478. (m_detected != ss.m_detected) ||
  3479. (m_state != ss.m_state);
  3480. }
  3481. HullID GetHullID(void) const
  3482. {
  3483. return m_hullID;
  3484. }
  3485. void SetHullID(HullID newVal)
  3486. {
  3487. m_hullID = newVal;
  3488. }
  3489. SectorID GetSectorID(void) const
  3490. {
  3491. return m_sectorID;
  3492. }
  3493. void SetSectorID(SectorID newVal)
  3494. {
  3495. m_sectorID = newVal;
  3496. }
  3497. StationID GetStationID(void) const
  3498. {
  3499. return m_stationID;
  3500. }
  3501. void SetStationID(StationID stationID)
  3502. {
  3503. m_stationID = stationID;
  3504. }
  3505. StationID GetParentID(void) const
  3506. {
  3507. return m_shipIDParent;
  3508. }
  3509. void SetParentID(ShipID shipID)
  3510. {
  3511. m_shipIDParent = shipID;
  3512. }
  3513. ShipState GetState(void) const
  3514. {
  3515. return m_state;
  3516. }
  3517. void SetState(ShipState newVal)
  3518. {
  3519. m_state = newVal;
  3520. m_unknown = false;
  3521. }
  3522. bool GetUnknown(void) const
  3523. {
  3524. return m_unknown;
  3525. }
  3526. void SetUnknown(void)
  3527. {
  3528. m_unknown = true;
  3529. }
  3530. bool GetDetected(void) const
  3531. {
  3532. return m_detected;
  3533. }
  3534. void SetDetected(bool bDetected)
  3535. {
  3536. m_detected = bDetected;
  3537. }
  3538. private:
  3539. HullID m_hullID;
  3540. SectorID m_sectorID;
  3541. StationID m_stationID;
  3542. ShipID m_shipIDParent;
  3543. ShipState m_state : 6;
  3544. bool m_unknown : 1;
  3545. bool m_detected : 1;
  3546. };
  3547. class ClusterSite : public AttachSite
  3548. {
  3549. public:
  3550. virtual HRESULT AddPoster(const char* textureName,
  3551. const Vector& position,
  3552. float radius) { return S_OK;}
  3553. virtual HRESULT GetEnvironmentGeo(const char* pszName) { return S_OK; }
  3554. virtual Geo* GetEnvironmentGeo() { return NULL; }
  3555. virtual GroupGeo* GetGroupScene() { return NULL; }
  3556. virtual PosterImage* GetPosterImage() { return NULL; }
  3557. virtual void SetEnvironmentGeo(const char* pszName) {}
  3558. virtual float GetRotation(void) const { return 0.0f; }
  3559. virtual void AddRotation(float da) {}
  3560. virtual void AddScanner(SideID sid, IscannerIGC* scannerNew) {}
  3561. virtual void DeleteScanner(SideID sid, IscannerIGC* scannerOld) {}
  3562. virtual const ScannerListIGC* GetScanners(SideID sid) const { return NULL; }
  3563. virtual AssetMask GetClusterAssetMask(void) { return 0; }
  3564. virtual void SetClusterAssetMask(AssetMask am) {}
  3565. virtual void MoveShip(void) {};
  3566. virtual void MoveStation(void) {}
  3567. };
  3568. //Utility functions
  3569. float solveForImpact(const Vector& deltaP,
  3570. const Vector& deltaV,
  3571. float speed,
  3572. float radius,
  3573. Vector* direction);
  3574. float solveForLead(ImodelIGC* shooter,
  3575. ImodelIGC* target,
  3576. IweaponIGC* weapon,
  3577. Vector* direction,
  3578. float skill = 1.0f);
  3579. float turnToFace(const Vector& deltaTarget,
  3580. float dt,
  3581. IshipIGC* pship,
  3582. ControlData* controls,
  3583. float skill = 1.0f);
  3584. IwarpIGC* FindPath(IshipIGC* pShip, ImodelIGC* pTarget, bool bCowardly);
  3585. const char* GetModelType(ImodelIGC* pmodel);
  3586. const char* GetModelName(ImodelIGC* pmodel);
  3587. bool LineOfSightExist(const IclusterIGC* pcluster,
  3588. const ImodelIGC* pmodel1,
  3589. const ImodelIGC* pmodel2);
  3590. //Note ... the following enum defines bits in a mask
  3591. enum TargetType
  3592. {
  3593. c_ttSpecial = 0x80000, //Special hack for commands
  3594. c_ttMyQueued = 0x80000, //Low byte must agree with c_cmd
  3595. c_ttMyAccepted = 0x80001,
  3596. c_ttMyTarget = 0x80002,
  3597. c_ttWorstEnemy = 0x80003,
  3598. c_ttMe = 0x80004,
  3599. c_ttFriendly = 0x0001,
  3600. c_ttEnemy = 0x0002,
  3601. c_ttNeutral = 0x0004,
  3602. c_ttShip = 0x0008,
  3603. c_ttStation = 0x0010,
  3604. c_ttAsteroid = 0x0020,
  3605. c_ttTreasure = 0x0040,
  3606. c_ttMissile = 0x0080,
  3607. c_ttWarp = 0x0100,
  3608. c_ttBuoy = 0x0200,
  3609. c_ttFront = 0x0400, //these two are exclusive
  3610. c_ttNearest = 0x0800,
  3611. c_ttAnyCluster = 0x1000,
  3612. c_ttPrevious = 0x2000,
  3613. c_ttMine = 0x4000,
  3614. c_ttProbe = 0x8000,
  3615. c_ttLeastTargeted = 0x10000,
  3616. c_ttNoRipcord = 0x20000,
  3617. c_ttCowardly = 0x40000,
  3618. c_ttShipTypes = c_ttShip | c_ttStation,
  3619. c_ttAllTypes = c_ttShip | c_ttStation |
  3620. c_ttAsteroid | c_ttBuoy |
  3621. c_ttWarp | c_ttTreasure | c_ttMissile | c_ttMine | c_ttProbe,
  3622. c_ttAllSides = c_ttFriendly | c_ttEnemy | c_ttNeutral,
  3623. c_ttAll = c_ttAllSides | c_ttAllTypes
  3624. };
  3625. extern const int c_ttTypebits[OT_modelEnd+1];
  3626. inline int GetTypebits(ObjectType ot)
  3627. {
  3628. assert (c_ttTypebits[OT_warp] == c_ttWarp);
  3629. assert (c_ttTypebits[OT_ship] == c_ttShip);
  3630. assert (c_ttTypebits[OT_asteroid] == c_ttAsteroid);
  3631. assert (c_ttTypebits[OT_station] == c_ttStation);
  3632. assert (c_ttTypebits[OT_treasure] == c_ttTreasure);
  3633. assert (c_ttTypebits[OT_missile] == c_ttMissile);
  3634. assert (c_ttTypebits[OT_mine] == c_ttMine);
  3635. assert (c_ttTypebits[OT_probe] == c_ttProbe);
  3636. assert (c_ttTypebits[OT_buoy] == c_ttBuoy);
  3637. return c_ttTypebits[ot];
  3638. }
  3639. bool FindableModel(ImodelIGC* m,
  3640. IsideIGC* pside,
  3641. int ttMask,
  3642. AbilityBitMask abmAbilities);
  3643. ImodelIGC* FindTarget(IshipIGC* pShip,
  3644. int ttMask,
  3645. ImodelIGC* pmodelCurrent = NULL,
  3646. IclusterIGC* pcluster = NULL,
  3647. const Vector* pposition = NULL,
  3648. const Orientation* porientation = NULL,
  3649. AbilityBitMask abmAbilities = 0, //e.g. anything
  3650. int maxDistance = 0x7fffffff); //e.g. anywhere
  3651. int GetDistance(IshipIGC* pship,
  3652. IclusterIGC* pclusterOne,
  3653. IclusterIGC* pclusterTwo,
  3654. int maxDistance = 0x7fffffff);
  3655. void PopulateCluster(ImissionIGC* pmission,
  3656. const MissionParams* pmp,
  3657. IclusterIGC* pcluster,
  3658. float amountHe3,
  3659. bool bAsteroids = true,
  3660. bool bTreasures = true,
  3661. short nMineableAsteroidsMultiplier = 1,
  3662. short nSpecialAsteroidsMultiplier = 1,
  3663. short nAsteroidsMultiplier = 1);
  3664. void CreateAsteroid(ImissionIGC* pmission,
  3665. IclusterIGC* pcluster,
  3666. int type,
  3667. float amountHe3);
  3668. class SideVisibility
  3669. {
  3670. public:
  3671. SideVisibility(void)
  3672. :
  3673. m_fVisible(false),
  3674. m_pLastSpotter(NULL)
  3675. {
  3676. }
  3677. ~SideVisibility(void)
  3678. {
  3679. if (m_pLastSpotter)
  3680. m_pLastSpotter->Release();
  3681. }
  3682. bool fVisible(void) const
  3683. {
  3684. return m_fVisible;
  3685. }
  3686. IscannerIGC* pLastSpotter(void) const
  3687. {
  3688. return m_pLastSpotter;
  3689. }
  3690. void fVisible(bool v)
  3691. {
  3692. m_fVisible = v;
  3693. }
  3694. void pLastSpotter(IscannerIGC* s)
  3695. {
  3696. if (m_pLastSpotter)
  3697. m_pLastSpotter->Release();
  3698. m_pLastSpotter = s;
  3699. if (s)
  3700. s->AddRef();
  3701. }
  3702. private:
  3703. bool m_fVisible;
  3704. IscannerIGC* m_pLastSpotter;
  3705. };
  3706. class GameSite // this is going away soon
  3707. {
  3708. public:
  3709. static int MessageBox(const ZString& strText, const ZString& strCaption, UINT nType);
  3710. };
  3711. enum LoadoutChange
  3712. {
  3713. c_lcMounted,
  3714. c_lcDismounted,
  3715. c_lcAdded,
  3716. c_lcRemoved,
  3717. c_lcHullChange,
  3718. c_lcQuantityChange,
  3719. c_lcAddPassenger,
  3720. c_lcRemovePassenger,
  3721. c_lcPassengerMove,
  3722. c_lcTurretChange,
  3723. c_lcDisembark,
  3724. c_lcCargoSelectionChanged
  3725. };
  3726. enum BucketChange
  3727. {
  3728. c_bcEmptied, //Bucket money set to zero
  3729. c_bcTerminated, //Bucket eliminated (station capture or made redundant)
  3730. c_bcMoneyChange, //More money (less?) in the bucket
  3731. c_bcPercentCompleteChange
  3732. };
  3733. class IIgcSite : public IObject
  3734. {
  3735. public:
  3736. virtual Time ServerTimeFromClientTime(Time timeClient)
  3737. {
  3738. return timeClient;
  3739. }
  3740. virtual Time ClientTimeFromServerTime(Time timeServer)
  3741. {
  3742. return timeServer;
  3743. }
  3744. virtual void DevelopmentCompleted(IbucketIGC* b, IdevelopmentIGC* d, Time now) {}
  3745. virtual void StationTypeCompleted(IbucketIGC* b, IstationIGC* pstation, IstationTypeIGC* st, Time now) {}
  3746. virtual void HullTypeCompleted(IsideIGC* pside, IhullTypeIGC* pht) {}
  3747. virtual void PartTypeCompleted(IsideIGC* pside, IpartTypeIGC* ppt) {}
  3748. virtual void DroneTypeCompleted(IbucketIGC* b, IstationIGC* pstation, IdroneTypeIGC* dt, Time now) {}
  3749. virtual void BucketChangeEvent(BucketChange bc, IbucketIGC* b) {}
  3750. virtual void SideBuildingTechChange(IsideIGC* s) {}
  3751. virtual void SideDevelopmentTechChange(IsideIGC* s) {}
  3752. virtual void SideGlobalAttributeChange(IsideIGC* s) {}
  3753. virtual void StationTypeChange(IstationIGC* s) {}
  3754. virtual void ClusterUpdateEvent(IclusterIGC* c) {}
  3755. virtual void BuildStation(IasteroidIGC* pasteroid,
  3756. IsideIGC* pside,
  3757. IstationTypeIGC* pstationtype,
  3758. Time now) { }
  3759. virtual TRef<ThingSite> CreateThingSite(ImodelIGC* pModel){return new ThingSite;}
  3760. virtual TRef<ClusterSite> CreateClusterSite(IclusterIGC* pCluster){return new ClusterSite;}
  3761. virtual void ReceiveChat(IshipIGC* pshipSender,
  3762. ChatTarget ctRecipient,
  3763. ObjectID oidRecipient,
  3764. SoundID voiceOver,
  3765. const char* szText,
  3766. CommandID cid,
  3767. ObjectType otTarget,
  3768. ObjectID oidTarget,
  3769. ImodelIGC* pmodelTarget = NULL) {}
  3770. virtual void SendChat(IshipIGC* pshipSender,
  3771. ChatTarget chatTarget,
  3772. ObjectID oidRecipient,
  3773. SoundID soVoiceOver,
  3774. const char* szText,
  3775. CommandID cid = c_cidNone,
  3776. ObjectType otTarget = NA,
  3777. ObjectID oidTarget = NA,
  3778. ImodelIGC* pmodelTarget = NULL,
  3779. bool bObjectModel = false) {}
  3780. void SendChatf(IshipIGC* pshipSender,
  3781. ChatTarget ctRecipient, ObjectID oidRecipient,
  3782. SoundID soVoiceOver, const char* pszText, ...)
  3783. {
  3784. const int c_cbBfr = 256;
  3785. char szChatBfr[c_cbBfr];
  3786. va_list vl;
  3787. va_start(vl, pszText);
  3788. _vsnprintf(szChatBfr, c_cbBfr, pszText, vl);
  3789. va_end(vl);
  3790. SendChat(pshipSender, ctRecipient, oidRecipient,
  3791. soVoiceOver, szChatBfr);
  3792. }
  3793. virtual void GetMoneyRequest(IshipIGC* pshipSender, Money amount, HullID hidFor) {}
  3794. virtual void PlaySoundEffect(SoundID soundID, ImodelIGC* model = NULL){}
  3795. virtual void PlaySoundEffect(SoundID soundID, ImodelIGC* model, const Vector& vectOffset) {}
  3796. virtual void PlayNotificationSound(SoundID soundID, ImodelIGC* model){}
  3797. virtual void PlayFFEffect(ForceEffectID effectID, ImodelIGC* model = NULL, LONG lDirection = 0){}
  3798. virtual void PlayVisualEffect(VisualEffectID effectID, ImodelIGC* model = NULL, float fIntensity = 1.0f){};
  3799. virtual int MessageBox(const ZString& strText, const ZString& strCaption, UINT nType){return 0;}
  3800. virtual void TerminateModelEvent(ImodelIGC* model){}
  3801. virtual void TerminateMissionEvent(ImissionIGC* pMission){}
  3802. virtual void KillAsteroidEvent(IasteroidIGC* pasteroid, bool explodeF) {}
  3803. virtual void DrainAsteroidEvent(IasteroidIGC* pasteroid) {}
  3804. virtual void KillProbeEvent(IprobeIGC* pprobe) {}
  3805. virtual void KillMissileEvent(ImissileIGC* pmissile, const Vector& position) {}
  3806. virtual void KillBuildingEffectEvent(IbuildingEffectIGC* pbe) {}
  3807. virtual void KillMineEvent(ImineIGC* pmine) {}
  3808. virtual void KillTreasureEvent(ItreasureIGC* ptreasure) { ptreasure->Terminate(); }
  3809. virtual void PostText(bool bCritical, const char* pszText, ...) {}
  3810. virtual void PostNotificationText(ImodelIGC* pmodel, bool bCritical, const char* pszText, ...) {}
  3811. virtual void EjectPlayer(ImodelIGC* pmodelCredit) {}
  3812. virtual void TargetKilled(ImodelIGC* pmodel) {}
  3813. virtual void ShipWarped(IshipIGC* pship, SectorID sidOld, SectorID sidNew) {};
  3814. virtual void DamageShipEvent(Time now, IshipIGC* ship, ImodelIGC* launcher, DamageTypeID type, float amount, float leakage, const Vector& p1, const Vector& p2){}
  3815. virtual void KillShipEvent(Time now, IshipIGC* ship, ImodelIGC* launcher, float amount, const Vector& p1, const Vector& p2){}
  3816. virtual void DamageStationEvent(IstationIGC* station, ImodelIGC* launcher, DamageTypeID type, float amount){}
  3817. virtual void KillStationEvent(IstationIGC* station, ImodelIGC* launcher, float amount){}
  3818. virtual bool DockWithStationEvent(IshipIGC* ship, IstationIGC* station){return true;}
  3819. virtual void CaptureStationEvent(IshipIGC* ship, IstationIGC* station){}
  3820. virtual bool LandOnCarrierEvent(IshipIGC* shipCarrier, IshipIGC* ship, float tCollision){return true;}
  3821. virtual bool RescueShipEvent(IshipIGC* shipRescued, IshipIGC* shipRescuer){return true;}
  3822. virtual void WarpBombEvent(IwarpIGC* pwap, ImissileIGC* pmissile) {}
  3823. virtual void HitWarpEvent(IshipIGC* ship, IwarpIGC* warp){}
  3824. virtual bool HitTreasureEvent(Time now, IshipIGC* ship, ItreasureIGC* treasure){ return true; }
  3825. virtual void PaydayEvent(IsideIGC* pside, float money){}
  3826. virtual void RequestRipcord(IshipIGC* ship, IclusterIGC* pcluster){}
  3827. virtual bool ContinueRipcord(IshipIGC* ship, ImodelIGC* pmodel) { return true; }
  3828. virtual bool UseRipcord(IshipIGC* ship, ImodelIGC* pmodel){ return false; }
  3829. virtual void FireMissile(IshipIGC* pship, ImagazineIGC* pmagazine,
  3830. Time timeFired, ImodelIGC* pTarget, float lock){}
  3831. virtual void FireExpendable(IshipIGC* pship, IdispenserIGC* pdispenser,
  3832. Time timeFired){}
  3833. virtual void *GetDroneFromShip(IshipIGC * pship){return NULL;} // return value is really a Drone*
  3834. virtual void CreateSideEvent(IsideIGC * pIsideIGC) {};
  3835. virtual void DestroySideEvent(IsideIGC * pIsideIGC) {};
  3836. virtual void ChangeStation(IshipIGC* pship,
  3837. IstationIGC* pstationOld,
  3838. IstationIGC* pstationNew) {} //changing clusters
  3839. virtual void ChangeCluster(IshipIGC* pship,
  3840. IclusterIGC* pclusterOld,
  3841. IclusterIGC* pclusterNew) {} //changing clusters
  3842. virtual void CommandChangedEvent(Command i, IshipIGC * pship, ImodelIGC* ptarget, CommandID cid) {};
  3843. virtual void Preload(const char* pszModelName,
  3844. const char* pszFileName) {};
  3845. virtual void ActivateTeleportProbe(IprobeIGC* pprobe) {};
  3846. virtual void DestroyTeleportProbe(IprobeIGC* pprobe) {};
  3847. virtual void LoadoutChangeEvent(IshipIGC* pship, IpartIGC* ppart, LoadoutChange lc) {}
  3848. virtual IObject* LoadRadarIcon(const char* szName)
  3849. {
  3850. return NULL;
  3851. }
  3852. virtual void ChangeGameState(void) {}
  3853. virtual void CreateBuildingEffect(Time now,
  3854. IasteroidIGC* pasteroid,
  3855. IshipIGC* pshipBuilder) {}
  3856. virtual void LayExpendable(Time now,
  3857. IexpendableTypeIGC* pet,
  3858. IshipIGC* pshipLayer) {}
  3859. virtual IclusterIGC* GetCluster(IshipIGC* pship,
  3860. ImodelIGC* pmodel)
  3861. {
  3862. return pship->CanSee(pmodel) ? pmodel->GetCluster() : NULL;
  3863. }
  3864. virtual IclusterIGC* GetRipcordCluster(IshipIGC* pship, HullAbilityBitMask habm = c_habmIsRipcordTarget)
  3865. {
  3866. IhullTypeIGC* pht = pship->GetBaseHullType();
  3867. return (pht && pht->HasCapability(habm))
  3868. ? pship->GetCluster()
  3869. : NULL;
  3870. }
  3871. virtual bool Reload(IshipIGC* pship, IlauncherIGC* plauncher, EquipmentType type) { return false; }
  3872. };
  3873. const DWORD c_dwFlashInterval = 250; //flash for 1/4 second on receiving damage
  3874. const DWORD c_dwDamageSlotInterval = 5000; //switch buckets every 5 seconds
  3875. const int c_iDamageSlotCount = 8; //and keep track of 8 damage buckets
  3876. class DamageTrack
  3877. {
  3878. public:
  3879. ~DamageTrack(void);
  3880. void SwitchSlots(void);
  3881. void ApplyDamage(Time timeNow,
  3882. ImodelIGC* pmodel,
  3883. float damage);
  3884. void Reset(void);
  3885. void AddDamageBucket(DamageBucket* pdb)
  3886. {
  3887. assert (pdb);
  3888. m_buckets.last(pdb);
  3889. }
  3890. void DeleteDamageBucket(DamageBucket* pdb)
  3891. {
  3892. assert (pdb);
  3893. DamageBucketLink* pdbl = m_buckets.find(pdb);
  3894. assert (pdbl);
  3895. delete pdbl;
  3896. }
  3897. DamageBucketList* GetDamageBuckets(void)
  3898. {
  3899. return &m_buckets;
  3900. }
  3901. private:
  3902. DamageTrack(DamageTrackSet* pdts);
  3903. static void sort(DamageBucketList* pListBuckets);
  3904. DamageBucketList m_buckets;
  3905. DamageTrackSet* m_pset;
  3906. friend class DamageTrackSet;
  3907. };
  3908. typedef Slist_utl<DamageTrack*> DamageTrackList;
  3909. typedef Slink_utl<DamageTrack*> DamageTrackLink;
  3910. class DamageBucket
  3911. {
  3912. public:
  3913. ~DamageBucket(void)
  3914. {
  3915. assert (m_model);
  3916. m_model->DeleteDamageBucket(this);
  3917. m_model->Release();
  3918. assert (m_track);
  3919. m_track->DeleteDamageBucket(this);
  3920. }
  3921. void Initialize(Time timeNow, ImodelIGC* pmodel)
  3922. {
  3923. assert (m_model == NULL);
  3924. assert (pmodel);
  3925. m_model = pmodel;
  3926. pmodel->AddRef();
  3927. m_timeLastDamage = timeNow;
  3928. }
  3929. ImodelIGC* model(void) const
  3930. {
  3931. return m_model;
  3932. }
  3933. float totalDamage(void) const
  3934. {
  3935. return m_totalDamage;
  3936. }
  3937. bool flash(Time timeNow)
  3938. {
  3939. return (timeNow < Time(m_timeLastDamage.clock() + c_dwFlashInterval)) &&
  3940. (timeNow >= m_timeLastDamage);
  3941. }
  3942. void SwitchSlots(int idSlot)
  3943. {
  3944. assert (idSlot >= 0);
  3945. assert (idSlot < c_iDamageSlotCount);
  3946. m_totalDamage -= m_damage[idSlot];
  3947. m_damage[idSlot] = 0.0f;
  3948. }
  3949. void ApplyDamage(Time timeNow,
  3950. int idSlot,
  3951. float d)
  3952. {
  3953. assert (idSlot >= 0);
  3954. assert (idSlot < c_iDamageSlotCount);
  3955. m_totalDamage += d;
  3956. m_damage[idSlot] += d;
  3957. //If we are not already in the bright phase of a flash
  3958. if (timeNow >= Time(m_timeLastDamage.clock() + c_dwFlashInterval))
  3959. {
  3960. //Two cases ... we are taking damage for the first time in a while
  3961. //or we're taking damage but in the dim phase of the previous cycle
  3962. Time timeReset = m_timeLastDamage.clock() + 2 * c_dwFlashInterval;
  3963. m_timeLastDamage = (timeNow > timeReset) ? timeNow : timeReset;
  3964. }
  3965. }
  3966. private:
  3967. DamageBucket(DamageTrack* ptrack,
  3968. ImodelIGC* pmodel)
  3969. :
  3970. m_model(pmodel),
  3971. m_track(ptrack),
  3972. m_totalDamage(0.0f)
  3973. {
  3974. assert (pmodel);
  3975. pmodel->AddRef();
  3976. pmodel->AddDamageBucket(this);
  3977. assert (ptrack);
  3978. ptrack->AddDamageBucket(this);
  3979. for (int i = 0; (i < c_iDamageSlotCount); i++)
  3980. m_damage[i] = 0.0f;
  3981. }
  3982. ImodelIGC* m_model;
  3983. DamageTrack* m_track;
  3984. float m_damage[c_iDamageSlotCount];
  3985. float m_totalDamage;
  3986. Time m_timeLastDamage;
  3987. friend class DamageTrack;
  3988. };
  3989. class DamageTrackSet
  3990. {
  3991. public:
  3992. void Initialize(Time now)
  3993. {
  3994. m_idSlot = 0;
  3995. m_timeSlotChange = Time(now.clock() + c_dwDamageSlotInterval);
  3996. }
  3997. void Update(Time now)
  3998. {
  3999. if (now >= m_timeSlotChange)
  4000. {
  4001. m_idSlot = (m_idSlot + 1) % c_iDamageSlotCount;
  4002. m_timeSlotChange = Time(m_timeSlotChange.clock() + c_dwDamageSlotInterval);
  4003. for (DamageTrackLink* pdtl = m_tracks.first(); (pdtl != NULL); pdtl = pdtl->next())
  4004. pdtl->data()->SwitchSlots();
  4005. }
  4006. }
  4007. DamageTrack* Create(void)
  4008. {
  4009. return new DamageTrack(this);
  4010. }
  4011. private:
  4012. void AddTrack(DamageTrack* pdt)
  4013. {
  4014. m_tracks.last(pdt);
  4015. }
  4016. void DeleteTrack(DamageTrack* pdt)
  4017. {
  4018. DamageTrackLink* pdtl = m_tracks.find(pdt);
  4019. assert (pdtl);
  4020. delete pdtl;
  4021. }
  4022. Time m_timeSlotChange;
  4023. int m_idSlot;
  4024. DamageTrackList m_tracks;
  4025. friend class DamageTrack;
  4026. };
  4027. ImissionIGC* CreateMission(void);
  4028. const float c_fTimeIncrement = 0.25f;
  4029. enum AmmoState
  4030. {
  4031. c_asEmpty,
  4032. c_asLow,
  4033. c_asFull
  4034. };
  4035. AmmoState GetAmmoState(IshipIGC* pship);
  4036. inline void AddIbaseIGC(BaseListIGC* list, IbaseIGC* base)
  4037. {
  4038. assert (list);
  4039. assert (base);
  4040. ZVerify(list->last(base));
  4041. base->AddRef();
  4042. }
  4043. inline void DeleteIbaseIGC(BaseListIGC* list, IbaseIGC* base)
  4044. {
  4045. assert (list);
  4046. assert (base);
  4047. for (BaseLinkIGC* l = list->first();
  4048. (l != NULL);
  4049. l = l->next())
  4050. {
  4051. if (l->data() == base)
  4052. {
  4053. delete l; //remove it from the list
  4054. base->Release(); //reduce the ref count
  4055. break; //all done
  4056. }
  4057. }
  4058. }
  4059. inline IbaseIGC* GetIbaseIGC(const BaseListIGC* list, ObjectID id)
  4060. {
  4061. assert (list);
  4062. for (BaseLinkIGC* l = list->first();
  4063. (l != NULL);
  4064. l = l->next())
  4065. {
  4066. IbaseIGC* b = l->data();
  4067. if (b->GetObjectID() == id)
  4068. return b;
  4069. }
  4070. return NULL;
  4071. }
  4072. bool Dodge(IshipIGC* pship, ImodelIGC* pmodelIgnore, int* pstate, bool bShipsOnly = false, float dtDodge = -1.0f);
  4073. typedef int GotoPositionMask;
  4074. class Waypoint
  4075. {
  4076. public:
  4077. enum Objective
  4078. {
  4079. c_oEnter, //dock for starbases, warp for alephs
  4080. c_oGoto, //get to within m_fOffset and stop
  4081. c_oNothing
  4082. };
  4083. Waypoint(void)
  4084. :
  4085. m_pmodelTarget(NULL),
  4086. m_objective(c_oNothing)
  4087. {
  4088. }
  4089. ~Waypoint(void)
  4090. {
  4091. if (m_pmodelTarget)
  4092. m_pmodelTarget->Release();
  4093. }
  4094. void Reset(void)
  4095. {
  4096. if (m_pmodelTarget)
  4097. {
  4098. m_pmodelTarget->Release();
  4099. m_pmodelTarget = NULL;
  4100. }
  4101. m_objective = c_oNothing;
  4102. }
  4103. void Set(Objective o,
  4104. ImodelIGC* pmodelTarget)
  4105. {
  4106. if(pmodelTarget)
  4107. {
  4108. assert ((o != c_oEnter) ||
  4109. (pmodelTarget->GetObjectType() == OT_ship) ||
  4110. (pmodelTarget->GetObjectType() == OT_station) ||
  4111. (pmodelTarget->GetObjectType() == OT_warp) ||
  4112. (pmodelTarget->GetObjectType() == OT_asteroid) ||
  4113. (pmodelTarget->GetObjectType() == OT_probe) ||
  4114. (pmodelTarget->GetObjectType() == OT_treasure));
  4115. if (m_pmodelTarget)
  4116. m_pmodelTarget->Release();
  4117. pmodelTarget->AddRef();
  4118. }
  4119. m_pmodelTarget = pmodelTarget;
  4120. m_objective = o;
  4121. }
  4122. private:
  4123. GotoPositionMask DoApproach(IshipIGC* pship,
  4124. const Vector& myPosition,
  4125. const Vector& itsPosition,
  4126. int nLand,
  4127. const Vector* pCenters,
  4128. const Vector* pDirections,
  4129. float distanceRest,
  4130. const Vector& positionRest,
  4131. Vector* pvectorGoto,
  4132. ImodelIGC** ppmodelSkip,
  4133. Vector* pvectorFacing);
  4134. GotoPositionMask GetGotoPosition(IshipIGC* pship,
  4135. float speed,
  4136. const Vector& positionRest,
  4137. Vector* pvectorGoto,
  4138. ImodelIGC** ppmodelSkip,
  4139. Vector* pvectorFacing);
  4140. ImodelIGC* m_pmodelTarget;
  4141. Objective m_objective;
  4142. friend class GotoPlan;
  4143. };
  4144. class GotoPlan
  4145. {
  4146. public:
  4147. //Is this really the only way to do this?
  4148. enum
  4149. {
  4150. c_wpTarget = 0x01,
  4151. c_wpWarp = 0x02
  4152. };
  4153. GotoPlan(IshipIGC* pship,
  4154. float fSkill = 0.5f)
  4155. :
  4156. m_pship(pship),
  4157. m_fSkill(fSkill),
  4158. m_maskWaypoints(0)
  4159. {
  4160. //Gotoplan is always a child of its ship, so no need to addref the ship pointer
  4161. assert (pship);
  4162. }
  4163. ~GotoPlan(void)
  4164. {
  4165. assert (m_pship);
  4166. }
  4167. void SetSkill(float fSkill)
  4168. {
  4169. m_fSkill = fSkill;
  4170. }
  4171. void Reset(void)
  4172. {
  4173. m_wpTarget.Reset();
  4174. m_wpWarp.Reset();
  4175. m_maskWaypoints = 0;
  4176. }
  4177. void Set(Waypoint::Objective o,
  4178. ImodelIGC* pmodelTarget)
  4179. {
  4180. assert (pmodelTarget);
  4181. m_wpTarget.Set(o, pmodelTarget);
  4182. m_wpWarp.Reset();
  4183. m_maskWaypoints = c_wpTarget;
  4184. m_pvOldCluster = m_pship->GetCluster();
  4185. m_pvOldClusterTarget = pmodelTarget->GetCluster();
  4186. }
  4187. int GetMaskWaypoints(void) const
  4188. {
  4189. return m_maskWaypoints;
  4190. }
  4191. bool Execute(Time now, float dt, bool bDodge);
  4192. private:
  4193. bool SetControls(float dt,
  4194. bool bDodge,
  4195. ControlData* pcontrols,
  4196. int* pstate);
  4197. IshipIGC* m_pship;
  4198. float m_fSkill;
  4199. int m_maskWaypoints;
  4200. Waypoint m_wpTarget; //Primary target
  4201. Waypoint m_wpWarp; //Warp we need to travel through to get there
  4202. void* m_pvOldCluster; //so we can tell when we change clusters
  4203. void* m_pvOldClusterTarget; //ditto for the target
  4204. };
  4205. static AssetMask GetAssetMask(IshipIGC* pship, IhullTypeIGC* pht, bool bFriendly)
  4206. {
  4207. AssetMask am;
  4208. switch (pship->GetPilotType())
  4209. {
  4210. case c_ptLayer: //NYI do we need to differentiate from builders? for the momment, assume no
  4211. case c_ptBuilder:
  4212. am = bFriendly ? c_amBuilder : c_amEnemyBuilder;
  4213. break;
  4214. case c_ptMiner:
  4215. am = bFriendly ? c_amMiner : c_amEnemyMiner;
  4216. break;
  4217. case c_ptCarrier:
  4218. am = bFriendly ? c_amCarrier : c_amEnemyCarrier;
  4219. break;
  4220. default:
  4221. if (bFriendly)
  4222. am = pht->HasCapability(c_habmLifepod) ? 0 : c_amFighter;
  4223. else
  4224. {
  4225. HullAbilityBitMask habm = pht->GetCapabilities();
  4226. if (habm & (c_habmBoard | c_habmCaptureThreat))
  4227. {
  4228. am = (habm & c_habmFighter)
  4229. ? (c_amEnemyFighter | c_amEnemyAPC)
  4230. : (c_amEnemyCapital | c_amEnemyAPC);
  4231. }
  4232. else if (habm & c_habmThreatToStation)
  4233. {
  4234. am = (habm & c_habmFighter)
  4235. ? (c_amEnemyFighter | c_amEnemyBomber)
  4236. : (c_amEnemyCapital | c_amEnemyBomber);
  4237. }
  4238. else
  4239. am = (habm & c_habmLifepod)
  4240. ? 0
  4241. : c_amEnemyFighter;
  4242. if (habm & c_habmIsRipcordTarget)
  4243. am |= c_amEnemyTeleportShip;
  4244. }
  4245. }
  4246. return am;
  4247. }
  4248. IshipIGC* CreateDrone(ImissionIGC* pmission,
  4249. ShipID shipID,
  4250. PilotType pt,
  4251. const char* pszName,
  4252. HullID hullID,
  4253. IsideIGC* pside,
  4254. AbilityBitMask abmOrders = 0,
  4255. float shootSkill = 1.0f,
  4256. float moveSkill = 1.0f,
  4257. float bravery = 1.0f);
  4258. class PersistPlayerScoreObject
  4259. {
  4260. public:
  4261. PersistPlayerScoreObject(void)
  4262. {
  4263. Reset();
  4264. }
  4265. PersistPlayerScoreObject(
  4266. float totalScore,
  4267. float rating,
  4268. RankID rank,
  4269. CivID civID
  4270. ) :
  4271. m_totalScore(totalScore),
  4272. m_fCombatRating(rating),
  4273. m_rank(rank),
  4274. m_civID(civID)
  4275. {
  4276. }
  4277. void Set(float totalScore,
  4278. float rating,
  4279. RankID rank)
  4280. {
  4281. m_totalScore = totalScore;
  4282. m_fCombatRating = rating;
  4283. m_rank = rank;
  4284. }
  4285. void Reset(void)
  4286. {
  4287. m_totalScore = 0.0f;
  4288. m_fCombatRating = 0.0f;
  4289. m_rank = 0;
  4290. m_civID = NA;
  4291. }
  4292. short GetRank(void) const
  4293. {
  4294. return m_rank;
  4295. }
  4296. float GetScore(void) const
  4297. {
  4298. return m_totalScore;
  4299. }
  4300. void SetCivID(CivID civID)
  4301. {
  4302. m_civID = civID;
  4303. }
  4304. CivID GetCivID() const
  4305. {
  4306. return m_civID;
  4307. }
  4308. float GetCombatRating(void) const
  4309. {
  4310. return m_fCombatRating;
  4311. }
  4312. void SetCombatRating(float cr)
  4313. {
  4314. m_fCombatRating = cr;
  4315. }
  4316. private:
  4317. float m_totalScore;
  4318. float m_fCombatRating;
  4319. RankID m_rank;
  4320. CivID m_civID;
  4321. friend class PlayerScoreObject;
  4322. };
  4323. typedef Slist_utl<PersistPlayerScoreObject*> PersistPlayerScoreObjectList;
  4324. typedef Slink_utl<PersistPlayerScoreObject*> PersistPlayerScoreObjectLink;
  4325. class PlayerScoreObject
  4326. {
  4327. public:
  4328. PlayerScoreObject(bool bPlayer)
  4329. :
  4330. m_bPlayer(bPlayer),
  4331. m_bConnected(false),
  4332. m_bCommanding(false),
  4333. m_fCombatRating(0.0f)
  4334. {
  4335. Reset(true);
  4336. }
  4337. void CalculateScore(ImissionIGC* pmission);
  4338. void SetScore(float fNewScore);
  4339. void SetCommanderScore(float fCommanderScore)
  4340. {
  4341. if (fCommanderScore > m_fScore)
  4342. m_fScore = fCommanderScore;
  4343. m_bCommandWin = m_bWin;
  4344. m_bCommandLose = m_bLose;
  4345. m_bCommandCredit = true;
  4346. }
  4347. float GetScore(void) const;
  4348. void Reset(bool bFull)
  4349. {
  4350. m_cWarpsSpotted = 0;
  4351. m_cAsteroidsSpotted = 0;
  4352. m_cMinerKills = 0.0f;
  4353. m_cBuilderKills = 0.0f;
  4354. m_cLayerKills = 0.0f;
  4355. m_cCarrierKills = 0.0f;
  4356. m_cPlayerKills = 0.0f;
  4357. m_cBaseKills = 0.0f;
  4358. m_cBaseCaptures = 0.0f;
  4359. m_cRescues = 0;
  4360. m_cTechsRecovered = 0;
  4361. m_cFlags = 0;
  4362. m_cArtifacts = 0;
  4363. m_cKills = 0;
  4364. m_cAssists = 0;
  4365. if (bFull)
  4366. {
  4367. m_cDeaths = 0;
  4368. m_cEjections = 0;
  4369. }
  4370. m_cPilotBaseKills = 0;
  4371. m_cPilotBaseCaptures = 0;
  4372. m_dtPlayed = 0.0f;
  4373. m_dtCommanded = 0.0f;
  4374. m_bWin = m_bLose = false;
  4375. m_bCommandWin = m_bCommandLose = false;
  4376. m_bCommandCredit = false;
  4377. m_fScore = 0.0f;
  4378. assert (!m_bConnected);
  4379. }
  4380. bool Connected(void) const
  4381. {
  4382. return m_bConnected;
  4383. }
  4384. bool Commanding(void) const
  4385. {
  4386. return m_bCommanding;
  4387. }
  4388. void Connect(Time t)
  4389. {
  4390. assert (!m_bConnected);
  4391. m_bConnected = true;
  4392. m_timeConnect = t;
  4393. if (m_bCommanding)
  4394. m_timeStartCommand = t;
  4395. }
  4396. void Disconnect(Time t)
  4397. {
  4398. if (m_bConnected)
  4399. {
  4400. m_bConnected = false;
  4401. m_dtPlayed += (t - m_timeConnect);
  4402. if (m_bCommanding)
  4403. m_dtCommanded += (t - m_timeStartCommand);
  4404. }
  4405. }
  4406. void StartCommand(Time t)
  4407. {
  4408. m_bCommanding = true;
  4409. if (m_bConnected)
  4410. m_timeStartCommand = t;
  4411. }
  4412. void StopCommand(Time t)
  4413. {
  4414. if (m_bCommanding)
  4415. {
  4416. m_bCommanding = false;
  4417. if (m_bConnected)
  4418. m_dtCommanded += (t - m_timeStartCommand);
  4419. }
  4420. }
  4421. void EndGame(ImissionIGC* pmission,
  4422. bool bWin,
  4423. bool bLose)
  4424. {
  4425. assert (!m_bConnected);
  4426. assert (!(bWin && bLose));
  4427. m_bWin = bWin;
  4428. m_bLose = bLose;
  4429. CalculateScore(pmission);
  4430. }
  4431. void SpotWarp(void)
  4432. {
  4433. m_cWarpsSpotted++;
  4434. }
  4435. void SpotSpecialAsteroid(void)
  4436. {
  4437. m_cAsteroidsSpotted++;
  4438. }
  4439. void KillShip(IshipIGC* pship,
  4440. float fraction)
  4441. {
  4442. switch (pship->GetPilotType())
  4443. {
  4444. case c_ptMiner:
  4445. {
  4446. m_cMinerKills += fraction;
  4447. }
  4448. break;
  4449. case c_ptBuilder:
  4450. {
  4451. m_cBuilderKills += fraction;
  4452. }
  4453. break;
  4454. case c_ptLayer:
  4455. {
  4456. m_cLayerKills += fraction;
  4457. }
  4458. break;
  4459. case c_ptCarrier:
  4460. {
  4461. m_cCarrierKills += fraction;
  4462. }
  4463. break;
  4464. default:
  4465. {
  4466. m_cPlayerKills += fraction;
  4467. }
  4468. break;
  4469. }
  4470. }
  4471. void KillBase(bool bPilot)
  4472. {
  4473. if (bPilot)
  4474. {
  4475. m_cBaseKills += 1.0f;
  4476. m_cPilotBaseKills++;
  4477. }
  4478. else
  4479. m_cBaseKills += 0.5f;
  4480. }
  4481. void CaptureBase(bool bPilot)
  4482. {
  4483. if (bPilot)
  4484. {
  4485. m_cBaseCaptures += 1.0f;
  4486. m_cPilotBaseCaptures++;
  4487. }
  4488. else
  4489. m_cBaseCaptures += 0.5f;
  4490. }
  4491. short GetPilotBaseKills(void) const
  4492. {
  4493. return m_cPilotBaseKills;
  4494. }
  4495. short GetPilotBaseCaptures(void) const
  4496. {
  4497. return m_cPilotBaseCaptures;
  4498. }
  4499. float GetWarpsSpotted(void) const
  4500. {
  4501. return m_cWarpsSpotted;
  4502. }
  4503. float GetAsteroidsSpotted(void) const
  4504. {
  4505. return m_cAsteroidsSpotted;
  4506. }
  4507. float GetMinerKills(void) const
  4508. {
  4509. return m_cMinerKills;
  4510. }
  4511. float GetBuilderKills(void) const
  4512. {
  4513. return m_cBuilderKills;
  4514. }
  4515. float GetLayerKills(void) const
  4516. {
  4517. return m_cLayerKills;
  4518. }
  4519. float GetCarrierKills(void) const
  4520. {
  4521. return m_cCarrierKills;
  4522. }
  4523. float GetPlayerKills(void) const
  4524. {
  4525. return m_cPlayerKills;
  4526. }
  4527. float GetBaseKills(void) const
  4528. {
  4529. return m_cBaseKills;
  4530. }
  4531. float GetBaseCaptures(void) const
  4532. {
  4533. return m_cBaseCaptures;
  4534. }
  4535. short GetTechsRecovered(void) const
  4536. {
  4537. return m_cTechsRecovered;
  4538. }
  4539. void AddTechsRecovered(void)
  4540. {
  4541. m_cTechsRecovered++;
  4542. }
  4543. short GetFlags(void) const
  4544. {
  4545. return m_cFlags;
  4546. }
  4547. void AddFlag(void)
  4548. {
  4549. m_cFlags++;
  4550. }
  4551. short GetArtifacts(void) const
  4552. {
  4553. return m_cArtifacts;
  4554. }
  4555. void AddArtifact(void)
  4556. {
  4557. m_cArtifacts++;
  4558. }
  4559. void AddRescue(void)
  4560. {
  4561. m_cRescues++;
  4562. }
  4563. short GetRescues(void) const
  4564. {
  4565. return m_cRescues;
  4566. }
  4567. short GetKills(void) const
  4568. {
  4569. return m_cKills;
  4570. }
  4571. void AddKill(void)
  4572. {
  4573. m_cKills++;
  4574. }
  4575. short GetAssists(void) const
  4576. {
  4577. return m_cAssists;
  4578. }
  4579. void AddAssist(void)
  4580. {
  4581. m_cAssists++;
  4582. }
  4583. short GetDeaths(void) const
  4584. {
  4585. return m_cDeaths;
  4586. }
  4587. void AddDeath(void)
  4588. {
  4589. m_cDeaths++;
  4590. }
  4591. void SetDeaths(short d)
  4592. {
  4593. m_cDeaths = d;
  4594. }
  4595. short GetEjections(void) const
  4596. {
  4597. return m_cEjections;
  4598. }
  4599. void AddEjection(void)
  4600. {
  4601. m_cEjections++;
  4602. }
  4603. void SetEjections(short e)
  4604. {
  4605. m_cEjections = e;
  4606. }
  4607. float GetCombatRating(void) const
  4608. {
  4609. return m_fCombatRating;
  4610. }
  4611. void SetCombatRating(float cr)
  4612. {
  4613. m_fCombatRating = cr;
  4614. }
  4615. static void AdjustCombatRating(ImissionIGC* pmission,
  4616. PlayerScoreObject* ppsoKiller,
  4617. PlayerScoreObject* ppsoKillee);
  4618. const PersistPlayerScoreObject& GetPersist(void) const
  4619. {
  4620. return m_persist;
  4621. }
  4622. PersistPlayerScoreObject& GetPersist(void)
  4623. {
  4624. return m_persist;
  4625. }
  4626. void SetPersist(const PersistPlayerScoreObject * p)
  4627. {
  4628. assert (p);
  4629. m_persist = *p;
  4630. m_fCombatRating = m_persist.GetCombatRating();
  4631. }
  4632. bool GetWinner(void) const
  4633. {
  4634. return m_bWin;
  4635. }
  4636. bool GetLoser(void) const
  4637. {
  4638. return m_bLose;
  4639. }
  4640. bool GetCommandWinner(void) const
  4641. {
  4642. return m_bCommandWin;
  4643. }
  4644. bool GetCommandLoser(void) const
  4645. {
  4646. return m_bCommandLose;
  4647. }
  4648. float GetTimePlayed() const
  4649. {
  4650. return m_dtPlayed;
  4651. }
  4652. float GetTimeCommanded() const
  4653. {
  4654. return m_dtCommanded;
  4655. }
  4656. bool GetCommandCredit(void) const
  4657. {
  4658. return m_bCommandCredit;
  4659. }
  4660. private:
  4661. Time m_timeConnect;
  4662. Time m_timeStartCommand;
  4663. short m_cWarpsSpotted;
  4664. short m_cAsteroidsSpotted;
  4665. float m_cMinerKills;
  4666. float m_cBuilderKills;
  4667. float m_cLayerKills;
  4668. float m_cCarrierKills;
  4669. float m_cPlayerKills;
  4670. float m_cBaseKills;
  4671. float m_cBaseCaptures;
  4672. short m_cTechsRecovered;
  4673. short m_cFlags;
  4674. short m_cArtifacts;
  4675. short m_cRescues;
  4676. short m_cKills;
  4677. short m_cAssists;
  4678. short m_cDeaths;
  4679. short m_cEjections;
  4680. short m_cPilotBaseKills;
  4681. short m_cPilotBaseCaptures;
  4682. float m_dtPlayed;
  4683. float m_dtCommanded;
  4684. float m_fCombatRating;
  4685. float m_fScore;
  4686. bool m_bPlayer;
  4687. bool m_bConnected;
  4688. bool m_bCommanding;
  4689. bool m_bWin;
  4690. bool m_bLose;
  4691. bool m_bCommandWin;
  4692. bool m_bCommandLose;
  4693. bool m_bCommandCredit;
  4694. PersistPlayerScoreObject m_persist;
  4695. };
  4696. typedef Slist_utl<PlayerScoreObject*> PlayerScoreObjectList;
  4697. typedef Slink_utl<PlayerScoreObject*> PlayerScoreObjectLink;
  4698. class GameOverScoreObject
  4699. {
  4700. public:
  4701. GameOverScoreObject(void)
  4702. {
  4703. }
  4704. void Set(const PlayerScoreObject* ppso)
  4705. {
  4706. //m_totalScore = ppso->GetScore();
  4707. m_dtRecentPlayed = ppso->GetTimePlayed();
  4708. //m_fCombatRating = ppso->GetPersist().GetCombatRating();
  4709. m_cRecentBaseKills = ppso->GetPilotBaseKills();
  4710. m_cRecentBaseCaptures = ppso->GetPilotBaseCaptures();
  4711. m_cRecentKills = ppso->GetKills();
  4712. m_cRecentDeaths = ppso->GetDeaths();
  4713. m_cRecentEjections = ppso->GetEjections();
  4714. //m_cTotalBaseKills = ppso->GetPersist().GetBaseKills();
  4715. //m_cTotalBaseCaptures = ppso->GetPersist().GetBaseCaptures();
  4716. //m_cTotalKills = ppso->GetPersist().GetKills();
  4717. //m_cTotalDeaths = ppso->GetPersist().GetDeaths();
  4718. //m_cTotalEjections = ppso->GetPersist().GetEjections();
  4719. m_rank = ppso->GetPersist().GetRank();
  4720. //m_cTotalWins = ppso->GetPersist().GetWins();
  4721. //m_cTotalLosses = ppso->GetPersist().GetLosses();
  4722. m_cRecentScore = ppso->GetScore();
  4723. m_cRecentAssists = ppso->GetAssists();
  4724. //m_bWinner = ppso->GetWinner();
  4725. //m_bLoser = ppso->GetLoser();
  4726. //m_cFlags = ppso->GetFlags();
  4727. //m_cArtifacts = ppso->GetArtifacts();
  4728. //m_cRescues = ppso->GetRescues();
  4729. m_bCommander = ppso->GetCommandCredit();
  4730. m_bGameCounted = ppso->GetLoser() || ppso->GetWinner();
  4731. }
  4732. short GetRank(void) const
  4733. {
  4734. return m_rank;
  4735. }
  4736. /*
  4737. float GetScore(void) const
  4738. {
  4739. return m_totalScore;
  4740. }
  4741. */
  4742. float GetRecentTimePlayed(void) const
  4743. {
  4744. return m_dtRecentPlayed;
  4745. }
  4746. short GetRecentBaseKills(void) const
  4747. {
  4748. return m_cRecentBaseKills;
  4749. }
  4750. short GetRecentBaseCaptures(void) const
  4751. {
  4752. return m_cRecentBaseCaptures;
  4753. }
  4754. short GetRecentKills(void) const
  4755. {
  4756. return m_cRecentKills;
  4757. }
  4758. short GetRecentDeaths(void) const
  4759. {
  4760. return m_cRecentDeaths;
  4761. }
  4762. short GetRecentEjections(void) const
  4763. {
  4764. return m_cRecentEjections;
  4765. }
  4766. /*
  4767. short GetTotalBaseKills(void) const
  4768. {
  4769. return m_cTotalBaseKills;
  4770. }
  4771. short GetTotalBaseCaptures(void) const
  4772. {
  4773. return m_cTotalBaseCaptures;
  4774. }
  4775. short GetFlags(void) const
  4776. {
  4777. return m_cFlags;
  4778. }
  4779. short GetArtifacts(void) const
  4780. {
  4781. return m_cArtifacts;
  4782. }
  4783. short GetRescues(void) const
  4784. {
  4785. return m_cRescues;
  4786. }
  4787. short GetTotalKills(void) const
  4788. {
  4789. return m_cTotalKills;
  4790. }
  4791. short GetTotalDeaths(void) const
  4792. {
  4793. return m_cTotalDeaths;
  4794. }
  4795. short GetTotalEjections(void) const
  4796. {
  4797. return m_cTotalEjections;
  4798. }
  4799. */
  4800. /*
  4801. short GetWins(void) const
  4802. {
  4803. return m_cTotalWins;
  4804. }
  4805. short GetLosses(void) const
  4806. {
  4807. return m_cTotalLosses;
  4808. }
  4809. */
  4810. float GetRecentScore(void) const
  4811. {
  4812. return m_cRecentScore;
  4813. }
  4814. unsigned short GetRecentAssists(void) const
  4815. {
  4816. return m_cRecentAssists;
  4817. }
  4818. /*
  4819. float GetCombatRating(void) const
  4820. {
  4821. return m_fCombatRating;
  4822. }
  4823. bool GetWinner(void) const
  4824. {
  4825. return m_bWinner;
  4826. }
  4827. bool GetLoser(void) const
  4828. {
  4829. return m_bLoser;
  4830. }
  4831. */
  4832. bool GetCommander(void) const
  4833. {
  4834. return m_bCommander;
  4835. }
  4836. bool GetGameCounted(void) const
  4837. {
  4838. return m_bGameCounted;
  4839. }
  4840. private:
  4841. //float m_totalScore;
  4842. float m_dtRecentPlayed;
  4843. //float m_fCombatRating;
  4844. float m_cRecentScore;
  4845. //short m_cFlags;
  4846. //short m_cArtifacts;
  4847. //short m_cRescues;
  4848. short m_cRecentBaseKills;
  4849. short m_cRecentBaseCaptures;
  4850. short m_cRecentKills;
  4851. short m_cRecentDeaths;
  4852. short m_cRecentEjections;
  4853. unsigned short m_cRecentAssists;
  4854. //short m_cTotalBaseKills;
  4855. //short m_cTotalBaseCaptures;
  4856. //short m_cTotalKills;
  4857. //short m_cTotalDeaths;
  4858. //short m_cTotalEjections;
  4859. short m_rank;
  4860. bool m_bCommander;
  4861. bool m_bGameCounted;
  4862. //unsigned short m_cTotalWins;
  4863. //unsigned short m_cTotalLosses;
  4864. //bool m_bWinner;
  4865. //bool m_bLoser;
  4866. };
  4867. //------------------------------------------------------------------------------
  4868. // normal igc files, i.e. missions can be dumped and loaded using these two
  4869. // functions. They return true if successful.
  4870. //------------------------------------------------------------------------------
  4871. bool DumpIGCFile (const char* name, ImissionIGC* pMission, __int64 iMaskExportTypes,
  4872. void (*munge)(int size, char* data) = NULL);
  4873. bool LoadIGCFile (const char* name, ImissionIGC* pMission, void (*munge)(int size, char* data) = NULL);
  4874. //------------------------------------------------------------------------------
  4875. // static data core files are dealt with by these functions. They are
  4876. // almost identical to the normal igc file loaders, but there is a version
  4877. // number in the file, and it is returned by the LoadIGCStaticCore function.
  4878. // if the load function fails, it returns NA.
  4879. //------------------------------------------------------------------------------
  4880. bool DumpIGCStaticCore (const char* name, ImissionIGC* pMission, __int64 iMaskExportTypes, void (*munge)(int size, char* data) = NULL);
  4881. int LoadIGCStaticCore (const char* name, ImissionIGC* pMission, bool fGetVersionOnly, void (*munge)(int size, char* data) = NULL);
  4882. int CacheIGCStaticCore (const char* name, ImissionIGC* pMission, bool fGetVersionOnly, void (*munge)(int size, char* data) = NULL);
  4883. #endif