menus.cpp 158 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. // menus.cpp
  19. // Project: Postal
  20. //
  21. // This module contains the actual menu data (structs, strings, etc.)
  22. //
  23. // History:
  24. // 12/05/96 MJR Started.
  25. //
  26. // 12/19/96 JMI Menus contained a pointer to guiItem which was a not-yet-
  27. // created gui from my old menu sample code. Removed ptr.
  28. // Typo in name of MainMenuTile.bmp.
  29. //
  30. // 12/19/96 JMI Offset menu items so they didn't overwrite menu heading
  31. // and moved "Ready?" from verify exit menu to the heading.
  32. //
  33. // 01/27/97 JMI Added more menus (High Scores, Options, and Start).
  34. //
  35. // 01/28/97 JMI Added new menu background and indicator for two menus
  36. // (Main and VerifyExit).
  37. //
  38. // 01/28/97 JMI Was setting menu box to not transparent instead of trans-
  39. // parent. Fixed.
  40. //
  41. // 01/29/97 JMI Now uses SampleMaster to play a sample when a choice is
  42. // made from the main menu.
  43. //
  44. // 01/30/97 JMI Added cheezy brighten/darken effect via scrollbar in
  45. // options menu.
  46. //
  47. // 01/31/97 JMI Made all menus uppercase. Also, uses flesh menu and
  48. // smash font for all menus now. Adjusted menu paths
  49. // so they are in the res/Menus dir and font paths so
  50. // they are in the res/Fonts dir.
  51. //
  52. // 01/31/97 JMI Adjusted menu sizes such that the flesh menu could be
  53. // shown.
  54. //
  55. // 02/02/97 JMI Added support for -1 passed on MenuChoice callback
  56. // indicating change in focused menu item. Added use of
  57. // new child struct in Menu struct, MenuGui. Relocated
  58. // title text on some menus. Resized font on some menus
  59. // to fit better. Got rid of PalTran func which was doing
  60. // nothing now that game.cpp does CLUT red shift/fade.
  61. //
  62. // 02/03/97 JMI Now menuClientGame invokes the options menu, if selected.
  63. // Adjusted paths for SAK dir.
  64. //
  65. // 02/04/97 JMI Now uses functions in game.cpp to get and set the gamma
  66. // level.
  67. //
  68. // 02/04/97 JMI Forgot to release memfile used to get scrollbar for options
  69. // menu.
  70. //
  71. // 02/10/97 JMI rspReleaseResource() now takes a ptr to a ptr.
  72. //
  73. // 02/19/97 JMI More implementation for Start Game menu.
  74. //
  75. // 03/06/97 JMI Added g_menuVerifyQuitGame.
  76. //
  77. // 03/07/97 JMI Added Load menu option on main menu.
  78. //
  79. // 03/28/97 JMI Disabled help and ordering info.
  80. //
  81. // 04/07/97 JMI When I added the Load menu option, I must've screwed up
  82. // the StartGameMenu() choice function so that it always
  83. // started a game. Fixed.
  84. //
  85. // 04/07/97 JMI Now uses g_GameSettings.m_szServerName for the server name.
  86. //
  87. // 04/08/97 JMI Added multiplayer options menu (menuMultiOptions).
  88. //
  89. // 04/11/97 JMI Added record and play demo options to Start Game Menu.
  90. //
  91. // 04/14/97 JMI Swapped positions of Record and Play menu options.
  92. //
  93. // 04/21/97 JMI Added menuEditor and utilized new auto go back
  94. // functionality in Menu API.
  95. //
  96. // 04/21/97 JMI menuEditor now specifies the palette indices to be set by
  97. // the Menu API.
  98. //
  99. // 04/22/97 JMI Added controls menu and sub menus for keyboard, mouse, and
  100. // joystick. Only the mouse sub menu is partially implemented
  101. // functionally (the rest are not yet implemented).
  102. //
  103. // 04/22/97 JMI Added checkbox for enabling mouse input.
  104. //
  105. // 04/22/97 JMI Separated game start options into 3 categories, single
  106. // player, multiplayer, and demo.
  107. //
  108. // 04/22/97 JMI Updated menuClient to work as the in game menu for Play.cpp.
  109. //
  110. // 04/22/97 JMI No longer uses chdir() to get the open dialog into the
  111. // correct directory. Now we simply default szRealmName
  112. // to the path of the dir we want to save under.
  113. //
  114. // 04/22/97 JMI Now VerifyQuitMenuChoice handles menuClientGame instead of
  115. // g_menuVerifyQuit.
  116. //
  117. // 04/24/97 JMI Took out the ! in "Postal!" title of main menu.
  118. //
  119. // 04/24/97 JMI Now uses the centering flag for header text and
  120. // two new flags for shadowing the header and the items.
  121. // Now colors are specified as RGBA and background font
  122. // color must be transparent (not offered as an option).
  123. //
  124. // 04/24/97 JMI Change menuClientGame's "GAME MENU" to "MENU".
  125. //
  126. // 04/25/97 JMI Changed menu item text shadow color to be more blood like.
  127. // Unified all menu header and item text sizes.
  128. // Scooted menu items in a bit to avoid having the bullet in-
  129. // dicator go off the menu.
  130. //
  131. // 04/25/97 JMI StartSingleMenu() was not calling Play_SetRealmName(NULL)
  132. // to clear the realm name so the game went in level order.
  133. //
  134. // 05/06/97 JMI Now the Gamma GUI displays text next to the scrollbar.
  135. //
  136. // 05/07/97 JMI Now the range of the Gamma GUI text is -50 to +50.
  137. //
  138. // 05/15/97 JMI Added the menu for disabling features like alpha blending
  139. // and X-ray effect.
  140. //
  141. // 05/22/97 JMI Added 3D lighting to the features that can be disabled.
  142. //
  143. // 05/23/97 JMI Added particle effects to the features that can be disabled.
  144. //
  145. // 05/25/97 JMI Swapped positions of Join and Host on Multiplayer menu.
  146. //
  147. // 05/29/97 JMI Now, when g_GameSettings.m_sServer is set,
  148. // g_GameSettings.m_sClient is set as well.
  149. //
  150. // 06/11/97 JMI Added g_MenuSettings.
  151. //
  152. // 06/12/97 MJR Moved much of the callback code from here into game.cpp.
  153. //
  154. // 07/01/97 JMI Now plays a different sound for a selected item vs. an
  155. // item selection change.
  156. //
  157. // 07/03/97 JMI Now calls Game_ControlsMenu() with choices from
  158. // menuControls.
  159. //
  160. // 07/04/97 JMI Added the appropriate amount of items for the keyboard,
  161. // mouse, and joystick menus.
  162. // Also, moved 'Use Mouse' to Options menu.
  163. // Also, changed "CONTROLS" option on Options menu to "EDIT
  164. // CONTROLS", "KEYBOARD" to "EDIT KEYS", and collapsed
  165. // "MOUSE" & "JOYSTICK" into "EDIT BUTTONS".
  166. //
  167. // 07/07/97 JMI Added callbacks for menuJoystick.
  168. //
  169. // 07/12/97 JMI Removed menuHighScores and its reference by menuMain.
  170. // Also, adjusted MenuChoice switch values to compensate for
  171. // choices after 'High Scores' being pushed back (3..5
  172. // became 2..4).
  173. //
  174. // 07/13/97 JMI Added Challenge option from menuStart that leads to new
  175. // menuChallenge menu.
  176. //
  177. // 07/14/97 JMI Added difficulty slider to menuOptions.
  178. //
  179. // 07/16/97 JMI Added menuVolumes and path from menuOptions.
  180. //
  181. // 07/18/97 JMI Got rid of bogus immitation PlaySample functions.
  182. // Now there is one PlaySample() function. Also, you now
  183. // MUST specify a category and you don't have to specify a
  184. // SoundInstance ptr to specify a volume.
  185. // Also, added an '_' in "START GAME".
  186. //
  187. // 07/18/97 JMI Changed "LOAD" to "LOAD_LEVEL" and added some underscores
  188. // for spaces in "LOAD GAME" and "THE GAUNTLET".
  189. //
  190. // 07/19/97 JMI Added 'Volume Distancing' to menuFeatures.
  191. // Now 'Options' launches many other menus for the options:
  192. // menuVideo, menuAudio, menuPlayOptions, menuInput.
  193. //
  194. // 07/21/97 JMI Changed "FEATURES" menu to "PERFORMANCE".
  195. //
  196. // 07/29/97 JMI Now uses in-thumb area for text representation of current
  197. // gamma value. The gamma range can be adjusted from the
  198. // scrollbar file like before, but now, the range in the
  199. // scrollbar will be mapped to the range GAMMA_RANGE so the
  200. // user's control can be more or less granular than the actual
  201. // gamma range.
  202. //
  203. // 08/01/97 JMI Now there's a 'SETUP' option on the menuStartMulti that
  204. // goes to menuMultiOptions.
  205. // Also, changed 'Other' in multi options menu to net port.
  206. //
  207. // 08/03/97 BRH Added network protocol option to the multiplayer setup
  208. // menu.
  209. //
  210. // 08/04/97 JMI Added sliders for mouse sensitivities (X & Y).
  211. // Added menu with sliders for all facets of rotation.
  212. //
  213. // 08/04/97 JMI Added performance option for playing ambient sounds.
  214. //
  215. // 08/05/97 JMI Added multiplayer option for connection type.
  216. //
  217. // 08/05/97 JMI Added 'Touch Organ' option to menuAudioOptions.
  218. //
  219. // 08/06/97 JMI Changed "MOUSE SENS. X" and "... Y" to better names and
  220. // use Columnize Guis flag on menuControls.
  221. //
  222. // 08/07/97 BRH Fixed problem where the port numnber was not getting
  223. // set from the gui.
  224. //
  225. // 08/12/97 JMI Added some '...'s to try that concept with menus where you
  226. // want to know.
  227. //
  228. // 08/13/97 MJR Added Host Name gui.
  229. //
  230. // 08/14/97 JMI Converted menu callbacks to returning true to accept or
  231. // false to deny.
  232. //
  233. // 08/15/97 JRD Added separate postal organ menu,
  234. //
  235. // 08/17/97 BRH Got rid of violence option on PlayOptions menu, and
  236. // got rid of help on the main menu.
  237. //
  238. // 08/17/97 JMI Now releases protocol chooser GUI.
  239. //
  240. // 08/17/97 JMI menuOrgan was calling AudioOptionsInit() and
  241. // AudioOptionsChoice() so choices on the organ menu were
  242. // affecting audio options. Changed to no init and
  243. // Organ_MenuChoice() as the choice callback.
  244. // Also, added two lines explaining briefly that you can hit
  245. // A..Z and 0..9 to play with the organ.
  246. //
  247. // 08/17/97 JMI Changed wording on menuOrgan.
  248. //
  249. // 08/17/97 MJR Now loads from g_resmgrShell, and uses new menu bg's.
  250. //
  251. // 08/18/97 BRH Changed protocol gui from an REdit to an RTxt gui.
  252. //
  253. // 08/20/97 BRH Added new samples for the new pain and suffering volume
  254. // adjustment categories.
  255. //
  256. // MJR Changed multiplayer-related menus and added a new one.
  257. //
  258. // 08/23/97 JMI Now the init/kill callback for the main menu calls game.cpp
  259. // to hook it in.
  260. //
  261. // 08/23/97 JMI Added better player color menu feedback.
  262. //
  263. // 08/23/97 JMI Moved ms_apszPlayerColorDescriptions[] from here into
  264. // CGameSettings where it can be used more generally.
  265. //
  266. // 08/24/97 MJR Lots of tuning for consistancy, wording, etc.
  267. // More and more tuning.
  268. // Removed grip-zone-radius stuff -- no longer needed.
  269. //
  270. // 08/25/97 MJR Made the color stuff into macros so they could easily be
  271. // changed for all menus. Changed the RGB values, but the
  272. // color mapping didn't seem to be affected!!!
  273. //
  274. // 08/25/97 JMI Colors were mapping to windows static colors so they did
  275. // not apparently change. Added mappable range to all menus
  276. // and made it so all menus set the palette as well.
  277. // Also, added code for new difficulty GUI which provides a
  278. // slider and a text area.
  279. // Also, changed the unspecified sound category sampler to
  280. // the mine beep.
  281. // Also, now scales the ranges of the sound sliders to between
  282. // 0 to 10 for the user and sets the value scaled to the selected
  283. // category's adjusted value for the current quality.
  284. //
  285. // 08/26/97 JMI Changed difficulty strings and name of PLAY menu to
  286. // DIFFICULTY. Also, changed the DIFFICULTY item to something
  287. // shorter like SET.
  288. //
  289. // 08/27/97 JMI Now when you choose 'Defaults' from the Mixer menu, it
  290. // plays all the samples at the default volume for feedback
  291. // (rather than just the last one).
  292. //
  293. // 08/27/97 JMI Took all underscores out of menu titles and items now that
  294. // RPrefs supports spaces in vars and sections.
  295. //
  296. // 08/27/97 JMI Changed "PLAY" option on Options menu to "DIFFICULTY".
  297. //
  298. // 08/27/97 JMI Now displays rotation degree values as integrals.
  299. // Also, all menus no use g_fontPostal for their helper GUIs.
  300. //
  301. // 08/27/97 JMI Removed "BACK" menu items. Actually replaced with a
  302. // disabled "". Note that this is not required by the menu
  303. // system. That is, you can set the cancel item to an item
  304. // that doesn't exist. The problem is there's no mechanism for
  305. // specifying the one after the last item and so each menu would
  306. // have to constantly be updated.
  307. // Also, now enter on any item in the mixer will play all the
  308. // sounds simultaneously so you can get an idea of their
  309. // combined levels.
  310. // Also, changed sampler for Unspecified to the empty weapon
  311. // noise (was mine beep).
  312. //
  313. // 09/02/97 JMI Added browse option to menuStartDemo.
  314. //
  315. // 09/04/97 JMI Removed browse option from menuStartDemo.
  316. //
  317. // 09/06/97 JMI No longer displays the Demo menu even for an instant if
  318. // g_GameSettings.m_sCanRecordDemos is FALSE.
  319. //
  320. // 09/17/97 JMI Menus now use localizable string variables from localize.*.
  321. //
  322. // 09/26/97 JMI Now uses the 'Restore defaults' string from localize.
  323. //
  324. // 09/26/97 JMI Resized menus to fit localization text for French & German:
  325. //
  326. // Menu Change Language that caused
  327. // ====================== ========== =======================
  328. // g_menuVerifyQuitGame SM -> MD French, German
  329. // menuVerifyExit SM -> MD French, German
  330. // menuOptions SM -> MD French, German
  331. // menuRotation MD -> LG French
  332. // menuStart SM -> MD French, German
  333. // menuStartSingle SM -> MD French, German
  334. // menuStartMulti SM -> MD French, German
  335. // menuChallenge SM -> MD German
  336. // menuJoinMulti MD -> LG French, German
  337. //
  338. // 10/10/97 JMI Put menuJoystick back on menuControls based on conditional
  339. // compile option ALLOW_JOYSTICK. Also, updated
  340. // ControlsChoice() amd ControlsInit() to handle these cases.
  341. //
  342. // 10/13/97 JMI Moved g_pszControlsMenu_UseJoystick to localize.* and took
  343. // out 'TEMP' comments.
  344. // Also, made 'Controls' menu a large menu b/c the new
  345. // joystick options were pushing things off the edge.
  346. //
  347. // 12/01/97 BRH Added #ifdef SPAWN sections to menus so that that spawn
  348. // verison of the game has different menus that only allow
  349. // them to join a multiplayer game.
  350. //
  351. // 12/04/97 BRH Added additional option for single player missions so they
  352. // can play the original postal levels or the add on pack
  353. // levels.
  354. //
  355. // 10/07/99 JMI Conditional remove Add On start menu option when in
  356. // SUPER_POSTAL target.
  357. //
  358. // 03/30/00 MJR Switched to START_MENU_ADDON_ITEM to control whether
  359. // the START menu has an Add-On item.
  360. //
  361. ////////////////////////////////////////////////////////////////////////////////
  362. #define MENUS_CPP
  363. #include "RSPiX.h"
  364. #ifdef PATHS_IN_INCLUDES
  365. #include "WishPiX/Menu/menu.h"
  366. #else
  367. #include "menu.h"
  368. #endif
  369. #include "menus.h"
  370. #include "game.h"
  371. #include "play.h"
  372. #include "SampleMaster.h"
  373. #include "input.h"
  374. #include "gameedit.h"
  375. #include "input.h"
  376. #include "MenuSettings.h"
  377. #include "InputSettingsDlg.h"
  378. #include "socket.h"
  379. #include "organ.h"
  380. #include "net.h"
  381. #include "CompileOptions.h" // For ALLOW_JOYSTICK macro.
  382. #include "update.h"
  383. #ifdef WIN32
  384. #include <direct.h>
  385. #else
  386. #include <unistd.h>
  387. #endif
  388. ////////////////////////////////////////////////////////////////////////////////
  389. // Macros/types/etc.
  390. ////////////////////////////////////////////////////////////////////////////////
  391. #define MENU_BG_SM "Menu/menu_sm.bmp"
  392. #define MENU_BG_MD "Menu/menu_md.bmp"
  393. #define MENU_BG_LG "Menu/menu_lg.bmp"
  394. #define MENU_RECT_SM 20, 20, 280, 350
  395. #define MENU_HEAD_Y_SM -149
  396. #define MENU_ITEM_X_SM 70
  397. #define MENU_ITEM_Y_SM -101
  398. #define MENU_ITEM_SPACE_Y_SM 4
  399. #define MENU_ITEM_IND_SPACE_X_SM 5
  400. #define MENU_RECT_MD 20, 20, 450, 460
  401. #define MENU_HEAD_Y_MD -196
  402. #define MENU_ITEM_X_MD 60
  403. #define MENU_ITEM_Y_MD -140
  404. #define MENU_ITEM_SPACE_Y_MD 4
  405. #define MENU_ITEM_IND_SPACE_X_MD 5
  406. #define MENU_RECT_LG 0, 0, 640, 480
  407. #define MENU_HEAD_Y_LG -195
  408. #define MENU_ITEM_X_LG 60
  409. #define MENU_ITEM_Y_LG -95
  410. #define MENU_ITEM_SPACE_Y_LG 4
  411. #define MENU_ITEM_IND_SPACE_X_LG 5
  412. #define MENU_INDICATOR "Menu/bullet.bmp"
  413. #define SMASH_FONT "Fonts/smash.fnt"
  414. #define HEAD_FONT_HEIGHT 36
  415. #define ITEM_FONT_HEIGHT 28
  416. #define ITEM_FONT_HEIGHT_SMALLER 24
  417. // This is used when setting up font's for GUI's. The size doesn't matter, but we do have to
  418. // supply a value, so just for kicks, let's use the same one each time. Since we use RFont to
  419. // try to figure out how many font sizes are used, we want this to be a cached size.
  420. #define DEFAULT_GUI_FONT_HEIGHT 19
  421. #define HEAD_COLOR MAKE_U32_COLOR(160, 0, 0, 0)
  422. #define HEAD_SHADOW_COLOR MAKE_U32_COLOR( 64, 16, 16, 0)
  423. #define ITEM_COLOR MAKE_U32_COLOR(160, 0, 0, 0)
  424. #define ITEM_SHADOW_COLOR MAKE_U32_COLOR( 64, 16, 16, 0)
  425. // Background color index for where there is no menu graphic.
  426. #define MENU_BG_COLOR 252
  427. // Starting palette entry to set.
  428. #define PAL_SET_START 0
  429. // Number of palette entries to set.
  430. #define PAL_SET_NUM 230
  431. // Starting palette entry we can map menu colors to.
  432. #define PAL_MAP_START 10
  433. // Number of palette entries we can map menu colors to.
  434. #define PAL_MAP_NUM 236
  435. #define GUI_GAMMA_FILE "Menu/GammaSB.gui"
  436. #define GUI_CONNECT_IP_FILE "Menu/JoinIP.gui"
  437. #define GUI_HOST_NAME_FILE "Menu/HostName.gui"
  438. #define PLAYER_NAME_GUI_FILE "Menu/PlayerName.gui"
  439. #define PLAYER_COLOR_GUI_FILE "Menu/PlayerColor.gui"
  440. #define GUI_CHECKBOX_FILE "Menu/CheckBox0.gui"
  441. #define GUI_DIFFICULTY_FILE "Menu/Difficulty.gui"
  442. #define GUI_VOLUME_FILE "Menu/VolumeSB.gui"
  443. #define NET_PORT_GUI_FILE "Menu/NetPort.gui"
  444. #define NET_PROTO_GUI_FILE "Menu/NetProto.gui"
  445. #define NET_CONNECTION_GUI_FILE "Menu/NetConnectionTxt.gui"
  446. #define GUI_MOUSE_SENSITIVITY_FILE "Menu/MouseSensitivitySB.gui"
  447. #define GUI_ROTATION_FILE "Menu/RotationSB.gui"
  448. #define GUI_TAP_ROTATION_FILE "Menu/TapRotationSB.gui"
  449. #define GUI_ID_GRIPRADIUS_VAL 10
  450. #define GUI_ID_GAMMA_VAL 10
  451. #define GUI_ID_SENSITIVITY_VAL 10
  452. #define GUI_ID_ROTATION_VAL 10
  453. #define GUI_ID_VOLUME_VAL 10
  454. #define GUI_ID_DIFFICULTY_SLIDER 8000
  455. #define GUI_ID_DIFFICULTY_TEXT 8001
  456. #define GUI_ID_DIFFICULTY_VAL 8002
  457. #define MIN_GAMMA_VAL 50
  458. #define MAX_GAMMA_VAL 205
  459. #define GAMMA_RANGE (MAX_GAMMA_VAL - MIN_GAMMA_VAL)
  460. #define USER_VOLUME_RANGE 11
  461. #define MOUSE_SENSITIVITY_DIVISOR 5.0
  462. // Determines the number of elements in the passed array at compile time.
  463. #define NUM_ELEMENTS(a) (sizeof(a) / sizeof(a[0]) )
  464. ////////////////////////////////////////////////////////////////////////////////
  465. // Function prototypes
  466. ////////////////////////////////////////////////////////////////////////////////
  467. ////////////////////////////////////////////////////////////////////////////////
  468. // Menu callbacks.
  469. static short MainMenuInit( // Returns 0 on succes, non-zero to cancel menu.
  470. Menu* pmenuCurrent, // In: Menu being init'ed or killed.
  471. short sInit); // In: TRUE, if initializing; FALSE, if killing.
  472. static bool MainMenuChoice( // Returns true to accept, false to deny choice.
  473. Menu* pmenuCurrent, // Current menu.
  474. short sMenuItem); // Item chosen.
  475. static bool VerifyExitMenuChoice( // Returns true to accept, false to deny choice.
  476. Menu* pmenuCurrent, // Current menu.
  477. short sMenuItem); // Item chosen.
  478. static bool ClientGameMenuChoice( // Returns true to accept, false to deny choice.
  479. Menu* pmenuCurrent, // Current menu.
  480. short sMenuItem); // Item chosen.
  481. static bool EditorMenuChoice( // Returns true to accept, false to deny choice.
  482. Menu* pmenuCurrent, // Current menu.
  483. short sMenuItem); // Item chosen.
  484. static bool StartGameMenu( // Returns true to accept, false to deny choice.
  485. Menu* pmenuCurrent, // Current menu.
  486. short sMenuItem); // Item chosen.
  487. static short StartGameInit( // Returns 0 on success, non-zero to cancel menu.
  488. Menu* pmenuCur, // Current menu.
  489. short sInit); // TRUE, if initializing; FALSE, if killing.
  490. static bool StartSingleMenu( // Returns true to accept, false to deny choice.
  491. Menu* pmenuCurrent, // Current menu.
  492. short sMenuItem); // Item chosen.
  493. static short ChallengeInit( // Returns 0 on success, non-zero to cancel menu.
  494. Menu* pmenuCur, // Current menu.
  495. short sInit); // TRUE, if initializing; FALSE, if killing.
  496. static bool ChallengeChoice( // Returns true to accept, false to deny choice.
  497. Menu* pmenuCurrent, // Current menu.
  498. short sMenuItem); // Item chosen.
  499. static short StartSingleInit( // Returns 0 on success, non-zero to cancel menu.
  500. Menu* pmenuCur, // Current menu.
  501. short sInit); // TRUE, if initializing; FALSE, if killing.
  502. static bool StartMultiMenu( // Returns true to accept, false to deny choice.
  503. Menu* pmenuCurrent, // Current menu.
  504. short sMenuItem); // Item chosen.
  505. static short StartMultiInit( // Returns 0 on success, non-zero to cancel menu.
  506. Menu* pmenuCur, // Current menu.
  507. short sInit); // TRUE, if initializing; FALSE, if killing.
  508. static bool JoinMultiMenu( // Returns true to accept, false to deny choice.
  509. Menu* pmenuCurrent, // Current menu.
  510. short sMenuItem); // Item chosen.
  511. static short JoinMultiInit( // Returns 0 on success, non-zero to cancel menu.
  512. Menu* pmenuCur, // Current menu.
  513. short sInit); // TRUE, if initializing; FALSE, if killing.
  514. static bool HostMultiMenu( // Returns true to accept, false to deny choice.
  515. Menu* pmenuCurrent, // Current menu.
  516. short sMenuItem); // Item chosen.
  517. static short HostMultiInit( // Returns 0 on success, non-zero to cancel menu.
  518. Menu* pmenuCur, // Current menu.
  519. short sInit); // TRUE, if initializing; FALSE, if killing.
  520. static bool StartDemoMenu( // Returns true to accept, false to deny choice.
  521. Menu* pmenuCurrent, // Current menu.
  522. short sMenuItem); // Item chosen.
  523. static short StartDemoInit( // Returns 0 on success, non-zero to cancel menu.
  524. Menu* pmenuCur, // Current menu.
  525. short sInit); // TRUE, if initializing; FALSE, if killing.
  526. static short OptionsInit( // Returns 0 on success, non-zero to cancel menu.
  527. Menu* pmenuCur, // Current menu.
  528. short sInit); // TRUE, if initializing; FALSE, if killing.
  529. static bool OptionsChoice( // Returns true to accept, false to deny choice.
  530. Menu* pmenuCurrent, // Current menu.
  531. short sMenuItem); // Item chosen.
  532. static short PlayOptionsInit( // Returns 0 on success, non-zero to cancel menu.
  533. Menu* pmenuCur, // Current menu.
  534. short sInit); // TRUE, if initializing; FALSE, if killing.
  535. static bool PlayOptionsChoice( // Returns true to accept, false to deny choice.
  536. Menu* pmenuCurrent, // Current menu.
  537. short sMenuItem); // Item chosen.
  538. static short VideoOptionsInit( // Returns 0 on success, non-zero to cancel menu.
  539. Menu* pmenuCur, // Current menu.
  540. short sInit); // TRUE, if initializing; FALSE, if killing.
  541. static bool VideoOptionsChoice( // Returns true to accept, false to deny choice.
  542. Menu* pmenuCurrent, // Current menu.
  543. short sMenuItem); // Item chosen.
  544. static short AudioOptionsInit( // Returns 0 on success, non-zero to cancel menu.
  545. Menu* pmenuCur, // Current menu.
  546. short sInit); // TRUE, if initializing; FALSE, if killing.
  547. static bool AudioOptionsChoice( // Returns true to accept, false to deny choice.
  548. Menu* pmenuCurrent, // Current menu.
  549. short sMenuItem); // Item chosen.
  550. static short VolumesInit( // Returns 0 on success, non-zero to cancel menu.
  551. Menu* pmenuCur, // Current menu.
  552. short sInit); // TRUE, if initializing; FALSE, if killing.
  553. static bool VolumesChoice( // Returns true to accept, false to deny choice.
  554. Menu* pmenuCurrent, // Current menu.
  555. short sMenuItem); // Item chosen.
  556. static short ControlsInit( // Returns 0 on success, non-zero to cancel menu.
  557. Menu* pmenuCur, // Current menu.
  558. short sInit); // TRUE, if initializing; FALSE, if killing.
  559. static bool ControlsChoice( // Returns true to accept, false to deny choice.
  560. Menu* pmenuCurrent, // Current menu.
  561. short sMenuItem); // Item chosen.
  562. static short RotationInit( // Returns 0 on success, non-zero to cancel menu.
  563. Menu* pmenuCur, // Current menu.
  564. short sInit); // TRUE, if initializing; FALSE, if killing.
  565. static bool RotationChoice( // Returns true to accept, false to deny choice.
  566. Menu* pmenuCurrent, // Current menu.
  567. short sMenuItem); // Item chosen.
  568. static short MouseInit( // Returns 0 on success, non-zero to cancel menu.
  569. Menu* pmenuCur, // Current menu.
  570. short sInit); // TRUE, if initializing; FALSE, if killing.
  571. static bool MouseChoice( // Returns true to accept, false to deny choice.
  572. Menu* pmenuCurrent, // Current menu.
  573. short sMenuItem); // Item chosen.
  574. static short KeyInit( // Returns 0 on success, non-zero to cancel menu.
  575. Menu* pmenuCur, // Current menu.
  576. short sInit); // TRUE, if initializing; FALSE, if killing.
  577. static bool KeyChoice( // Returns true to accept, false to deny choice.
  578. Menu* pmenuCurrent, // Current menu.
  579. short sMenuItem); // Item chosen.
  580. static short JoyInit( // Returns 0 on success, non-zero to cancel menu.
  581. Menu* pmenuCur, // Current menu.
  582. short sInit); // TRUE, if initializing; FALSE, if killing.
  583. static bool JoyChoice( // Returns true to accept, false to deny choice.
  584. Menu* pmenuCurrent, // Current menu.
  585. short sMenuItem); // Item chosen.
  586. static short MultiOptionsInit( // Returns 0 on success, non-zero to cancel menu.
  587. Menu* pmenuCur, // Current menu.
  588. short sInit); // TRUE, if initializing; FALSE, if killing.
  589. static bool MultiOptionsChoice( // Returns true to accept, false to deny choice.
  590. Menu* pmenuCur, // Current menu.
  591. short sMenuItem); // Item chosen.
  592. static short FeaturesInit( // Returns 0 on success, non-zero to cancel menu.
  593. Menu* pmenuCur, // Current menu.
  594. short sInit); // TRUE, if initializing; FALSE, if killing.
  595. static bool FeaturesChoice( // Returns true to accept, false to deny choice.
  596. Menu* pmenuCur, // Current menu.
  597. short sMenuItem); // Item chosen.
  598. ////////////////////////////////////////////////////////////////////////////////
  599. // GUI callbacks.
  600. static void GammaScrollUpdate( // Returns nothing.
  601. RScrollBar* psb); // Scrollbar that got updated.
  602. static void DifficultyScrollUpdate( // Returns nothing.
  603. RScrollBar* psb); // Scrollbar that got updated.
  604. static void VolumesScrollUpdate( // Returns nothing.
  605. RScrollBar* psb); // Scrollbar that got updated.
  606. static void MouseSensitivityScrollUpdate( // Returns nothing.
  607. RScrollBar* psb); // Scrollbar that got updated.
  608. static void RotationScrollUpdateDouble( // Returns nothing.
  609. RScrollBar* psb); // Scrollbar that got updated.
  610. static void RotationScrollUpdateShort( // Returns nothing.
  611. RScrollBar* psb); // Scrollbar that got updated.
  612. ////////////////////////////////////////////////////////////////////////////////
  613. // Variables/data
  614. ////////////////////////////////////////////////////////////////////////////////
  615. CMenuSettings g_MenuSettings;
  616. // Controls.
  617. static RScrollBar* ms_psbGamma = NULL;
  618. static REdit* ms_peditConnect = NULL;
  619. static REdit* ms_peditHostName = NULL;
  620. static REdit* ms_peditName = NULL;
  621. static RTxt* ms_ptxtColor = NULL;
  622. static RTxt* ms_ptxtProto = NULL;
  623. static RMultiBtn* ms_pmbCheckBox = NULL;
  624. static RScrollBar* ms_psbDifficulty = NULL;
  625. static RScrollBar* ms_psbMouseSensitivityX = NULL;
  626. static RScrollBar* ms_psbMouseSensitivityY = NULL;
  627. static RTxt* ms_ptxtBandwidth = NULL;
  628. static SampleMaster::SoundInstance ms_siLastSamplePlayed = 0; // Last sample played.
  629. static SampleMasterID* ms_apsmidVolumeTesters[SampleMaster::MAX_NUM_SOUND_CATEGORIES] =
  630. {
  631. &g_smidEmptyWeapon, // Unspecified
  632. &g_smidMusicTester, // BackgroundMusic
  633. &g_smidShotgun, // Weapon
  634. &g_smidLoadedWeapon, // UserFeedBack
  635. &g_smidRocketExplode, // Destruction
  636. &g_smidAmbientTester, // Ambient
  637. &g_smidDemonBleed, // Demon.
  638. &g_smidSteveScumbag, // Voices.
  639. &g_smidMikeAhh, // Pain
  640. &g_smidWrithing2, // Suffering
  641. };
  642. static char* ms_apszDifficultyDescriptions[] =
  643. {
  644. "Easy",
  645. "Easy",
  646. "Easy",
  647. "Medium",
  648. "Medium",
  649. "Medium",
  650. "Hard",
  651. "Hard",
  652. "Hard",
  653. "Hard",
  654. "Masochist",
  655. };
  656. // Main menu
  657. extern Menu menuMain =
  658. {
  659. MAIN_MENU_ID,
  660. // Position info.
  661. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  662. MENU_RECT_SM, // menu x, y, w, h
  663. -60, // menu header x offset
  664. MENU_HEAD_Y_SM, // menu header y offset
  665. MENU_ITEM_X_SM, // menu items x offset
  666. MENU_ITEM_Y_SM, // menu items y offset
  667. MENU_ITEM_SPACE_Y_SM, // vertical space between menu items
  668. MENU_ITEM_IND_SPACE_X_SM, // horizontal space between indicator and menu items
  669. },
  670. // Background info.
  671. { // pszFile, u32BackColor, sStartIndex, sNumEntries
  672. MENU_BG_SM,
  673. MENU_BG_COLOR, // Background color.
  674. PAL_SET_START, // Starting palette index to set.
  675. PAL_SET_NUM, // Number of entries to set.
  676. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  677. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  678. },
  679. // GUI settings.
  680. { // sTransparent.
  681. TRUE // TRUE if GUI is to be BLiT with transparency.
  682. },
  683. // Flags.
  684. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  685. // Header and its font info.
  686. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  687. g_pszMainMenu_Title,
  688. SMASH_FONT,
  689. HEAD_FONT_HEIGHT, // Height of font.
  690. HEAD_COLOR, // Text RGBA.
  691. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  692. },
  693. // Font info.
  694. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  695. SMASH_FONT,
  696. ITEM_FONT_HEIGHT, // Height of font.
  697. ITEM_COLOR, // Text RGBA.
  698. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  699. },
  700. // Menu indicator.
  701. { // pszFile, type
  702. MENU_INDICATOR,
  703. RImage::FSPR8
  704. },
  705. // Menu callbacks.
  706. { // fnInit, fnChoice,
  707. MainMenuInit, // Called before menu is initialized.
  708. MainMenuChoice // Called when item is chosen.
  709. },
  710. // Menu auto items.
  711. { // sDefaultItem, sCancelItem,
  712. 0, // Menu item (index in ami[]) selected initially.
  713. // Negative indicates distance from number of items
  714. // (e.g., -1 is the last item).
  715. -1, // Menu item (index in ami[]) chosen on cancel.
  716. // Negative indicates distance from number of items
  717. // (e.g., -1 is the last item).
  718. },
  719. // Menu items.
  720. #if defined(SPAWN)
  721. { // pszText, sEnabled, pmenu, pgui
  722. { g_pszStartMultiplayerMenu_Join,TRUE, &menuJoinMulti, NULL, },
  723. { g_pszMainMenu_Options, TRUE, &menuOptions, NULL, },
  724. { g_pszMainMenu_Exit, TRUE, &menuVerifyExit, NULL, },
  725. NULL // Terminates list.
  726. },
  727. #else
  728. { // pszText, sEnabled, pmenu, pgui
  729. { g_pszMainMenu_Start, TRUE, &menuStartSingle/*menuStart*/, NULL, },
  730. { g_pszMainMenu_Options, TRUE, &menuOptions, NULL, },
  731. #ifndef EDITOR_REMOVED
  732. { g_pszMainMenu_Editor, TRUE, NULL, NULL, },
  733. #endif
  734. #if defined(DEMO)
  735. { g_pszMainMenu_Buy, TRUE, NULL, NULL, },
  736. #endif
  737. { g_pszMainMenu_Exit, TRUE, &menuVerifyExit, NULL, },
  738. NULL // Terminates list.
  739. },
  740. #endif
  741. };
  742. // Verify exit menu
  743. extern Menu menuVerifyExit =
  744. {
  745. VERIFY_EXIT_MENU_ID,
  746. // Position info.
  747. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  748. MENU_RECT_SM, // menu x, y, w, h
  749. -120, // menu header x offset
  750. MENU_HEAD_Y_SM, // menu header y offset
  751. MENU_ITEM_X_SM, // menu items x offset
  752. MENU_ITEM_Y_SM, // menu items y offset
  753. MENU_ITEM_SPACE_Y_SM, // vertical space between menu items
  754. MENU_ITEM_IND_SPACE_X_SM, // horizontal space between indicator and menu items
  755. },
  756. // Background info.
  757. { // pszFile, u32BackColor
  758. MENU_BG_SM,
  759. MENU_BG_COLOR, // Background color.
  760. PAL_SET_START, // Starting palette index to set.
  761. PAL_SET_NUM, // Number of entries to set.
  762. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  763. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  764. },
  765. // GUI settings.
  766. { // sTransparent.
  767. TRUE, // TRUE if GUI is to be BLiT with transparency.
  768. },
  769. // Flags.
  770. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  771. // Header and its font info.
  772. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  773. g_pszVerifyExitMenu_Title,
  774. SMASH_FONT,
  775. HEAD_FONT_HEIGHT, // Height of font.
  776. HEAD_COLOR, // Text RGBA.
  777. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  778. },
  779. // Font info.
  780. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  781. SMASH_FONT,
  782. ITEM_FONT_HEIGHT, // Height of font.
  783. ITEM_COLOR, // Text RGBA.
  784. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  785. },
  786. // Menu indicator.
  787. { // pszFile, type
  788. MENU_INDICATOR,
  789. RImage::FSPR8,
  790. },
  791. // Menu callbacks.
  792. { // fnInit, fnChoice,
  793. NULL, // Called before menu is initialized.
  794. VerifyExitMenuChoice, // Called when item is chosen.
  795. },
  796. // Menu auto items.
  797. { // sDefaultItem, sCancelItem,
  798. 0, // Menu item (index in ami[]) selected initially.
  799. // Negative indicates distance from number of items
  800. // (e.g., -1 is the last item).
  801. -1, // Menu item (index in ami[]) chosen on cancel.
  802. // Negative indicates distance from number of items
  803. // (e.g., -1 is the last item).
  804. },
  805. // Menu items.
  806. { // pszText, sEnabled, pmenu, pgui
  807. { g_pszVerifyExitMenu_Yes, TRUE, NULL, NULL, },
  808. { g_pszVerifyExitMenu_No, TRUE, &menuMain, NULL, },
  809. NULL // Terminates list.
  810. },
  811. };
  812. // Verify exit menu
  813. extern Menu g_menuVerifyQuitGame =
  814. {
  815. VERIFY_QUIT_GAME_MENU_ID,
  816. // Position info.
  817. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  818. MENU_RECT_MD, // menu x, y, w, h
  819. -120, // menu header x offset
  820. MENU_HEAD_Y_MD, // menu header y offset
  821. MENU_ITEM_X_MD, // menu items x offset
  822. MENU_ITEM_Y_MD, // menu items y offset
  823. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  824. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  825. },
  826. // Background info.
  827. { // pszFile, u32BackColor
  828. MENU_BG_MD,
  829. MENU_BG_COLOR, // Background color.
  830. PAL_SET_START, // Starting palette index to set.
  831. PAL_SET_NUM, // Number of entries to set.
  832. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  833. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  834. },
  835. // GUI settings.
  836. { // sTransparent.
  837. TRUE, // TRUE if GUI is to be BLiT with transparency.
  838. },
  839. // Flags.
  840. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  841. // Header and its font info.
  842. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  843. g_pszVerifyQuitMenu_Title,
  844. SMASH_FONT,
  845. HEAD_FONT_HEIGHT, // Height of font.
  846. HEAD_COLOR, // Text RGBA.
  847. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  848. },
  849. // Font info.
  850. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  851. SMASH_FONT,
  852. ITEM_FONT_HEIGHT, // Height of font.
  853. ITEM_COLOR, // Text RGBA.
  854. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  855. },
  856. // Menu indicator.
  857. { // pszFile, type
  858. MENU_INDICATOR,
  859. RImage::FSPR8,
  860. },
  861. // Menu callbacks.
  862. { // fnInit, fnChoice,
  863. NULL, // Called before menu is initialized.
  864. Play_VerifyQuitMenuChoice, // Called when item is chosen.
  865. },
  866. // Menu auto items.
  867. { // sDefaultItem, sCancelItem,
  868. 0, // Menu item (index in ami[]) selected initially.
  869. // Negative indicates distance from number of items
  870. // (e.g., -1 is the last item).
  871. -1, // Menu item (index in ami[]) chosen on cancel.
  872. // Negative indicates distance from number of items
  873. // (e.g., -1 is the last item).
  874. },
  875. // Menu items.
  876. { // pszText, sEnabled, pmenu, pgui
  877. { g_pszVerifyQuitMenu_Yes, TRUE, NULL, NULL, },
  878. { g_pszVerifyQuitMenu_No, TRUE, NULL, NULL, },
  879. NULL // Terminates list.
  880. },
  881. };
  882. // Client game menu
  883. extern Menu menuClientGame =
  884. {
  885. CLIENT_GAME_MENU_ID,
  886. // Position info.
  887. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  888. MENU_RECT_SM, // menu x, y, w, h
  889. -60, // menu header x offset
  890. MENU_HEAD_Y_SM, // menu header y offset
  891. MENU_ITEM_X_SM, // menu items x offset
  892. MENU_ITEM_Y_SM, // menu items y offset
  893. MENU_ITEM_SPACE_Y_SM, // vertical space between menu items
  894. MENU_ITEM_IND_SPACE_X_SM, // horizontal space between indicator and menu items
  895. },
  896. // Background info.
  897. { // pszFile, u32BackColor
  898. MENU_BG_SM,
  899. MENU_BG_COLOR, // Background color.
  900. PAL_SET_START, // Starting palette index to set.
  901. PAL_SET_NUM, // Number of entries to set.
  902. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  903. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  904. },
  905. // GUI settings.
  906. { // sTransparent.
  907. TRUE, // TRUE if GUI is to be BLiT with transparency.
  908. },
  909. // Flags.
  910. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  911. // Header and its font info.
  912. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  913. g_pszGameMenu_Title,
  914. SMASH_FONT,
  915. HEAD_FONT_HEIGHT, // Height of font.
  916. HEAD_COLOR, // Text RGBA.
  917. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  918. },
  919. // Font info.
  920. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  921. SMASH_FONT,
  922. ITEM_FONT_HEIGHT, // Height of font.
  923. ITEM_COLOR, // Text RGBA.
  924. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  925. },
  926. // Menu indicator.
  927. { // pszFile, type
  928. MENU_INDICATOR,
  929. RImage::FSPR8,
  930. },
  931. // Menu callbacks.
  932. { // fnInit, fnChoice,
  933. NULL, // Called before menu is initialized.
  934. Play_VerifyQuitMenuChoice, // Called when item is chosen.
  935. },
  936. // Menu auto items.
  937. { // sDefaultItem, sCancelItem,
  938. 0, // Menu item (index in ami[]) selected initially.
  939. // Negative indicates distance from number of items
  940. // (e.g., -1 is the last item).
  941. 0, // Menu item (index in ami[]) chosen on cancel.
  942. // Negative indicates distance from number of items
  943. // (e.g., -1 is the last item).
  944. },
  945. // Menu items.
  946. { // pszText, sEnabled, pmenu, pgui
  947. { g_pszGameMenu_Continue, TRUE, NULL, NULL, },
  948. { g_pszGameMenu_Save, TRUE, NULL, NULL, },
  949. { g_pszGameMenu_Options, TRUE, &menuOptions, NULL, },
  950. { g_pszGameMenu_Quit, TRUE, NULL, NULL, },
  951. NULL // Terminates list.
  952. },
  953. };
  954. // Editor menu
  955. extern Menu menuEditor =
  956. {
  957. EDITOR_MENU_ID,
  958. // Position info.
  959. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  960. MENU_RECT_SM, // menu x, y, w, h
  961. -60, // menu header x offset
  962. MENU_HEAD_Y_SM, // menu header y offset
  963. MENU_ITEM_X_SM, // menu items x offset
  964. MENU_ITEM_Y_SM, // menu items y offset
  965. MENU_ITEM_SPACE_Y_SM, // vertical space between menu items
  966. MENU_ITEM_IND_SPACE_X_SM, // horizontal space between indicator and menu items
  967. },
  968. // Background info.
  969. { // pszFile, u32BackColor
  970. MENU_BG_SM,
  971. MENU_BG_COLOR, // Background color.
  972. PAL_SET_START, // Starting palette index to set.
  973. PAL_SET_NUM, // Number of entries to set.
  974. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  975. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  976. },
  977. // GUI settings.
  978. { // sTransparent.
  979. TRUE, // TRUE if GUI is to be BLiT with transparency.
  980. },
  981. // Flags.
  982. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  983. // Header and its font info.
  984. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  985. g_pszEditorMenu_Title,
  986. SMASH_FONT,
  987. HEAD_FONT_HEIGHT, // Height of font.
  988. HEAD_COLOR, // Text RGBA.
  989. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  990. },
  991. // Font info.
  992. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  993. SMASH_FONT,
  994. ITEM_FONT_HEIGHT, // Height of font.
  995. ITEM_COLOR, // Text RGBA.
  996. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  997. },
  998. // Menu indicator.
  999. { // pszFile, type
  1000. MENU_INDICATOR,
  1001. RImage::FSPR8,
  1002. },
  1003. // Menu callbacks.
  1004. { // fnInit, fnChoice,
  1005. NULL, // Called before menu is initialized.
  1006. EditorMenuChoice, // Called when item is chosen.
  1007. },
  1008. // Menu auto items.
  1009. { // sDefaultItem, sCancelItem,
  1010. 0, // Menu item (index in ami[]) selected initially.
  1011. // Negative indicates distance from number of items
  1012. // (e.g., -1 is the last item).
  1013. 0, // Menu item (index in ami[]) chosen on cancel.
  1014. // Negative indicates distance from number of items
  1015. // (e.g., -1 is the last item).
  1016. },
  1017. // Menu items.
  1018. { // pszText, sEnabled, pmenu, pgui
  1019. { g_pszEditorMenu_Continue, TRUE, NULL, NULL, },
  1020. { g_pszEditorMenu_Options, TRUE, &menuOptions, NULL, },
  1021. { g_pszEditorMenu_Quit, TRUE, NULL, NULL, },
  1022. NULL // Terminates list.
  1023. },
  1024. };
  1025. // Options menu.
  1026. extern Menu menuOptions =
  1027. {
  1028. OPTIONS_MENU_ID,
  1029. // Position info.
  1030. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1031. MENU_RECT_MD, // menu x, y, w, h
  1032. -60, // menu header x offset
  1033. MENU_HEAD_Y_MD, // menu header y offset
  1034. MENU_ITEM_X_MD, // menu items x offset
  1035. MENU_ITEM_Y_MD, // menu items y offset
  1036. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  1037. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  1038. },
  1039. // Background info.
  1040. { // pszFile, u32BackColor
  1041. MENU_BG_MD,
  1042. MENU_BG_COLOR, // Background color.
  1043. PAL_SET_START, // Starting palette index to set.
  1044. PAL_SET_NUM, // Number of entries to set.
  1045. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1046. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1047. },
  1048. // GUI settings.
  1049. { // sTransparent.
  1050. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1051. },
  1052. // Flags.
  1053. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  1054. // Header and its font info.
  1055. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1056. g_pszOptionsMenu_Title,
  1057. SMASH_FONT,
  1058. HEAD_FONT_HEIGHT, // Height of font.
  1059. HEAD_COLOR, // Text RGBA.
  1060. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1061. },
  1062. // Font info.
  1063. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1064. SMASH_FONT,
  1065. ITEM_FONT_HEIGHT, // Height of font.
  1066. ITEM_COLOR, // Text RGBA.
  1067. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1068. },
  1069. // Menu indicator.
  1070. { // pszFile, type
  1071. MENU_INDICATOR,
  1072. RImage::FSPR8,
  1073. },
  1074. // Menu callbacks.
  1075. { // fnInit, fnChoice,
  1076. OptionsInit, // Called before menu is initialized.
  1077. OptionsChoice, // Called when item is chosen.
  1078. },
  1079. // Menu auto items.
  1080. { // sDefaultItem, sCancelItem,
  1081. 0, // Menu item (index in ami[]) selected initially.
  1082. // Negative indicates distance from number of items
  1083. // (e.g., -1 is the last item).
  1084. -1, // Menu item (index in ami[]) chosen on cancel.
  1085. // Negative indicates distance from number of items
  1086. // (e.g., -1 is the last item).
  1087. },
  1088. // Menu items.
  1089. { // pszText, sEnabled, pmenu, pgui
  1090. #if 0
  1091. { g_pszOptionsMenu_Video, TRUE, &menuVideoOptions, NULL, },
  1092. #endif
  1093. { g_pszOptionsMenu_Audio, TRUE, &menuAudioOptions, NULL, },
  1094. { g_pszOptionsMenu_Controls, TRUE, &menuControls, NULL, },
  1095. #ifndef MULTIPLAYER_REMOVED
  1096. { g_pszOptionsMenu_Multiplayer, TRUE, &menuMultiOptions, NULL, },
  1097. #endif
  1098. { g_pszOptionsMenu_Performance, TRUE, &menuFeatures, NULL, },
  1099. { g_pszOptionsMenu_Difficulty, TRUE, &menuPlayOptions, NULL, },
  1100. { g_pszOptionsMenu_Crosshair, TRUE, NULL, NULL, },
  1101. { "", FALSE, NULL, NULL, },
  1102. NULL // Terminates list.
  1103. },
  1104. };
  1105. // Options menu.
  1106. extern Menu menuPlayOptions =
  1107. {
  1108. PLAYOPTIONS_MENU_ID,
  1109. // Position info.
  1110. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1111. MENU_RECT_MD, // menu x, y, w, h
  1112. -60, // menu header x offset
  1113. MENU_HEAD_Y_MD, // menu header y offset
  1114. MENU_ITEM_X_MD, // menu items x offset
  1115. MENU_ITEM_Y_MD, // menu items y offset
  1116. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  1117. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  1118. },
  1119. // Background info.
  1120. { // pszFile, u32BackColor
  1121. MENU_BG_MD,
  1122. MENU_BG_COLOR, // Background color.
  1123. PAL_SET_START, // Starting palette index to set.
  1124. PAL_SET_NUM, // Number of entries to set.
  1125. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1126. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1127. },
  1128. // GUI settings.
  1129. { // sTransparent.
  1130. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1131. },
  1132. // Flags.
  1133. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  1134. // Header and its font info.
  1135. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1136. g_pszDifficultyMenu_Title,
  1137. SMASH_FONT,
  1138. HEAD_FONT_HEIGHT, // Height of font.
  1139. HEAD_COLOR, // Text RGBA.
  1140. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1141. },
  1142. // Font info.
  1143. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1144. SMASH_FONT,
  1145. ITEM_FONT_HEIGHT, // Height of font.
  1146. ITEM_COLOR, // Text RGBA.
  1147. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1148. },
  1149. // Menu indicator.
  1150. { // pszFile, type
  1151. MENU_INDICATOR,
  1152. RImage::FSPR8,
  1153. },
  1154. // Menu callbacks.
  1155. { // fnInit, fnChoice,
  1156. PlayOptionsInit, // Called before menu is initialized.
  1157. PlayOptionsChoice, // Called when item is chosen.
  1158. },
  1159. // Menu auto items.
  1160. { // sDefaultItem, sCancelItem,
  1161. 0, // Menu item (index in ami[]) selected initially.
  1162. // Negative indicates distance from number of items
  1163. // (e.g., -1 is the last item).
  1164. -1, // Menu item (index in ami[]) chosen on cancel.
  1165. // Negative indicates distance from number of items
  1166. // (e.g., -1 is the last item).
  1167. },
  1168. // Menu items.
  1169. { // pszText, sEnabled, pmenu, pgui
  1170. { g_pszDifficultyMenu_SetDifficulty, TRUE, NULL, NULL, },
  1171. { "", FALSE, NULL, NULL, },
  1172. NULL // Terminates list.
  1173. },
  1174. };
  1175. // Postal music organ:
  1176. extern Menu menuOrgan =
  1177. {
  1178. ORGAN_MENU_ID,
  1179. // Position info.
  1180. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1181. MENU_RECT_MD, // menu x, y, w, h
  1182. -60, // menu header x offset
  1183. MENU_HEAD_Y_MD, // menu header y offset
  1184. MENU_ITEM_X_MD, // menu items x offset
  1185. MENU_ITEM_Y_MD, // menu items y offset
  1186. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  1187. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  1188. },
  1189. // Background info.
  1190. { // pszFile, u32BackColor
  1191. MENU_BG_MD,
  1192. MENU_BG_COLOR, // Background color.
  1193. PAL_SET_START, // Starting palette index to set.
  1194. PAL_SET_NUM, // Number of entries to set.
  1195. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1196. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1197. },
  1198. // GUI settings.
  1199. { // sTransparent.
  1200. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1201. },
  1202. // Flags.
  1203. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  1204. // Header and its font info.
  1205. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1206. g_pszOrganMenu_Title,
  1207. SMASH_FONT,
  1208. HEAD_FONT_HEIGHT, // Height of font.
  1209. HEAD_COLOR, // Text RGBA.
  1210. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1211. },
  1212. // Font info.
  1213. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1214. SMASH_FONT,
  1215. ITEM_FONT_HEIGHT, // Height of font.
  1216. ITEM_COLOR, // Text RGBA.
  1217. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1218. },
  1219. // Menu indicator.
  1220. { // pszFile, type
  1221. MENU_INDICATOR,
  1222. RImage::FSPR8,
  1223. },
  1224. // Menu callbacks.
  1225. { // fnInit, fnChoice,
  1226. NULL, // Called before menu is initialized.
  1227. Organ_MenuChoice, // Called when item is chosen.
  1228. },
  1229. // Menu auto items.
  1230. { // sDefaultItem, sCancelItem,
  1231. 0, // Menu item (index in ami[]) selected initially.
  1232. // Negative indicates distance from number of items
  1233. // (e.g., -1 is the last item).
  1234. -1, // Menu item (index in ami[]) chosen on cancel.
  1235. // Negative indicates distance from number of items
  1236. // (e.g., -1 is the last item).
  1237. },
  1238. // Menu items.
  1239. { // pszText, sEnabled, pmenu, pgui
  1240. { "", FALSE, NULL, NULL, },
  1241. { g_pszOrganMenu_SpecialKeysHeading, FALSE, NULL, NULL, },
  1242. { g_pszOrganMenu_NumericKeysFunction, FALSE, NULL, NULL, },
  1243. { g_pszOrganMenu_AlphaKeysFunction, FALSE, NULL, NULL, },
  1244. { g_pszOrganMenu_TabKeyFunction, FALSE, NULL, NULL, },
  1245. { "", FALSE, NULL, NULL, },
  1246. { g_pszOrganMenu_Exit, TRUE, NULL, NULL, },
  1247. NULL // Terminates list.
  1248. },
  1249. };
  1250. // Audio Options menu.
  1251. extern Menu menuAudioOptions =
  1252. {
  1253. AUDIO_MENU_ID,
  1254. // Position info.
  1255. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1256. MENU_RECT_SM, // menu x, y, w, h
  1257. -60, // menu header x offset
  1258. MENU_HEAD_Y_SM, // menu header y offset
  1259. MENU_ITEM_X_SM, // menu items x offset
  1260. MENU_ITEM_Y_SM, // menu items y offset
  1261. MENU_ITEM_SPACE_Y_SM, // vertical space between menu items
  1262. MENU_ITEM_IND_SPACE_X_SM, // horizontal space between indicator and menu items
  1263. },
  1264. // Background info.
  1265. { // pszFile, u32BackColor
  1266. MENU_BG_SM,
  1267. MENU_BG_COLOR, // Background color.
  1268. PAL_SET_START, // Starting palette index to set.
  1269. PAL_SET_NUM, // Number of entries to set.
  1270. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1271. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1272. },
  1273. // GUI settings.
  1274. { // sTransparent.
  1275. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1276. },
  1277. // Flags.
  1278. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  1279. // Header and its font info.
  1280. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1281. g_pszAudioMenu_Title,
  1282. SMASH_FONT,
  1283. HEAD_FONT_HEIGHT, // Height of font.
  1284. HEAD_COLOR, // Text RGBA.
  1285. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1286. },
  1287. // Font info.
  1288. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1289. SMASH_FONT,
  1290. ITEM_FONT_HEIGHT, // Height of font.
  1291. ITEM_COLOR, // Text RGBA.
  1292. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1293. },
  1294. // Menu indicator.
  1295. { // pszFile, type
  1296. MENU_INDICATOR,
  1297. RImage::FSPR8,
  1298. },
  1299. // Menu callbacks.
  1300. { // fnInit, fnChoice,
  1301. AudioOptionsInit, // Called before menu is initialized.
  1302. AudioOptionsChoice, // Called when item is chosen.
  1303. },
  1304. // Menu auto items.
  1305. { // sDefaultItem, sCancelItem,
  1306. 0, // Menu item (index in ami[]) selected initially.
  1307. // Negative indicates distance from number of items
  1308. // (e.g., -1 is the last item).
  1309. -1, // Menu item (index in ami[]) chosen on cancel.
  1310. // Negative indicates distance from number of items
  1311. // (e.g., -1 is the last item).
  1312. },
  1313. // Menu items.
  1314. { // pszText, sEnabled, pmenu, pgui
  1315. { g_pszAudioMenu_Mixer, TRUE, &menuVolumes, NULL, },
  1316. { g_pszAudioMenu_SoundTest, TRUE, &menuOrgan, NULL, },
  1317. { "", FALSE, NULL, NULL, },
  1318. NULL // Terminates list.
  1319. },
  1320. };
  1321. // Video Options menu.
  1322. extern Menu menuVideoOptions =
  1323. {
  1324. VIDEO_MENU_ID,
  1325. // Position info.
  1326. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1327. MENU_RECT_SM, // menu x, y, w, h
  1328. -60, // menu header x offset
  1329. MENU_HEAD_Y_SM, // menu header y offset
  1330. MENU_ITEM_X_SM, // menu items x offset
  1331. MENU_ITEM_Y_SM, // menu items y offset
  1332. MENU_ITEM_SPACE_Y_SM, // vertical space between menu items
  1333. MENU_ITEM_IND_SPACE_X_SM, // horizontal space between indicator and menu items
  1334. },
  1335. // Background info.
  1336. { // pszFile, u32BackColor
  1337. MENU_BG_SM,
  1338. MENU_BG_COLOR, // Background color.
  1339. PAL_SET_START, // Starting palette index to set.
  1340. PAL_SET_NUM, // Number of entries to set.
  1341. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1342. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1343. },
  1344. // GUI settings.
  1345. { // sTransparent.
  1346. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1347. },
  1348. // Flags.
  1349. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  1350. // Header and its font info.
  1351. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1352. g_pszVideoMenu_Title,
  1353. SMASH_FONT,
  1354. HEAD_FONT_HEIGHT, // Height of font.
  1355. HEAD_COLOR, // Text RGBA.
  1356. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1357. },
  1358. // Font info.
  1359. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1360. SMASH_FONT,
  1361. ITEM_FONT_HEIGHT, // Height of font.
  1362. ITEM_COLOR, // Text RGBA.
  1363. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1364. },
  1365. // Menu indicator.
  1366. { // pszFile, type
  1367. MENU_INDICATOR,
  1368. RImage::FSPR8,
  1369. },
  1370. // Menu callbacks.
  1371. { // fnInit, fnChoice,
  1372. VideoOptionsInit, // Called before menu is initialized.
  1373. VideoOptionsChoice, // Called when item is chosen.
  1374. },
  1375. // Menu auto items.
  1376. { // sDefaultItem, sCancelItem,
  1377. 0, // Menu item (index in ami[]) selected initially.
  1378. // Negative indicates distance from number of items
  1379. // (e.g., -1 is the last item).
  1380. -1, // Menu item (index in ami[]) chosen on cancel.
  1381. // Negative indicates distance from number of items
  1382. // (e.g., -1 is the last item).
  1383. },
  1384. // Menu items.
  1385. { // pszText, sEnabled, pmenu, pgui
  1386. { g_pszVideoMenu_Gamma, TRUE, NULL, NULL, },
  1387. { "", FALSE, NULL, NULL, },
  1388. NULL // Terminates list.
  1389. },
  1390. };
  1391. // Controls menu.
  1392. extern Menu menuControls =
  1393. {
  1394. CONTROLS_MENU_ID,
  1395. // Position info.
  1396. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1397. MENU_RECT_LG, // menu x, y, w, h
  1398. -60, // menu header x offset
  1399. MENU_HEAD_Y_LG, // menu header y offset
  1400. MENU_ITEM_X_LG, // menu items x offset
  1401. MENU_ITEM_Y_LG, // menu items y offset
  1402. MENU_ITEM_SPACE_Y_LG, // vertical space between menu items
  1403. MENU_ITEM_IND_SPACE_X_LG, // horizontal space between indicator and menu items
  1404. },
  1405. // Background info.
  1406. { // pszFile, u32BackColor
  1407. MENU_BG_LG,
  1408. MENU_BG_COLOR, // Background color.
  1409. PAL_SET_START, // Starting palette index to set.
  1410. PAL_SET_NUM, // Number of entries to set.
  1411. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1412. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1413. },
  1414. // GUI settings.
  1415. { // sTransparent.
  1416. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1417. },
  1418. // Flags.
  1419. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  1420. // Header and its font info.
  1421. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1422. g_pszControlsMenu_Title,
  1423. SMASH_FONT,
  1424. HEAD_FONT_HEIGHT, // Height of font.
  1425. HEAD_COLOR, // Text RGBA.
  1426. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1427. },
  1428. // Font info.
  1429. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1430. SMASH_FONT,
  1431. ITEM_FONT_HEIGHT, // Height of font.
  1432. ITEM_COLOR, // Text RGBA.
  1433. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1434. },
  1435. // Menu indicator.
  1436. { // pszFile, type
  1437. MENU_INDICATOR,
  1438. RImage::FSPR8,
  1439. },
  1440. // Menu callbacks.
  1441. { // fnInit, fnChoice,
  1442. ControlsInit, // Called before menu is initialized.
  1443. ControlsChoice, // Called when item is chosen.
  1444. },
  1445. // Menu auto items.
  1446. { // sDefaultItem, sCancelItem,
  1447. 0, // Menu item (index in ami[]) selected initially.
  1448. // Negative indicates distance from number of items
  1449. // (e.g., -1 is the last item).
  1450. -1, // Menu item (index in ami[]) chosen on cancel.
  1451. // Negative indicates distance from number of items
  1452. // (e.g., -1 is the last item).
  1453. },
  1454. // Menu items.
  1455. { // pszText, sEnabled, pmenu, pgui
  1456. { g_pszControlsMenu_KeyboardSetup, TRUE, &menuKeyboard, NULL, },
  1457. { g_pszControlsMenu_MouseSetup, TRUE, &menuMouse, NULL, },
  1458. #if defined(ALLOW_JOYSTICK)
  1459. { g_pszControlsMenu_JoystickSetup, TRUE, &menuJoystick, NULL, },
  1460. #endif // defined(ALLOW_JOYSTICK)
  1461. { g_pszControlsMenu_TurningSpeeds, TRUE, &menuRotation, NULL, },
  1462. #if defined(ALLOW_JOYSTICK)
  1463. { g_pszControlsMenu_UseJoystick, TRUE, NULL, NULL, },
  1464. #endif // defined(ALLOW_JOYSTICK)
  1465. { g_pszControlsMenu_UseMouse, TRUE, NULL, NULL, },
  1466. { g_pszControlsMenu_HorizMouseSensitivity, TRUE, NULL, NULL, },
  1467. { g_pszControlsMenu_VertMouseSensitivity, TRUE, NULL, NULL, },
  1468. { "", FALSE, NULL, NULL, },
  1469. NULL // Terminates list.
  1470. },
  1471. };
  1472. // Keyboard menu.
  1473. extern Menu menuKeyboard =
  1474. {
  1475. KEYBOARD_MENU_ID,
  1476. // Position info.
  1477. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1478. MENU_RECT_LG, // Pos and dimensions.
  1479. 15, // Offset from left edge for menu header.
  1480. // Negative indicates offset from center.
  1481. 12, // Offset from top edge for menu header.
  1482. // Negative indicates offset from center.
  1483. 72, // Offset from left edge for menu items.
  1484. // Negative indicates offset from center.
  1485. 40, // Offset from top edge for menu items.
  1486. // Negative indicates offset from center.
  1487. -5, // Space between menu items.
  1488. 5, // Space between indicator and menu items horizontally.
  1489. -10, // X position menu items should not pass w/i Menu.
  1490. // Less than 1, indicates offset from right edge.
  1491. -20, // Y position menu items should not pass w/i Menu.
  1492. // Less than 1, indicates offset from right edge.
  1493. },
  1494. // Background info.
  1495. { // pszFile, u32BackColor
  1496. MENU_BG_LG,
  1497. MENU_BG_COLOR, // Background color.
  1498. PAL_SET_START, // Starting palette index to set.
  1499. PAL_SET_NUM, // Number of entries to set.
  1500. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1501. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1502. },
  1503. // GUI settings.
  1504. { // sTransparent.
  1505. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1506. },
  1507. // Flags.
  1508. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  1509. // Header and its font info.
  1510. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1511. g_pszKeyboardSetupMenu_Title,
  1512. SMASH_FONT,
  1513. HEAD_FONT_HEIGHT, // Height of font.
  1514. HEAD_COLOR, // Text RGBA.
  1515. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1516. },
  1517. // Font info.
  1518. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1519. SMASH_FONT,
  1520. ITEM_FONT_HEIGHT_SMALLER, // Height of font.
  1521. ITEM_COLOR, // Text RGBA.
  1522. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1523. },
  1524. // Menu indicator.
  1525. { // pszFile, type
  1526. MENU_INDICATOR,
  1527. RImage::FSPR8,
  1528. },
  1529. // Menu callbacks.
  1530. { // fnInit, fnChoice,
  1531. KeyInit, // Called before menu is initialized.
  1532. KeyChoice, // Called when item is chosen.
  1533. },
  1534. // Menu auto items.
  1535. { // sDefaultItem, sCancelItem,
  1536. 0, // Menu item (index in ami[]) selected initially.
  1537. // Negative indicates distance from number of items
  1538. // (e.g., -1 is the last item).
  1539. -1, // Menu item (index in ami[]) chosen on cancel.
  1540. // Negative indicates distance from number of items
  1541. // (e.g., -1 is the last item).
  1542. },
  1543. // Menu items.
  1544. // Note that in the old ways we had to reserve as many of these
  1545. // as there were items to be in this menu, but now, since this array
  1546. // is not open ended, we don't. But, if it ever ends up open ended
  1547. // again, this will have to be updated. I included enough for the
  1548. // current settings, but more will have to be added, if we ever change
  1549. // back and add more input functions.
  1550. { // pszText, sEnabled, pmenu, pgui
  1551. { NULL, TRUE, NULL, NULL, },
  1552. { NULL, TRUE, NULL, NULL, },
  1553. { NULL, TRUE, NULL, NULL, },
  1554. { NULL, TRUE, NULL, NULL, },
  1555. { NULL, TRUE, NULL, NULL, },
  1556. { NULL, TRUE, NULL, NULL, },
  1557. { NULL, TRUE, NULL, NULL, },
  1558. { NULL, TRUE, NULL, NULL, },
  1559. { NULL, TRUE, NULL, NULL, },
  1560. { NULL, TRUE, NULL, NULL, },
  1561. { NULL, TRUE, NULL, NULL, },
  1562. { NULL, TRUE, NULL, NULL, },
  1563. { NULL, TRUE, NULL, NULL, },
  1564. { NULL, TRUE, NULL, NULL, },
  1565. { NULL, TRUE, NULL, NULL, },
  1566. { NULL, TRUE, NULL, NULL, },
  1567. { NULL, TRUE, NULL, NULL, },
  1568. { NULL, TRUE, NULL, NULL, },
  1569. { NULL, TRUE, NULL, NULL, },
  1570. { NULL, TRUE, NULL, NULL, },
  1571. { NULL, TRUE, NULL, NULL, },
  1572. { NULL, TRUE, NULL, NULL, },
  1573. { NULL, TRUE, NULL, NULL, },
  1574. { NULL, TRUE, NULL, NULL, },
  1575. { NULL, TRUE, NULL, NULL, },
  1576. { NULL, TRUE, NULL, NULL, },
  1577. { NULL, TRUE, NULL, NULL, },
  1578. { NULL, TRUE, NULL, NULL, },
  1579. { NULL, TRUE, NULL, NULL, },
  1580. { NULL, TRUE, NULL, NULL, },
  1581. { NULL, TRUE, NULL, NULL, },
  1582. { NULL, TRUE, NULL, NULL, },
  1583. { NULL, TRUE, NULL, NULL, },
  1584. { NULL, TRUE, NULL, NULL, },
  1585. { NULL, TRUE, NULL, NULL, },
  1586. NULL // Terminates list.
  1587. },
  1588. };
  1589. // Mouse menu.
  1590. extern Menu menuMouse =
  1591. {
  1592. MOUSE_MENU_ID,
  1593. // Position info.
  1594. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1595. MENU_RECT_LG, // Pos and dimensions.
  1596. 15, // Offset from left edge for menu header.
  1597. // Negative indicates offset from center.
  1598. 12, // Offset from top edge for menu header.
  1599. // Negative indicates offset from center.
  1600. 72, // Offset from left edge for menu items.
  1601. // Negative indicates offset from center.
  1602. 40, // Offset from top edge for menu items.
  1603. // Negative indicates offset from center.
  1604. -5, // Space between menu items.
  1605. 5, // Space between indicator and menu items horizontally.
  1606. -10, // X position menu items should not pass w/i Menu.
  1607. // Less than 1, indicates offset from right edge.
  1608. -20, // Y position menu items should not pass w/i Menu.
  1609. // Less than 1, indicates offset from right edge.
  1610. },
  1611. // Background info.
  1612. { // pszFile, u32BackColor
  1613. MENU_BG_LG,
  1614. MENU_BG_COLOR, // Background color.
  1615. PAL_SET_START, // Starting palette index to set.
  1616. PAL_SET_NUM, // Number of entries to set.
  1617. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1618. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1619. },
  1620. // GUI settings.
  1621. { // sTransparent.
  1622. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1623. },
  1624. // Flags.
  1625. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  1626. // Header and its font info.
  1627. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1628. g_pszMouseSetupMenu_Title,
  1629. SMASH_FONT,
  1630. HEAD_FONT_HEIGHT, // Height of font.
  1631. HEAD_COLOR, // Text RGBA.
  1632. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1633. },
  1634. // Font info.
  1635. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1636. SMASH_FONT,
  1637. ITEM_FONT_HEIGHT_SMALLER, // Height of font.
  1638. ITEM_COLOR, // Text RGBA.
  1639. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1640. },
  1641. // Menu indicator.
  1642. { // pszFile, type
  1643. MENU_INDICATOR,
  1644. RImage::FSPR8,
  1645. },
  1646. // Menu callbacks.
  1647. { // fnInit, fnChoice,
  1648. MouseInit, // Called before menu is initialized.
  1649. MouseChoice, // Called when item is chosen.
  1650. },
  1651. // Menu auto items.
  1652. { // sDefaultItem, sCancelItem,
  1653. 0, // Menu item (index in ami[]) selected initially.
  1654. // Negative indicates distance from number of items
  1655. // (e.g., -1 is the last item).
  1656. -1, // Menu item (index in ami[]) chosen on cancel.
  1657. // Negative indicates distance from number of items
  1658. // (e.g., -1 is the last item).
  1659. },
  1660. // Menu items.
  1661. // Note that in the old ways we had to reserve as many of these
  1662. // as there were items to be in this menu, but now, since this array
  1663. // is not open ended, we don't. But, if it ever ends up open ended
  1664. // again, this will have to be updated. I included enough for the
  1665. // current settings, but more will have to be added, if we ever change
  1666. // back and add more input functions.
  1667. { // pszText, sEnabled, pmenu, pgui
  1668. { NULL, TRUE, NULL, NULL, },
  1669. { NULL, TRUE, NULL, NULL, },
  1670. { NULL, TRUE, NULL, NULL, },
  1671. { NULL, TRUE, NULL, NULL, },
  1672. { NULL, TRUE, NULL, NULL, },
  1673. { NULL, TRUE, NULL, NULL, },
  1674. { NULL, TRUE, NULL, NULL, },
  1675. { NULL, TRUE, NULL, NULL, },
  1676. { NULL, TRUE, NULL, NULL, },
  1677. { NULL, TRUE, NULL, NULL, },
  1678. { NULL, TRUE, NULL, NULL, },
  1679. { NULL, TRUE, NULL, NULL, },
  1680. { NULL, TRUE, NULL, NULL, },
  1681. { NULL, TRUE, NULL, NULL, },
  1682. { NULL, TRUE, NULL, NULL, },
  1683. { NULL, TRUE, NULL, NULL, },
  1684. { NULL, TRUE, NULL, NULL, },
  1685. { NULL, TRUE, NULL, NULL, },
  1686. { NULL, TRUE, NULL, NULL, },
  1687. { NULL, TRUE, NULL, NULL, },
  1688. { NULL, TRUE, NULL, NULL, },
  1689. { NULL, TRUE, NULL, NULL, },
  1690. { NULL, TRUE, NULL, NULL, },
  1691. { NULL, TRUE, NULL, NULL, },
  1692. { NULL, TRUE, NULL, NULL, },
  1693. { NULL, TRUE, NULL, NULL, },
  1694. { NULL, TRUE, NULL, NULL, },
  1695. { NULL, TRUE, NULL, NULL, },
  1696. { NULL, TRUE, NULL, NULL, },
  1697. { NULL, TRUE, NULL, NULL, },
  1698. { NULL, TRUE, NULL, NULL, },
  1699. { NULL, TRUE, NULL, NULL, },
  1700. { NULL, TRUE, NULL, NULL, },
  1701. { NULL, TRUE, NULL, NULL, },
  1702. { NULL, TRUE, NULL, NULL, },
  1703. NULL // Terminates list.
  1704. },
  1705. };
  1706. // Joystick menu.
  1707. extern Menu menuJoystick =
  1708. {
  1709. JOYSTICK_MENU_ID,
  1710. // Position info.
  1711. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1712. MENU_RECT_LG, // Pos and dimensions.
  1713. 15, // Offset from left edge for menu header.
  1714. // Negative indicates offset from center.
  1715. 12, // Offset from top edge for menu header.
  1716. // Negative indicates offset from center.
  1717. 72, // Offset from left edge for menu items.
  1718. // Negative indicates offset from center.
  1719. 40, // Offset from top edge for menu items.
  1720. // Negative indicates offset from center.
  1721. -5, // Space between menu items.
  1722. 5, // Space between indicator and menu items horizontally.
  1723. -10, // X position menu items should not pass w/i Menu.
  1724. // Less than 1, indicates offset from right edge.
  1725. -20, // Y position menu items should not pass w/i Menu.
  1726. // Less than 1, indicates offset from right edge.
  1727. },
  1728. // Background info.
  1729. { // pszFile, u32BackColor
  1730. MENU_BG_LG,
  1731. MENU_BG_COLOR, // Background color.
  1732. PAL_SET_START, // Starting palette index to set.
  1733. PAL_SET_NUM, // Number of entries to set.
  1734. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1735. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1736. },
  1737. // GUI settings.
  1738. { // sTransparent.
  1739. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1740. },
  1741. // Flags.
  1742. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  1743. // Header and its font info.
  1744. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1745. g_pszJoystickSetupMenu_Title,
  1746. SMASH_FONT,
  1747. HEAD_FONT_HEIGHT, // Height of font.
  1748. HEAD_COLOR, // Text RGBA.
  1749. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1750. },
  1751. // Font info.
  1752. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1753. SMASH_FONT,
  1754. ITEM_FONT_HEIGHT_SMALLER, // Height of font.
  1755. ITEM_COLOR, // Text RGBA.
  1756. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1757. },
  1758. // Menu indicator.
  1759. { // pszFile, type
  1760. MENU_INDICATOR,
  1761. RImage::FSPR8,
  1762. },
  1763. // Menu callbacks.
  1764. { // fnInit, fnChoice,
  1765. JoyInit, // Called before menu is initialized.
  1766. JoyChoice, // Called when item is chosen.
  1767. },
  1768. // Menu auto items.
  1769. { // sDefaultItem, sCancelItem,
  1770. 0, // Menu item (index in ami[]) selected initially.
  1771. // Negative indicates distance from number of items
  1772. // (e.g., -1 is the last item).
  1773. -1, // Menu item (index in ami[]) chosen on cancel.
  1774. // Negative indicates distance from number of items
  1775. // (e.g., -1 is the last item).
  1776. },
  1777. // Menu items.
  1778. // Note that in the old ways we had to reserve as many of these
  1779. // as there were items to be in this menu, but now, since this array
  1780. // is not open ended, we don't. But, if it ever ends up open ended
  1781. // again, this will have to be updated. I included enough for the
  1782. // current settings, but more will have to be added, if we ever change
  1783. // back and add more input functions.
  1784. { // pszText, sEnabled, pmenu, pgui
  1785. { NULL, TRUE, NULL, NULL, },
  1786. { NULL, TRUE, NULL, NULL, },
  1787. { NULL, TRUE, NULL, NULL, },
  1788. { NULL, TRUE, NULL, NULL, },
  1789. { NULL, TRUE, NULL, NULL, },
  1790. { NULL, TRUE, NULL, NULL, },
  1791. { NULL, TRUE, NULL, NULL, },
  1792. { NULL, TRUE, NULL, NULL, },
  1793. { NULL, TRUE, NULL, NULL, },
  1794. { NULL, TRUE, NULL, NULL, },
  1795. { NULL, TRUE, NULL, NULL, },
  1796. { NULL, TRUE, NULL, NULL, },
  1797. { NULL, TRUE, NULL, NULL, },
  1798. { NULL, TRUE, NULL, NULL, },
  1799. { NULL, TRUE, NULL, NULL, },
  1800. { NULL, TRUE, NULL, NULL, },
  1801. { NULL, TRUE, NULL, NULL, },
  1802. { NULL, TRUE, NULL, NULL, },
  1803. { NULL, TRUE, NULL, NULL, },
  1804. { NULL, TRUE, NULL, NULL, },
  1805. { NULL, TRUE, NULL, NULL, },
  1806. { NULL, TRUE, NULL, NULL, },
  1807. { NULL, TRUE, NULL, NULL, },
  1808. { NULL, TRUE, NULL, NULL, },
  1809. { NULL, TRUE, NULL, NULL, },
  1810. { NULL, TRUE, NULL, NULL, },
  1811. { NULL, TRUE, NULL, NULL, },
  1812. { NULL, TRUE, NULL, NULL, },
  1813. { NULL, TRUE, NULL, NULL, },
  1814. { NULL, TRUE, NULL, NULL, },
  1815. { NULL, TRUE, NULL, NULL, },
  1816. { NULL, TRUE, NULL, NULL, },
  1817. { NULL, TRUE, NULL, NULL, },
  1818. { NULL, TRUE, NULL, NULL, },
  1819. { NULL, TRUE, NULL, NULL, },
  1820. NULL // Terminates list.
  1821. },
  1822. };
  1823. // Features menu.
  1824. extern Menu menuFeatures =
  1825. {
  1826. FEATURES_MENU_ID,
  1827. // Position info.
  1828. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1829. MENU_RECT_MD, // menu x, y, w, h
  1830. -80, // menu header x offset
  1831. MENU_HEAD_Y_MD, // menu header y offset
  1832. MENU_ITEM_X_MD, // menu items x offset
  1833. MENU_ITEM_Y_MD, // menu items y offset
  1834. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  1835. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  1836. },
  1837. // Background info.
  1838. { // pszFile, u32BackColor
  1839. MENU_BG_MD,
  1840. MENU_BG_COLOR, // Background color.
  1841. PAL_SET_START, // Starting palette index to set.
  1842. PAL_SET_NUM, // Number of entries to set.
  1843. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1844. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1845. },
  1846. // GUI settings.
  1847. { // sTransparent.
  1848. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1849. },
  1850. // Flags.
  1851. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  1852. // Header and its font info.
  1853. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1854. g_pszPerformanceMenu_Title,
  1855. SMASH_FONT,
  1856. HEAD_FONT_HEIGHT, // Height of font.
  1857. HEAD_COLOR, // Text RGBA.
  1858. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1859. },
  1860. // Font info.
  1861. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1862. SMASH_FONT,
  1863. ITEM_FONT_HEIGHT, // Height of font.
  1864. ITEM_COLOR, // Text RGBA.
  1865. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1866. },
  1867. // Menu indicator.
  1868. { // pszFile, type
  1869. MENU_INDICATOR,
  1870. RImage::FSPR8,
  1871. },
  1872. // Menu callbacks.
  1873. { // fnInit, fnChoice,
  1874. FeaturesInit, // Called before menu is initialized.
  1875. FeaturesChoice, // Called when item is chosen.
  1876. },
  1877. // Menu auto items.
  1878. { // sDefaultItem, sCancelItem,
  1879. 0, // Menu item (index in ami[]) selected initially.
  1880. // Negative indicates distance from number of items
  1881. // (e.g., -1 is the last item).
  1882. -1, // Menu item (index in ami[]) chosen on cancel.
  1883. // Negative indicates distance from number of items
  1884. // (e.g., -1 is the last item).
  1885. },
  1886. // Menu items.
  1887. { // pszText, sEnabled, pmenu, pgui
  1888. { g_pszPerformanceMenu_Transparency, TRUE, NULL, NULL, },
  1889. { g_pszPerformanceMenu_3dLighting, TRUE, NULL, NULL, },
  1890. { g_pszPerformanceMenu_Particles, TRUE, NULL, NULL, },
  1891. { g_pszPerformanceMenu_DynamicVolume, TRUE, NULL, NULL, },
  1892. { g_pszPerformanceMenu_AmbientSounds, TRUE, NULL, NULL, },
  1893. { "", FALSE, NULL, NULL, },
  1894. NULL // Terminates list.
  1895. },
  1896. };
  1897. // Rotation menu.
  1898. extern Menu menuRotation =
  1899. {
  1900. ROTATION_MENU_ID,
  1901. // Position info.
  1902. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1903. MENU_RECT_LG, // menu x, y, w, h
  1904. -60, // menu header x offset
  1905. MENU_HEAD_Y_LG, // menu header y offset
  1906. MENU_ITEM_X_LG, // menu items x offset
  1907. MENU_ITEM_Y_LG, // menu items y offset
  1908. MENU_ITEM_SPACE_Y_LG, // vertical space between menu items
  1909. MENU_ITEM_IND_SPACE_X_LG, // horizontal space between indicator and menu items
  1910. },
  1911. // Background info.
  1912. { // pszFile, u32BackColor
  1913. MENU_BG_LG,
  1914. MENU_BG_COLOR, // Background color.
  1915. PAL_SET_START, // Starting palette index to set.
  1916. PAL_SET_NUM, // Number of entries to set.
  1917. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1918. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1919. },
  1920. // GUI settings.
  1921. { // sTransparent.
  1922. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1923. },
  1924. // Flags.
  1925. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  1926. // Header and its font info.
  1927. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  1928. g_pszRotationSetupMenu_Title,
  1929. SMASH_FONT,
  1930. HEAD_FONT_HEIGHT, // Height of font.
  1931. HEAD_COLOR, // Text RGBA.
  1932. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  1933. },
  1934. // Font info.
  1935. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  1936. SMASH_FONT,
  1937. ITEM_FONT_HEIGHT, // Height of font.
  1938. ITEM_COLOR, // Text RGBA.
  1939. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  1940. },
  1941. // Menu indicator.
  1942. { // pszFile, type
  1943. MENU_INDICATOR,
  1944. RImage::FSPR8,
  1945. },
  1946. // Menu callbacks.
  1947. { // fnInit, fnChoice,
  1948. RotationInit, // Called before menu is initialized.
  1949. RotationChoice, // Called when item is chosen.
  1950. },
  1951. // Menu auto items.
  1952. { // sDefaultItem, sCancelItem,
  1953. 0, // Menu item (index in ami[]) selected initially.
  1954. // Negative indicates distance from number of items
  1955. // (e.g., -1 is the last item).
  1956. -1, // Menu item (index in ami[]) chosen on cancel.
  1957. // Negative indicates distance from number of items
  1958. // (e.g., -1 is the last item).
  1959. },
  1960. // Menu items.
  1961. { // pszText, sEnabled, pmenu, pgui
  1962. { g_pszRotationSetupMenu_RunningSlow, TRUE, NULL, NULL, },
  1963. { g_pszRotationSetupMenu_RunningFast, TRUE, NULL, NULL, },
  1964. { g_pszRotationSetupMenu_StandingSlow, TRUE, NULL, NULL, },
  1965. { g_pszRotationSetupMenu_StandingFast, TRUE, NULL, NULL, },
  1966. { g_pszRotationSetupMenu_TapDegrees, TRUE, NULL, NULL, },
  1967. { g_pszRotationSetupMenu_RestoreDefaults, TRUE, NULL, NULL, },
  1968. { "", FALSE, NULL, NULL, },
  1969. NULL // Terminates list.
  1970. },
  1971. };
  1972. // Volumes menu.
  1973. extern Menu menuVolumes =
  1974. {
  1975. VOLUME_MENU_ID,
  1976. // Position info.
  1977. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  1978. MENU_RECT_MD, // menu x, y, w, h
  1979. -60, // menu header x offset
  1980. MENU_HEAD_Y_MD, // menu header y offset
  1981. MENU_ITEM_X_MD, // menu items x offset
  1982. MENU_ITEM_Y_MD, // menu items y offset
  1983. 1, //MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  1984. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  1985. },
  1986. // Background info.
  1987. { // pszFile, u32BackColor
  1988. MENU_BG_MD,
  1989. MENU_BG_COLOR, // Background color.
  1990. PAL_SET_START, // Starting palette index to set.
  1991. PAL_SET_NUM, // Number of entries to set.
  1992. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  1993. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  1994. },
  1995. // GUI settings.
  1996. { // sTransparent.
  1997. TRUE, // TRUE if GUI is to be BLiT with transparency.
  1998. },
  1999. // Flags.
  2000. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  2001. // Header and its font info.
  2002. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2003. g_pszVolumesMenu_Title,
  2004. SMASH_FONT,
  2005. HEAD_FONT_HEIGHT, // Height of font.
  2006. HEAD_COLOR, // Text RGBA.
  2007. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2008. },
  2009. // Font info.
  2010. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2011. SMASH_FONT,
  2012. ITEM_FONT_HEIGHT_SMALLER, // Height of font.
  2013. ITEM_COLOR, // Text RGBA.
  2014. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2015. },
  2016. // Menu indicator.
  2017. { // pszFile, type
  2018. MENU_INDICATOR,
  2019. RImage::FSPR8,
  2020. },
  2021. // Menu callbacks.
  2022. { // fnInit, fnChoice,
  2023. VolumesInit, // Called before menu is initialized.
  2024. VolumesChoice, // Called when item is chosen.
  2025. },
  2026. // Menu auto items.
  2027. { // sDefaultItem, sCancelItem,
  2028. 0, // Menu item (index in ami[]) selected initially.
  2029. // Negative indicates distance from number of items
  2030. // (e.g., -1 is the last item).
  2031. -1, // Menu item (index in ami[]) chosen on cancel.
  2032. // Negative indicates distance from number of items
  2033. // (e.g., -1 is the last item).
  2034. },
  2035. // Menu items.
  2036. // Note that in the old ways we had to reserve as many of these
  2037. // as there were items to be in this menu, but now, since this array
  2038. // is not open ended, we don't. But, if it ever ends up open ended
  2039. // again, this will have to be updated. I included enough for the
  2040. // current settings, but more will have to be added, if we ever change
  2041. // back and add more volume categories.
  2042. { // pszText, sEnabled, pmenu, pgui
  2043. { NULL, TRUE, NULL, NULL, },
  2044. { NULL, TRUE, NULL, NULL, },
  2045. { NULL, TRUE, NULL, NULL, },
  2046. { NULL, TRUE, NULL, NULL, },
  2047. { NULL, TRUE, NULL, NULL, },
  2048. { NULL, TRUE, NULL, NULL, },
  2049. { NULL, TRUE, NULL, NULL, },
  2050. { NULL, TRUE, NULL, NULL, },
  2051. { NULL, TRUE, NULL, NULL, },
  2052. { NULL, TRUE, NULL, NULL, },
  2053. { NULL, TRUE, NULL, NULL, },
  2054. { NULL, TRUE, NULL, NULL, },
  2055. { NULL, TRUE, NULL, NULL, },
  2056. { NULL, TRUE, NULL, NULL, },
  2057. { NULL, TRUE, NULL, NULL, },
  2058. { NULL, TRUE, NULL, NULL, },
  2059. { NULL, TRUE, NULL, NULL, },
  2060. { NULL, TRUE, NULL, NULL, },
  2061. { NULL, TRUE, NULL, NULL, },
  2062. { NULL, TRUE, NULL, NULL, },
  2063. { NULL, TRUE, NULL, NULL, },
  2064. { NULL, TRUE, NULL, NULL, },
  2065. { NULL, TRUE, NULL, NULL, },
  2066. { NULL, TRUE, NULL, NULL, },
  2067. { NULL, TRUE, NULL, NULL, },
  2068. NULL // Terminates list.
  2069. },
  2070. };
  2071. // Start menu.
  2072. extern Menu menuStart =
  2073. {
  2074. START_MENU_ID,
  2075. // Position info.
  2076. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  2077. MENU_RECT_MD, // menu x, y, w, h
  2078. -120, // menu header x offset
  2079. MENU_HEAD_Y_MD, // menu header y offset
  2080. MENU_ITEM_X_MD, // menu items x offset
  2081. MENU_ITEM_Y_MD, // menu items y offset
  2082. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  2083. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  2084. },
  2085. // Background info.
  2086. { // pszFile, u32BackColor
  2087. MENU_BG_MD,
  2088. MENU_BG_COLOR, // Background color.
  2089. PAL_SET_START, // Starting palette index to set.
  2090. PAL_SET_NUM, // Number of entries to set.
  2091. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  2092. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  2093. },
  2094. // GUI settings.
  2095. { // sTransparent.
  2096. TRUE, // TRUE if GUI is to be BLiT with transparency.
  2097. },
  2098. // Flags.
  2099. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  2100. // Header and its font info.
  2101. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2102. g_pszStartGameMenu_Title,
  2103. SMASH_FONT,
  2104. HEAD_FONT_HEIGHT, // Height of font.
  2105. HEAD_COLOR, // Text RGBA.
  2106. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2107. },
  2108. // Font info.
  2109. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2110. SMASH_FONT,
  2111. ITEM_FONT_HEIGHT, // Height of font.
  2112. ITEM_COLOR, // Text RGBA.
  2113. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2114. },
  2115. // Menu indicator.
  2116. { // pszFile, type
  2117. MENU_INDICATOR,
  2118. RImage::FSPR8,
  2119. },
  2120. // Menu callbacks.
  2121. { // fnInit, fnChoice,
  2122. StartGameInit, // Called before menu is initialized.
  2123. StartGameMenu, // Called when item is chosen.
  2124. },
  2125. // Menu auto items.
  2126. { // sDefaultItem, sCancelItem,
  2127. 0, // Menu item (index in ami[]) selected initially.
  2128. // Negative indicates distance from number of items
  2129. // (e.g., -1 is the last item).
  2130. -1, // Menu item (index in ami[]) chosen on cancel.
  2131. // Negative indicates distance from number of items
  2132. // (e.g., -1 is the last item).
  2133. },
  2134. // Menu items.
  2135. { // pszText, sEnabled, pmenu, pgui
  2136. { g_pszStartGameMenu_SinglePlayer, TRUE, &menuStartSingle, NULL, },
  2137. #ifndef MULTIPLAYER_REMOVED
  2138. { g_pszStartGameMenu_Multiplayer, TRUE, &menuStartMulti, NULL, },
  2139. #endif
  2140. { g_pszStartGameMenu_Demo, TRUE, &menuStartDemo, NULL, },
  2141. { "", FALSE, NULL, NULL, },
  2142. NULL // Terminates list.
  2143. },
  2144. };
  2145. // Single player start menu.
  2146. extern Menu menuStartSingle =
  2147. {
  2148. START_SINGLE_MENU_ID,
  2149. // Position info.
  2150. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  2151. MENU_RECT_MD, // menu x, y, w, h
  2152. -120, // menu header x offset
  2153. MENU_HEAD_Y_MD, // menu header y offset
  2154. MENU_ITEM_X_MD, // menu items x offset
  2155. MENU_ITEM_Y_MD, // menu items y offset
  2156. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  2157. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  2158. },
  2159. // Background info.
  2160. { // pszFile, u32BackColor
  2161. MENU_BG_MD,
  2162. MENU_BG_COLOR, // Background color.
  2163. PAL_SET_START, // Starting palette index to set.
  2164. PAL_SET_NUM, // Number of entries to set.
  2165. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  2166. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  2167. },
  2168. // GUI settings.
  2169. { // sTransparent.
  2170. TRUE, // TRUE if GUI is to be BLiT with transparency.
  2171. },
  2172. // Flags.
  2173. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  2174. // Header and its font info.
  2175. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2176. g_pszStartSinglePlayerMenu_Title,
  2177. SMASH_FONT,
  2178. HEAD_FONT_HEIGHT, // Height of font.
  2179. HEAD_COLOR, // Text RGBA.
  2180. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2181. },
  2182. // Font info.
  2183. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2184. SMASH_FONT,
  2185. ITEM_FONT_HEIGHT, // Height of font.
  2186. ITEM_COLOR, // Text RGBA.
  2187. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2188. },
  2189. // Menu indicator.
  2190. { // pszFile, type
  2191. MENU_INDICATOR,
  2192. RImage::FSPR8,
  2193. },
  2194. // Menu callbacks.
  2195. { // fnInit, fnChoice,
  2196. StartSingleInit, // Called before menu is initialized.
  2197. StartSingleMenu, // Called when item is chosen.
  2198. },
  2199. // Menu auto items.
  2200. { // sDefaultItem, sCancelItem,
  2201. 0, // Menu item (index in ami[]) selected initially.
  2202. // Negative indicates distance from number of items
  2203. // (e.g., -1 is the last item).
  2204. -1, // Menu item (index in ami[]) chosen on cancel.
  2205. // Negative indicates distance from number of items
  2206. // (e.g., -1 is the last item).
  2207. },
  2208. // Menu items.
  2209. { // pszText, sEnabled, pmenu, pgui
  2210. { g_pszStartSinglePlayerMenu_New, TRUE, NULL, NULL, },
  2211. #if defined(START_MENU_ADDON_ITEM)
  2212. { g_pszStartSinglePlayerMenu_AddOn, TRUE, NULL, NULL, },
  2213. #endif
  2214. #ifndef LOADLEVEL_REMOVED
  2215. { g_pszStartSinglePlayerMenu_LoadLevel, TRUE, NULL, NULL, },
  2216. #endif
  2217. { g_pszStartSinglePlayerMenu_LoadGame, TRUE, NULL, NULL, },
  2218. { g_pszStartSinglePlayerMenu_Challenge, TRUE, /*&menuChallenge,*/NULL, NULL, },
  2219. { "", FALSE, NULL, NULL, },
  2220. NULL // Terminates list.
  2221. },
  2222. };
  2223. // Single player start menu.
  2224. extern Menu menuChallenge =
  2225. {
  2226. CHALLENGE_MENU_ID,
  2227. // Position info.
  2228. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  2229. MENU_RECT_MD, // menu x, y, w, h
  2230. -120, // menu header x offset
  2231. MENU_HEAD_Y_MD, // menu header y offset
  2232. MENU_ITEM_X_MD, // menu items x offset
  2233. MENU_ITEM_Y_MD, // menu items y offset
  2234. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  2235. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  2236. },
  2237. // Background info.
  2238. { // pszFile, u32BackColor
  2239. MENU_BG_MD,
  2240. MENU_BG_COLOR, // Background color.
  2241. PAL_SET_START, // Starting palette index to set.
  2242. PAL_SET_NUM, // Number of entries to set.
  2243. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  2244. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  2245. },
  2246. // GUI settings.
  2247. { // sTransparent.
  2248. TRUE, // TRUE if GUI is to be BLiT with transparency.
  2249. },
  2250. // Flags.
  2251. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  2252. // Header and its font info.
  2253. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2254. g_pszStartChallengeMenu_Title,
  2255. SMASH_FONT,
  2256. HEAD_FONT_HEIGHT, // Height of font.
  2257. HEAD_COLOR, // Text RGBA.
  2258. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2259. },
  2260. // Font info.
  2261. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2262. SMASH_FONT,
  2263. ITEM_FONT_HEIGHT, // Height of font.
  2264. ITEM_COLOR, // Text RGBA.
  2265. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2266. },
  2267. // Menu indicator.
  2268. { // pszFile, type
  2269. MENU_INDICATOR,
  2270. RImage::FSPR8,
  2271. },
  2272. // Menu callbacks.
  2273. { // fnInit, fnChoice,
  2274. ChallengeInit, // Called before menu is initialized.
  2275. ChallengeChoice, // Called when item is chosen.
  2276. },
  2277. // Menu auto items.
  2278. { // sDefaultItem, sCancelItem,
  2279. 0, // Menu item (index in ami[]) selected initially.
  2280. // Negative indicates distance from number of items
  2281. // (e.g., -1 is the last item).
  2282. -1, // Menu item (index in ami[]) chosen on cancel.
  2283. // Negative indicates distance from number of items
  2284. // (e.g., -1 is the last item).
  2285. },
  2286. // Menu items.
  2287. { // pszText, sEnabled, pmenu, pgui
  2288. { g_pszStartChallengeMenu_Gauntlet, TRUE, NULL, NULL, },
  2289. { g_pszStartChallengeMenu_Timed, TRUE, NULL, NULL, },
  2290. { g_pszStartChallengeMenu_Goal, TRUE, NULL, NULL, },
  2291. { g_pszStartChallengeMenu_Flag, TRUE, NULL, NULL, },
  2292. { g_pszStartChallengeMenu_CheckPoint, TRUE, NULL, NULL, },
  2293. { "", FALSE, NULL, NULL, },
  2294. NULL // Terminates list.
  2295. },
  2296. };
  2297. // Multiplayer start menu.
  2298. extern Menu menuStartMulti =
  2299. {
  2300. START_MULTI_MENU_ID,
  2301. // Position info.
  2302. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  2303. MENU_RECT_MD, // menu x, y, w, h
  2304. -120, // menu header x offset
  2305. MENU_HEAD_Y_MD, // menu header y offset
  2306. MENU_ITEM_X_MD, // menu items x offset
  2307. MENU_ITEM_Y_MD, // menu items y offset
  2308. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  2309. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  2310. },
  2311. // Background info.
  2312. { // pszFile, u32BackColor
  2313. MENU_BG_MD,
  2314. MENU_BG_COLOR, // Background color.
  2315. PAL_SET_START, // Starting palette index to set.
  2316. PAL_SET_NUM, // Number of entries to set.
  2317. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  2318. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  2319. },
  2320. // GUI settings.
  2321. { // sTransparent.
  2322. TRUE, // TRUE if GUI is to be BLiT with transparency.
  2323. },
  2324. // Flags.
  2325. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  2326. // Header and its font info.
  2327. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2328. g_pszStartMultiplayerMenu_Title,
  2329. SMASH_FONT,
  2330. HEAD_FONT_HEIGHT, // Height of font.
  2331. HEAD_COLOR, // Text RGBA.
  2332. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2333. },
  2334. // Font info.
  2335. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2336. SMASH_FONT,
  2337. ITEM_FONT_HEIGHT, // Height of font.
  2338. ITEM_COLOR, // Text RGBA.
  2339. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2340. },
  2341. // Menu indicator.
  2342. { // pszFile, type
  2343. MENU_INDICATOR,
  2344. RImage::FSPR8,
  2345. },
  2346. // Menu callbacks.
  2347. { // fnInit, fnChoice,
  2348. StartMultiInit, // Called before menu is initialized.
  2349. StartMultiMenu, // Called when item is chosen.
  2350. },
  2351. // Menu auto items.
  2352. { // sDefaultItem, sCancelItem,
  2353. 0, // Menu item (index in ami[]) selected initially.
  2354. // Negative indicates distance from number of items
  2355. // (e.g., -1 is the last item).
  2356. -1, // Menu item (index in ami[]) chosen on cancel.
  2357. // Negative indicates distance from number of items
  2358. // (e.g., -1 is the last item).
  2359. },
  2360. // Menu items.
  2361. { // pszText, sEnabled, pmenu, pgui
  2362. { g_pszStartMultiplayerMenu_Join, TRUE, &menuJoinMulti, NULL, },
  2363. { g_pszStartMultiplayerMenu_Host, TRUE, &menuHostMulti, NULL, },
  2364. { g_pszStartMultiplayerMenu_Options, TRUE, &menuMultiOptions, NULL, },
  2365. { "", FALSE, NULL, NULL, },
  2366. NULL // Terminates list.
  2367. },
  2368. };
  2369. // Join Multiplayer menu.
  2370. extern Menu menuJoinMulti =
  2371. {
  2372. JOIN_MULTI_MENU_ID,
  2373. // Position info.
  2374. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  2375. MENU_RECT_LG, // menu x, y, w, h
  2376. -60, // menu header x offset
  2377. MENU_HEAD_Y_LG, // menu header y offset
  2378. MENU_ITEM_X_LG, // menu items x offset
  2379. MENU_ITEM_Y_LG, // menu items y offset
  2380. MENU_ITEM_SPACE_Y_LG, // vertical space between menu items
  2381. MENU_ITEM_IND_SPACE_X_LG, // horizontal space between indicator and menu items
  2382. },
  2383. // Background info.
  2384. { // pszFile, u32BackColor
  2385. MENU_BG_LG,
  2386. MENU_BG_COLOR, // Background color.
  2387. PAL_SET_START, // Starting palette index to set.
  2388. PAL_SET_NUM, // Number of entries to set.
  2389. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  2390. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  2391. },
  2392. // GUI settings.
  2393. { // sTransparent.
  2394. TRUE, // TRUE if GUI is to be BLiT with transparency.
  2395. },
  2396. // Flags.
  2397. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  2398. // Header and its font info.
  2399. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2400. g_pszJoinGameMenu_Title,
  2401. SMASH_FONT,
  2402. HEAD_FONT_HEIGHT, // Height of font.
  2403. HEAD_COLOR, // Text RGBA.
  2404. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2405. },
  2406. // Font info.
  2407. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2408. SMASH_FONT,
  2409. ITEM_FONT_HEIGHT, // Height of font.
  2410. ITEM_COLOR, // Text RGBA.
  2411. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2412. },
  2413. // Menu indicator.
  2414. { // pszFile, type
  2415. MENU_INDICATOR,
  2416. RImage::FSPR8,
  2417. },
  2418. // Menu callbacks.
  2419. { // fnInit, fnChoice,
  2420. JoinMultiInit, // Called before menu is initialized.
  2421. JoinMultiMenu, // Called when item is chosen.
  2422. },
  2423. // Menu auto items.
  2424. { // sDefaultItem, sCancelItem,
  2425. 0, // Menu item (index in ami[]) selected initially.
  2426. // Negative indicates distance from number of items
  2427. // (e.g., -1 is the last item).
  2428. -1, // Menu item (index in ami[]) chosen on cancel.
  2429. // Negative indicates distance from number of items
  2430. // (e.g., -1 is the last item).
  2431. },
  2432. // Menu items.
  2433. { // pszText, sEnabled, pmenu, pgui
  2434. { g_pszJoinGameMenu_Browse, TRUE, NULL, NULL, },
  2435. { g_pszJoinGameMenu_ConnectTo, TRUE, NULL, NULL, },
  2436. { "", FALSE, NULL, NULL, },
  2437. NULL // Terminates list.
  2438. },
  2439. };
  2440. // Join Multiplayer menu.
  2441. extern Menu menuHostMulti =
  2442. {
  2443. HOST_MULTI_MENU_ID,
  2444. // Position info.
  2445. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  2446. MENU_RECT_MD, // menu x, y, w, h
  2447. -60, // menu header x offset
  2448. MENU_HEAD_Y_MD, // menu header y offset
  2449. MENU_ITEM_X_MD, // menu items x offset
  2450. MENU_ITEM_Y_MD, // menu items y offset
  2451. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  2452. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  2453. },
  2454. // Background info.
  2455. { // pszFile, u32BackColor
  2456. MENU_BG_MD,
  2457. MENU_BG_COLOR, // Background color.
  2458. PAL_SET_START, // Starting palette index to set.
  2459. PAL_SET_NUM, // Number of entries to set.
  2460. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  2461. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  2462. },
  2463. // GUI settings.
  2464. { // sTransparent.
  2465. TRUE, // TRUE if GUI is to be BLiT with transparency.
  2466. },
  2467. // Flags.
  2468. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  2469. // Header and its font info.
  2470. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2471. g_pszHostGameMenu_Title,
  2472. SMASH_FONT,
  2473. HEAD_FONT_HEIGHT, // Height of font.
  2474. HEAD_COLOR, // Text RGBA.
  2475. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2476. },
  2477. // Font info.
  2478. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2479. SMASH_FONT,
  2480. ITEM_FONT_HEIGHT, // Height of font.
  2481. ITEM_COLOR, // Text RGBA.
  2482. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2483. },
  2484. // Menu indicator.
  2485. { // pszFile, type
  2486. MENU_INDICATOR,
  2487. RImage::FSPR8,
  2488. },
  2489. // Menu callbacks.
  2490. { // fnInit, fnChoice,
  2491. HostMultiInit, // Called before menu is initialized.
  2492. HostMultiMenu, // Called when item is chosen.
  2493. },
  2494. // Menu auto items.
  2495. { // sDefaultItem, sCancelItem,
  2496. 0, // Menu item (index in ami[]) selected initially.
  2497. // Negative indicates distance from number of items
  2498. // (e.g., -1 is the last item).
  2499. -1, // Menu item (index in ami[]) chosen on cancel.
  2500. // Negative indicates distance from number of items
  2501. // (e.g., -1 is the last item).
  2502. },
  2503. // Menu items.
  2504. { // pszText, sEnabled, pmenu, pgui
  2505. { g_pszHostGameMenu_Start, TRUE, NULL, NULL, },
  2506. { "", FALSE, NULL, NULL, },
  2507. NULL // Terminates list.
  2508. },
  2509. };
  2510. // Single player start menu.
  2511. extern Menu menuStartDemo =
  2512. {
  2513. START_DEMO_MENU_ID,
  2514. // Position info.
  2515. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  2516. MENU_RECT_SM, // menu x, y, w, h
  2517. -120, // menu header x offset
  2518. MENU_HEAD_Y_SM, // menu header y offset
  2519. MENU_ITEM_X_SM, // menu items x offset
  2520. MENU_ITEM_Y_SM, // menu items y offset
  2521. MENU_ITEM_SPACE_Y_SM, // vertical space between menu items
  2522. MENU_ITEM_IND_SPACE_X_SM, // horizontal space between indicator and menu items
  2523. },
  2524. // Background info.
  2525. { // pszFile, u32BackColor
  2526. MENU_BG_SM,
  2527. MENU_BG_COLOR, // Background color.
  2528. PAL_SET_START, // Starting palette index to set.
  2529. PAL_SET_NUM, // Number of entries to set.
  2530. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  2531. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  2532. },
  2533. // GUI settings.
  2534. { // sTransparent.
  2535. TRUE, // TRUE if GUI is to be BLiT with transparency.
  2536. },
  2537. // Flags.
  2538. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  2539. // Header and its font info.
  2540. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2541. g_pszStartDemoMenu_Title,
  2542. SMASH_FONT,
  2543. HEAD_FONT_HEIGHT, // Height of font.
  2544. HEAD_COLOR, // Text RGBA.
  2545. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2546. },
  2547. // Font info.
  2548. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2549. SMASH_FONT,
  2550. ITEM_FONT_HEIGHT, // Height of font.
  2551. ITEM_COLOR, // Text RGBA.
  2552. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2553. },
  2554. // Menu indicator.
  2555. { // pszFile, type
  2556. MENU_INDICATOR,
  2557. RImage::FSPR8,
  2558. },
  2559. // Menu callbacks.
  2560. { // fnInit, fnChoice,
  2561. StartDemoInit, // Called before menu is initialized.
  2562. StartDemoMenu, // Called when item is chosen.
  2563. },
  2564. // Menu auto items.
  2565. { // sDefaultItem, sCancelItem,
  2566. 0, // Menu item (index in ami[]) selected initially.
  2567. // Negative indicates distance from number of items
  2568. // (e.g., -1 is the last item).
  2569. -1, // Menu item (index in ami[]) chosen on cancel.
  2570. // Negative indicates distance from number of items
  2571. // (e.g., -1 is the last item).
  2572. },
  2573. // Menu items.
  2574. { // pszText, sEnabled, pmenu, pgui
  2575. // { g_pszStartDemoMenu_Browse, TRUE, NULL, NULL, },
  2576. { g_pszStartDemoMenu_Play, TRUE, NULL, NULL, },
  2577. { g_pszStartDemoMenu_Record, TRUE, NULL, NULL, },
  2578. { "", FALSE, NULL, NULL, },
  2579. NULL // Terminates list.
  2580. },
  2581. };
  2582. // Multiplayer options menu.
  2583. extern Menu menuMultiOptions =
  2584. {
  2585. MULTIPLAYER_OPTIONS_MENU_ID,
  2586. // Position info.
  2587. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  2588. MENU_RECT_MD, // menu x, y, w, h
  2589. -60, // menu header x offset
  2590. MENU_HEAD_Y_MD, // menu header y offset
  2591. MENU_ITEM_X_MD, // menu items x offset
  2592. MENU_ITEM_Y_MD, // menu items y offset
  2593. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  2594. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  2595. },
  2596. // Background info.
  2597. { // pszFile, u32BackColor
  2598. MENU_BG_MD,
  2599. MENU_BG_COLOR, // Background color.
  2600. PAL_SET_START, // Starting palette index to set.
  2601. PAL_SET_NUM, // Number of entries to set.
  2602. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  2603. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  2604. },
  2605. // GUI settings.
  2606. { // sTransparent.
  2607. TRUE, // TRUE if GUI is to be BLiT with transparency.
  2608. },
  2609. // Flags.
  2610. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter | MenuColumnizeGuis),
  2611. // Header and its font info.
  2612. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  2613. g_pszMultiplayerSetupMenu_Title,
  2614. SMASH_FONT,
  2615. HEAD_FONT_HEIGHT, // Height of font.
  2616. HEAD_COLOR, // Text RGBA.
  2617. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  2618. },
  2619. // Font info.
  2620. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  2621. SMASH_FONT,
  2622. ITEM_FONT_HEIGHT, // Height of font.
  2623. ITEM_COLOR, // Text RGBA.
  2624. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  2625. },
  2626. // Menu indicator.
  2627. { // pszFile, type
  2628. MENU_INDICATOR,
  2629. RImage::FSPR8,
  2630. },
  2631. // Menu callbacks.
  2632. { // fnInit, fnChoice,
  2633. MultiOptionsInit, // Called before menu is initialized.
  2634. MultiOptionsChoice, // Called when item is chosen.
  2635. },
  2636. // Menu auto items.
  2637. { // sDefaultItem, sCancelItem,
  2638. 0, // Menu item (index in ami[]) selected initially.
  2639. // Negative indicates distance from number of items
  2640. // (e.g., -1 is the last item).
  2641. -1, // Menu item (index in ami[]) chosen on cancel.
  2642. // Negative indicates distance from number of items
  2643. // (e.g., -1 is the last item).
  2644. },
  2645. // Menu items.
  2646. { // pszText, sEnabled, pmenu, pgui
  2647. { g_pszMultiplayerSetupMenu_Name, TRUE, NULL, NULL, },
  2648. { g_pszMultiplayerSetupMenu_Color, TRUE, NULL, NULL, },
  2649. { g_pszMultiplayerSetupMenu_Protocol, TRUE, NULL, NULL, },
  2650. { g_pszMultiplayerSetupMenu_Connection, TRUE, NULL, NULL, },
  2651. { "", FALSE, NULL, NULL, },
  2652. NULL // Terminates list.
  2653. },
  2654. };
  2655. ////////////////////////////////////////////////////////////////////////////////
  2656. // Menu callbacks.
  2657. ////////////////////////////////////////////////////////////////////////////////
  2658. //
  2659. // Called when main menu is initialized or killed.
  2660. //
  2661. ////////////////////////////////////////////////////////////////////////////////
  2662. static short MainMenuInit( // Returns 0 on succes, non-zero to cancel menu.
  2663. Menu* pmenuCurrent, // In: Menu being init'ed or killed.
  2664. short sInit) // In: TRUE, if initializing; FALSE, if killing.
  2665. {
  2666. short sRes = 0; // Assume success.
  2667. Game_InitMainMenu(sInit);
  2668. return sRes;
  2669. }
  2670. ////////////////////////////////////////////////////////////////////////////////
  2671. //
  2672. // Called when item is chosen from main menu
  2673. //
  2674. ////////////////////////////////////////////////////////////////////////////////
  2675. static bool MainMenuChoice( // Returns true to accept, false to deny choice.
  2676. Menu* /*pmenuCurrent*/, // Current menu.
  2677. short sMenuItem) // Item chosen.
  2678. {
  2679. bool bAcceptChoice = true; // Assume accepting.
  2680. // Audible Feedback.
  2681. if (sMenuItem == -1)
  2682. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  2683. else
  2684. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  2685. switch (sMenuItem)
  2686. {
  2687. case 2:
  2688. #if defined(SPAWN) || defined(EDITOR_REMOVED)
  2689. // Exit
  2690. #else
  2691. // Editor
  2692. Game_StartEditor();
  2693. #endif
  2694. break;
  2695. case 3:
  2696. #if defined(DEMO)
  2697. // Buy
  2698. Game_Buy();
  2699. #else
  2700. // (some other choice we don't care about)
  2701. #endif
  2702. break;
  2703. }
  2704. return bAcceptChoice;
  2705. }
  2706. static bool VerifyExitMenuChoice( // Returns true to accept, false to deny choice.
  2707. Menu* /*pmenuCurrent*/, // Current menu.
  2708. short sMenuItem) // Item chosen.
  2709. {
  2710. bool bAcceptChoice = true; // Assume accepting.
  2711. // Audible Feedback.
  2712. if (sMenuItem == -1)
  2713. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  2714. else
  2715. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  2716. switch (sMenuItem)
  2717. {
  2718. case 0: // Yes
  2719. // Set quit status to something other than 1 (which is what RSPiX Blue sets it to
  2720. // if a system-specific quit is used) so we can later detect wether we should immediately
  2721. // quit the app or put up the credits first.
  2722. rspSetQuitStatus(10);
  2723. break;
  2724. case 1: // No
  2725. break;
  2726. }
  2727. return bAcceptChoice;
  2728. }
  2729. static bool ClientGameMenuChoice( // Returns true to accept, false to deny choice.
  2730. Menu* /*pmenuCurrent*/, // Current menu.
  2731. short sMenuItem) // Item chosen.
  2732. {
  2733. bool bAcceptChoice = true; // Assume accepting.
  2734. // Audible Feedback.
  2735. if (sMenuItem == -1)
  2736. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  2737. else
  2738. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  2739. switch (sMenuItem)
  2740. {
  2741. case 0: // Continue.
  2742. StopMenu();
  2743. break;
  2744. case 1: // Options.
  2745. break;
  2746. case 2: // Quit.
  2747. break;
  2748. }
  2749. return bAcceptChoice;
  2750. }
  2751. ////////////////////////////////////////////////////////////////////////////////
  2752. //
  2753. // Called to init or kill the Start Game menu.
  2754. //
  2755. ////////////////////////////////////////////////////////////////////////////////
  2756. static short StartGameInit( // Returns 0 on success, non-zero to cancel menu.
  2757. Menu* pmenuCur, // Current menu.
  2758. short sInit) // TRUE, if initializing; FALSE, if killing.
  2759. {
  2760. short sRes = 0; // Assume success.
  2761. // Be sure the demo option reflects INI setting.
  2762. if (g_GameSettings.m_sCanRecordDemos == FALSE)
  2763. {
  2764. menuStart.ami[2].pmenu = NULL;
  2765. }
  2766. return sRes;
  2767. }
  2768. ////////////////////////////////////////////////////////////////////////////////
  2769. //
  2770. // Called by the menu API when an item is chosen in menuStart.
  2771. //
  2772. ////////////////////////////////////////////////////////////////////////////////
  2773. static bool StartGameMenu( // Returns true to accept, false to deny choice.
  2774. Menu* pmenuCurrent, // Current menu.
  2775. short sMenuItem) // Item chosen.
  2776. {
  2777. bool bAcceptChoice = true; // Assume accepting.
  2778. switch (sMenuItem)
  2779. {
  2780. #ifndef MULTIPLAYER_REMOVED
  2781. case 1:
  2782. // This is necessary to give the game a chance to inform the
  2783. // player in case multiplayer mode is disabled. The return
  2784. // value determines whether we accept this choice.
  2785. bAcceptChoice = Game_StartMultiPlayerGame(sMenuItem);
  2786. break;
  2787. case 2:
  2788. #else
  2789. case 1:
  2790. #endif
  2791. // If we can't record...
  2792. if (g_GameSettings.m_sCanRecordDemos == FALSE)
  2793. {
  2794. // Start a demo in playback mode by simulating the menu choice "Play"
  2795. // from the demo menu.
  2796. Game_StartDemoGame(1);
  2797. }
  2798. break;
  2799. }
  2800. // Audible Feedback.
  2801. if (sMenuItem == -1)
  2802. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  2803. else
  2804. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  2805. return bAcceptChoice;
  2806. }
  2807. ////////////////////////////////////////////////////////////////////////////////
  2808. //
  2809. // Called to init or kill the Challenge menu.
  2810. //
  2811. ////////////////////////////////////////////////////////////////////////////////
  2812. static short ChallengeInit( // Returns 0 on success, non-zero to cancel menu.
  2813. Menu* pmenuCur, // Current menu.
  2814. short sInit) // TRUE, if initializing; FALSE, if killing.
  2815. {
  2816. short sRes = 0; // Assume success.
  2817. return sRes;
  2818. }
  2819. ////////////////////////////////////////////////////////////////////////////////
  2820. //
  2821. // Called by the menu API when an item is chosen in menuChallenge.
  2822. //
  2823. ////////////////////////////////////////////////////////////////////////////////
  2824. static bool ChallengeChoice( // Returns true to accept, false to deny choice.
  2825. Menu* pmenuCurrent, // Current menu.
  2826. short sMenuItem) // Item chosen.
  2827. {
  2828. bool bAcceptChoice = true; // Assume accepting.
  2829. // Audible Feedback.
  2830. if (sMenuItem == -1)
  2831. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  2832. else
  2833. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  2834. // Let game module handle it
  2835. Game_StartChallengeGame(sMenuItem);
  2836. return bAcceptChoice;
  2837. }
  2838. ////////////////////////////////////////////////////////////////////////////////
  2839. //
  2840. // Called to init or kill the Start Single Player Game menu.
  2841. //
  2842. ////////////////////////////////////////////////////////////////////////////////
  2843. static short StartSingleInit( // Returns 0 on success, non-zero to cancel menu.
  2844. Menu* pmenuCur, // Current menu.
  2845. short sInit) // TRUE, if initializing; FALSE, if killing.
  2846. {
  2847. return 0;
  2848. }
  2849. ////////////////////////////////////////////////////////////////////////////////
  2850. //
  2851. // Called by the menu API when an item is chosen in menuStartSingle.
  2852. //
  2853. ////////////////////////////////////////////////////////////////////////////////
  2854. static bool StartSingleMenu( // Returns true to accept, false to deny choice.
  2855. Menu* pmenuCurrent, // Current menu.
  2856. short sMenuItem) // Item chosen.
  2857. {
  2858. bool bAcceptChoice = true; // Assume accepting.
  2859. // Audible Feedback.
  2860. if (sMenuItem == -1)
  2861. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  2862. else
  2863. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  2864. // Let game module handle it
  2865. Game_StartSinglePlayerGame(sMenuItem);
  2866. return bAcceptChoice;
  2867. }
  2868. ////////////////////////////////////////////////////////////////////////////////
  2869. //
  2870. // Called to init or kill the Start Multiplayer Game menu.
  2871. //
  2872. ////////////////////////////////////////////////////////////////////////////////
  2873. static short StartMultiInit( // Returns 0 on success, non-zero to cancel menu.
  2874. Menu* pmenuCur, // Current menu.
  2875. short sInit) // TRUE, if initializing; FALSE, if killing.
  2876. {
  2877. short sRes = 0; // Assume success.
  2878. if (sInit != FALSE)
  2879. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  2880. return sRes;
  2881. }
  2882. ////////////////////////////////////////////////////////////////////////////////
  2883. //
  2884. // Called by the menu API when an item is chosen in menuStartMulti.
  2885. //
  2886. ////////////////////////////////////////////////////////////////////////////////
  2887. static bool StartMultiMenu( // Returns true to accept, false to deny choice.
  2888. Menu* pmenuCurrent, // Current menu.
  2889. short sMenuItem) // Item chosen.
  2890. {
  2891. bool bAcceptChoice = true; // Assume accepting.
  2892. // Audible Feedback.
  2893. if (sMenuItem == -1)
  2894. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  2895. else
  2896. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  2897. return bAcceptChoice;
  2898. }
  2899. ////////////////////////////////////////////////////////////////////////////////
  2900. //
  2901. // Called to init or kill menuJoinMulti.
  2902. //
  2903. ////////////////////////////////////////////////////////////////////////////////
  2904. static short JoinMultiInit( // Returns 0 on success, non-zero to cancel menu.
  2905. Menu* pmenuCur, // Current menu.
  2906. short sInit) // TRUE, if initializing; FALSE, if killing.
  2907. {
  2908. short sRes = 0; // Assume success.
  2909. if (sInit != FALSE)
  2910. {
  2911. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  2912. if (rspGetResource(&g_resmgrShell, GUI_CONNECT_IP_FILE, &ms_peditConnect) == 0)
  2913. {
  2914. // Set the text from the INI setting. Note that we are changing a resource!
  2915. ms_peditConnect->m_sMaxText = sizeof(g_GameSettings.m_szServerName) - 1;
  2916. ms_peditConnect->SetText("%s", g_GameSettings.m_szServerName);
  2917. ms_peditConnect->Compose();
  2918. // Let menu know about it.
  2919. pmenuCur->ami[1].pgui = ms_peditConnect;
  2920. }
  2921. else
  2922. {
  2923. TRACE("JoinMultiInit(): ms_presmgr->Get() failed.\n");
  2924. sRes = 1;
  2925. }
  2926. }
  2927. else
  2928. {
  2929. // Release resources
  2930. rspReleaseResource(&g_resmgrShell, &ms_peditConnect);
  2931. // Clear menu's pointer.
  2932. pmenuCur->ami[1].pgui = NULL;
  2933. }
  2934. return sRes;
  2935. }
  2936. ////////////////////////////////////////////////////////////////////////////////
  2937. //
  2938. // Called by the menu API when an item is chosen in menuJoinMulti.
  2939. //
  2940. ////////////////////////////////////////////////////////////////////////////////
  2941. static bool JoinMultiMenu( // Returns true to accept, false to deny choice.
  2942. Menu* pmenuCurrent, // Current menu.
  2943. short sMenuItem) // Item chosen.
  2944. {
  2945. bool bAcceptChoice = true; // Assume accepting.
  2946. // Audible Feedback.
  2947. if (sMenuItem == -1)
  2948. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  2949. else
  2950. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  2951. // If specified, get server name (BEFORE calling the game module!)
  2952. if (ms_peditConnect != NULL)
  2953. ms_peditConnect->GetText(g_GameSettings.m_szServerName, sizeof(g_GameSettings.m_szServerName) );
  2954. // Let game module handle it
  2955. Game_JoinMultiPlayerGame(sMenuItem);
  2956. return bAcceptChoice;
  2957. }
  2958. ////////////////////////////////////////////////////////////////////////////////
  2959. //
  2960. // Called to init or kill menuHostMulti.
  2961. //
  2962. ////////////////////////////////////////////////////////////////////////////////
  2963. static short HostMultiInit( // Returns 0 on success, non-zero to cancel menu.
  2964. Menu* pmenuCur, // Current menu.
  2965. short sInit) // TRUE, if initializing; FALSE, if killing.
  2966. {
  2967. short sRes = 0; // Assume success.
  2968. if (sInit != FALSE)
  2969. {
  2970. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  2971. if (rspGetResource(&g_resmgrShell, GUI_HOST_NAME_FILE, &ms_peditHostName) == 0)
  2972. {
  2973. // Set the text from the INI setting. Note that we are changing a resource!
  2974. ms_peditHostName->m_sMaxText = Net::MaxHostNameSize - 1;
  2975. ms_peditHostName->SetText("%s", g_GameSettings.m_szHostName);
  2976. ms_peditHostName->Compose();
  2977. // Let menu know about it.
  2978. pmenuCur->ami[0].pgui = ms_peditHostName;
  2979. }
  2980. else
  2981. {
  2982. TRACE("HostMultiInit(): ms_presmgr->Get() failed.\n");
  2983. sRes = 1;
  2984. }
  2985. }
  2986. else
  2987. {
  2988. // Release resources
  2989. rspReleaseResource(&g_resmgrShell, &ms_peditHostName);
  2990. // Clear menu's pointer.
  2991. pmenuCur->ami[0].pgui = NULL;
  2992. }
  2993. return sRes;
  2994. }
  2995. ////////////////////////////////////////////////////////////////////////////////
  2996. //
  2997. // Called by the menu API when an item is chosen in menuHostMulti.
  2998. //
  2999. ////////////////////////////////////////////////////////////////////////////////
  3000. static bool HostMultiMenu( // Returns true to accept, false to deny choice.
  3001. Menu* pmenuCurrent, // Current menu.
  3002. short sMenuItem) // Item chosen.
  3003. {
  3004. bool bAcceptChoice = true; // Assume accepting.
  3005. // Audible Feedback.
  3006. if (sMenuItem == -1)
  3007. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3008. else
  3009. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3010. // If specified, get host name (BEFORE calling the game module!)
  3011. if (ms_peditHostName != NULL)
  3012. ms_peditHostName->GetText(g_GameSettings.m_szHostName, sizeof(g_GameSettings.m_szHostName) );
  3013. // Let game module handle it
  3014. Game_HostMultiPlayerGame(sMenuItem);
  3015. return bAcceptChoice;
  3016. }
  3017. ////////////////////////////////////////////////////////////////////////////////
  3018. //
  3019. // Called to init or kill the Start Demo Game menu.
  3020. //
  3021. ////////////////////////////////////////////////////////////////////////////////
  3022. static short StartDemoInit( // Returns 0 on success, non-zero to cancel menu.
  3023. Menu* pmenuCur, // Current menu.
  3024. short sInit) // TRUE, if initializing; FALSE, if killing.
  3025. {
  3026. short sRes = 0; // Assume success.
  3027. return sRes;
  3028. }
  3029. ////////////////////////////////////////////////////////////////////////////////
  3030. //
  3031. // Called by the menu API when an item is chosen in menuStartDemo.
  3032. //
  3033. ////////////////////////////////////////////////////////////////////////////////
  3034. static bool StartDemoMenu( // Returns true to accept, false to deny choice.
  3035. Menu* pmenuCurrent, // Current menu.
  3036. short sMenuItem) // Item chosen.
  3037. {
  3038. bool bAcceptChoice = true; // Assume accepting.
  3039. bool bPlay = false;
  3040. // Audible Feedback.
  3041. if (sMenuItem == -1)
  3042. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3043. else
  3044. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3045. // Let game module handle it
  3046. switch (sMenuItem)
  3047. {
  3048. case 0:
  3049. Game_StartDemoGame(0);
  3050. break;
  3051. case 1:
  3052. Game_StartDemoGame(2);
  3053. break;
  3054. }
  3055. return bAcceptChoice;
  3056. }
  3057. ////////////////////////////////////////////////////////////////////////////////
  3058. //
  3059. // Called to init or kill the options menu.
  3060. //
  3061. ////////////////////////////////////////////////////////////////////////////////
  3062. static short OptionsInit( // Returns 0 on success, non-zero to cancel menu.
  3063. Menu* pmenuCur, // Current menu.
  3064. short sInit) // TRUE, if initializing; FALSE, if killing.
  3065. {
  3066. short sRes = 0; // Assume success.
  3067. if (sInit != FALSE)
  3068. {
  3069. #ifndef MULTIPLAYER_REMOVED
  3070. short sMenuItem = 5;
  3071. #else
  3072. short sMenuItem = 4;
  3073. #endif
  3074. RMultiBtn** ppmb = (RMultiBtn**)&(pmenuCur->ami[sMenuItem++].pgui);
  3075. // Get check box for 'Crosshair'.
  3076. if (rspGetResourceInstance(&g_resmgrShell, GUI_CHECKBOX_FILE, ppmb) == 0)
  3077. {
  3078. // Set the initial state.
  3079. (*ppmb)->m_sState = (g_GameSettings.m_sCrossHair != FALSE) ? 1 : 2;
  3080. (*ppmb)->Compose();
  3081. }
  3082. else
  3083. {
  3084. TRACE("ControlsInit(): rspGetResource() failed.\n");
  3085. sRes = 1;
  3086. }
  3087. }
  3088. else
  3089. {
  3090. #ifndef MULTIPLAYER_REMOVED
  3091. short sMenuItem = 6;
  3092. #else
  3093. short sMenuItem = 5;
  3094. #endif
  3095. RMultiBtn** ppmb = (RMultiBtn**)&(pmenuCur->ami[sMenuItem++].pgui);
  3096. if (*ppmb)
  3097. {
  3098. // Store new mouse usage setting.
  3099. g_GameSettings.m_sCrossHair = ((*ppmb)->m_sState == 1) ? TRUE : FALSE;
  3100. // Release resource.
  3101. rspReleaseResourceInstance(&g_resmgrShell, ppmb);
  3102. }
  3103. }
  3104. return sRes;
  3105. }
  3106. ////////////////////////////////////////////////////////////////////////////////
  3107. //
  3108. // Called when a choice is made or changed on the options menu.
  3109. //
  3110. ////////////////////////////////////////////////////////////////////////////////
  3111. static bool OptionsChoice( // Returns true to accept, false to deny choice.
  3112. Menu* pmenuCurrent, // Current menu.
  3113. short sMenuItem) // Item chosen or -1 for change of focus.
  3114. {
  3115. bool bAcceptChoice = true; // Assume accepting.
  3116. switch (sMenuItem)
  3117. {
  3118. #ifndef MULTIPLAYER_REMOVED
  3119. case 5:
  3120. #else
  3121. case 4:
  3122. #endif
  3123. {
  3124. // Toggle 'Use Joystick'.
  3125. RMultiBtn* pmb = (RMultiBtn*)pmenuCurrent->ami[sMenuItem].pgui;
  3126. ASSERT(pmb->m_type == RGuiItem::MultiBtn);
  3127. pmb->NextState();
  3128. pmb->Compose();
  3129. break;
  3130. }
  3131. }
  3132. // Audible Feedback.
  3133. if (sMenuItem == -1)
  3134. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3135. else
  3136. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3137. return bAcceptChoice;
  3138. }
  3139. ////////////////////////////////////////////////////////////////////////////////
  3140. //
  3141. // Called to init or kill the play options menu.
  3142. //
  3143. ////////////////////////////////////////////////////////////////////////////////
  3144. static short PlayOptionsInit( // Returns 0 on success, non-zero to cancel menu.
  3145. Menu* pmenuCur, // Current menu.
  3146. short sInit) // TRUE, if initializing; FALSE, if killing.
  3147. {
  3148. short sRes = 0; // Assume success.
  3149. if (sInit != FALSE)
  3150. {
  3151. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  3152. RGuiItem* pgui;
  3153. // Get difficulty slider . . .
  3154. if (rspGetResource(&g_resmgrShell, GUI_DIFFICULTY_FILE, &pgui) == 0)
  3155. {
  3156. // Get the scrollbar . . .
  3157. ms_psbDifficulty = (RScrollBar*)pgui->GetItemFromId(GUI_ID_DIFFICULTY_SLIDER);
  3158. if (ms_psbDifficulty)
  3159. {
  3160. // Set the update call.
  3161. ms_psbDifficulty->m_upcUser = DifficultyScrollUpdate;
  3162. // This is weird but it allows artie to finer tune the scroll thumb size.
  3163. // We use the ID of the parent as the divisor for the scrollbar value.
  3164. // Set the initial position.
  3165. ms_psbDifficulty->SetPos(g_GameSettings.m_sDifficulty * pgui->m_lId);
  3166. }
  3167. // Let menu know about it.
  3168. pmenuCur->ami[0].pgui = pgui;
  3169. }
  3170. else
  3171. {
  3172. TRACE("PlayOptionsInit(): rspGetResource() failed.\n");
  3173. sRes = 1;
  3174. }
  3175. }
  3176. else
  3177. {
  3178. if (pmenuCur->ami[0].pgui)
  3179. {
  3180. // Release the resource.
  3181. rspReleaseResource(&g_resmgrShell, &pmenuCur->ami[0].pgui);
  3182. }
  3183. }
  3184. return sRes;
  3185. }
  3186. ////////////////////////////////////////////////////////////////////////////////
  3187. //
  3188. // Called when a choice is made or changed on the play options menu.
  3189. //
  3190. ////////////////////////////////////////////////////////////////////////////////
  3191. static bool PlayOptionsChoice( // Returns true to accept, false to deny choice.
  3192. Menu* pmenuCurrent, // Current menu.
  3193. short sMenuItem) // Item chosen or -1 for change of focus.
  3194. {
  3195. bool bAcceptChoice = true; // Assume accepting.
  3196. // Audible Feedback.
  3197. if (sMenuItem == -1)
  3198. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3199. else
  3200. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3201. return bAcceptChoice;
  3202. }
  3203. ////////////////////////////////////////////////////////////////////////////////
  3204. //
  3205. // Called to init or kill the video options menu.
  3206. //
  3207. ////////////////////////////////////////////////////////////////////////////////
  3208. static short VideoOptionsInit( // Returns 0 on success, non-zero to cancel menu.
  3209. Menu* pmenuCur, // Current menu.
  3210. short sInit) // TRUE, if initializing; FALSE, if killing.
  3211. {
  3212. short sRes = 0; // Assume success.
  3213. if (sInit != FALSE)
  3214. {
  3215. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  3216. if (rspGetResource(&g_resmgrShell, GUI_GAMMA_FILE, &ms_psbGamma) == 0)
  3217. {
  3218. // Set the update call.
  3219. ms_psbGamma->m_upcUser = GammaScrollUpdate;
  3220. // Get range.
  3221. long lMin, lMax;
  3222. ms_psbGamma->GetRange(&lMin, &lMax);
  3223. // Determine range of values.
  3224. long lRange = lMax - lMin;
  3225. // Set the initial position. Gamma value indicator will get set via callback.
  3226. // Convert to gamma value by ratio.
  3227. long lVal = long(float(lRange) / GAMMA_RANGE * (GetGammaLevel() - MIN_GAMMA_VAL) + 0.5) + lMin;
  3228. ms_psbGamma->SetPos(lVal);
  3229. // Let menu know about it.
  3230. pmenuCur->ami[0].pgui = ms_psbGamma;
  3231. }
  3232. else
  3233. {
  3234. TRACE("VideoOptionsInit(): rspGetResource() failed.\n");
  3235. sRes = 1;
  3236. }
  3237. }
  3238. else
  3239. {
  3240. if (ms_psbGamma != NULL)
  3241. {
  3242. // Release resource.
  3243. rspReleaseResource(&g_resmgrShell, &ms_psbGamma);
  3244. }
  3245. // Clear menu's pointer.
  3246. pmenuCur->ami[0].pgui = NULL;
  3247. }
  3248. return sRes;
  3249. }
  3250. ////////////////////////////////////////////////////////////////////////////////
  3251. //
  3252. // Called when a choice is made or changed on the video options menu.
  3253. //
  3254. ////////////////////////////////////////////////////////////////////////////////
  3255. static bool VideoOptionsChoice( // Returns true to accept, false to deny choice.
  3256. Menu* pmenuCurrent, // Current menu.
  3257. short sMenuItem) // Item chosen or -1 for change of focus.
  3258. {
  3259. bool bAcceptChoice = true; // Assume accepting.
  3260. // Audible Feedback.
  3261. if (sMenuItem == -1)
  3262. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3263. else
  3264. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3265. return bAcceptChoice;
  3266. }
  3267. ////////////////////////////////////////////////////////////////////////////////
  3268. //
  3269. // Called to init or kill the audio options menu.
  3270. //
  3271. ////////////////////////////////////////////////////////////////////////////////
  3272. static short AudioOptionsInit( // Returns 0 on success, non-zero to cancel menu.
  3273. Menu* pmenuCur, // Current menu.
  3274. short sInit) // TRUE, if initializing; FALSE, if killing.
  3275. {
  3276. short sRes = 0; // Assume success.
  3277. if (sInit != FALSE)
  3278. {
  3279. }
  3280. else
  3281. {
  3282. }
  3283. return sRes;
  3284. }
  3285. ////////////////////////////////////////////////////////////////////////////////
  3286. //
  3287. // Called when a choice is made or changed on the audio options menu.
  3288. //
  3289. ////////////////////////////////////////////////////////////////////////////////
  3290. static bool AudioOptionsChoice( // Returns true to accept, false to deny choice.
  3291. Menu* pmenuCurrent, // Current menu.
  3292. short sMenuItem) // Item chosen or -1 for change of focus.
  3293. {
  3294. bool bAcceptChoice = true; // Assume accepting.
  3295. Game_AudioOptionsChoice(sMenuItem);
  3296. // Audible Feedback.
  3297. if (sMenuItem == -1)
  3298. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3299. else
  3300. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3301. return bAcceptChoice;
  3302. }
  3303. ////////////////////////////////////////////////////////////////////////////////
  3304. //
  3305. // Called to init or kill the volumes menu.
  3306. //
  3307. ////////////////////////////////////////////////////////////////////////////////
  3308. static short VolumesInit( // Returns 0 on success, non-zero to cancel menu.
  3309. Menu* pmenuCur, // Current menu.
  3310. short sInit) // TRUE, if initializing; FALSE, if killing.
  3311. {
  3312. short sRes = 0; // Assume success.
  3313. if (sInit != FALSE)
  3314. {
  3315. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  3316. short i;
  3317. for (i = 0; i < SampleMaster::MAX_NUM_SOUND_CATEGORIES && sRes == 0 && i < (NUM_ELEMENTS(pmenuCur->ami) - 2); i++)
  3318. {
  3319. if (rspGetResourceInstance(&g_resmgrShell, GUI_VOLUME_FILE, (RScrollBar**)&(pmenuCur->ami[i].pgui)) == 0)
  3320. {
  3321. RScrollBar* psb = (RScrollBar*)(pmenuCur->ami[i].pgui);
  3322. ASSERT(psb->m_type == RGuiItem::ScrollBar);
  3323. // Let the callback know which item this is.
  3324. psb->m_ulUserData = i;
  3325. long lMin, lMax, lRange;
  3326. psb->GetRange(&lMin, &lMax);
  3327. lRange = lMax - lMin;
  3328. // Set the initial position.
  3329. psb->SetPos(g_GameSettings.m_asCategoryVolumes[i] * lRange / SampleMaster::UserMaxVolume);
  3330. // Set the rate so based on the range.
  3331. psb->m_lButtonIncDec = lRange / SampleMaster::UserMaxVolume;
  3332. psb->m_lTrayIncDec = psb->m_lButtonIncDec;
  3333. // Set the update call. Note that we set the callback after setting the
  3334. // initial position so we don't get a callback for that.
  3335. psb->m_upcUser = VolumesScrollUpdate;
  3336. // Note that we have to update the GUI val here b/c we don't allow the callback
  3337. // until after we set the initial position of the scrollbar to avoid it playing
  3338. // the example sample during that position change.
  3339. // Get val indicator.
  3340. RGuiItem* pguiVal = psb->GetItemFromId(GUI_ID_VOLUME_VAL);
  3341. if (pguiVal)
  3342. {
  3343. pguiVal->SetText("%d", g_GameSettings.m_asCategoryVolumes[i]);
  3344. pguiVal->Compose();
  3345. }
  3346. // Text.
  3347. pmenuCur->ami[i].pszText = SampleMaster::ms_apszSoundCategories[i];
  3348. }
  3349. else
  3350. {
  3351. TRACE("VolumesInit(): Failed to get resource.\n");
  3352. sRes = 1;
  3353. }
  3354. }
  3355. // Make the second to last one defaults.
  3356. pmenuCur->ami[i].sEnabled = TRUE;
  3357. pmenuCur->ami[i++].pszText = g_pszRotationSetupMenu_RestoreDefaults;
  3358. // Make the last one back.
  3359. #if 0
  3360. static char szBack[] = "";
  3361. pmenuCur->ami[i].pszText = szBack;
  3362. pmenuCur->ami[i].sEnabled = FALSE;
  3363. #endif
  3364. pmenuCur->menuautoitems.sCancelItem = i;
  3365. }
  3366. else
  3367. {
  3368. short i;
  3369. for (i = 0; i < SampleMaster::MAX_NUM_SOUND_CATEGORIES && sRes == 0 && pmenuCur->ami[i].pszText; i++)
  3370. {
  3371. // If this resource was allocated . . .
  3372. if (pmenuCur->ami[i].pgui)
  3373. {
  3374. // Release resource.
  3375. rspReleaseResourceInstance(&g_resmgrShell, &(pmenuCur->ami[i].pgui));
  3376. }
  3377. }
  3378. }
  3379. return sRes;
  3380. }
  3381. ////////////////////////////////////////////////////////////////////////////////
  3382. //
  3383. // Called when a choice is made or changed on the volumes menu.
  3384. //
  3385. ////////////////////////////////////////////////////////////////////////////////
  3386. static bool VolumesChoice( // Returns true to accept, false to deny choice.
  3387. Menu* pmenuCurrent, // Current menu.
  3388. short sMenuItem) // Item chosen or -1 for change of focus.
  3389. {
  3390. bool bAcceptChoice = true; // Assume accepting.
  3391. // Audible Feedback.
  3392. switch (sMenuItem)
  3393. {
  3394. case -1: // Selection change.
  3395. break;
  3396. case SampleMaster::MAX_NUM_SOUND_CATEGORIES + 1: // Back.
  3397. break;
  3398. case SampleMaster::MAX_NUM_SOUND_CATEGORIES: // Restore defaults.
  3399. {
  3400. short i;
  3401. for (i = 0; i < SampleMaster::MAX_NUM_SOUND_CATEGORIES && i < NUM_ELEMENTS(pmenuCurrent->ami); i++)
  3402. {
  3403. if (pmenuCurrent->ami[i].pgui)
  3404. {
  3405. long lMin, lMax, lRange;
  3406. ( (RScrollBar*)(pmenuCurrent->ami[i].pgui) )->GetRange(&lMin, &lMax);
  3407. lRange = lMax - lMin;
  3408. ((RScrollBar*)(pmenuCurrent->ami[i].pgui) )->SetPos(SampleMaster::UserDefaultVolume * lRange / SampleMaster::UserMaxVolume);
  3409. // This'll keep the next sample from aborting the current so we can let the user
  3410. // hear all the sounds when 'defaults' is chosen.
  3411. ms_siLastSamplePlayed = 0;
  3412. }
  3413. }
  3414. break;
  3415. }
  3416. default: // Play all.
  3417. {
  3418. // Play all samples simultaneously so user can hear the mixage.
  3419. short i;
  3420. for (i = 0; i < SampleMaster::MAX_NUM_SOUND_CATEGORIES; i++)
  3421. {
  3422. // Play a sample in that category.
  3423. PlaySample( // Returns RSnd used to play the sample.
  3424. // Does not fail.
  3425. *(ms_apsmidVolumeTesters[i]), // In: Identifier of sample you want played.
  3426. (SampleMaster::SoundCategory)i, // In: Sound Volume Category for user adjustment
  3427. 255, // In: Initial Sound Instance Volume (0 - 255)
  3428. &ms_siLastSamplePlayed); // Out: Handle for adjusting sound volume
  3429. ms_siLastSamplePlayed = 0;
  3430. }
  3431. break;
  3432. }
  3433. }
  3434. if (sMenuItem == -1)
  3435. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3436. else
  3437. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3438. return bAcceptChoice;
  3439. }
  3440. ////////////////////////////////////////////////////////////////////////////////
  3441. //
  3442. // Called when the controls menu is initialized.
  3443. //
  3444. ////////////////////////////////////////////////////////////////////////////////
  3445. static short ControlsInit( // Returns 0 on success, non-zero to cancel menu.
  3446. Menu* pmenuCur, // Current menu.
  3447. short sInit) // TRUE, if initializing; FALSE, if killing.
  3448. {
  3449. short sRes = 0; // Assume success.
  3450. if (sInit != FALSE)
  3451. {
  3452. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  3453. #if defined(ALLOW_JOYSTICK)
  3454. short sMenuItem = 4;
  3455. RMultiBtn** ppmb = (RMultiBtn**)&(pmenuCur->ami[sMenuItem++].pgui);
  3456. // Get check box for 'Use Joystick'.
  3457. if (rspGetResourceInstance(&g_resmgrShell, GUI_CHECKBOX_FILE, ppmb) == 0)
  3458. {
  3459. // Set the initial state.
  3460. (*ppmb)->m_sState = (g_InputSettings.m_sUseJoy != FALSE) ? 1 : 2;
  3461. (*ppmb)->Compose();
  3462. }
  3463. else
  3464. {
  3465. TRACE("ControlsInit(): rspGetResource() failed.\n");
  3466. sRes = 1;
  3467. }
  3468. #else
  3469. short sMenuItem = 3;
  3470. #endif // defined(ALLOW_JOYSTICK)
  3471. // Get check box for 'Use Mouse'.
  3472. if (rspGetResourceInstance(&g_resmgrShell, GUI_CHECKBOX_FILE, &ms_pmbCheckBox) == 0)
  3473. {
  3474. // Set the initial state.
  3475. ms_pmbCheckBox->m_sState = (g_InputSettings.m_sUseMouse != FALSE) ? 1 : 2;
  3476. ms_pmbCheckBox->Compose();
  3477. // Let menu know about it.
  3478. pmenuCur->ami[sMenuItem++].pgui = ms_pmbCheckBox;
  3479. }
  3480. else
  3481. {
  3482. TRACE("ControlsInit(): rspGetResource() failed.\n");
  3483. sRes = 1;
  3484. }
  3485. // Get scrollbar for 'Mouse Sensitivity'.
  3486. if (rspGetResourceInstance(&g_resmgrShell, GUI_MOUSE_SENSITIVITY_FILE, &ms_psbMouseSensitivityX) == 0)
  3487. {
  3488. // Set the initial state.
  3489. // Set the callback.
  3490. ms_psbMouseSensitivityX->m_upcUser = MouseSensitivityScrollUpdate;
  3491. // Set the value to change.
  3492. ms_psbMouseSensitivityX->m_ulUserInstance = (ULONG)&g_InputSettings.m_dMouseSensitivityX;
  3493. // Set the initial position. ms_psbGammaVal will get set via callback.
  3494. ms_psbMouseSensitivityX->SetPos(g_InputSettings.m_dMouseSensitivityX * MOUSE_SENSITIVITY_DIVISOR);
  3495. // Let menu know about it.
  3496. pmenuCur->ami[sMenuItem++].pgui = ms_psbMouseSensitivityX;
  3497. }
  3498. else
  3499. {
  3500. TRACE("ControlsInit(): rspGetResource() failed.\n");
  3501. sRes = 2;
  3502. }
  3503. // Get scrollbar for 'Mouse Sensitivity'.
  3504. if (rspGetResourceInstance(&g_resmgrShell, GUI_MOUSE_SENSITIVITY_FILE, &ms_psbMouseSensitivityY) == 0)
  3505. {
  3506. // Set the initial state.
  3507. // Set the callback.
  3508. ms_psbMouseSensitivityY->m_upcUser = MouseSensitivityScrollUpdate;
  3509. // Set the value to change.
  3510. ms_psbMouseSensitivityY->m_ulUserInstance = (ULONG)&g_InputSettings.m_dMouseSensitivityY;
  3511. // Set the initial position. ms_psbGammaVal will get set via callback.
  3512. ms_psbMouseSensitivityY->SetPos(g_InputSettings.m_dMouseSensitivityY * MOUSE_SENSITIVITY_DIVISOR);
  3513. // Let menu know about it.
  3514. pmenuCur->ami[sMenuItem++].pgui = ms_psbMouseSensitivityY;
  3515. }
  3516. else
  3517. {
  3518. TRACE("ControlsInit(): rspGetResource() failed.\n");
  3519. sRes = 3;
  3520. }
  3521. }
  3522. else
  3523. {
  3524. #if defined(ALLOW_JOYSTICK)
  3525. short sMenuItem = 4;
  3526. RMultiBtn** ppmb = (RMultiBtn**)&(pmenuCur->ami[sMenuItem++].pgui);
  3527. if (*ppmb)
  3528. {
  3529. // Store new mouse usage setting.
  3530. g_InputSettings.m_sUseJoy = ((*ppmb)->m_sState == 1) ? TRUE : FALSE;
  3531. // Release resource.
  3532. rspReleaseResourceInstance(&g_resmgrShell, ppmb);
  3533. }
  3534. #else
  3535. short sMenuItem = 3;
  3536. #endif // defined(ALLOW_JOYSTICK)
  3537. if (ms_pmbCheckBox)
  3538. {
  3539. // Store new mouse usage setting.
  3540. g_InputSettings.m_sUseMouse = (ms_pmbCheckBox->m_sState == 1) ? TRUE : FALSE;
  3541. // Release resource.
  3542. rspReleaseResourceInstance(&g_resmgrShell, &ms_pmbCheckBox);
  3543. }
  3544. // Clear menu's pointer.
  3545. pmenuCur->ami[sMenuItem++].pgui = NULL;
  3546. if (ms_psbMouseSensitivityX != NULL)
  3547. {
  3548. // Release resource.
  3549. rspReleaseResourceInstance(&g_resmgrShell, &ms_psbMouseSensitivityX);
  3550. }
  3551. // Clear menu's pointer.
  3552. pmenuCur->ami[sMenuItem++].pgui = NULL;
  3553. if (ms_psbMouseSensitivityY != NULL)
  3554. {
  3555. // Release resource.
  3556. rspReleaseResourceInstance(&g_resmgrShell, &ms_psbMouseSensitivityY);
  3557. }
  3558. // Clear menu's pointer.
  3559. pmenuCur->ami[sMenuItem++].pgui = NULL;
  3560. }
  3561. return sRes;
  3562. }
  3563. ////////////////////////////////////////////////////////////////////////////////
  3564. //
  3565. // Call when a selection is changed or made on the controls menu.
  3566. //
  3567. ////////////////////////////////////////////////////////////////////////////////
  3568. static bool ControlsChoice( // Returns true to accept, false to deny choice.
  3569. Menu* pmenuCurrent, // Current menu.
  3570. short sMenuItem) // Item chosen.
  3571. {
  3572. bool bAcceptChoice = true; // Assume accepting.
  3573. switch (sMenuItem)
  3574. {
  3575. #if defined(ALLOW_JOYSTICK)
  3576. case 4:
  3577. {
  3578. // Toggle 'Use Joystick'.
  3579. RMultiBtn* pmb = (RMultiBtn*)pmenuCurrent->ami[sMenuItem].pgui;
  3580. ASSERT(pmb->m_type == RGuiItem::MultiBtn);
  3581. pmb->NextState();
  3582. pmb->Compose();
  3583. break;
  3584. }
  3585. case 5:
  3586. #else
  3587. case 3:
  3588. #endif // defined(ALLOW_JOYSTICK)
  3589. // Toggle 'Use Mouse'.
  3590. ms_pmbCheckBox->NextState();
  3591. ms_pmbCheckBox->Compose();
  3592. break;
  3593. }
  3594. // Audible Feedback.
  3595. if (sMenuItem == -1)
  3596. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3597. else
  3598. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3599. // Call game.
  3600. Game_ControlsMenu(sMenuItem);
  3601. return bAcceptChoice;
  3602. }
  3603. ////////////////////////////////////////////////////////////////////////////////
  3604. //
  3605. // Macro for RotationInit().
  3606. //
  3607. ////////////////////////////////////////////////////////////////////////////////
  3608. template <class ValType>
  3609. short SetUpRotationScrollBar( // Returns 0 on success.
  3610. ValType* pvtRotationVal, // In: Rotation value to tune via scrollbar.
  3611. Menu* pmenu, // In: Menu.
  3612. short sChoiceIndex, // In: Index of choice.
  3613. char* pszResName) // In: Resource name.
  3614. {
  3615. short sRes = 0; // Assume success.
  3616. RScrollBar* psb = NULL;
  3617. if (rspGetResourceInstance(&g_resmgrShell, pszResName, &psb) == 0)
  3618. {
  3619. // Set the initial state.
  3620. // Set the callback.
  3621. switch (sizeof(ValType))
  3622. {
  3623. case 2:
  3624. psb->m_upcUser = RotationScrollUpdateShort;
  3625. break;
  3626. case 8:
  3627. psb->m_upcUser = RotationScrollUpdateDouble;
  3628. break;
  3629. default:
  3630. TRACE("SetUpRotationScrollBar(): Unsupported value size.\n");
  3631. break;
  3632. }
  3633. // Set the value to change.
  3634. psb->m_ulUserInstance = (ULONG)pvtRotationVal;
  3635. // Set the initial position. psb will get set via callback.
  3636. psb->SetPos(*pvtRotationVal);
  3637. }
  3638. else
  3639. {
  3640. TRACE("SetUpRotationScrollBar(): rspGetResource() failed for \"%s\".\n", pszResName);
  3641. sRes = 1;
  3642. }
  3643. // Let menu know about it.
  3644. pmenu->ami[sChoiceIndex].pgui = psb;
  3645. return sRes;
  3646. }
  3647. ////////////////////////////////////////////////////////////////////////////////
  3648. //
  3649. // Called when the Rotation menu is initialized.
  3650. //
  3651. ////////////////////////////////////////////////////////////////////////////////
  3652. static short RotationInit( // Returns 0 on success, non-zero to cancel menu.
  3653. Menu* pmenuCur, // Current menu.
  3654. short sInit) // TRUE, if initializing; FALSE, if killing.
  3655. {
  3656. short sRes = 0; // Assume success.
  3657. if (sInit != FALSE)
  3658. {
  3659. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  3660. // Get scrollbars for rotation parameters.
  3661. sRes |= SetUpRotationScrollBar(&g_InputSettings.m_dMovingSlowDegreesPerSec, pmenuCur, 0, GUI_ROTATION_FILE);
  3662. sRes |= SetUpRotationScrollBar(&g_InputSettings.m_dMovingFastDegreesPerSec, pmenuCur, 1, GUI_ROTATION_FILE);
  3663. sRes |= SetUpRotationScrollBar(&g_InputSettings.m_dStillSlowDegreesPerSec, pmenuCur, 2, GUI_ROTATION_FILE);
  3664. sRes |= SetUpRotationScrollBar(&g_InputSettings.m_dStillFastDegreesPerSec, pmenuCur, 3, GUI_ROTATION_FILE);
  3665. sRes |= SetUpRotationScrollBar(&g_InputSettings.m_sTapRotationDegrees, pmenuCur, 4, GUI_TAP_ROTATION_FILE);
  3666. }
  3667. else
  3668. {
  3669. short i;
  3670. for (i = 0; pmenuCur->ami[i].pszText; i++)
  3671. {
  3672. if (pmenuCur->ami[i].pgui)
  3673. {
  3674. rspReleaseResourceInstance(&g_resmgrShell, (RScrollBar**)&(pmenuCur->ami[i].pgui) );
  3675. }
  3676. }
  3677. }
  3678. return sRes;
  3679. }
  3680. ////////////////////////////////////////////////////////////////////////////////
  3681. //
  3682. // Call when a selection is changed or made on the Rotation menu.
  3683. //
  3684. ////////////////////////////////////////////////////////////////////////////////
  3685. static bool RotationChoice( // Returns true to accept, false to deny choice.
  3686. Menu* pmenuCurrent, // Current menu.
  3687. short sMenuItem) // Item chosen.
  3688. {
  3689. bool bAcceptChoice = true; // Assume accepting.
  3690. switch (sMenuItem)
  3691. {
  3692. // Restore defaults.
  3693. case 5:
  3694. g_InputSettings.DefaultRotations();
  3695. // Update sliders.
  3696. ( (RScrollBar*)(pmenuCurrent->ami[0].pgui) )->SetPos(g_InputSettings.m_dMovingSlowDegreesPerSec);
  3697. ( (RScrollBar*)(pmenuCurrent->ami[1].pgui) )->SetPos(g_InputSettings.m_dMovingFastDegreesPerSec);
  3698. ( (RScrollBar*)(pmenuCurrent->ami[2].pgui) )->SetPos(g_InputSettings.m_dStillSlowDegreesPerSec);
  3699. ( (RScrollBar*)(pmenuCurrent->ami[3].pgui) )->SetPos(g_InputSettings.m_dStillFastDegreesPerSec);
  3700. ( (RScrollBar*)(pmenuCurrent->ami[4].pgui) )->SetPos(g_InputSettings.m_sTapRotationDegrees);
  3701. break;
  3702. }
  3703. // Audible Feedback.
  3704. if (sMenuItem == -1)
  3705. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3706. else
  3707. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3708. return bAcceptChoice;
  3709. }
  3710. ////////////////////////////////////////////////////////////////////////////////
  3711. //
  3712. // Called to init or kill the multiplyaer options menu.
  3713. //
  3714. ////////////////////////////////////////////////////////////////////////////////
  3715. static short MultiOptionsInit( // Returns 0 on success, non-zero to cancel menu.
  3716. Menu* pmenuCur, // Current menu.
  3717. short sInit) // TRUE, if initializing; FALSE, if killing.
  3718. {
  3719. short sRes = 0; // Assume success.
  3720. if (sInit != FALSE)
  3721. {
  3722. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  3723. if (rspGetResource(&g_resmgrShell, PLAYER_NAME_GUI_FILE, &ms_peditName) == 0)
  3724. {
  3725. // Set the text from the INI setting. Note that we are changing a resource!
  3726. ms_peditName->m_sMaxText = Net::MaxPlayerNameSize - 1;
  3727. ms_peditName->SetText("%s", g_GameSettings.m_szPlayerName);
  3728. ms_peditName->Compose();
  3729. // Let menu know about it.
  3730. pmenuCur->ami[0].pgui = ms_peditName;
  3731. // If any errors occurred after getting resource, this function will be
  3732. // called with sInit == FALSE.
  3733. }
  3734. else
  3735. {
  3736. TRACE("MultiOptionsInit(): rspGetResource() failed.\n");
  3737. sRes = 1;
  3738. }
  3739. if (rspGetResource(&g_resmgrShell, PLAYER_COLOR_GUI_FILE, &ms_ptxtColor) == 0)
  3740. {
  3741. // Keep in bounds just in case (anyone could type any number into the INI) . . .
  3742. if ( g_GameSettings.m_sPlayerColorIndex >= CGameSettings::ms_sNumPlayerColorDescriptions
  3743. || g_GameSettings.m_sPlayerColorIndex >= CDude::MaxTextures
  3744. || g_GameSettings.m_sPlayerColorIndex < 0)
  3745. {
  3746. g_GameSettings.m_sPlayerColorIndex = 0;
  3747. }
  3748. // Set the text from the INI setting. Note that we are changing a
  3749. // resource!
  3750. ms_ptxtColor->SetText("%s", CGameSettings::ms_apszPlayerColorDescriptions[g_GameSettings.m_sPlayerColorIndex]);
  3751. ms_ptxtColor->Compose();
  3752. pmenuCur->ami[1].pgui = ms_ptxtColor;
  3753. }
  3754. else
  3755. {
  3756. TRACE("MultiOptionsInit(): rspGetResource() failed.\n");
  3757. sRes = 2;
  3758. }
  3759. if (rspGetResource(&g_resmgrShell, NET_PROTO_GUI_FILE, &ms_ptxtProto) == 0)
  3760. {
  3761. // Set the text from the INI setting. Note that we are changing a
  3762. // resource!
  3763. ms_ptxtProto->SetText("%s", RSocket::GetProtoName((RSocket::ProtoType)g_GameSettings.m_usProtocol));
  3764. ms_ptxtProto->Compose();
  3765. pmenuCur->ami[2].pgui = ms_ptxtProto;
  3766. }
  3767. else
  3768. {
  3769. TRACE("MultiOptionsIni(): rspGetResource() failed.\n");
  3770. sRes = 4;
  3771. }
  3772. if (rspGetResource(&g_resmgrShell, NET_CONNECTION_GUI_FILE, &ms_ptxtBandwidth) == 0)
  3773. {
  3774. // Set the text from the INI setting. Note that we are changing a
  3775. // resource!
  3776. if (g_GameSettings.m_sNetBandwidth >= Net::NumBandwidths)
  3777. g_GameSettings.m_sNetBandwidth = Net::FirstBandwidth;
  3778. ms_ptxtBandwidth->SetText("%s", Net::BandwidthText[g_GameSettings.m_sNetBandwidth]);
  3779. ms_ptxtBandwidth->Compose();
  3780. pmenuCur->ami[3].pgui = ms_ptxtBandwidth;
  3781. }
  3782. else
  3783. {
  3784. TRACE("MultiOptionsInit(): rspGetResource() failed.\n");
  3785. sRes = 5;
  3786. }
  3787. }
  3788. else
  3789. {
  3790. if (ms_peditName != NULL)
  3791. {
  3792. // Get the player name for storage purposes.
  3793. ms_peditName->GetText(g_GameSettings.m_szPlayerName, sizeof(g_GameSettings.m_szPlayerName) );
  3794. // Release resource.
  3795. rspReleaseResource(&g_resmgrShell, &ms_peditName);
  3796. // Clear menu's pointer.
  3797. pmenuCur->ami[0].pgui = NULL;
  3798. }
  3799. if (ms_ptxtColor != NULL)
  3800. {
  3801. // Release resource.
  3802. rspReleaseResource(&g_resmgrShell, &ms_ptxtColor);
  3803. // Clear menu's pointer.
  3804. pmenuCur->ami[1].pgui = NULL;
  3805. }
  3806. if (ms_ptxtProto)
  3807. {
  3808. // Release resource.
  3809. rspReleaseResource(&g_resmgrShell, &ms_ptxtProto);
  3810. // Clear menu's pointer.
  3811. pmenuCur->ami[2].pgui = NULL;
  3812. }
  3813. if (ms_ptxtBandwidth)
  3814. {
  3815. // Release resource.
  3816. rspReleaseResource(&g_resmgrShell, &ms_ptxtBandwidth);
  3817. // Clear menu's pointer.
  3818. pmenuCur->ami[3].pgui = NULL;
  3819. }
  3820. }
  3821. return sRes;
  3822. }
  3823. ////////////////////////////////////////////////////////////////////////////////
  3824. //
  3825. // Called when a choice is made or changed on the multiplayer options menu.
  3826. //
  3827. ////////////////////////////////////////////////////////////////////////////////
  3828. static bool MultiOptionsChoice( // Returns true to accept, false to deny choice.
  3829. Menu* pmenuCur, // Current menu.
  3830. short sMenuItem) // Item chosen.
  3831. {
  3832. bool bAcceptChoice = true; // Assume accepting.
  3833. // Toggle the protocol to the next one in the list
  3834. switch (sMenuItem)
  3835. {
  3836. case 1:
  3837. // Increment and check to make sure we have a description and we have such a color . . .
  3838. g_GameSettings.m_sPlayerColorIndex++;
  3839. if ( g_GameSettings.m_sPlayerColorIndex >= CGameSettings::ms_sNumPlayerColorDescriptions
  3840. || g_GameSettings.m_sPlayerColorIndex >= CDude::MaxTextures)
  3841. {
  3842. g_GameSettings.m_sPlayerColorIndex = 0;
  3843. }
  3844. // Set the text from the INI setting. Note that we are changing a
  3845. // resource!
  3846. ms_ptxtColor->SetText("%s", CGameSettings::ms_apszPlayerColorDescriptions[g_GameSettings.m_sPlayerColorIndex]);
  3847. ms_ptxtColor->Compose();
  3848. break;
  3849. case 2:
  3850. if (ms_ptxtProto != NULL)
  3851. {
  3852. g_GameSettings.m_usProtocol++;
  3853. if (g_GameSettings.m_usProtocol >= RSocket::NumProtocols)
  3854. g_GameSettings.m_usProtocol = RSocket::FirstProtocol;
  3855. ms_ptxtProto->SetText("%s", RSocket::GetProtoName((RSocket::ProtoType)g_GameSettings.m_usProtocol));
  3856. ms_ptxtProto->Compose();
  3857. }
  3858. break;
  3859. case 3:
  3860. if (ms_ptxtBandwidth)
  3861. {
  3862. g_GameSettings.m_sNetBandwidth = (Net::Bandwidth)(g_GameSettings.m_sNetBandwidth + 1);
  3863. if (g_GameSettings.m_sNetBandwidth >= Net::NumBandwidths)
  3864. g_GameSettings.m_sNetBandwidth = Net::FirstBandwidth;
  3865. // Set new text and realize.
  3866. ms_ptxtBandwidth->SetText("%s", Net::BandwidthText[g_GameSettings.m_sNetBandwidth]);
  3867. ms_ptxtBandwidth->Compose();
  3868. }
  3869. break;
  3870. }
  3871. // Audible Feedback.
  3872. if (sMenuItem == -1)
  3873. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3874. else
  3875. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3876. return bAcceptChoice;
  3877. }
  3878. ////////////////////////////////////////////////////////////////////////////////
  3879. //
  3880. // Called when a choice is made or changed on the Editor menu.
  3881. //
  3882. ////////////////////////////////////////////////////////////////////////////////
  3883. static bool EditorMenuChoice( // Returns true to accept, false to deny choice.
  3884. Menu* pmenuCurrent, // Current menu.
  3885. short sMenuItem) // Item chosen.
  3886. {
  3887. bool bAcceptChoice = true; // Assume accepting.
  3888. switch (sMenuItem)
  3889. {
  3890. case 0:
  3891. Edit_Menu_Continue();
  3892. break;
  3893. case 1:
  3894. break;
  3895. case 2:
  3896. Edit_Menu_ExitEditor();
  3897. break;
  3898. }
  3899. // Audible Feedback.
  3900. if (sMenuItem == -1)
  3901. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3902. else
  3903. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3904. return bAcceptChoice;
  3905. }
  3906. ////////////////////////////////////////////////////////////////////////////////
  3907. //
  3908. // Called to init or kill the Mouse menu.
  3909. //
  3910. ////////////////////////////////////////////////////////////////////////////////
  3911. static short MouseInit( // Returns 0 on success, non-zero to cancel menu.
  3912. Menu* pmenuCur, // Current menu.
  3913. short sInit) // TRUE, if initializing; FALSE, if killing.
  3914. {
  3915. short sRes = 0; // Assume success.
  3916. if (sInit == TRUE)
  3917. {
  3918. sRes = InputSettingsDlg_InitMenu(pmenuCur);
  3919. }
  3920. else
  3921. {
  3922. sRes = InputSettingsDlg_KillMenu(pmenuCur);
  3923. }
  3924. return sRes;
  3925. }
  3926. ////////////////////////////////////////////////////////////////////////////////
  3927. //
  3928. // Called when a choice is made or changed on the Mouse menu.
  3929. //
  3930. ////////////////////////////////////////////////////////////////////////////////
  3931. static bool MouseChoice( // Returns true to accept, false to deny choice.
  3932. Menu* pmenuCurrent, // Current menu.
  3933. short sMenuItem) // Item chosen or -1 for change of focus.
  3934. {
  3935. bool bAcceptChoice = true; // Assume accepting.
  3936. // Audible Feedback.
  3937. if (sMenuItem == -1)
  3938. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3939. else
  3940. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3941. InputSettingsDlg_Choice(pmenuCurrent, sMenuItem);
  3942. return bAcceptChoice;
  3943. }
  3944. ////////////////////////////////////////////////////////////////////////////////
  3945. //
  3946. // Called to init or kill the Key menu.
  3947. //
  3948. ////////////////////////////////////////////////////////////////////////////////
  3949. static short KeyInit( // Returns 0 on success, non-zero to cancel menu.
  3950. Menu* pmenuCur, // Current menu.
  3951. short sInit) // TRUE, if initializing; FALSE, if killing.
  3952. {
  3953. short sRes = 0; // Assume success.
  3954. if (sInit == TRUE)
  3955. {
  3956. sRes = InputSettingsDlg_InitMenu(pmenuCur);
  3957. }
  3958. else
  3959. {
  3960. sRes = InputSettingsDlg_KillMenu(pmenuCur);
  3961. }
  3962. return sRes;
  3963. }
  3964. ////////////////////////////////////////////////////////////////////////////////
  3965. //
  3966. // Called when a choice is made or changed on the Key menu.
  3967. //
  3968. ////////////////////////////////////////////////////////////////////////////////
  3969. static bool KeyChoice( // Returns true to accept, false to deny choice.
  3970. Menu* pmenuCurrent, // Current menu.
  3971. short sMenuItem) // Item chosen or -1 for change of focus.
  3972. {
  3973. bool bAcceptChoice = true; // Assume accepting.
  3974. // Audible Feedback.
  3975. if (sMenuItem == -1)
  3976. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  3977. else
  3978. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  3979. InputSettingsDlg_Choice(pmenuCurrent, sMenuItem);
  3980. return bAcceptChoice;
  3981. }
  3982. ////////////////////////////////////////////////////////////////////////////////
  3983. //
  3984. // Called to init or kill the Joy menu.
  3985. //
  3986. ////////////////////////////////////////////////////////////////////////////////
  3987. static short JoyInit( // Returns 0 on success, non-zero to cancel menu.
  3988. Menu* pmenuCur, // Current menu.
  3989. short sInit) // TRUE, if initializing; FALSE, if killing.
  3990. {
  3991. short sRes = 0; // Assume success.
  3992. if (sInit == TRUE)
  3993. {
  3994. sRes = InputSettingsDlg_InitMenu(pmenuCur);
  3995. }
  3996. else
  3997. {
  3998. sRes = InputSettingsDlg_KillMenu(pmenuCur);
  3999. }
  4000. return sRes;
  4001. }
  4002. ////////////////////////////////////////////////////////////////////////////////
  4003. //
  4004. // Called when a choice is made or changed on the Joy menu.
  4005. //
  4006. ////////////////////////////////////////////////////////////////////////////////
  4007. static bool JoyChoice( // Returns true to accept, false to deny choice.
  4008. Menu* pmenuCurrent, // Current menu.
  4009. short sMenuItem) // Item chosen or -1 for change of focus.
  4010. {
  4011. bool bAcceptChoice = true; // Assume accepting.
  4012. // Audible Feedback.
  4013. if (sMenuItem == -1)
  4014. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  4015. else
  4016. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  4017. InputSettingsDlg_Choice(pmenuCurrent, sMenuItem);
  4018. return bAcceptChoice;
  4019. }
  4020. ////////////////////////////////////////////////////////////////////////////////
  4021. //
  4022. // Called to init or kill the Features menu.
  4023. //
  4024. ////////////////////////////////////////////////////////////////////////////////
  4025. static short FeaturesInit( // Returns 0 on success, non-zero to cancel menu.
  4026. Menu* pmenuCur, // Current menu.
  4027. short sInit) // TRUE, if initializing; FALSE, if killing.
  4028. {
  4029. short sRes = 0; // Assume success.
  4030. if (sInit != FALSE)
  4031. {
  4032. RGuiItem::ms_print.SetFont(DEFAULT_GUI_FONT_HEIGHT, &g_fontPostal);
  4033. short sItem;
  4034. short sMaxFeatureItems = NUM_ELEMENTS(pmenuCur->ami) - 1;
  4035. for (sItem = 0; sItem < sMaxFeatureItems && pmenuCur->ami[sItem + 1].pszText && sRes == 0; sItem++)
  4036. {
  4037. RMultiBtn** ppmb = (RMultiBtn**)&(pmenuCur->ami[sItem].pgui);
  4038. if (rspGetResourceInstance(&g_resmgrShell, GUI_CHECKBOX_FILE, ppmb) == 0)
  4039. {
  4040. // Set the initial state.
  4041. short sState = 1;
  4042. switch (sItem)
  4043. {
  4044. case 0:
  4045. sState = (g_GameSettings.m_sAlphaBlend != FALSE) ? 1 : 2;
  4046. break;
  4047. case 1:
  4048. sState = (g_GameSettings.m_s3dFog != FALSE) ? 1 : 2;
  4049. break;
  4050. case 2:
  4051. sState = (g_GameSettings.m_sParticleEffects != FALSE) ? 1 : 2;
  4052. break;
  4053. case 3:
  4054. sState = (g_GameSettings.m_sVolumeDistance != FALSE) ? 1 : 2;
  4055. break;
  4056. case 4:
  4057. sState = (g_GameSettings.m_sPlayAmbientSounds != FALSE) ? 1 : 2;
  4058. break;
  4059. }
  4060. (*ppmb)->m_sState = sState;
  4061. (*ppmb)->Compose();
  4062. }
  4063. else
  4064. {
  4065. TRACE("FeaturesInit(): rspGetResource() failed.\n");
  4066. sRes = 1;
  4067. }
  4068. }
  4069. }
  4070. else
  4071. {
  4072. short sMaxFeatureItems = NUM_ELEMENTS(pmenuCur->ami) - 1;
  4073. short sItem;
  4074. for (sItem = 0; sItem < sMaxFeatureItems; sItem++)
  4075. {
  4076. RMultiBtn** ppmb = (RMultiBtn**)&(pmenuCur->ami[sItem].pgui);
  4077. if (*ppmb)
  4078. {
  4079. // Get the final state.
  4080. short sOn = ( (*ppmb)->m_sState == 1) ? TRUE : FALSE;
  4081. // Release the resource.
  4082. rspReleaseResourceInstance(&g_resmgrShell, ppmb);
  4083. // Update the feature.
  4084. switch (sItem)
  4085. {
  4086. case 0:
  4087. g_GameSettings.m_sAlphaBlend = sOn;
  4088. break;
  4089. case 1:
  4090. g_GameSettings.m_s3dFog = sOn;
  4091. break;
  4092. case 2:
  4093. g_GameSettings.m_sParticleEffects = sOn;
  4094. break;
  4095. case 3:
  4096. g_GameSettings.m_sVolumeDistance = sOn;
  4097. break;
  4098. case 4:
  4099. g_GameSettings.m_sPlayAmbientSounds = sOn;
  4100. break;
  4101. }
  4102. }
  4103. }
  4104. }
  4105. return sRes;
  4106. }
  4107. ////////////////////////////////////////////////////////////////////////////////
  4108. //
  4109. // Called when a choice is made or changed on the Features menu.
  4110. //
  4111. ////////////////////////////////////////////////////////////////////////////////
  4112. static bool FeaturesChoice( // Returns true to accept, false to deny choice.
  4113. Menu* pmenuCurrent, // Current menu.
  4114. short sMenuItem) // Item chosen or -1 for change of focus.
  4115. {
  4116. bool bAcceptChoice = true; // Assume accepting.
  4117. // Audible Feedback.
  4118. if (sMenuItem == -1)
  4119. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  4120. else
  4121. {
  4122. // If there's an associated GUI . . .
  4123. if (pmenuCurrent->ami[sMenuItem].pgui)
  4124. {
  4125. // If it's a multistate btn . . .
  4126. if (pmenuCurrent->ami[sMenuItem].pgui->m_type == RGuiItem::MultiBtn)
  4127. {
  4128. // Move to the next state and update visual components.
  4129. RMultiBtn* pmb = (RMultiBtn*)pmenuCurrent->ami[sMenuItem].pgui;
  4130. pmb->NextState();
  4131. pmb->Compose();
  4132. }
  4133. }
  4134. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  4135. }
  4136. return bAcceptChoice;
  4137. }
  4138. ////////////////////////////////////////////////////////////////////////////////
  4139. // GUI callbacks.
  4140. ////////////////////////////////////////////////////////////////////////////////
  4141. //
  4142. // Callback from ms_psbGamma to update 'gamma' adjustment.
  4143. //
  4144. ////////////////////////////////////////////////////////////////////////////////
  4145. static void GammaScrollUpdate( // Returns nothing.
  4146. RScrollBar* psb) // Scrollbar that got updated.
  4147. {
  4148. ASSERT(psb != NULL);
  4149. // Get range.
  4150. long lMin, lMax;
  4151. psb->GetRange(&lMin, &lMax);
  4152. // Determine range of values.
  4153. long lRange = lMax - lMin;
  4154. // Set via scroll position.
  4155. long lVal = psb->GetPos();
  4156. // Convert to gamma value by ratio.
  4157. short sVal = short(GAMMA_RANGE / float(lRange) * (lVal - lMin) + 0.5) + MIN_GAMMA_VAL;
  4158. SetGammaLevel(sVal);
  4159. RGuiItem* pguiGammaVal = psb->GetItemFromId(GUI_ID_GAMMA_VAL);
  4160. if (pguiGammaVal)
  4161. {
  4162. pguiGammaVal->SetText("%+02ld", lVal);
  4163. pguiGammaVal->Compose();
  4164. }
  4165. }
  4166. ////////////////////////////////////////////////////////////////////////////////
  4167. //
  4168. // Callback from ms_psbDifficulty to update difficulty adjustment.
  4169. //
  4170. ////////////////////////////////////////////////////////////////////////////////
  4171. static void DifficultyScrollUpdate( // Returns nothing.
  4172. RScrollBar* psb) // Scrollbar that got updated.
  4173. {
  4174. ASSERT(psb != NULL);
  4175. // Get the parent.
  4176. RGuiItem* pguiParent = psb->GetParent();
  4177. // This is weird but it allows artie to finer tune the scroll thumb size.
  4178. // We use the ID of the parent as the divisor for the scrollbar value.
  4179. short sDivisor = (short)pguiParent->m_lId;
  4180. g_GameSettings.m_sDifficulty = (short)psb->GetPos() / sDivisor;
  4181. RGuiItem* pguiVal = psb->GetItemFromId(GUI_ID_DIFFICULTY_VAL);
  4182. if (pguiVal)
  4183. {
  4184. pguiVal->SetText("%d", g_GameSettings.m_sDifficulty);
  4185. pguiVal->Compose();
  4186. }
  4187. if (pguiParent)
  4188. {
  4189. RGuiItem* pguiText = psb->GetParent()->GetItemFromId(GUI_ID_DIFFICULTY_TEXT);
  4190. if (pguiText)
  4191. {
  4192. // Add shadow.
  4193. pguiText->m_sTextEffects |= RGuiItem::Shadow;
  4194. pguiText->m_u32TextShadowColor = GetCurrentMenuBox()->m_u32TextShadowColor;
  4195. pguiText->SetText("%s", ms_apszDifficultyDescriptions[g_GameSettings.m_sDifficulty - 1] );
  4196. pguiText->Compose();
  4197. }
  4198. }
  4199. }
  4200. ////////////////////////////////////////////////////////////////////////////////
  4201. //
  4202. // Callback from volume sliders to update corresponding volume adjustment.
  4203. //
  4204. ////////////////////////////////////////////////////////////////////////////////
  4205. static void VolumesScrollUpdate( // Returns nothing.
  4206. RScrollBar* psb) // Scrollbar that got updated.
  4207. {
  4208. ASSERT(psb != NULL);
  4209. SampleMaster::SoundCategory sc = (SampleMaster::SoundCategory)psb->m_ulUserData;
  4210. long lMin, lMax, lRange;
  4211. psb->GetRange(&lMin, &lMax);
  4212. lRange = lMax - lMin;
  4213. // Get volume and scale to user volume.
  4214. g_GameSettings.m_asCategoryVolumes[sc] = (short)(psb->GetPos() * SampleMaster::UserMaxVolume / lRange);
  4215. SetCategoryVolume(sc, g_GameSettings.m_asCategoryVolumes[sc]);
  4216. SampleMasterID* psmid = ms_apsmidVolumeTesters[sc];
  4217. if (psmid == NULL)
  4218. {
  4219. psmid = ms_apsmidVolumeTesters[0];
  4220. }
  4221. if (ms_siLastSamplePlayed)
  4222. {
  4223. // Abort last one.
  4224. AbortSample(ms_siLastSamplePlayed);
  4225. }
  4226. // Play a sample in that category.
  4227. PlaySample( // Returns RSnd used to play the sample.
  4228. // Does not fail.
  4229. *psmid, // In: Identifier of sample you want played.
  4230. sc, // In: Sound Volume Category for user adjustment
  4231. 255, // In: Initial Sound Instance Volume (0 - 255)
  4232. &ms_siLastSamplePlayed); // Out: Handle for adjusting sound volume
  4233. // Get val indicator.
  4234. RGuiItem* pguiVal = psb->GetItemFromId(GUI_ID_VOLUME_VAL);
  4235. if (pguiVal)
  4236. {
  4237. pguiVal->SetText("%d", g_GameSettings.m_asCategoryVolumes[sc]);
  4238. pguiVal->Compose();
  4239. }
  4240. }
  4241. ////////////////////////////////////////////////////////////////////////////////
  4242. //
  4243. // Callback from mouse sensitivity sliders to update corresponding
  4244. // mouse sensitivity adjsutment.
  4245. //
  4246. ////////////////////////////////////////////////////////////////////////////////
  4247. static void MouseSensitivityScrollUpdate( // Returns nothing.
  4248. RScrollBar* psb) // Scrollbar that got updated.
  4249. {
  4250. // Update value.
  4251. double* pdSensitivity = (double*)psb->m_ulUserInstance;
  4252. *pdSensitivity = double(psb->GetPos() ) / MOUSE_SENSITIVITY_DIVISOR;
  4253. RGuiItem* pguiVal = psb->GetItemFromId(GUI_ID_SENSITIVITY_VAL);
  4254. if (pguiVal)
  4255. {
  4256. pguiVal->SetText("%f", *pdSensitivity);
  4257. pguiVal->Compose();
  4258. }
  4259. }
  4260. ////////////////////////////////////////////////////////////////////////////////
  4261. //
  4262. // Callback from rotation scrollbars.
  4263. //
  4264. ////////////////////////////////////////////////////////////////////////////////
  4265. static void RotationScrollUpdateDouble( // Returns nothing.
  4266. RScrollBar* psb) // Scrollbar that got updated.
  4267. {
  4268. double* pdRotVal = (double*)psb->m_ulUserInstance;
  4269. *pdRotVal = double(psb->GetPos() );
  4270. RGuiItem* pguiVal = psb->GetItemFromId(GUI_ID_ROTATION_VAL);
  4271. if (pguiVal)
  4272. {
  4273. pguiVal->SetText("%d", (short)(*pdRotVal) );
  4274. pguiVal->Compose();
  4275. }
  4276. }
  4277. ////////////////////////////////////////////////////////////////////////////////
  4278. //
  4279. // Callback from rotation scrollbars.
  4280. //
  4281. ////////////////////////////////////////////////////////////////////////////////
  4282. static void RotationScrollUpdateShort( // Returns nothing.
  4283. RScrollBar* psb) // Scrollbar that got updated.
  4284. {
  4285. short* psRotVal = (short*)psb->m_ulUserInstance;
  4286. *psRotVal = short(psb->GetPos() );
  4287. RGuiItem* pguiVal = psb->GetItemFromId(GUI_ID_ROTATION_VAL);
  4288. if (pguiVal)
  4289. {
  4290. pguiVal->SetText("%d", *psRotVal);
  4291. pguiVal->Compose();
  4292. }
  4293. }
  4294. // Workaround the need for a platform-specific file selector, since this
  4295. // requires external dependencies like GTK+ on Linux, and may not play well
  4296. // with a fullscreen display mode on any platform. Better to just render
  4297. // into the existing framebuffer. --ryan.
  4298. #if 1 //PLATFORM_UNIX
  4299. static bool PickFileMenuChoice(Menu *pmenuCurrent, short sMenuItem);
  4300. extern Menu g_menuPickFile =
  4301. {
  4302. PICK_FILE_MENU_ID,
  4303. // Position info.
  4304. { // x, y, w, h, sPosX, sPosY, sItemSpacingY, sIndicatorSpacingX,
  4305. MENU_RECT_MD, // menu x, y, w, h
  4306. -120, // menu header x offset
  4307. MENU_HEAD_Y_MD, // menu header y offset
  4308. MENU_ITEM_X_MD, // menu items x offset
  4309. MENU_ITEM_Y_MD, // menu items y offset
  4310. MENU_ITEM_SPACE_Y_MD, // vertical space between menu items
  4311. MENU_ITEM_IND_SPACE_X_MD, // horizontal space between indicator and menu items
  4312. },
  4313. // Background info.
  4314. { // pszFile, u32BackColor
  4315. MENU_BG_MD,
  4316. MENU_BG_COLOR, // Background color.
  4317. PAL_SET_START, // Starting palette index to set.
  4318. PAL_SET_NUM, // Number of entries to set.
  4319. PAL_MAP_START, // Starting index of palette entries that can be mapped to.
  4320. PAL_MAP_NUM, // Number of palette entries that can be mapped to.
  4321. },
  4322. // GUI settings.
  4323. { // sTransparent.
  4324. TRUE, // TRUE if GUI is to be BLiT with transparency.
  4325. },
  4326. // Flags.
  4327. (MenuFlags)(MenuPosCenter | MenuBackTiled | MenuItemTextShadow | MenuHeaderTextShadow | MenuHeaderTextCenter),
  4328. // Header and its font info.
  4329. { // pszHeaderText, pszFontFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor.
  4330. NULL, // filled in by PickFile().
  4331. SMASH_FONT,
  4332. HEAD_FONT_HEIGHT, // Height of font.
  4333. HEAD_COLOR, // Text RGBA.
  4334. HEAD_SHADOW_COLOR // Text Shadow RGBA.
  4335. },
  4336. // Font info.
  4337. { // pszFile, sHeight, u32ForeColor, u32BackColor, u32ShadowColor
  4338. SMASH_FONT,
  4339. ITEM_FONT_HEIGHT, // Height of font.
  4340. ITEM_COLOR, // Text RGBA.
  4341. ITEM_SHADOW_COLOR // Text Shadow RGBA.
  4342. },
  4343. // Menu indicator.
  4344. { // pszFile, type
  4345. MENU_INDICATOR,
  4346. RImage::FSPR8,
  4347. },
  4348. // Menu callbacks.
  4349. { // fnInit, fnChoice,
  4350. NULL, // Called before menu is initialized.
  4351. PickFileMenuChoice, // Called when item is chosen.
  4352. },
  4353. // Menu auto items.
  4354. { // sDefaultItem, sCancelItem,
  4355. 0, // Menu item (index in ami[]) selected initially.
  4356. // Negative indicates distance from number of items
  4357. // (e.g., -1 is the last item).
  4358. -1, // Menu item (index in ami[]) chosen on cancel.
  4359. // Negative indicates distance from number of items
  4360. // (e.g., -1 is the last item).
  4361. },
  4362. // Menu items.
  4363. // Filled in by PickFile().
  4364. { // pszText, sEnabled, pmenu, pgui
  4365. NULL // Terminates list.
  4366. },
  4367. };
  4368. static volatile bool g_PickFileMenuDone = false;
  4369. static volatile const char *g_PickFileMenuChoice = NULL;
  4370. static bool PickFileMenuChoice(Menu *pmenuCurrent, short sMenuItem)
  4371. {
  4372. ASSERT(pmenuCurrent == &g_menuPickFile);
  4373. if (sMenuItem == -1) // focus change.
  4374. {
  4375. PlaySample(g_smidMenuItemChange, SampleMaster::UserFeedBack);
  4376. return true;
  4377. }
  4378. PlaySample(g_smidMenuItemSelect, SampleMaster::UserFeedBack);
  4379. g_PickFileMenuChoice = (const char *) pmenuCurrent->ami[sMenuItem].pszText;
  4380. g_PickFileMenuDone = true; // break loop in PickFile().
  4381. return true; // accept choice.
  4382. }
  4383. short PickFile(const char *title, void (*enumer)(Menu *), char *buf, size_t bufsize)
  4384. {
  4385. *buf = '\0';
  4386. Menu *currentMenu = GetCurrentMenu();
  4387. int Max = (sizeof(g_menuPickFile.ami) / sizeof(g_menuPickFile.ami[0])) - 1;
  4388. g_menuPickFile.menuheader.pszHeaderText = (char *) title;
  4389. memset(&g_menuPickFile.ami, '\0', sizeof (g_menuPickFile.ami));
  4390. enumer(&g_menuPickFile);
  4391. g_menuPickFile.menuautoitems.sCancelItem = Max; // the null index
  4392. g_PickFileMenuChoice = NULL;
  4393. g_PickFileMenuDone = false;
  4394. short sResult = StartMenu(&g_menuPickFile, &g_resmgrShell, g_pimScreenBuf);
  4395. if (sResult != 0)
  4396. {
  4397. TRACE("StartMenu failed! Can't pick file!\n");
  4398. return -1;
  4399. }
  4400. while (!g_PickFileMenuDone)
  4401. {
  4402. if (rspGetQuitStatus())
  4403. break;
  4404. // Update the system, drive the audio, blah blah blah.
  4405. UpdateSystem();
  4406. RInputEvent ie;
  4407. ie.type = RInputEvent::None;
  4408. rspGetNextInputEvent(&ie);
  4409. DoMenuInput(&ie, g_InputSettings.m_sUseJoy);
  4410. DoMenuOutput(g_pimScreenBuf);
  4411. rspUpdateDisplay();
  4412. }
  4413. if (g_PickFileMenuChoice != NULL)
  4414. {
  4415. strncpy(buf, (const char *) g_PickFileMenuChoice, bufsize);
  4416. buf[bufsize-1] = '\0'; // just in case.
  4417. }
  4418. TRACE("PickFile: Going with %s.\n", buf);
  4419. for (int i = 0; (i < Max) && (g_menuPickFile.ami[i].pszText); i++)
  4420. free(g_menuPickFile.ami[i].pszText);
  4421. // put the old menu back.
  4422. StartMenu(currentMenu, &g_resmgrShell, g_pimScreenBuf);
  4423. return ((g_PickFileMenuChoice == NULL) ? -1 : 0);
  4424. }
  4425. #endif // PLATFORM_UNIX
  4426. ////////////////////////////////////////////////////////////////////////////////
  4427. // EOF
  4428. ////////////////////////////////////////////////////////////////////////////////