SCORE.CPP 85 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: F:\projects\c&c\vcs\code\score.cpv 2.17 16 Oct 1995 16:49:54 JOE_BOSTIC $ */
  15. /***********************************************************************************************
  16. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : SCORE.CPP *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : April 19, 1994 *
  26. * *
  27. * Last Update : May 3, 1995 [BWG] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * Call_Back_Delay -- Combines Call_Back() and Delay() functions *
  32. * Draw_Bar_Graphs -- Draw "Casualties" bar graphs *
  33. * Draw_InfantryMan -- Draw one guy in score screen, update animation *
  34. * Draw_Infantrymen -- Draw all the guys on the score screen *
  35. * New_Infantry_Anim -- Start up a new animation for one of the infantrymen *
  36. * ScoreClass::Count_Up_Print -- Prints a number (up to its max) into a string, cleanly *
  37. * ScoreClass::Delay -- Pauses waiting for keypress. *
  38. * ScoreClass::DO_GDI_GRAPH -- Show # of people or buildings killed on GDI score screen *
  39. * ScoreClass::Presentation -- Main routine to display score screen. *
  40. * ScoreClass::Print_Graph_Title -- Prints title on score screen. *
  41. * ScoreClass::Print_Minutes -- Print out hours/minutes up to max *
  42. * ScoreClass::Pulse_Bar_Graph -- Pulses the bargraph color. *
  43. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  44. #include "function.h"
  45. #include "textblit.h"
  46. #define SCORETEXT_X 184
  47. #define SCORETEXT_Y 8
  48. #define CASUALTY_Y 88
  49. #define BUILDING_X 256
  50. #define BUILDING_Y 128
  51. #define BARGRAPH_X 266
  52. #define MAX_BAR_X 318 // max possible is 319 because of bar's right shadow
  53. #define SIZEGBAR 119
  54. #define HALLFAME_X 19
  55. #define HALLFAME_Y 120
  56. #define MULTISCOREX 30
  57. #define TEDIT_FAME 1
  58. #define NUMINFANTRYMEN 15
  59. #define NUMFAMENAMES 7
  60. #define MAX_FAMENAME_LENGTH 12
  61. struct InfantryAnim {
  62. int xpos;
  63. int ypos;
  64. void const *shapefile;
  65. void const *remap;
  66. int anim;
  67. int stage;
  68. char delay;
  69. InfantryTypeClass const *Class;
  70. } InfantryMan[NUMINFANTRYMEN];
  71. void Draw_InfantryMen(void);
  72. void Draw_InfantryMan(int index);
  73. void New_Infantry_Anim(int index, int anim);
  74. void Draw_Bar_Graphs(int i, int gkilled, int nkilled, int ckilled);
  75. void Animate_Cursor(int pos, int ypos);
  76. void Animate_Score_Objs(void);
  77. void Cycle_Wait_Click(void);
  78. int ScorePass;
  79. void const * Beepy6;
  80. int ControlQ; // cheat key to skip past score/mapsel screens
  81. bool StillUpdating;
  82. GraphicBufferClass *PseudoSeenBuff;
  83. GraphicBufferClass *TextPrintBuffer;
  84. #ifdef WRITE_LBM
  85. PUBLIC bool CCWrite_LBM_File(CCFileClass &lbmhandle, BufferClass& buff, short bitplanes, unsigned char *palette);
  86. #endif
  87. unsigned char RemapCiv[256]={
  88. 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
  89. 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0xD0,0x18,0x19,0xD1,0xD2,0xD3,0xD4,0x1E,0xD5,
  90. 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
  91. 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
  92. 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
  93. 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
  94. 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
  95. 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0xD6,0xD7,0xD8,0xD9,0x7E,0xDA,
  96. 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
  97. 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,
  98. 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
  99. 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
  100. 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
  101. 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xDB,0xDC,0xDD,0xDE,0xDB,0xDC,0xDD,0xDE,0xDF,
  102. 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
  103. 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
  104. unsigned char const ScoreRemapGrey[256] = {
  105. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0..15
  106. 16, 17, 18, 19, 20,176, 22,208, 24, 25,209,210,211,212, 30,213, // 16..31
  107. 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 32..47
  108. 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 48..63
  109. 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 64..79
  110. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 80..95
  111. 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, // 96..111
  112. 112,113,114,115,116,117,118,119,120,121,214,215,216,217,149,218, // 112..127
  113. 128,129,130,131,132,133,134,135,136,137,138,108,140,141,142,143, // 128..143
  114. 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, // 144..159
  115. 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, // 160..175
  116. 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, // 176..191
  117. 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, // 192..207
  118. 208,209,210,211,212,213,214,219,220,221,222,219,220,221,222,223, // 208..223
  119. 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, // 224..239
  120. 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 // 240..255
  121. };
  122. unsigned char const ScoreRemapYellow[256] = {
  123. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0..15
  124. 16, 17, 18, 19, 20,176, 22,208, 24, 25,209,210,211,212, 30,213, // 16..31
  125. 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 32..47
  126. 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 48..63
  127. 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 64..79
  128. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 80..95
  129. 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, // 96..111
  130. 112,113,114,115,116,117,118,119,120,121,214,215,216,217,149,218, // 112..127
  131. 128,129,130,131,132,133,134,135,136,137,138,108,140,141,142,143, // 128..143
  132. 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, // 144..159
  133. 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, // 160..175
  134. 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, // 176..191
  135. 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, // 192..207
  136. 208,209,210,211,212,213,214,219,220,221,222,219,220,221,222,223, // 208..223
  137. 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, // 224..239
  138. 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 // 240..255
  139. };
  140. unsigned char const ScoreRemapBldg[256]={
  141. 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
  142. 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
  143. 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
  144. 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
  145. 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
  146. 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
  147. 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
  148. 0x70,0x71,0xCE,0xC5,0x49,0x48,0x47,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,
  149. 0x80,0x81,0xB8,0x83,0x7C,0x7A,0x76,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
  150. 0x74,0x91,0x92,0x93,0x94,0x95,0xB5,0x97,0x98,0xCF,0x4B,0x7F,0x9C,0x9D,0x9E,0x9F,
  151. 0xA0,0xA1,0xA2,0x83,0x79,0xA5,0xA6,0xA7,0x43,0x99,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
  152. 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
  153. 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
  154. 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xBB,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
  155. 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
  156. 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF
  157. };
  158. unsigned char const ScoreRemapFBall[256]={
  159. 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
  160. 0xB0,0xE5,0x82,0xE4,0xE3,0xE2,0xB1,0xD0,0xE1,0xE0,0xD1,0xD2,0xD3,0xD4,0xDF,0xD5,
  161. 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0xE6,0xE7,0xA0,0xE8,0x2E,0x2F,
  162. 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
  163. 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
  164. 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
  165. 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
  166. 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,
  167. 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
  168. 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,
  169. 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
  170. 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
  171. 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
  172. 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
  173. 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
  174. 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF
  175. };
  176. TextBlitClass BlitList;
  177. char *ScreenNames[2]={"S-GDIIN2.WSA","SCRSCN1.WSA"};
  178. //extern short StreamLowImpact;
  179. // ST - 1/3/2019 10:38AM
  180. int StreamLowImpact = FALSE;
  181. struct Fame {
  182. char name[MAX_FAMENAME_LENGTH];
  183. int score;
  184. int level;
  185. };
  186. ScoreAnimClass *ScoreObjs[MAXSCOREOBJS];
  187. ScoreAnimClass::ScoreAnimClass(int x, int y, void const * data)
  188. {
  189. BlitList.Add (x*2, y*2, x*2, y*2, 2* String_Pixel_Width ( (char*)data ) , 16);
  190. XPos = x;
  191. YPos = y;
  192. Timer.Set(0);
  193. Timer.Start();
  194. DataPtr = data;
  195. }
  196. ScoreTimeClass::ScoreTimeClass(int xpos, int ypos, void const * data, int max, int timer) :
  197. ScoreAnimClass(xpos, ypos, data)
  198. {
  199. Stage = 0;
  200. MaxStage = max;
  201. TimerReset = timer;
  202. }
  203. void ScoreTimeClass::Update(void)
  204. {
  205. GraphicViewPortClass *oldpage;
  206. if (!Timer.Time()) {
  207. Timer.Set(TimerReset);
  208. if (++Stage >= MaxStage) Stage = 0;
  209. oldpage = LogicPage;
  210. Set_Logic_Page(PseudoSeenBuff);
  211. CC_Draw_Shape(DataPtr, Stage, XPos, YPos, WINDOW_MAIN, SHAPE_WIN_REL, 0, 0);
  212. Set_Logic_Page(oldpage);
  213. }
  214. }
  215. ScoreCredsClass::ScoreCredsClass(int xpos, int ypos, void const * data, int max, int timer) :
  216. ScoreAnimClass(xpos, ypos, data)
  217. {
  218. Stage = 0;
  219. MaxStage = max;
  220. TimerReset = timer;
  221. Clock1 = MixFileClass::Retrieve("CLOCK1.AUD");
  222. CashTurn = MixFileClass::Retrieve("CASHTURN.AUD");
  223. }
  224. void ScoreCredsClass::Update(void)
  225. {
  226. GraphicViewPortClass *oldpage;
  227. if (!Timer.Time()) {
  228. Timer.Set(TimerReset);
  229. if (++Stage >= MaxStage) Stage = 0;
  230. oldpage = LogicPage;
  231. Set_Logic_Page(PseudoSeenBuff);
  232. if (Stage <22) {
  233. Play_Sample(Clock1, 255, Options.Normalize_Sound(70));
  234. } else {
  235. if (Stage==24) {
  236. Play_Sample(CashTurn, 255, Options.Normalize_Sound(70));
  237. }
  238. }
  239. CC_Draw_Shape(DataPtr,Stage, XPos, YPos, WINDOW_MAIN,SHAPE_WIN_REL, 0, 0);
  240. Set_Logic_Page(oldpage);
  241. }
  242. }
  243. ScorePrintClass::ScorePrintClass(int string, int xpos, int ypos, void const * palette, int background) :
  244. ScoreAnimClass(xpos, ypos, Text_String(string))
  245. {
  246. Background = background;
  247. PrimaryPalette = palette;
  248. Stage = 0;
  249. }
  250. ScorePrintClass::ScorePrintClass(void const * string, int xpos, int ypos, void const * palette, int background) :
  251. ScoreAnimClass(xpos, ypos, string)
  252. {
  253. Background = background;
  254. PrimaryPalette = palette;
  255. Stage = 0;
  256. }
  257. void ScorePrintClass::Update(void)
  258. {
  259. static char localstr[2]={0,0};
  260. static char _whitepal[]={0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F};
  261. if (Stage && (((char *)DataPtr)[Stage-1]==0) ) {
  262. for (int i = 0; i < MAXSCOREOBJS; i++) {
  263. if (ScoreObjs[i] == this) {
  264. ScoreObjs[i] = 0;
  265. }
  266. }
  267. BlitList.Add (XPos*2, YPos*2, XPos*2, YPos*2,(Stage*6)+14, 8*2);
  268. delete this;
  269. return;
  270. }
  271. StillUpdating = true;
  272. if (!Timer.Time()) {
  273. Timer.Set(1);
  274. int pos = XPos+(Stage*6);
  275. if (Stage) {
  276. localstr[0]=((char *)DataPtr)[Stage-1];
  277. /*
  278. ** Clear out the white letter overlay
  279. */
  280. static char const _blackpal[]={BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK};
  281. Set_Font_Palette(_blackpal);
  282. TextPrintBuffer->Print(localstr, 2*(pos-6),2*(YPos-1), TBLACK, TBLACK);
  283. TextPrintBuffer->Print(localstr, 2*(pos-6),2*(YPos+1), TBLACK, TBLACK);
  284. TextPrintBuffer->Print(localstr, 2*(pos-6+1),2*(YPos), TBLACK, TBLACK);
  285. Set_Font_Palette(PrimaryPalette);
  286. TextPrintBuffer->Print(localstr, 2*(pos-6),2*YPos, TBLACK, TBLACK);
  287. }
  288. if (((char *)DataPtr)[Stage]) {
  289. localstr[0]=((char *)DataPtr)[Stage];
  290. Set_Font_Palette(_whitepal);
  291. TextPrintBuffer->Print(localstr, pos*2, 2*(YPos-1), TBLACK, TBLACK);
  292. TextPrintBuffer->Print(localstr, pos*2, 2*(YPos+1), TBLACK, TBLACK);
  293. TextPrintBuffer->Print(localstr, (pos+1)*2,2*YPos , TBLACK, TBLACK);
  294. }
  295. Stage++;
  296. }
  297. }
  298. MultiStagePrintClass::MultiStagePrintClass(int string, int xpos, int ypos, void const * palette, int background) :
  299. ScoreAnimClass(xpos, ypos, Text_String(string))
  300. {
  301. Background = background;
  302. PrimaryPalette = palette;
  303. Stage = 0;
  304. }
  305. MultiStagePrintClass::MultiStagePrintClass(void const * string, int xpos, int ypos, void const * palette, int background) :
  306. ScoreAnimClass(xpos, ypos, string)
  307. {
  308. Background = background;
  309. PrimaryPalette = palette;
  310. Stage = 0;
  311. }
  312. void MultiStagePrintClass::Update(void)
  313. {
  314. static char localstr[2]={0,0};
  315. static char _whitepal[]={0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F};
  316. if (Stage && (((char *)DataPtr)[Stage-1]==0) ) {
  317. for (int i = 0; i < MAXSCOREOBJS; i++) {
  318. if (ScoreObjs[i] == this) {
  319. ScoreObjs[i] = 0;
  320. }
  321. }
  322. BlitList.Add (XPos*2, YPos*2, XPos*2, YPos*2,(Stage*6)+14, 8*2);
  323. delete this;
  324. return;
  325. }
  326. StillUpdating = true;
  327. if (!Timer.Time()) {
  328. Timer.Set(1);
  329. /*
  330. ** Do 10 stages at once
  331. */
  332. for (int wibble = 0 ; wibble < 10 ; wibble ++){
  333. int pos = XPos+(Stage*6);
  334. if (Stage) {
  335. localstr[0]=((char *)DataPtr)[Stage-1];
  336. /*
  337. ** Clear out the white letter overlay
  338. */
  339. static char const _blackpal[]={BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK,BLACK};
  340. Set_Font_Palette(_blackpal);
  341. TextPrintBuffer->Print(localstr, 2*(pos-6),2*(YPos-1), TBLACK, TBLACK);
  342. TextPrintBuffer->Print(localstr, 2*(pos-6),2*(YPos+1), TBLACK, TBLACK);
  343. TextPrintBuffer->Print(localstr, 2*(pos-6+1),2*(YPos), TBLACK, TBLACK);
  344. Set_Font_Palette(PrimaryPalette);
  345. TextPrintBuffer->Print(localstr, 2*(pos-6),2*YPos, TBLACK, TBLACK);
  346. }
  347. if (((char *)DataPtr)[Stage]) {
  348. localstr[0]=((char *)DataPtr)[Stage];
  349. Set_Font_Palette(_whitepal);
  350. TextPrintBuffer->Print(localstr, pos*2, 2*(YPos-1), TBLACK, TBLACK);
  351. TextPrintBuffer->Print(localstr, pos*2, 2*(YPos+1), TBLACK, TBLACK);
  352. TextPrintBuffer->Print(localstr, (pos+1)*2,2*YPos , TBLACK, TBLACK);
  353. }
  354. Stage++;
  355. if ( ( (char *) DataPtr) [Stage-1] == 0 ) break;
  356. }
  357. }
  358. }
  359. ScoreScaleClass::ScoreScaleClass(void const * string, int xpos, int ypos, char const palette[]) :
  360. ScoreAnimClass(xpos, ypos, string)
  361. {
  362. Palette = &palette[0];
  363. Stage = 5;
  364. }
  365. void ScoreScaleClass::Update(void)
  366. {
  367. static int _destx[]={0,80,107,134,180,228};
  368. static int _destw[]={6,20, 30, 40, 60, 80};
  369. /*
  370. ** Restore the background for the scaled-up letter
  371. */
  372. if (!Timer.Time()) {
  373. Timer.Set(1);
  374. if (Stage != 5) {
  375. TextPrintBuffer->Blit(HidPage, _destx[Stage+1]*2, YPos*2, _destx[Stage+1]*2, YPos*2, _destw[Stage+1]*2, _destw[Stage+1]*2);
  376. //SysMemPage.Blit(*PseudoSeenBuff, _destx[Stage+1], YPos, _destx[Stage+1], YPos, _destw[Stage+1], _destw[Stage+1]);
  377. }
  378. if (Stage) {
  379. Set_Font_Palette(Palette);
  380. TextPrintBuffer->Fill_Rect(0,0, 7*2,7*2, TBLACK);
  381. TextPrintBuffer->Print((char *)DataPtr, 0,0, TBLACK, TBLACK);
  382. TextPrintBuffer->Scale(HidPage, 0,0, _destx[Stage]*2, YPos*2, 5*2,5*2, _destw[Stage]*2, _destw[Stage]*2, true);
  383. //SysMemPage.Fill_Rect(0,0, 7,7, TBLACK);
  384. //SysMemPage.Print((char *)DataPtr, 0,0, TBLACK, TBLACK);
  385. //SysMemPage.Scale(*PseudoSeenBuff, 0,0, _destx[Stage], YPos, 5,5, _destw[Stage], _destw[Stage], true);
  386. Stage--;
  387. } else {
  388. Set_Font_Palette(Palette);
  389. for (int i = 0; i < MAXSCOREOBJS; i++) {
  390. if (ScoreObjs[i]==this) ScoreObjs[i] = 0;
  391. }
  392. TextPrintBuffer->Print((char *)DataPtr, XPos*2,YPos*2, TBLACK, TBLACK);
  393. //TextPrintBuffer->Blit(HidPage, XPos*2, YPos*2, XPos*2, YPos*2,2*6,2*6);
  394. //BlitList.Add (XPos, YPos, XPos, YPos, 6,6);
  395. //SysMemPage.Print((char *)DataPtr, XPos,YPos, TBLACK, TBLACK);
  396. //SysMemPage.Blit(*PseudoSeenBuff, XPos,YPos, XPos, YPos, 6,6);
  397. delete this;
  398. return;
  399. }
  400. }
  401. }
  402. int Alloc_Object(ScoreAnimClass *obj)
  403. {
  404. int i,ret;
  405. for (i = ret = 0; i < MAXSCOREOBJS; i++) {
  406. if (!ScoreObjs[i]) {
  407. ScoreObjs[i] = obj;
  408. ret = i;
  409. break;
  410. }
  411. }
  412. return(ret);
  413. }
  414. TextBlitClass::TextBlitClass (void)
  415. {
  416. Clear();
  417. }
  418. void TextBlitClass::Add (int x, int y, int dx, int dy, int w, int h)
  419. {
  420. if ( Count < MAX_ENTRIES ){
  421. BlitListo [Count].SourceX = x;
  422. BlitListo [Count].SourceY = y;
  423. BlitListo [Count].DestX = dx;
  424. BlitListo [Count].DestY = dy;
  425. BlitListo [Count].Width = w;
  426. BlitListo [Count].Height = h;
  427. Count++;
  428. }
  429. }
  430. void TextBlitClass::Clear(void)
  431. {
  432. Count = 0;
  433. }
  434. void TextBlitClass::Update(void)
  435. {
  436. if (TextPrintBuffer){
  437. if (HidPage.Lock()){
  438. for (int i=0 ; i<Count ; i++){
  439. TextPrintBuffer->Blit (HidPage, BlitListo[i].SourceX,
  440. BlitListo[i].SourceY,
  441. BlitListo[i].DestX,
  442. BlitListo[i].DestY,
  443. BlitListo[i].Width,
  444. BlitListo[i].Height,
  445. true);
  446. }
  447. HidPage.Unlock();
  448. }
  449. }
  450. }
  451. void Disable_Uncompressed_Shapes (void);
  452. void Enable_Uncompressed_Shapes (void);
  453. /***********************************************************************************************
  454. * ScoreClass::Presentation -- Main routine to display score screen. *
  455. * *
  456. * This is the main routine that displays the score screen graphics. *
  457. * It gets called at the end of each scenario and is used to present *
  458. * the results and a rating of the player's battle. *
  459. * *
  460. * INPUT: none *
  461. * *
  462. * OUTPUT: none *
  463. * *
  464. * WARNINGS: none *
  465. * *
  466. * HISTORY: *
  467. * 05/02/1994 : Created. *
  468. *=============================================================================================*/
  469. void ScoreClass::Presentation(void)
  470. {
  471. //static char const _redpal[]={0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x21,0x2F};
  472. static char const _redpal[]={0x20,0x22,0x24,0x26,0x28,0x28,0x28,0x28,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x21,0x2F};
  473. static char const _greenpal[]={0x10,0x12,0x14,0x16,0x18,0x18,0x18,0x18,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x10,0x1F};
  474. static char const _bluepal[]={0x60,0x62,0x64,0x66,0x68,0x68,0x68,0x68,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x61,0x6F};
  475. //static char const _bluepal[]={0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x61,0x6F};
  476. static unsigned char const _yellowpal[]={0x0,0x0,0xEC,0x0,0xEB,0x0,0xEA,0x0,0xE9,0x0,0x0,0x0,0x0,0x0,0xED,0x0};
  477. static int const _casuax[2]={144,146};
  478. static int const _casuay[2]={ 78, 90};
  479. static int const _gditxx[2]={150,224};
  480. static int const _gditxy[2]={ 90, 90};
  481. static int const _nodtxx[2]={150,224};
  482. static int const _nodtxy[2]={102,102};
  483. // static int _bargrx[2]={297,SCORETEXT_X+64};
  484. // static int _bargry[2]={ 90,CASUALTY_Y + 2};
  485. static int const _bldggy[2]={138,128};
  486. static int const _bldgny[2]={150,140};
  487. // int gdikilled, nodkilled, civkilled, max, i, k, shapenum;
  488. int i;
  489. int max;
  490. void const * yellowptr;
  491. void const * redptr;
  492. CCFileClass file(FAME_FILE_NAME);
  493. struct Fame hallfame[NUMFAMENAMES];
  494. void *anim, *oldfont;
  495. int oldfontxspacing = FontXSpacing;
  496. int house = PlayerPtr->Class->House; // 0 or 1
  497. char inter_pal[15];
  498. /*
  499. ** Choose an appropriate palette file for the interpolation
  500. */
  501. if (house == HOUSE_GOOD){
  502. sprintf(inter_pal,"SCORPAL1.PAL");
  503. }else{
  504. sprintf(inter_pal,"SNODPAL1.PAL");
  505. }
  506. if (Special.IsJurassic && AreThingiesEnabled) return;
  507. PseudoSeenBuff = new GraphicBufferClass(320,200,(void*)NULL);
  508. TextPrintBuffer = new GraphicBufferClass(SeenBuff.Get_Width(), SeenBuff.Get_Height(), (void*)NULL);
  509. TextPrintBuffer->Clear();
  510. BlitList.Clear();
  511. Disable_Uncompressed_Shapes ();
  512. ControlQ = 0;
  513. FontXSpacing = 0;
  514. Map.Override_Mouse_Shape(MOUSE_NORMAL);
  515. Theme.Queue_Song(THEME_WIN1);
  516. VisiblePage.Clear();
  517. PseudoSeenBuff->Clear();
  518. SysMemPage.Clear();
  519. WWMouse->Erase_Mouse(&HidPage, TRUE);
  520. HiddenPage.Clear();
  521. Set_Palette(BlackPalette);
  522. Set_Logic_Page(SysMemPage);
  523. void const * country4 = MixFileClass::Retrieve("COUNTRY4.AUD");
  524. void const * sfx4 = MixFileClass::Retrieve("SFX4.AUD");
  525. Beepy6 = MixFileClass::Retrieve("BEEPY6.AUD");
  526. /*
  527. ** Load the background for the score screen
  528. */
  529. anim = Open_Animation(ScreenNames[house],NULL,0L,(WSAOpenType)(WSA_OPEN_FROM_MEM | WSA_OPEN_TO_PAGE),Palette);
  530. unsigned minutes = (unsigned)((ElapsedTime / (long)TIMER_MINUTE))+1;
  531. /*
  532. ** Determine leadership rating.
  533. */
  534. unsigned leadership = 0;
  535. int index;
  536. for (index = 0; index < Logic.Count(); index++) {
  537. ObjectClass * object = Logic[index];
  538. if (object->Owner() == house) {
  539. leadership++;
  540. }
  541. }
  542. HouseClass *houses[3];
  543. for (index = 0; index < 3; index++) {
  544. houses[index] =(HouseClass::As_Pointer((HousesType)(HOUSE_GOOD+index)));
  545. }
  546. GKilled = (HouseClass::As_Pointer(HOUSE_GOOD))->UnitsLost;
  547. NKilled = (HouseClass::As_Pointer(HOUSE_BAD))->UnitsLost;
  548. CKilled = (HouseClass::As_Pointer(HOUSE_NEUTRAL))->UnitsLost;
  549. GBKilled = (HouseClass::As_Pointer(HOUSE_GOOD))->BuildingsLost;
  550. NBKilled = (HouseClass::As_Pointer(HOUSE_BAD))->BuildingsLost;
  551. CBKilled = (HouseClass::As_Pointer(HOUSE_NEUTRAL))->BuildingsLost;
  552. /*
  553. ** New - ST 6/12/96 2:40PM
  554. */
  555. GHarvested = (HouseClass::As_Pointer(HOUSE_GOOD))->HarvestedCredits;
  556. NHarvested = (HouseClass::As_Pointer(HOUSE_BAD))->HarvestedCredits;
  557. if (!leadership) leadership++;
  558. leadership = Cardinal_To_Fixed(GKilled+GBKilled+leadership, leadership);
  559. leadership = Fixed_To_Cardinal(100, leadership);
  560. if (leadership > 100) leadership = 100;
  561. /*
  562. ** Determine efficiency rating.
  563. */
  564. int gharv = GHarvested;
  565. int init = PlayerPtr->InitialCredits;
  566. int cred = PlayerPtr->Available_Money();
  567. unsigned efficiency = Cardinal_To_Fixed( (house == HOUSE_GOOD ? GHarvested : NHarvested) + (unsigned)PlayerPtr->InitialCredits+1, (unsigned)PlayerPtr->Available_Money()+1);
  568. if (!efficiency) efficiency++;
  569. efficiency = Fixed_To_Cardinal(100, efficiency);
  570. if (efficiency > 100) efficiency = 100;
  571. /*
  572. ** Calculate total score
  573. */
  574. long total = ((leadership * 40) + (4600) + (efficiency * 14))/100;
  575. if (!total) total++;
  576. total *= (BuildLevel+1);
  577. // Load up the shapes for the Nod score screen
  578. if (house == HOUSE_GOOD) {
  579. yellowptr = MixFileClass::Retrieve("BAR3YLW.SHP");
  580. redptr = MixFileClass::Retrieve("BAR3RED.SHP");
  581. }
  582. /* Change to the six-point font for Text_Print */
  583. oldfont = Set_Font(ScoreFontPtr);
  584. Call_Back();
  585. /* --- Now display the background animation --- */
  586. Hide_Mouse();
  587. Animate_Frame(anim, SysMemPage, 1);
  588. SysMemPage.Blit(*PseudoSeenBuff);
  589. Increase_Palette_Luminance (Palette , 30,30,30,63);
  590. InterpolationPalette = Palette;
  591. InterpolationPaletteChanged = TRUE;
  592. Read_Interpolation_Palette(inter_pal);
  593. Interpolate_2X_Scale( PseudoSeenBuff , &SeenBuff , inter_pal);
  594. Fade_Palette_To(Palette, FADE_PALETTE_FAST, Call_Back);
  595. Play_Sample(country4, 255, Options.Normalize_Sound(90));
  596. int frame = 1;
  597. StreamLowImpact = true;
  598. while (frame < Get_Animation_Frame_Count(anim)) {
  599. Animate_Frame(anim, *PseudoSeenBuff, frame++);
  600. ////////////////Interpolate_2X_Scale( PseudoSeenBuff , &SeenBuff , NULL);
  601. Call_Back_Delay(2);
  602. }
  603. StreamLowImpact = false;
  604. Call_Back();
  605. Close_Animation(anim);
  606. /*
  607. ** Background's up, so now load various shapes and animations
  608. */
  609. void const * timeshape = MixFileClass::Retrieve("TIME.SHP");
  610. ScoreObjs[0] = new ScoreTimeClass(233, 2, timeshape, 30, 4);
  611. void const * hiscore1shape = MixFileClass::Retrieve("HISCORE1.SHP");
  612. void const * hiscore2shape = MixFileClass::Retrieve("HISCORE2.SHP");
  613. ScoreObjs[1] = new ScoreTimeClass(4, 97, hiscore1shape, 10, 4);
  614. ScoreObjs[2] = new ScoreTimeClass(8, 172, hiscore2shape, 10, 4);
  615. /* Now display the stuff */
  616. PseudoSeenBuff->Blit(SysMemPage);
  617. if (house == HOUSE_BAD) {
  618. /*
  619. ** load the logo
  620. */
  621. void const * logoptr = MixFileClass::Retrieve("LOGOS.SHP");
  622. CC_Draw_Shape(logoptr, 1, 0, 0, WINDOW_MAIN, SHAPE_WIN_REL, 0, 0);
  623. Bit_It_In_Scale(0,0, 128,104-16, &SysMemPage, PseudoSeenBuff, &SeenBuff , 1);
  624. }
  625. Set_Logic_Page(PseudoSeenBuff);
  626. #ifdef FRENCH
  627. Alloc_Object(new ScorePrintClass(TXT_SCORE_TIME, 200, 3,_greenpal));
  628. #else
  629. Alloc_Object(new ScorePrintClass(TXT_SCORE_TIME, 206, 3,_greenpal));
  630. #endif
  631. Alloc_Object(new ScorePrintClass(TXT_SCORE_LEAD, 182, 26,_greenpal));
  632. Alloc_Object(new ScorePrintClass(TXT_SCORE_EFFI, 182, 38,_greenpal));
  633. Alloc_Object(new ScorePrintClass(TXT_SCORE_TOTA, 182, 50,_greenpal));
  634. Play_Sample(sfx4, 255, Options.Normalize_Sound(120));
  635. Call_Back_Delay(13);
  636. max = MAX((long)leadership, (long)efficiency);
  637. int scorecounter = 0;
  638. Keyboard::Clear();
  639. BlitList.Add (264*2, 26*2, 264*2, 26*2, 4*12 , 12);
  640. BlitList.Add (264*2, 38*2, 264*2, 38*2, 4*12 , 12);
  641. BlitList.Add (264*2, 50*2, 264*2, 50*2, 4*12 , 12);
  642. BlitList.Add (275*2, 9*2, 275*2, 9*2, 64, 12 ); //Minutes
  643. for (i = 0; i <= 160; i++) {
  644. Set_Font_Palette(_greenpal);
  645. Count_Up_Print("%3d%%", i, leadership, 264, 26);
  646. if (i>=30) Count_Up_Print("%3d%%", i-30, efficiency, 264, 38);
  647. if (i>=60) {
  648. Count_Up_Print("%3d",scorecounter, total, 264, 50);
  649. scorecounter += total/100;
  650. }
  651. Print_Minutes(minutes);
  652. Call_Back_Delay(1);
  653. Play_Sample(Beepy6, 255, Options.Normalize_Sound(60));
  654. if (Check_Key() && i < (max-5) ) {
  655. i=158;
  656. Keyboard::Clear();
  657. }
  658. }
  659. Count_Up_Print("%3d", total, total, 264, 50);
  660. Call_Back_Delay(60);
  661. if (house == HOUSE_BAD) Show_Credits(house, _greenpal);
  662. Call_Back_Delay(60);
  663. /*
  664. ** Show stats on # of units killed
  665. */
  666. Set_Logic_Page(*PseudoSeenBuff);
  667. Play_Sample(sfx4, 255, Options.Normalize_Sound(90));
  668. Alloc_Object(new ScorePrintClass(TXT_SCORE_CASU, _casuax[house], _casuay[house],_redpal));
  669. Call_Back_Delay(9);
  670. if (house == HOUSE_BAD) {
  671. Alloc_Object(new ScorePrintClass(TXT_SCORE_NEUT, 200, 114,_redpal));
  672. Call_Back_Delay(4);
  673. }
  674. Alloc_Object(new ScorePrintClass(TXT_SCORE_GDI, _gditxx[house], _gditxy[house],_redpal));
  675. Alloc_Object(new ScorePrintClass(TXT_SCORE_NOD, _nodtxx[house], _nodtxy[house],_redpal));
  676. Call_Back_Delay(6);
  677. Set_Font_Palette(_redpal);
  678. if (house == HOUSE_BAD) {
  679. Do_Nod_Casualties_Graph();
  680. } else {
  681. Do_GDI_Graph(yellowptr, redptr, GKilled + CKilled, NKilled, 88);
  682. }
  683. Set_Logic_Page(*PseudoSeenBuff);
  684. /*
  685. ** Print out stats on buildings destroyed
  686. */
  687. Play_Sample(sfx4, 255, Options.Normalize_Sound(90));
  688. if (house == HOUSE_GOOD) {
  689. Alloc_Object(new ScorePrintClass(TXT_SCORE_BUIL, 144, 126,_greenpal));
  690. Call_Back_Delay(9);
  691. } else {
  692. Alloc_Object(new ScorePrintClass(TXT_SCORE_BUIL1, 146, 128,_greenpal));
  693. Alloc_Object(new ScorePrintClass(TXT_SCORE_BUIL2, 146, 136,_greenpal));
  694. Call_Back_Delay(9);
  695. Alloc_Object(new ScorePrintClass(TXT_SCORE_NEUT, 200, 152,_greenpal));
  696. Call_Back_Delay(4);
  697. }
  698. Alloc_Object(new ScorePrintClass(TXT_SCORE_GDI, _gditxx[house], _bldggy[house],_greenpal));
  699. Alloc_Object(new ScorePrintClass(TXT_SCORE_NOD, _gditxx[house], _bldgny[house],_greenpal));
  700. Call_Back_Delay(7);
  701. if (house==HOUSE_BAD) {
  702. Call_Back_Delay(6);
  703. Set_Font_Palette(_greenpal);
  704. Do_Nod_Buildings_Graph();
  705. } else {
  706. Do_GDI_Graph(yellowptr, redptr, GBKilled + CBKilled, NBKilled, 136);
  707. }
  708. // Wait for text printing to complete
  709. while (StillUpdating){
  710. Call_Back_Delay(1);
  711. }
  712. if (Keyboard::Check()) Keyboard::Clear();
  713. if (house == HOUSE_GOOD) Show_Credits(house, _greenpal);
  714. /*
  715. ** Hall of fame display and processing
  716. */
  717. Play_Sample(sfx4, 255, Options.Normalize_Sound(90));
  718. Alloc_Object(new ScorePrintClass(TXT_SCORE_TOP, 28, 110,_bluepal));
  719. Call_Back_Delay(9);
  720. /*
  721. ** First check for the existence of the file, and if there isn't one,
  722. ** make a new one filled with blanks.
  723. */
  724. if (!file.Is_Available()) {
  725. // hall of fame doesn't exist, so blank it out & write it
  726. file.Open(WRITE);
  727. for (i = 0; i < NUMFAMENAMES; i++) {
  728. hallfame[i].name[0] =
  729. hallfame[i].score =
  730. hallfame[i].level = 0;
  731. file.Write(&hallfame[i], sizeof(struct Fame));
  732. }
  733. file.Close();
  734. }
  735. file.Open(READ);
  736. for (i = 0; i < NUMFAMENAMES; i++) {
  737. file.Read(&hallfame[i], sizeof(struct Fame));
  738. }
  739. file.Close();
  740. /*
  741. ** If the player's score is good enough to bump someone off the list,
  742. ** remove their data, move everyone down a notch, and set index = where
  743. ** their info goes
  744. */
  745. if(hallfame[NUMFAMENAMES-1].score >= total)
  746. hallfame[NUMFAMENAMES-1].score = 0;
  747. for (index = 0; index < NUMFAMENAMES; index++) {
  748. if (total > hallfame[index].score) {
  749. if (index < (NUMFAMENAMES-1)) for (i = (NUMFAMENAMES-1); i > index; i--) hallfame[i] = hallfame[i-1];
  750. hallfame[index].score = total;
  751. hallfame[index].level = Scenario;
  752. // hallfame[index].level = BuildLevel;
  753. //hallfame[index].name[0] = 0; // blank out the name
  754. memset (hallfame[index].name, ' ', sizeof (hallfame[index].name) -1);
  755. hallfame[index].name[sizeof (hallfame[index].name)-1] = 0;
  756. break;
  757. }
  758. }
  759. /*
  760. ** Now display the hall of fame
  761. */
  762. Set_Logic_Page(*PseudoSeenBuff);
  763. for (i = 0; i < NUMFAMENAMES; i++) {
  764. Alloc_Object(new ScorePrintClass(hallfame[i].name, HALLFAME_X, HALLFAME_Y + (i*8), _bluepal));
  765. if (hallfame[i].score) {
  766. char *str = (char *)(SysMemPage.Get_Buffer()) + i*32;
  767. sprintf(str,"%d", hallfame[i].score);
  768. Alloc_Object(new ScorePrintClass(str, HALLFAME_X+(6*15), HALLFAME_Y + (i*8), _bluepal, BLACK));
  769. if (hallfame[i].level < 20) {
  770. sprintf(str+16,"%d", hallfame[i].level);
  771. } else {
  772. strcpy(str+16, "**");
  773. }
  774. Alloc_Object(new ScorePrintClass(str+16, HALLFAME_X+(6*12), HALLFAME_Y + (i*8), _bluepal, BLACK));
  775. Call_Back_Delay(13);
  776. }
  777. }
  778. // Wait for text printing to complete
  779. while (StillUpdating){
  780. Call_Back_Delay(1);
  781. }
  782. /*
  783. ** If the player's on the hall of fame, have him enter his name now
  784. */
  785. Keyboard::Clear();
  786. if (index < NUMFAMENAMES) {
  787. Input_Name(hallfame[index].name, HALLFAME_X, HALLFAME_Y + (index*8), _bluepal);
  788. file.Open(WRITE);
  789. for (i = 0; i < NUMFAMENAMES; i++) {
  790. file.Write(&hallfame[i], sizeof(struct Fame));
  791. }
  792. file.Close();
  793. } else {
  794. #ifdef FRENCH
  795. Alloc_Object(new ScorePrintClass(TXT_MAP_CLICK2, 145, 190, _yellowpal));
  796. #else
  797. Alloc_Object(new ScorePrintClass(TXT_MAP_CLICK2, 149, 190, _yellowpal));
  798. #endif
  799. Cycle_Wait_Click();
  800. }
  801. #ifdef WRITE_LBM
  802. file.Open("e:scorscrn.lbm",WRITE);
  803. SeenBuff.Blit(SysMemPage,0,0, 0,0, 320,200);
  804. CCWrite_LBM_File(file, SysMemPage, 8, Palette);
  805. file.Close();
  806. #endif
  807. Keyboard::Clear();
  808. /* get rid of all the animating objects */
  809. for (i = 0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) {
  810. delete ScoreObjs[i];
  811. ScoreObjs[i] = 0;
  812. }
  813. Fade_Palette_To(BlackPalette, FADE_PALETTE_FAST, NULL);
  814. VisiblePage.Clear();
  815. Show_Mouse();
  816. // Map_Selection();
  817. Theme.Queue_Song(THEME_NONE);
  818. Fade_Palette_To(BlackPalette, FADE_PALETTE_FAST, NULL);
  819. VisiblePage.Clear();
  820. Set_Palette(GamePalette);
  821. Set_Font(oldfont);
  822. FontXSpacing = oldfontxspacing;
  823. ControlQ = 0;
  824. Set_Logic_Page (SeenBuff);
  825. delete PseudoSeenBuff;
  826. delete TextPrintBuffer;
  827. TextPrintBuffer = NULL;
  828. BlitList.Clear();
  829. Enable_Uncompressed_Shapes();
  830. }
  831. // ST = 12/17/2018 5:44PM
  832. #ifndef TickCount
  833. extern TimerClass TickCount;
  834. #endif
  835. void Cycle_Wait_Click(void)
  836. {
  837. int counter = 0;
  838. int minclicks = 20;
  839. unsigned long timingtime = TickCount.Time();
  840. //SerialPacketType sendpacket;
  841. //SerialPacketType receivepacket;
  842. //int packetlen;
  843. Keyboard::Clear();
  844. while (minclicks || (!Check_Key() && !ControlQ) ) {
  845. if (GameToPlay == GAME_NULL_MODEM ||
  846. GameToPlay == GAME_MODEM){
  847. //GameToPlay == GAME_INTERNET) {
  848. #if (0) //PG_TO_FIX
  849. //
  850. // send a timing packet if enough time has gone by.
  851. //
  852. if ( (TickCount.Time() - timingtime) > PACKET_TIMING_TIMEOUT) {
  853. sendpacket.Command = SERIAL_SCORE_SCREEN;
  854. sendpacket.ResponseTime = NullModem.Response_Time();
  855. sendpacket.ID = ModemGameToPlay;
  856. NullModem.Send_Message (&sendpacket, sizeof(sendpacket), 0);
  857. timingtime = TickCount.Time();
  858. }
  859. if (NullModem.Get_Message (&receivepacket, &packetlen) > 0) {
  860. // throw packet away
  861. packetlen = packetlen;
  862. }
  863. NullModem.Service();
  864. #endif
  865. }
  866. Call_Back_Delay(1);
  867. if (minclicks) {
  868. minclicks--;
  869. Keyboard::Clear();
  870. }
  871. counter = ((++counter) & 7);
  872. if (!counter) {
  873. unsigned char r,g,b;
  874. r = Palette[233*3+0];
  875. g = Palette[233*3+1];
  876. b = Palette[233*3+2];
  877. for (int i = 233; i < 237; i++) {
  878. Palette[i*3+0] = Palette[(i+1)*3+0];
  879. Palette[i*3+1] = Palette[(i+1)*3+1];
  880. Palette[i*3+2] = Palette[(i+1)*3+2];
  881. }
  882. Palette[237*3+0] = r;
  883. Palette[237*3+1] = g;
  884. Palette[237*3+2] = b;
  885. Set_Palette(Palette);
  886. }
  887. }
  888. Keyboard::Clear();
  889. }
  890. void ScoreClass::Do_Nod_Buildings_Graph(void)
  891. {
  892. int shapenum;
  893. InfantryTypeClass const *ramboclass;
  894. void const * factptr = MixFileClass::Retrieve("FACT.SHP");
  895. void const * rmboptr = MixFileClass::Retrieve("RMBO.SHP");
  896. void const * fball1ptr = MixFileClass::Retrieve("FBALL1.SHP");
  897. ramboclass = &InfantryTypeClass::As_Reference(INFANTRY_E5);
  898. /*
  899. ** Print the # of buildings on the hidpage so we only need to do it once
  900. */
  901. PseudoSeenBuff->Blit(SysMemPage);
  902. Set_Logic_Page(SysMemPage);
  903. Call_Back_Delay(30);
  904. BlitList.Add (2* (BUILDING_X + 8), 2* (BUILDING_Y), 2* (BUILDING_X+8), 2* (BUILDING_Y), 5*12 , 12);
  905. BlitList.Add (2* (BUILDING_X + 8), 2* (BUILDING_Y + 12), 2* (BUILDING_X+8), 2* (BUILDING_Y + 12), 5*12 , 12);
  906. BlitList.Add (2* (BUILDING_X + 8), 2* (BUILDING_Y + 24), 2* (BUILDING_X+8), 2* (BUILDING_Y + 24), 5*12 , 12);
  907. TextPrintBuffer->Print( 0, (BUILDING_X + 8)*2, BUILDING_Y*2, TBLACK, TBLACK);
  908. TextPrintBuffer->Print( 0, (BUILDING_X + 8)*2, (BUILDING_Y + 12)*2, TBLACK, TBLACK);
  909. TextPrintBuffer->Print( 0, (BUILDING_X + 8)*2, (BUILDING_Y + 24)*2, TBLACK, TBLACK);
  910. /*
  911. ** Here's the animation/draw loop for blowing up the factory
  912. */
  913. int i;
  914. for (i=0; i<98; i++) {
  915. SysMemPage.Blit(SysMemPage, BUILDING_X, BUILDING_Y, 0, 0, 320-BUILDING_X,48);
  916. shapenum = 0; // no damage
  917. if (i >= 60) {
  918. shapenum = Extract_Shape_Count(factptr) - 2; // some damage
  919. if (i == 60) {
  920. Shake_The_Screen(6);
  921. Sound_Effect(VOC_CRUMBLE, VOL_FULL, 0);
  922. }
  923. if (i > 65) {
  924. shapenum = Extract_Shape_Count(factptr) - 1; // mega damage
  925. }
  926. }
  927. /*
  928. ** Draw the building before Rambo
  929. */
  930. if (i < 68) {
  931. CC_Draw_Shape(factptr,shapenum, 0, 0, WINDOW_MAIN,
  932. SHAPE_FADING|SHAPE_WIN_REL, ScoreRemapBldg,Map.UnitShadow);
  933. }
  934. /*
  935. ** Now draw some fires, if appropriate
  936. */
  937. if (i >= 61) {
  938. int firecount = Extract_Shape_Count(fball1ptr);
  939. int shapeindex = (i-61)>>1;
  940. if (shapeindex < firecount) {
  941. CC_Draw_Shape(fball1ptr, shapeindex, 10, 10, WINDOW_MAIN,
  942. SHAPE_FADING|SHAPE_CENTER|SHAPE_WIN_REL,//|SHAPE_GHOST,
  943. ScoreRemapFBall,0);
  944. }
  945. if (i > 64) {
  946. shapeindex = (i-64)>>1;
  947. if (shapeindex < firecount) {
  948. CC_Draw_Shape(fball1ptr, shapeindex, 50, 30, WINDOW_MAIN,
  949. SHAPE_FADING|SHAPE_CENTER|SHAPE_WIN_REL,//|SHAPE_GHOST,
  950. ScoreRemapFBall,0);
  951. }
  952. }
  953. }
  954. /*
  955. ** Draw the Rambo character running away from the building
  956. */
  957. CC_Draw_Shape(rmboptr, (ramboclass->DoControls[DO_WALK].Frame + ramboclass->DoControls[DO_WALK].Jump*6) + ((i>>1)%ramboclass->DoControls[DO_WALK].Count),
  958. i+32, 40, WINDOW_MAIN,
  959. SHAPE_FADING|SHAPE_CENTER|SHAPE_WIN_REL,//|SHAPE_GHOST,
  960. ScoreRemapYellow,Map.UnitShadow);
  961. SysMemPage.Blit(*PseudoSeenBuff, 0, 0, BUILDING_X, BUILDING_Y, 320-BUILDING_X,48);
  962. /*
  963. ** Extra font related stuff. ST - 7/29/96 2:22PM
  964. */
  965. Interpolate_2X_Scale(PseudoSeenBuff , &HidPage ,NULL);
  966. BlitList.Update();
  967. WWMouse->Draw_Mouse(&HidPage);
  968. Blit_Hid_Page_To_Seen_Buff();
  969. WWMouse->Erase_Mouse(&HidPage, TRUE);
  970. //Interpolate_2X_Scale( PseudoSeenBuff , &SeenBuff , NULL);
  971. if (!Check_Key()) Call_Back_Delay(1);
  972. }
  973. i = MAX(GBKilled, NBKilled);
  974. i = MAX(i, CBKilled);
  975. for (int q = 0; q <= i; q++) {
  976. Count_Up_Print( "%d", q, GBKilled,BUILDING_X + 8,BUILDING_Y );
  977. Count_Up_Print( "%d", q, NBKilled,BUILDING_X + 8,BUILDING_Y + 12);
  978. Count_Up_Print( "%d", q, CBKilled,BUILDING_X + 8,BUILDING_Y + 24);
  979. if (!Check_Key()) {
  980. Play_Sample(Beepy6, 255, Options.Normalize_Sound(110));
  981. Call_Back_Delay(1);
  982. }
  983. }
  984. }
  985. /***************************************************************************
  986. * DO_GDI_GRAPH -- Show # of people or buildings killed on GDI score screen*
  987. * *
  988. * *
  989. * *
  990. * INPUT: yellowptr, redptr = pointers to shape file for graphs *
  991. * *
  992. * OUTPUT: *
  993. * *
  994. * WARNINGS: *
  995. * *
  996. * HISTORY: *
  997. * 05/03/1995 BWG : Created. *
  998. *=========================================================================*/
  999. void ScoreClass::Do_GDI_Graph(void const * yellowptr, void const * redptr, int gkilled, int nkilled, int ypos)
  1000. {
  1001. int i, max;
  1002. int gdikilled = gkilled, nodkilled=nkilled;
  1003. max = MAX(gdikilled, nodkilled);
  1004. if (!max) max=1;
  1005. gdikilled = (gdikilled * SIZEGBAR) / max;
  1006. nodkilled = (nodkilled * SIZEGBAR) / max;
  1007. if (max < 20) {
  1008. gdikilled = gkilled * 5;
  1009. nodkilled = nkilled * 5;
  1010. }
  1011. max = MAX(gdikilled, nodkilled);
  1012. if (!max) max=1;
  1013. // Draw the white-flash shape on the hidpage
  1014. Set_Logic_Page(SysMemPage);
  1015. SysMemPage.Fill_Rect(0,0, 124,9, TBLACK);
  1016. CC_Draw_Shape(redptr, 120, 0,0, WINDOW_MAIN,SHAPE_WIN_REL, 0, 0);
  1017. Set_Logic_Page(PseudoSeenBuff);
  1018. BlitList.Add (2* 297, 2* (ypos+2), 2* 297, 2* (ypos+2), 5*12 , 12);
  1019. for (i = 1; i <= gdikilled; i++) {
  1020. if (i != gdikilled) {
  1021. CC_Draw_Shape(yellowptr,i, 172, ypos, WINDOW_MAIN,SHAPE_WIN_REL, 0, 0);
  1022. } else {
  1023. SysMemPage.Blit(*PseudoSeenBuff,0,0, 172, ypos, 3+gdikilled,9);
  1024. }
  1025. Count_Up_Print("%d", (i*gkilled) / max, gkilled, 297, ypos+2);
  1026. if (!Check_Key()) {
  1027. Play_Sample(Beepy6, 255, Options.Normalize_Sound(110));
  1028. Call_Back_Delay(2);
  1029. }
  1030. }
  1031. CC_Draw_Shape(yellowptr,gdikilled, 172,ypos , WINDOW_MAIN,SHAPE_WIN_REL, 0, 0);
  1032. Count_Up_Print("%d", gkilled, gkilled, 297, ypos+ 2);
  1033. if (!Check_Key()) Call_Back_Delay(40);
  1034. BlitList.Add (2* 297, 2* (ypos+14), 2* 297, 2* (ypos+14), 5*12 , 12);
  1035. for (i = 1; i <= nodkilled; i++) {
  1036. if (i != nodkilled) {
  1037. CC_Draw_Shape(redptr, i, 172, ypos+12, WINDOW_MAIN,SHAPE_WIN_REL, 0, 0);
  1038. } else {
  1039. SysMemPage.Blit(*PseudoSeenBuff,0,0, 172,ypos+12, 3+nodkilled,9);
  1040. }
  1041. Count_Up_Print("%d", (i*nkilled) / max, nkilled, 297, ypos+14);
  1042. if (!Check_Key()) {
  1043. Play_Sample(Beepy6, 255, Options.Normalize_Sound(110));
  1044. Call_Back_Delay(2);
  1045. }
  1046. }
  1047. // if (Keyboard::Check()) Keyboard::Clear();
  1048. /*
  1049. ** Make sure accurate count is printed at end
  1050. */
  1051. CC_Draw_Shape( redptr,nodkilled, 172,ypos+12, WINDOW_MAIN,SHAPE_WIN_REL, 0, 0);
  1052. Count_Up_Print("%d", nkilled, nkilled, 297, ypos+14);
  1053. if (!Check_Key()) Call_Back_Delay(40);
  1054. }
  1055. void ScoreClass::Do_Nod_Casualties_Graph(void)
  1056. {
  1057. int i, gdikilled, nodkilled, civkilled, max;
  1058. void const * e1ptr = MixFileClass::Retrieve("E1.SHP");
  1059. void const * c1ptr = MixFileClass::Retrieve("C1.SHP");
  1060. gdikilled = GKilled;
  1061. nodkilled = NKilled;
  1062. civkilled = CKilled;
  1063. max = MAX(gdikilled, nodkilled);
  1064. max = MAX(max, civkilled);
  1065. if (!max) max=1;
  1066. if ((gdikilled > (MAX_BAR_X - BARGRAPH_X)) || (nodkilled > (MAX_BAR_X - BARGRAPH_X)) || (civkilled > (MAX_BAR_X - BARGRAPH_X))) {
  1067. gdikilled = (gdikilled * (MAX_BAR_X - BARGRAPH_X)) / max;
  1068. nodkilled = (nodkilled * (MAX_BAR_X - BARGRAPH_X)) / max;
  1069. civkilled = (civkilled * (MAX_BAR_X - BARGRAPH_X)) / max;
  1070. }
  1071. max = MAX(gdikilled, nodkilled);
  1072. max = MAX(max, civkilled);
  1073. if (!max) max=1;
  1074. /*
  1075. ** Initialize a bunch of objects for the infantrymen who pose for the bar
  1076. ** graphs of casualties.
  1077. */
  1078. int q = NUMINFANTRYMEN/3;
  1079. int r = q*2;
  1080. for (i = 0; i < NUMINFANTRYMEN/3; i++) {
  1081. InfantryMan[i+0].xpos =
  1082. InfantryMan[i+q].xpos =
  1083. InfantryMan[i+r].xpos = (i*10) + 7;
  1084. InfantryMan[i+0].ypos = 11;
  1085. InfantryMan[i+q].ypos = 21;
  1086. InfantryMan[i+r].ypos = 31;
  1087. InfantryMan[i+0].shapefile =
  1088. InfantryMan[i+q].shapefile = e1ptr;
  1089. InfantryMan[i+r].shapefile = c1ptr;
  1090. InfantryMan[i+0].remap = ScoreRemapYellow;
  1091. InfantryMan[i+q].remap = ScoreRemapGrey;
  1092. InfantryMan[i+r].remap = RemapCiv;
  1093. InfantryMan[i+0].anim =
  1094. InfantryMan[i+q].anim =
  1095. InfantryMan[i+r].anim = 0;
  1096. InfantryMan[i+0].stage =
  1097. InfantryMan[i+q].stage =
  1098. InfantryMan[i+r].stage = 0;
  1099. InfantryMan[i+0].delay =
  1100. InfantryMan[i+q].delay =
  1101. InfantryMan[i+r].delay = Random() & 0x1F;
  1102. InfantryMan[i+0].Class =
  1103. InfantryMan[i+q].Class = &InfantryTypeClass::As_Reference(INFANTRY_E1);
  1104. InfantryMan[i+r].Class = &InfantryTypeClass::As_Reference(INFANTRY_C1);
  1105. }
  1106. /*
  1107. ** Draw the infantrymen and pause briefly before running the graph
  1108. */
  1109. Draw_InfantryMen();
  1110. SysMemPage.Blit(*PseudoSeenBuff, 0, 0, BARGRAPH_X, CASUALTY_Y, 320-BARGRAPH_X, 34);
  1111. //Interpolate_2X_Scale( PseudoSeenBuff , &SeenBuff, NULL);
  1112. /*
  1113. ** Extra font related stuff. ST - 7/29/96 2:22PM
  1114. */
  1115. Interpolate_2X_Scale(PseudoSeenBuff , &HidPage ,NULL);
  1116. BlitList.Update();
  1117. WWMouse->Draw_Mouse(&HidPage);
  1118. Blit_Hid_Page_To_Seen_Buff();
  1119. WWMouse->Erase_Mouse(&HidPage, TRUE);
  1120. Call_Back_Delay(40);
  1121. BlitList.Add (2* (SCORETEXT_X + 64), 2* (CASUALTY_Y + 2), 2* (SCORETEXT_X + 64), 2* (CASUALTY_Y + 2), 5*12 , 12);
  1122. BlitList.Add (2* (SCORETEXT_X + 64), 2* (CASUALTY_Y + 14), 2* (SCORETEXT_X + 64), 2* (CASUALTY_Y + 14), 5*12 , 12);
  1123. BlitList.Add (2* (SCORETEXT_X + 64), 2* (CASUALTY_Y + 26), 2* (SCORETEXT_X + 64), 2* (CASUALTY_Y + 26), 5*12 , 12);
  1124. for (i = 1; i <= max; i++) {
  1125. // Draw & update infantrymen 3 times for every tick on the graph (i)
  1126. for (int q = 0; q < 3; q++) {
  1127. Draw_InfantryMen();
  1128. Draw_Bar_Graphs(i, gdikilled, nodkilled, civkilled);
  1129. SysMemPage.Blit(*PseudoSeenBuff, 0, 0, BARGRAPH_X, CASUALTY_Y, 320-BARGRAPH_X, 34);
  1130. Count_Up_Print("%d", (i*GKilled) / max, GKilled, SCORETEXT_X+64, CASUALTY_Y + 2);
  1131. Count_Up_Print("%d", (i*NKilled) / max, NKilled, SCORETEXT_X+64, CASUALTY_Y + 14);
  1132. Count_Up_Print("%d", (i*CKilled) / max, CKilled, SCORETEXT_X+64, CASUALTY_Y + 26);
  1133. if (!Check_Key()) Call_Back_Delay(3);
  1134. }
  1135. Play_Sample(Beepy6, 255, Options.Normalize_Sound(110));
  1136. }
  1137. if (Check_Key()) Keyboard::Clear();
  1138. /*
  1139. ** Make sure accurate count is printed at end
  1140. */
  1141. Count_Up_Print("%d", GKilled, GKilled, SCORETEXT_X+64, CASUALTY_Y + 2);
  1142. Count_Up_Print("%d", NKilled, NKilled, SCORETEXT_X+64, CASUALTY_Y + 14);
  1143. Count_Up_Print("%d", CKilled, CKilled, SCORETEXT_X+64, CASUALTY_Y + 26);
  1144. /*
  1145. ** Finish up death animations, if there are any active
  1146. */
  1147. int k = 1;
  1148. while (k) {
  1149. for (i=k=0; i<NUMINFANTRYMEN; i++) if (InfantryMan[i].anim >= DO_GUN_DEATH) k=1;
  1150. if (k) Draw_InfantryMen();
  1151. Draw_Bar_Graphs(max, gdikilled, nodkilled, civkilled);
  1152. SysMemPage.Blit(*PseudoSeenBuff, 0, 0, BARGRAPH_X, CASUALTY_Y, 320-BARGRAPH_X, 34);
  1153. Call_Back_Delay(1);
  1154. }
  1155. }
  1156. void ScoreClass::Show_Credits(int house, char const pal[])
  1157. {
  1158. static int _credsx[2]={276,276};
  1159. static int _credsy[2]={173,58};
  1160. static int _credpx[2]={228,236};
  1161. #ifdef GERMAN
  1162. static int _credpy[2]={181, 74};
  1163. static int _credtx[2]={162,162};
  1164. static int _credty[2]={173, 62};
  1165. #else
  1166. static int _credpy[2]={189-12, 74};
  1167. static int _credtx[2]={182,182};
  1168. static int _credty[2]={179-12, 62};
  1169. #endif
  1170. int credobj,i;
  1171. int min,add;
  1172. void const * credshape = MixFileClass::Retrieve("CREDS.SHP");
  1173. Alloc_Object(new ScorePrintClass(TXT_SCORE_ENDCRED, _credtx[house], _credty[house],pal));
  1174. Call_Back_Delay(15);
  1175. credobj = Alloc_Object(new ScoreCredsClass(_credsx[house], _credsy[house], credshape, 32, 2));
  1176. min = PlayerPtr->Available_Money() / 100;
  1177. /*
  1178. ** Print out total credits left at end of scenario
  1179. */
  1180. i = -50;
  1181. BlitList.Add (2* (_credpx[house]), 2* (_credpy[house]), 2* (_credpx[house]), 2* (_credpy[house]), 5*12 , 12);
  1182. do {
  1183. add = 5;
  1184. if ((PlayerPtr->Available_Money() - i) > 100 ) add += 15;
  1185. if ((PlayerPtr->Available_Money() - i) > 1000) add += 30;
  1186. if (add < min) add = min;
  1187. i += add;
  1188. if (i < 0) i=0;
  1189. Set_Font_Palette(pal);
  1190. Count_Up_Print("%d", i, PlayerPtr->Available_Money(), _credpx[house], _credpy[house]);
  1191. Call_Back_Delay(2);
  1192. if (Check_Key()) {
  1193. i=PlayerPtr->Available_Money() - 5;
  1194. Keyboard::Clear();
  1195. }
  1196. } while (i < PlayerPtr->Available_Money()) ;
  1197. // Make sure the credits object doesn't freeze on the white stage
  1198. while (((ScoreTimeClass *)ScoreObjs[credobj])->Stage >= 20 && !ControlQ) {
  1199. Call_Back_Delay(1);
  1200. }
  1201. delete ScoreObjs[credobj];
  1202. ScoreObjs[credobj] = 0;
  1203. }
  1204. /***************************************************************************
  1205. * SCORECLASS::PRINT_MINUTES -- Print out hours/minutes up to max *
  1206. * *
  1207. * Same as count-up-print, but for the time *
  1208. * *
  1209. * INPUT: current minute count and maximum *
  1210. * *
  1211. * OUTPUT: *
  1212. * *
  1213. * WARNINGS: *
  1214. * *
  1215. * HISTORY: *
  1216. * 04/13/1995 BWG : Created. *
  1217. *=========================================================================*/
  1218. void ScoreClass::Print_Minutes(int minutes)
  1219. {
  1220. char str[20];
  1221. if (minutes >= 60) {
  1222. if ((minutes/60) > 9) minutes = (9*60 + 59);
  1223. sprintf(str,Text_String(TXT_SCORE_TIMEFORMAT1), (minutes / 60),(minutes % 60));
  1224. } else {
  1225. sprintf(str,Text_String(TXT_SCORE_TIMEFORMAT2), minutes);
  1226. }
  1227. TextPrintBuffer->Print(str, 275*2, 9*2, TBLACK, TBLACK);
  1228. }
  1229. /***********************************************************************************************
  1230. * ScoreClass::Count_Up_Print -- Prints a number (up to its max) into a string, cleanly. *
  1231. * *
  1232. * This routine prints out a number (like 70) or its maximum number, into a string, onto *
  1233. * the screen, on a clean section of the screen, and blits it forward to the seenpage so you*
  1234. * can print without flashing and can print over something (to count up %'s). *
  1235. * *
  1236. * INPUT: str = string to print into *
  1237. * percent = # to print *
  1238. * max = # to print if percent > max *
  1239. * xpos = x pixel coord *
  1240. * ypos = y pixel coord *
  1241. * *
  1242. * OUTPUT: none *
  1243. * *
  1244. * WARNINGS: none *
  1245. * *
  1246. * HISTORY: *
  1247. * 04/07/1995 BWG : Created. *
  1248. *=============================================================================================*/
  1249. void ScoreClass::Count_Up_Print(char *str, int percent, int max, int xpos, int ypos)
  1250. {
  1251. char destbuf[64];
  1252. int width;
  1253. sprintf(destbuf, str, percent <= max ? percent : max);
  1254. width = strlen(destbuf) * 7;
  1255. // HidPage.Blit(HidPage, xpos, ypos, 0, 0, width, 8);
  1256. // Set_Logic_Page(HidPage);
  1257. // LogicPage->Print( destbuf, 0, 0, WHITE, TBLACK);
  1258. // HidPage.Blit(SeenBuff, 0, 0, xpos, ypos, width, 8);
  1259. TextPrintBuffer->Fill_Rect (xpos*2, ypos*2, (xpos + width)*2, (ypos+7)*2, BLACK);
  1260. TextPrintBuffer->Print (destbuf, xpos*2, ypos*2, WHITE, TBLACK);
  1261. //TextPrintBuffer->Blit(*TextPrintBuffer, xpos*2, ypos*2, 0, 0, width*2, 8*2);
  1262. //TextPrintBuffer->Print(destbuf, 0, 0, WHITE, TBLACK);
  1263. //TextPrintBuffer->Blit(SeenBuff, 0, 0, xpos*2, ypos*2, width*2, 8*2);
  1264. // PseudoSeenBuff->Print( destbuf, xpos, ypos, TBLACK, BLACK);
  1265. // Interpolate_2X_Scale( PseudoSeenBuff , &SeenBuff , NULL);
  1266. }
  1267. /***********************************************************************************************
  1268. * ScoreClass::Input_Name -- Gets the name from the keyboard *
  1269. * *
  1270. * This routine handles keyboard input, and does a nifty zooming letter effect too. *
  1271. * *
  1272. * INPUT: str = string to put user's typing into *
  1273. * xpos = x pixel coord *
  1274. * ypos = y pixel coord *
  1275. * pal = text remapping palette to print using *
  1276. * *
  1277. * OUTPUT: none *
  1278. * *
  1279. * WARNINGS: none *
  1280. * *
  1281. * HISTORY: *
  1282. * 05/15/1995 BWG : Created. *
  1283. *=============================================================================================*/
  1284. void ScoreClass::Input_Name(char str[], int xpos, int ypos, char const pal[])
  1285. {
  1286. int key, ascii, index=0;
  1287. void const * keystrok = MixFileClass::Retrieve("KEYSTROK.AUD");
  1288. /*
  1289. ** Ready the hidpage so it can restore background under zoomed letters
  1290. */
  1291. PseudoSeenBuff->Blit(SysMemPage);
  1292. do {
  1293. Call_Back();
  1294. Animate_Score_Objs();
  1295. Animate_Cursor(index, ypos);
  1296. /*
  1297. ** Extra font related stuff. ST - 7/29/96 2:22PM
  1298. */
  1299. Interpolate_2X_Scale (PseudoSeenBuff , &HidPage ,NULL);
  1300. BlitList.Update();
  1301. Blit_Hid_Page_To_Seen_Buff();
  1302. if (Check_Key()) { //if (Keyboard::Check()) {
  1303. key = Get_Key(); //key = Keyboard::Get();
  1304. if (index == MAX_FAMENAME_LENGTH-2) {
  1305. while (Check_Key()) {
  1306. Get_Key();
  1307. }
  1308. }
  1309. /*
  1310. ** If they hit 'backspace' when they're on the last letter,
  1311. ** turn it into a space instead.
  1312. */
  1313. if ((key == KA_BACKSPACE) && (index == MAX_FAMENAME_LENGTH-2) ) {
  1314. if (str[index] && str[index]!=32) key = 32;
  1315. }
  1316. if (key == KA_BACKSPACE) { //if (key == KN_BACKSPACE) {
  1317. if (index) {
  1318. str[--index] = 0;
  1319. int xposindex6 = xpos+(index*6);
  1320. PseudoSeenBuff->Fill_Rect(xposindex6,ypos,xposindex6+6,ypos+6,TBLACK);
  1321. SysMemPage.Fill_Rect(xposindex6,ypos,xposindex6+6,ypos+6,TBLACK);
  1322. TextPrintBuffer->Fill_Rect(xposindex6*2,ypos*2,(xposindex6+6)*2,(ypos+6)*2, BLACK);
  1323. }
  1324. } else if (key!=KA_RETURN) { //else if (key != KN_RETURN && key!=KN_KEYPAD_RETURN) {
  1325. ascii = key; //ascii = KN_To_KA(key);
  1326. if (ascii >= 'a' && ascii <= 'z') ascii -= ('a' - 'A');
  1327. //if (ascii >='A' && ascii<='Z' || ascii == ' ') {
  1328. if ( (ascii >= '!' && ascii <= KA_TILDA) || ascii == ' ') {
  1329. PseudoSeenBuff->Fill_Rect(xpos + (index*6), ypos, xpos + (index*6)+6, ypos+5, TBLACK);
  1330. SysMemPage.Fill_Rect(xpos + (index*6), ypos, xpos + (index*6)+6, ypos+5, TBLACK);
  1331. TextPrintBuffer->Fill_Rect(2*(xpos + (index*6)), ypos*2, 2*(xpos + (index*6)+6), 2*(ypos+6), BLACK);
  1332. str[index] = ascii;
  1333. str[index+1] = 0;
  1334. int objindex;
  1335. Play_Sample(keystrok, 255, Options.Normalize_Sound(255));
  1336. objindex = Alloc_Object(new ScoreScaleClass(str+index,xpos+(index*6), ypos, pal));
  1337. while (ScoreObjs[objindex]) Call_Back_Delay(1);
  1338. if (index < (MAX_FAMENAME_LENGTH-2) ) index++;
  1339. }
  1340. }
  1341. }
  1342. } while(key!=KA_RETURN); // } while(key != KN_RETURN && key!=KN_KEYPAD_RETURN);
  1343. }
  1344. void Animate_Cursor(int pos, int ypos)
  1345. {
  1346. static int _lastpos, _state;
  1347. static CountDownTimerClass _timer;
  1348. ypos += 7; // move cursor to bottom of letter
  1349. // If they moved the cursor, erase old one and force state=0, to make green draw right away
  1350. if (pos != _lastpos) {
  1351. PseudoSeenBuff->Draw_Line(HALLFAME_X + (_lastpos*6),ypos, HALLFAME_X + (_lastpos*6) + 5, ypos, TBLACK);
  1352. TextPrintBuffer->Fill_Rect(2*(HALLFAME_X + (_lastpos*6)),2*ypos, 2*(HALLFAME_X + (_lastpos*6) + 5), 2*ypos+1, BLACK);
  1353. _lastpos = pos;
  1354. _state = 0;
  1355. }
  1356. PseudoSeenBuff->Draw_Line(HALLFAME_X + (pos*6),ypos, HALLFAME_X + (pos*6)+5, ypos, _state ? LTBLUE : TBLACK);
  1357. TextPrintBuffer->Fill_Rect(2*(HALLFAME_X + (pos*6)),2*ypos, 2*(HALLFAME_X + (pos*6)+5), 2*ypos+1, _state ? LTBLUE : BLACK);
  1358. /*
  1359. ** Toggle the color of the cursor, green or black, if it's time to do so.
  1360. */
  1361. if (!_timer.Time()) {
  1362. _state ^= 1;
  1363. _timer.Set(5);
  1364. }
  1365. }
  1366. /***************************************************************************
  1367. * Draw_InfantryMen -- Draw all the guys on the score screen *
  1368. * *
  1369. * *
  1370. * *
  1371. * INPUT: *
  1372. * *
  1373. * OUTPUT: *
  1374. * *
  1375. * WARNINGS: *
  1376. * *
  1377. * HISTORY: *
  1378. * 04/13/1995 BWG : Created. *
  1379. *=========================================================================*/
  1380. void Draw_InfantryMen()
  1381. {
  1382. int k;
  1383. // Only draw the infantrymen if we're playing Nod... GDI wouldn't execute
  1384. // people like that.
  1385. /*
  1386. ** First restore the background
  1387. */
  1388. SysMemPage.Blit(SysMemPage, BARGRAPH_X, CASUALTY_Y, 0, 0, 320-BARGRAPH_X, 34);
  1389. Set_Logic_Page(SysMemPage);
  1390. /*
  1391. ** Then draw all the infantrymen on the clean SysMemPage
  1392. */
  1393. for (k = 0; k < NUMINFANTRYMEN; k++) Draw_InfantryMan(k);
  1394. /*
  1395. ** They'll all be blitted over to the seenpage after the graphs are drawn
  1396. */
  1397. }
  1398. /***************************************************************************
  1399. * Draw_InfantryMan -- Draw one guy in score screen, update animation *
  1400. * *
  1401. * This routine draws one of the infantrymen in the "Casualties" area *
  1402. * *
  1403. * INPUT: *
  1404. * *
  1405. * OUTPUT: *
  1406. * *
  1407. * WARNINGS: *
  1408. * *
  1409. * HISTORY: *
  1410. * 04/13/1995 BWG : Created. *
  1411. *=========================================================================*/
  1412. void Draw_InfantryMan(int index)
  1413. {
  1414. int stage;
  1415. /* If the infantryman's dead, just abort this function */
  1416. if (InfantryMan[index].anim == -1) return;
  1417. stage = InfantryMan[index].stage + InfantryMan[index].Class->DoControls[InfantryMan[index].anim].Frame;
  1418. CC_Draw_Shape(InfantryMan[index].shapefile,
  1419. stage,
  1420. InfantryMan[index].xpos,
  1421. InfantryMan[index].ypos,
  1422. WINDOW_MAIN,
  1423. SHAPE_FADING|SHAPE_CENTER|SHAPE_WIN_REL,//|SHAPE_GHOST,
  1424. InfantryMan[index].remap,
  1425. Map.UnitShadow);
  1426. /*
  1427. ** see if it's time to run a new anim
  1428. */
  1429. if (--InfantryMan[index].delay < 0) {
  1430. InfantryMan[index].delay = 3;
  1431. if (++InfantryMan[index].stage >= InfantryMan[index].Class->DoControls[InfantryMan[index].anim].Count) {
  1432. /*
  1433. ** was he playing a death anim? If so, and it's done, erase him
  1434. */
  1435. if (InfantryMan[index].anim >= DO_GUN_DEATH) {
  1436. InfantryMan[index].anim = -1;
  1437. } else {
  1438. New_Infantry_Anim(index, DO_STAND_READY);
  1439. }
  1440. }
  1441. }
  1442. }
  1443. /***************************************************************************
  1444. * New_Infantry_Anim -- Start up a new animation for one of the infantrymen*
  1445. * *
  1446. * *
  1447. * *
  1448. * INPUT: index: which of the 30 infantrymen to affect *
  1449. * anim: which animation sequence to start him into *
  1450. * OUTPUT: *
  1451. * *
  1452. * WARNINGS: *
  1453. * *
  1454. * HISTORY: *
  1455. * 04/13/1995 BWG : Created. *
  1456. *=========================================================================*/
  1457. void New_Infantry_Anim(int index, int anim)
  1458. {
  1459. InfantryMan[index].anim = anim;
  1460. InfantryMan[index].stage = 0;
  1461. if (anim >= DO_GUN_DEATH) {
  1462. InfantryMan[index].delay = 1; // start right away
  1463. } else {
  1464. InfantryMan[index].delay = Random() & 15;
  1465. }
  1466. }
  1467. /***************************************************************************
  1468. * Draw_Bar_Graphs -- Draw "Casualties" bar graphs *
  1469. * *
  1470. * *
  1471. * *
  1472. * INPUT: i = current count of how far to draw graph *
  1473. * gkilled = # of GDI forces killed (adjusted to fit in space) *
  1474. * nkilled = # of Nod forces killed (adjusted to fit in space) *
  1475. * ckilled = # of civilians killed (adjusted to fit in space) *
  1476. * OUTPUT: *
  1477. * *
  1478. * WARNINGS: *
  1479. * *
  1480. * HISTORY: *
  1481. * 04/13/1995 BWG : Created. *
  1482. *=========================================================================*/
  1483. void Draw_Bar_Graphs(int i, int gkilled, int nkilled, int ckilled)
  1484. {
  1485. if (gkilled) {
  1486. LogicPage->Fill_Rect(0, 0+4, 0+MIN(i,gkilled), 0+5, LTCYAN);
  1487. LogicPage->Draw_Line(0+1, 0+6, 0+MIN(i,gkilled)+1, 0+6, TBLACK);
  1488. LogicPage->Draw_Line(0+MIN(i,gkilled)+1,0+5, 0+MIN(i,gkilled)+1, 0+5, TBLACK);
  1489. if (i <= gkilled) {
  1490. int anim = InfantryMan[i/11].anim;
  1491. if (anim!=-1 && anim < DO_GUN_DEATH) {
  1492. if (i/11) {
  1493. New_Infantry_Anim(i/11,DO_GUN_DEATH + (Random() & 3));
  1494. } else {
  1495. New_Infantry_Anim(i/11,DO_GUN_DEATH);
  1496. }
  1497. // Sound_Effect(Random_Pick(VOC_SCREAM1, VOC_SCREAM5));
  1498. }
  1499. }
  1500. }
  1501. if (nkilled) {
  1502. LogicPage->Fill_Rect(0, 0+16, 0+MIN(i,nkilled), 0+17, RED);
  1503. LogicPage->Draw_Line(0+1, 0+18, 0+MIN(i,nkilled)+1, 0+18, TBLACK);
  1504. LogicPage->Draw_Line(0+MIN(i,nkilled)+1, 0+17, 0+MIN(i,nkilled)+1, 0+17, TBLACK);
  1505. if (i <= nkilled) {
  1506. int anim = InfantryMan[(NUMINFANTRYMEN/3)+(i/11)].anim;
  1507. if (anim!=-1 && anim < DO_GUN_DEATH) {
  1508. if (i/11) {
  1509. New_Infantry_Anim((NUMINFANTRYMEN/3)+(i/11),DO_GUN_DEATH + (Random() & 3));
  1510. } else {
  1511. New_Infantry_Anim((NUMINFANTRYMEN/3)+(i/11),DO_GUN_DEATH);
  1512. }
  1513. // Sound_Effect(Random_Pick(VOC_SCREAM1, VOC_SCREAM5));
  1514. }
  1515. }
  1516. }
  1517. if (ckilled) {
  1518. LogicPage->Fill_Rect(0, 0+28, 0+MIN(i,ckilled), 0+29, RED);
  1519. LogicPage->Draw_Line(0+1, 0+30, 0+MIN(i,ckilled)+1, 0+30, TBLACK);
  1520. LogicPage->Draw_Line(0+MIN(i,ckilled)+1, 0+29, 0+MIN(i,ckilled)+1, 0+29, TBLACK);
  1521. if (i <= ckilled) {
  1522. int anim = InfantryMan[((NUMINFANTRYMEN*2)/3)+(i/11)].anim;
  1523. if (anim!=-1 && anim < DO_GUN_DEATH) {
  1524. if (i/11) {
  1525. New_Infantry_Anim(((NUMINFANTRYMEN*2)/3)+(i/11),DO_GUN_DEATH + (Random() & 3));
  1526. } else {
  1527. New_Infantry_Anim(((NUMINFANTRYMEN*2)/3)+(i/11),DO_GUN_DEATH);
  1528. }
  1529. // Sound_Effect(Random_Pick(VOC_SCREAM1, VOC_SCREAM5));
  1530. }
  1531. }
  1532. }
  1533. }
  1534. /***************************************************************************
  1535. * Call_Back_Delay -- Combines Call_Back() and Delay() functions *
  1536. * *
  1537. * This is just to cut down on code size and typing a little. *
  1538. * *
  1539. * INPUT: *
  1540. * *
  1541. * OUTPUT: *
  1542. * *
  1543. * WARNINGS: *
  1544. * *
  1545. * HISTORY: *
  1546. * 04/13/1995 BWG : Created. *
  1547. *=========================================================================*/
  1548. void Call_Back_Delay(int time)
  1549. {
  1550. CountDownTimerClass cd;
  1551. if (!ControlQ) {
  1552. if (Keyboard::Down(KN_LCTRL) && Keyboard::Down(KN_Q)) {
  1553. ControlQ = 1;
  1554. Keyboard::Clear();
  1555. }
  1556. }
  1557. if (ControlQ) time=0;
  1558. cd.Set(time);
  1559. StreamLowImpact = true;
  1560. do {
  1561. Call_Back();
  1562. //Animate_Score_Objs();
  1563. //Interpolate_2X_Scale(PseudoSeenBuff , &SeenBuff ,NULL);
  1564. //if (Get_Mouse_State()){
  1565. // Interpolate_2X_Scale(PseudoSeenBuff , &SeenBuff ,NULL);
  1566. //BlitList.Update();
  1567. //}else{
  1568. Animate_Score_Objs();
  1569. Interpolate_2X_Scale(PseudoSeenBuff , &HidPage ,NULL);
  1570. BlitList.Update();
  1571. WWMouse->Draw_Mouse(&HidPage);
  1572. Blit_Hid_Page_To_Seen_Buff();
  1573. WWMouse->Erase_Mouse(&HidPage, TRUE);
  1574. //}
  1575. } while(cd.Time());
  1576. StreamLowImpact = false;
  1577. }
  1578. void Animate_Score_Objs()
  1579. {
  1580. StillUpdating = false;
  1581. for (int i = 0; i < MAXSCOREOBJS; i++) {
  1582. if (ScoreObjs[i]) {
  1583. ScoreObjs[i]->Update();
  1584. }
  1585. }
  1586. }
  1587. char *Int_Print(int a)
  1588. {
  1589. static char str[10];
  1590. sprintf(str,"%d",a);
  1591. return str;
  1592. }
  1593. /***********************************************************************************************
  1594. * Multi_Score_Presentation -- Multiplayer routine to display score screen. *
  1595. * *
  1596. * *
  1597. * INPUT: none *
  1598. * *
  1599. * OUTPUT: none *
  1600. * *
  1601. * WARNINGS: none *
  1602. * *
  1603. * HISTORY: *
  1604. * 06/11/1995 BWG: Created. *
  1605. *=============================================================================================*/
  1606. void Multi_Score_Presentation(void)
  1607. {
  1608. static unsigned char const _cycleyellowpal[]={0x0,0xec,0xEb,0xea,0xE9,0xe9,0xE9,0x0,0xE9,0x0,0x0,0x0,0x0,0x0,0xED,0x0};
  1609. static unsigned char const _greenpal[]= {0x0,0x12,0x14,0x16,0x18,0x18,0x18,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x10,0x0};
  1610. static unsigned char const _redpal[]= {0x0,0x22,0x24,0x26,0x28,0x28,0x28,0x0,0x28,0x0,0x0,0x0,0x0,0x0,0x20,0x0};
  1611. static unsigned char const _graypal[]= {0x0,0xca,0xCb,0xcc,0xCd,0xcd,0xCd,0x0,0xCD,0x0,0x0,0x0,0x0,0x0,0xC8,0x0};
  1612. static unsigned char const _orangepal[]={0x0,0xd1,0xD2,0xd3,0xD4,0xd4,0xD4,0x0,0xD4,0x0,0x0,0x0,0x0,0x0,0xD0,0x0};
  1613. static unsigned char const _bluepal[]= {0x0,0x2,0x0a,0xb,0x0b,0xb,0x0B,0x0,0x0B,0x0,0x0,0x0,0x0,0x0,0x09,0x0};
  1614. static unsigned char const _yellowpal[]={0x0,0x5,0xee,0xf1,0xf2,0xf2,0xF2,0xf2,0xF2,0x0,0x0,0x0,0x0,0x0,0x7D,0x0};
  1615. //static char const _greenpal[]= {0x0,0x0,0x12,0x0,0x14,0x0,0x16,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x10,0x0};
  1616. //static char const _redpal[]= {0x0,0x0,0x22,0x0,0x24,0x0,0x26,0x0,0x28,0x0,0x0,0x0,0x0,0x0,0x20,0x0};
  1617. //static char const _graypal[]= {0x0,0x0,0xCA,0x0,0xCB,0x0,0xCC,0x0,0xCD,0x0,0x0,0x0,0x0,0x0,0xC8,0x0};
  1618. //static char const _orangepal[]={0x0,0x0,0xD1,0x0,0xD2,0x0,0xD3,0x0,0xD4,0x0,0x0,0x0,0x0,0x0,0xD0,0x0};
  1619. //static char const _bluepal[]= {0x0,0x0,0x02,0x0,0x0A,0x0,0x0B,0x0,0x0B,0x0,0x0,0x0,0x0,0x0,0x09,0x0};
  1620. //static char const _yellowpal[]={0x0,0x0,0x05,0x0,0xEE,0x0,0xF1,0x0,0xF2,0x0,0x0,0x0,0x0,0x0,0x7D,0x0};
  1621. static unsigned char const *_colors[]={_yellowpal,_redpal,_bluepal,_orangepal,_greenpal,_graypal};
  1622. int i,k;
  1623. void *oldfont, *anim;
  1624. int oldfontxspacing = FontXSpacing;
  1625. char const *pal;
  1626. FontXSpacing = 0;
  1627. Map.Override_Mouse_Shape(MOUSE_NORMAL);
  1628. Theme.Queue_Song(THEME_WIN1);
  1629. PseudoSeenBuff = new GraphicBufferClass(320,200,(void*)NULL);
  1630. TextPrintBuffer = new GraphicBufferClass(SeenBuff.Get_Width(), SeenBuff.Get_Height() ,(void*)NULL);
  1631. BlitList.Clear();
  1632. SysMemPage.Clear();
  1633. PseudoSeenBuff->Clear();
  1634. HiddenPage.Clear();
  1635. TextPrintBuffer->Clear();
  1636. Set_Palette(BlackPalette);
  1637. anim = Open_Animation("MLTIPLYR.WSA",NULL,0L,(WSAOpenType)(WSA_OPEN_FROM_MEM | WSA_OPEN_TO_PAGE),Palette);
  1638. Hide_Mouse();
  1639. /*
  1640. ** Display the background animation
  1641. */
  1642. VisiblePage.Clear();
  1643. InterpolationPaletteChanged = TRUE;
  1644. InterpolationPalette = Palette;
  1645. Increase_Palette_Luminance (Palette , 30,30,30,63);
  1646. Animate_Frame(anim, *PseudoSeenBuff, 1);
  1647. Interpolate_2X_Scale( PseudoSeenBuff , &SeenBuff , "MULTSCOR.PAL");
  1648. Fade_Palette_To(Palette, FADE_PALETTE_FAST, Call_Back);
  1649. int frame = 1;
  1650. while (frame < Get_Animation_Frame_Count(anim)) {
  1651. Animate_Frame(anim, *PseudoSeenBuff, frame++);
  1652. Call_Back_Delay(2);
  1653. }
  1654. Close_Animation(anim);
  1655. /* Change to the six-point font for Text_Print */
  1656. oldfont = Set_Font(ScoreFontPtr);
  1657. Call_Back();
  1658. Set_Logic_Page(*PseudoSeenBuff);
  1659. /*
  1660. ** Move all the scores over a notch if there's more games than can be
  1661. ** shown (which is known by MPlayerCurGame == MAX_MULTI_GAMES-1);
  1662. */
  1663. if (MPlayerCurGame == MAX_MULTI_GAMES-1) {
  1664. for(i = 0; i < MAX_MULTI_NAMES; i++) {
  1665. for(k = 0; k < MAX_MULTI_GAMES-1; k++) {
  1666. MPlayerScore[i].Kills[k] = MPlayerScore[i].Kills[k+1];
  1667. }
  1668. }
  1669. }
  1670. int y = 41;
  1671. for(i = 0; i < MAX_MULTI_NAMES; i++) {
  1672. if (strlen(MPlayerScore[i].Name)) {
  1673. pal = (const char*)_colors[MPlayerScore[i].Color];
  1674. Alloc_Object(new ScorePrintClass(MPlayerScore[i].Name, 15, y,pal));
  1675. Call_Back_Delay(20);
  1676. Alloc_Object(new ScorePrintClass(Int_Print(MPlayerScore[i].Wins), 118, y, pal));
  1677. Call_Back_Delay(6);
  1678. for(k = 0; k <= MIN(MPlayerCurGame, MAX_MULTI_GAMES-2); k++) {
  1679. if (MPlayerScore[i].Kills[k] >= 0) {
  1680. Alloc_Object(new ScorePrintClass(Int_Print(MPlayerScore[i].Kills[k]), 225+(24*k), y, pal));
  1681. Call_Back_Delay(6);
  1682. }
  1683. }
  1684. y += 12;
  1685. }
  1686. }
  1687. #if (FRENCH)
  1688. Alloc_Object(new ScorePrintClass(TXT_MAP_CLICK2, 90 /*(320-strlen(Text_String(TXT_MAP_CLICK2)))/2*/, 185, _cycleyellowpal));
  1689. #else
  1690. Alloc_Object(new ScorePrintClass(TXT_MAP_CLICK2, 109 /*(320-strlen(Text_String(TXT_MAP_CLICK2)))/2*/, 185, _cycleyellowpal));
  1691. #endif
  1692. Cycle_Wait_Click();
  1693. /* get rid of all the animating objects */
  1694. for (i = 0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) {
  1695. delete ScoreObjs[i];
  1696. ScoreObjs[i] = 0;
  1697. }
  1698. Theme.Queue_Song(THEME_NONE);
  1699. Fade_Palette_To(BlackPalette, FADE_PALETTE_FAST, NULL);
  1700. VisiblePage.Clear();
  1701. Set_Palette(GamePalette);
  1702. Set_Logic_Page (SeenBuff);
  1703. delete PseudoSeenBuff;
  1704. delete TextPrintBuffer;
  1705. BlitList.Clear();
  1706. Set_Font(oldfont);
  1707. FontXSpacing = oldfontxspacing;
  1708. ControlQ = 0;
  1709. Show_Mouse();
  1710. }
  1711. #ifdef WRITE_LBM
  1712. // A BitMapHeader is stored in a BMHD chunk. This structure MUST be an even size
  1713. typedef struct {
  1714. unsigned short w, h; // raster width & height in pixels
  1715. unsigned short x, y; // position for this image
  1716. unsigned char planes; // # source bitplanes
  1717. unsigned char masking; // masking technique
  1718. unsigned char compression; // compression algoithm
  1719. unsigned char pad1; // UNUSED. For consistency, put 0 here.
  1720. unsigned short transcolor; // transparent "color number"
  1721. unsigned char xaspect, yaspect; // aspect ratio, a rational number x/y
  1722. unsigned short pagewidth, pageheight; // source "page" size in pixels
  1723. } BitMapHeaderType;
  1724. // All values in LocalHeader are always the same except planes. This is set in Write_BMHD
  1725. // the WORD values must be in low-high order for compatibility.
  1726. static BitMapHeaderType LocalHeader = {
  1727. 0x4001, 0xc800, 0, 0, 0, 0, // width, height, x, y, planes, mask
  1728. 1, 0, 0xFF00, 5, 6, // compress, pad1, transcolor, xasptect, yaspect
  1729. 0x4001, 0xC800 }; // pagewidth, pageheight
  1730. #define BM_HEADER_SIZE (((sizeof(BitMapHeaderType) + 1) & 0xFFFE) + 8L)
  1731. /*=========================================================================*/
  1732. /* The following static functions are in this file: */
  1733. /*=========================================================================*/
  1734. static long CCWrite_BMHD(CCFileClass &lbmhandle, short bitplanes);
  1735. static long CCWrite_CMAP(CCFileClass &lbmhandle, unsigned char * palette, short bitplanes);
  1736. static long CCWrite_BODY(CCFileClass &lbmhandle, BufferClass& buff, short bitplanes);
  1737. static long CCWrite_Row(CCFileClass &lbmhandle, unsigned char *buffer);
  1738. /*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
  1739. /***************************************************************************
  1740. * CCWrite_LBM_File -- Writes out a file in LBM format *
  1741. * *
  1742. * INPUT: short lbmhandle -- lbm file handle already opened by caller *
  1743. * BufferClass buff -- buff where MCGA picture is *
  1744. * short bitplane -- number of bitplanes to convert to *
  1745. * char *palette -- pointer to palette for buff *
  1746. * *
  1747. * OUTPUT: Returns bool -- successfull or not *
  1748. * *
  1749. * WARNINGS: *
  1750. * *
  1751. * HISTORY: *
  1752. * 11/18/1991 SB : Created. *
  1753. *=========================================================================*/
  1754. bool CCWrite_LBM_File(CCFileClass &lbmhandle, BufferClass& buff, short bitplanes, unsigned char *palette)
  1755. {
  1756. long filesize;
  1757. lbmhandle.Seek(0L, SEEK_SET); // goto beginning of file
  1758. lbmhandle.Write("FORM????ILBM", 12L); // First 12 bytes of all .lbm files
  1759. // size is unkown so write ????
  1760. filesize = 12L; // 4 bytes for "ILBM"
  1761. filesize += CCWrite_BMHD(lbmhandle, bitplanes); // write out BMHD (fixed size)
  1762. filesize += CCWrite_CMAP(lbmhandle, palette, bitplanes); // write out CMAP
  1763. // Write out the body, or compressed picture image. This size will depend
  1764. // on the compression, but the value passed back is what the compressor
  1765. // assumed was written to file
  1766. filesize += CCWrite_BODY(lbmhandle, buff, bitplanes);
  1767. // Verify that we were able to write out the file without running out of space
  1768. if (lbmhandle.Seek(0L, SEEK_END) != filesize) {
  1769. return(false);
  1770. }
  1771. lbmhandle.Seek(4L, SEEK_SET); // goto beginning of file
  1772. filesize = Reverse_LONG(filesize - 8L); // - 8 because of "FORM" + short (size)
  1773. lbmhandle.Write( (char *) &filesize, 4L); // patch in filesize
  1774. return(true);
  1775. }
  1776. /***************************************************************************
  1777. * CCWrite_BMHD -- writes out the bit map header (LocalHeader) *
  1778. * *
  1779. * INPUT: short lbmhandle -- file handle for lbm file *
  1780. * short pitplanes -- number of bitplanes to write out *
  1781. * *
  1782. * OUTPUT: LONG number of bytes hopefully written out to .LBM file *
  1783. * *
  1784. * WARNINGS: *
  1785. * *
  1786. * HISTORY: *
  1787. * 11/19/1991 SB : Created. *
  1788. *=========================================================================*/
  1789. static long CCWrite_BMHD(CCFileClass &lbmhandle, short bitplanes)
  1790. {
  1791. long size;
  1792. lbmhandle.Write("BMHD", 4L); // write out chunk title
  1793. size = Reverse_LONG(sizeof(LocalHeader)); // write out size of LocalHeader chunk
  1794. lbmhandle.Write((char *) &size, 4L);
  1795. LocalHeader.planes = bitplanes; // only nonconstant value in LocalHeader
  1796. // Make sure size is even. Return 8 = "BMHD" + size of the bitmap header structure
  1797. return(lbmhandle.Write((char *) &LocalHeader,
  1798. (sizeof(LocalHeader) + 1) & 0xFFFE) + 8L);
  1799. }
  1800. /***************************************************************************
  1801. * CCWrite_CMAP -- Writes out CMAP (palette) information *
  1802. * *
  1803. * *
  1804. * INPUT: short lbmhandle -- file handle of lbm file *
  1805. * char * palette -- pointer to paletter information *
  1806. * short bitplanes -- used to figure out size of palette *
  1807. * *
  1808. * OUTPUT: long number of bytes that should have been written out to .LBM. *
  1809. * *
  1810. * WARNINGS: *
  1811. * *
  1812. * HISTORY: *
  1813. * 11/19/1991 SB : Created. *
  1814. *=========================================================================*/
  1815. static long CCWrite_CMAP(CCFileClass &lbmhandle, unsigned char * palette, short bitplanes)
  1816. {
  1817. short color, r, g, b, colors;
  1818. long size;
  1819. unsigned char *pal_ptr;
  1820. char rgb[3];
  1821. lbmhandle.Write("CMAP", 4L); // write out palette info
  1822. colors = 1 << bitplanes; // colors = 2 to the bitplanes
  1823. size = Reverse_LONG(colors * 3L); // size = colors * 3 guns
  1824. lbmhandle.Write((char *) &size, 4L);
  1825. for (pal_ptr = palette, color = 0; color < colors; color++) { // for each color
  1826. if ((r = *pal_ptr++) != 0) { // DPaint changes allows 0 - 100 for gun values
  1827. r = (r << 2) | 0x03; // this must be converted to 0 - 256 for LBM
  1828. } // so LBM_val = (DP_val * 4) | 3 if DP_val != 0
  1829. if ((g = *pal_ptr++) != 0) {
  1830. g = (g << 2) | 0x03;
  1831. }
  1832. if ((b = *pal_ptr++) != 0) {
  1833. b = (b << 2) | 0x03;
  1834. }
  1835. rgb[0] = r; // assign gun values to an array to write out
  1836. rgb[1] = g;
  1837. rgb[2] = b;
  1838. lbmhandle.Write(rgb, 3L);
  1839. }
  1840. // size = colors * 3
  1841. return(((colors << 1) + colors) + 8L); // total size of CMAP 8 = "CMAP" + short (size)
  1842. }
  1843. /***************************************************************************
  1844. * CCWrite_Body -- writes out compressed data in an LBM file *
  1845. * *
  1846. * INPUT: short lbmhandle -- file handle of lbm file *
  1847. * *
  1848. * OUTPUT: long - number of byte written *
  1849. * *
  1850. * WARNINGS: *
  1851. * *
  1852. * HISTORY: *
  1853. * 11/19/1991 SB : Created. *
  1854. *=========================================================================*/
  1855. static long CCWrite_BODY(CCFileClass &lbmhandle, BufferClass& buff, short bitplanes)
  1856. {
  1857. long bodysize = 0;
  1858. long actualsize;
  1859. long size;
  1860. short planebit;
  1861. short line, plane;
  1862. unsigned char buffer[40];
  1863. unsigned char *buffptr;
  1864. lbmhandle.Write("BODY????", 8L); // BODY chunk ID, ???? reserved for chuncksize
  1865. buffptr = (unsigned char *) buff.Get_Buffer(); // point to beginning of buff
  1866. for (line = 0; line < 200; line++) {
  1867. planebit = 1; // start with bit 1 set
  1868. for (plane = 0; plane < bitplanes; plane++) {
  1869. Pack_2_Plane(buffer, buffptr, planebit); // convert to planar
  1870. bodysize += CCWrite_Row(lbmhandle, buffer); // write to to the BODY in the LBM
  1871. planebit <<= 1; // set next bit
  1872. }
  1873. buffptr += 320; // row size is 320
  1874. }
  1875. actualsize = bodysize + (bodysize&0x01);
  1876. if (actualsize != bodysize) {
  1877. lbmhandle.Write(buffer, 1); // Padd the block.
  1878. }
  1879. lbmhandle.Seek( -(actualsize + 4L), SEEK_CUR); // Patch in chunksize
  1880. size = Reverse_LONG(bodysize);
  1881. lbmhandle.Write( (char *) &size ,4L);
  1882. return(actualsize + 8L); // total size of BODY, "BODY????" = 8 bytes
  1883. }
  1884. /***************************************************************************
  1885. * CCWrite_Row -- compresses and writes a row plane to .lbm file *
  1886. * *
  1887. * INPUT: short lbmhandle -- lbm file handle *
  1888. * unsigned char *buffer -- pointer to buffer to be written out *
  1889. * *
  1890. * OUTPUT: long size of chunk that should have been written out *
  1891. * *
  1892. * WARNINGS: *
  1893. * *
  1894. * HISTORY: *
  1895. * 11/19/1991 SB : Created. *
  1896. *=========================================================================*/
  1897. static long CCWrite_Row(CCFileClass &lbmhandle, unsigned char *buffer)
  1898. {
  1899. short i;
  1900. short chunksize = 0;
  1901. short dataLength = 40; // 320 rows / 8 ( 1 plane per row)
  1902. unsigned char repCode, current, curr_plus_2;
  1903. unsigned char *buffptr;
  1904. while (dataLength) {
  1905. // If at least 2 more bytes and they are equal, then replicate
  1906. if ((dataLength >= 2) && (buffer[0] == buffer[1])) {
  1907. buffptr = buffer;
  1908. for (i = 0; (i <= 128) && (i < (dataLength - 1)); i++) {
  1909. if (*buffptr != buffptr[1]) {
  1910. break;
  1911. }
  1912. buffptr++;
  1913. }
  1914. i++;
  1915. repCode = -i + 1;
  1916. lbmhandle.Write(&repCode, 1L); // Write count as -count+1
  1917. lbmhandle.Write(buffer, 1L); // Write byte to replicate
  1918. buffer += i;
  1919. dataLength -= i;
  1920. chunksize += 2;
  1921. } else { // Copy literally till 3 byte run or two 2 byte runs found
  1922. for (i = 0; (i <= 128) && (i < dataLength); i++) {
  1923. current = buffer[i];
  1924. curr_plus_2 = buffer[i + 2];
  1925. if (i == dataLength - 1)
  1926. continue;
  1927. if (current != buffer[i + 1])
  1928. continue;
  1929. if (i == dataLength - 2)
  1930. continue;
  1931. if (current == curr_plus_2)
  1932. break;
  1933. if (i == dataLength - 3)
  1934. continue;
  1935. if (curr_plus_2 == buffer[i + 3])
  1936. break;
  1937. }
  1938. repCode = i - 1;
  1939. lbmhandle.Write(&repCode, 1L); // Write count as count-1
  1940. lbmhandle.Write(buffer, (long) i); // Write 'count' bytes
  1941. buffer += i;
  1942. dataLength -= i;
  1943. chunksize += i + 1;
  1944. }
  1945. } // end while
  1946. return(chunksize);
  1947. }
  1948. #endif