CREDITS.CPP 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. /*******************************************************************************
  2. FILE: CREDITS.CPP
  3. DESCRIPTION:
  4. AUTHOR: Peter M. Freese
  5. CREATED: 12-05-95
  6. COPYRIGHT: Copyright (c) 1995 Q Studios Corporation
  7. *******************************************************************************/
  8. #include "credits.h"
  9. #include "key.h"
  10. #include "sound.h"
  11. #include "screen.h"
  12. #include "globals.h"
  13. #include "misc.h"
  14. #include "view.h"
  15. #include "gfx.h"
  16. #include "trig.h"
  17. #include "debug4g.h"
  18. #define kDACWaitTicks 2 // ticks between DAC updates
  19. char *credits[] =
  20. {
  21. "Game By",
  22. "Q Studios",
  23. "",
  24. "Project Director",
  25. "Nick Newhard",
  26. "",
  27. "Executive Producer",
  28. "George Broussard",
  29. "",
  30. "Lead Programmer",
  31. "Peter Freese",
  32. "",
  33. "3D Engine",
  34. "Ken Silverman",
  35. NULL,
  36. "Level Design",
  37. "Jay Wilson",
  38. "Nick Newhard",
  39. "Terry Hamel",
  40. "Kevin Kilstrom",
  41. "Richard Gray",
  42. "Vance Andrew Blevins",
  43. NULL,
  44. "Artists",
  45. "Kevin Kilstrom",
  46. "Terry Hamel",
  47. "",
  48. "Creature Models",
  49. "Kevin Kilstrom",
  50. "",
  51. "Additional Art",
  52. "Rick Welsh",
  53. "David Brinkley",
  54. NULL,
  55. "Music and Sound",
  56. "LoudMouth",
  57. "",
  58. "3D Sound System",
  59. "Peter Freese",
  60. "",
  61. "Audio Technology",
  62. "Jim Dose",
  63. "",
  64. "Network Programming",
  65. "Mark Dochterman",
  66. NULL,
  67. "Special Thanks",
  68. "Chris Rush",
  69. "Erik Klokstad",
  70. "Helen Newhard",
  71. "Cynthia Freese",
  72. "Francine Kilstrom",
  73. };
  74. static BOOL Wait( int nTicks )
  75. {
  76. gGameClock = 0;
  77. while ( gGameClock < nTicks )
  78. if ( keyGet() != 0 )
  79. return FALSE;
  80. return TRUE;
  81. }
  82. static BOOL DoFade( BYTE r, BYTE g, BYTE b, int nTicks )
  83. {
  84. dassert(nTicks > 0);
  85. scrSetupFade(r, g, b);
  86. gGameClock = gFrameClock = 0;
  87. do
  88. {
  89. while (gGameClock < gFrameClock);
  90. gFrameClock += kDACWaitTicks;
  91. WaitVSync();
  92. scrFadeAmount(divscale16(ClipHigh(gGameClock, nTicks), nTicks));
  93. if ( keyGet() != 0 )
  94. return FALSE;
  95. } while ( gGameClock <= nTicks );
  96. return TRUE;
  97. }
  98. static BOOL DoUnFade( int nTicks )
  99. {
  100. dassert(nTicks > 0);
  101. scrSetupUnfade();
  102. gGameClock = gFrameClock = 0;
  103. do
  104. {
  105. while (gGameClock < gFrameClock);
  106. gFrameClock += kDACWaitTicks;
  107. WaitVSync();
  108. scrFadeAmount(0x10000 - divscale16(ClipHigh(gGameClock, nTicks), nTicks));
  109. if ( keyGet() != 0 )
  110. return FALSE;
  111. } while ( gGameClock <= nTicks );
  112. return TRUE;
  113. }
  114. // show logos
  115. void credLogos( void )
  116. {
  117. int nEffect = 0;
  118. // sndPlaySong("INTRO", FALSE);
  119. // black out dac
  120. if ( !DoFade(0, 0, 0, 1) ) return;
  121. // castle background
  122. rotatesprite(320 << 15, 200 << 15, 0x10000, 0, 2046, 0, 0,
  123. kRotateScale | kRotateNoMask, 0, 0, 319, 199);
  124. scrNextPage();
  125. if ( !DoUnFade(2 * kTimerRate) ) return;
  126. if ( !Wait(1 * kTimerRate) ) return;
  127. if ( !DoFade(255, 255, 255, 2) ) return;
  128. /*
  129. // flash the subliminal babe
  130. rotatesprite(320 << 15, 200 << 15, 0x10000, 0, 2323, 0, 0,
  131. kRotateScale | kRotateNoMask, 0, 0, 319, 199);
  132. scrNextPage();
  133. DoUnFade(1);
  134. DoFade(255, 255, 255, 1);
  135. */
  136. // castle again
  137. rotatesprite(320 << 15, 200 << 15, 0x10000, 0, 2046, 0, 0,
  138. kRotateScale | kRotateNoMask, 0, 0, 319, 199);
  139. // Q Studios logo
  140. rotatesprite(320 << 15, 200 << 15, 0x10000, 0, 2047, 0, 0,
  141. kRotateScale | kRotateNoMask, 0, 0, 319, 199);
  142. scrNextPage();
  143. sndStartSample("THUNDER2", 255);
  144. if ( !DoUnFade(60) ) return;
  145. if ( !Wait(1 * kTimerRate) ) return;
  146. sndStartSample("THUNDER", 255);
  147. if ( !Wait(1 * kTimerRate) ) return;
  148. if ( !DoFade(0, 0, 0, 60) ) return;
  149. // menu background
  150. rotatesprite(320 << 15, 200 << 15, 0x10000, 0, 2049, 0, 0,
  151. kRotateScale | kRotateNoMask, 0, 0, 319, 199);
  152. scrNextPage();
  153. if ( !DoUnFade(60) ) return;
  154. sndStartSample("DOORSLID", 255);
  155. if ( !Wait(2 * kTimerRate) ) return;
  156. if ( !DoFade(0, 0, 0, 60) ) return;
  157. while ( sndIsSongPlaying() )
  158. {
  159. if (keyGet() != 0 )
  160. return;
  161. }
  162. }
  163. static QFONT *pFont;
  164. static int fuseX, fuseY;
  165. static void DrawCreditText( char *string, int x, int y, int nAlign )
  166. {
  167. char *s;
  168. dassert(string != NULL);
  169. setupmvlineasm(16);
  170. if ( nAlign != TA_LEFT )
  171. {
  172. int nWidth = -pFont->charSpace;
  173. for ( s = string; *s; s++ )
  174. nWidth += pFont->info[*s].hspace + pFont->charSpace;
  175. if ( nAlign == TA_CENTER )
  176. nWidth >>= 1;
  177. x -= nWidth;
  178. }
  179. for ( s = string; *s; s++ )
  180. {
  181. int nShade = ClipRange(qdist(x - fuseX, y - fuseY) - 16, 0, 56);
  182. BYTE *pPalookup = palookup[kPLUNormal] + (getpalookup(0, nShade) << 8);
  183. viewDrawChar(pFont, *s, x, y, pPalookup);
  184. x += pFont->info[*s].hspace + pFont->charSpace;
  185. }
  186. }
  187. #define kLineSpace 14
  188. // show credits
  189. void credCredits( void )
  190. {
  191. int n = 0;
  192. int x, y;
  193. fuseX = -256;
  194. fuseY = -256;
  195. RESHANDLE hFont = gSysRes.Lookup((long)kFontMessage, ".QFN");
  196. dassert(hFont != NULL);
  197. pFont = (QFONT *)gSysRes.Lock(hFont);
  198. sndPlaySong("BLOOD5", FALSE);
  199. // black out dac
  200. if ( !DoFade(0, 0, 0, 1) ) return;
  201. while ( n < LENGTH(credits) )
  202. {
  203. // calculate number of lines to display
  204. int nLines = 0;
  205. while ( credits[n + nLines] != NULL )
  206. nLines++;
  207. // draw the screen
  208. clearview(0);
  209. y = (200 - nLines * kLineSpace) / 2;
  210. for ( int i = 0; i < nLines; i++ )
  211. {
  212. DrawCreditText(credits[n + i], 160, y, TA_CENTER);
  213. y += kLineSpace;
  214. }
  215. scrNextPage();
  216. DoUnFade(60);
  217. int y0 = Random(200);
  218. int y1 = Random(200);
  219. int nFrame = 0;
  220. for ( x = -32; x < 320 + 32; x += 1 )
  221. {
  222. fuseX = x;
  223. fuseY = y0 + muldiv(y1 - y0, x, 320);
  224. clearview(0);
  225. y = (200 - nLines * kLineSpace) / 2;
  226. for ( int i = 0; i < nLines; i++ )
  227. {
  228. DrawCreditText(credits[n + i], 160, y, TA_CENTER);
  229. y += kLineSpace;
  230. }
  231. /*
  232. nFrame = IncRotate(nFrame, 3);
  233. rotatesprite(fuseX << 16, fuseY << 16, 0x10000 + BiRandom(0x1000),
  234. (short)BiRandom(kAngle30), (short)(3195 + nFrame),
  235. -128, kPLUNormal, kRotateStatus, 0, 0, xdim - 1, ydim - 1);
  236. */
  237. scrNextPage();
  238. Wait(3);
  239. }
  240. DoFade(0, 0, 0, 60);
  241. n += nLines + 1;
  242. }
  243. sndFadeSong(400);
  244. gSysRes.Unlock(hFont);
  245. }