C6_MAIN.C 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  1. /* Catacomb Apocalypse Source Code
  2. * Copyright (C) 1993-2014 Flat Rock Software
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. // C3_MAIN.C
  19. #define CATALOG
  20. #include <time.h>
  21. #include <stdarg.h>
  22. #include "DEF.H"
  23. #include "GELIB.H"
  24. #pragma hdrstop
  25. #include <dir.h>
  26. /*
  27. =============================================================================
  28. LOCAL CONSTANTS
  29. =============================================================================
  30. */
  31. /*
  32. =============================================================================
  33. GLOBAL VARIABLES
  34. =============================================================================
  35. */
  36. typedef enum demo_screens {sc_logo,sc_title,sc_credits1,sc_credits2,sc_credits3,sc_credits4,sc_end} demo_screens;
  37. struct Shape shape,
  38. SdLogoShp,
  39. TitleShp,
  40. CreditBKShp,
  41. Credit1Shp,
  42. Credit2Shp,
  43. Credit3Shp,
  44. Credit4Shp,
  45. Credit5Shp,
  46. Credit6Shp,
  47. Credit7Shp,
  48. Credit8Shp,
  49. Credit9Shp,
  50. Credit10Shp;
  51. PresenterInfo MainHelpText;
  52. GameDiff restartgame;
  53. boolean loadedgame,abortgame,ingame;
  54. memptr scalesegs[NUMPICS];
  55. char str[80],str2[20];
  56. unsigned tedlevelnum;
  57. boolean tedlevel;
  58. gametype gamestate;
  59. exittype playstate;
  60. char SlowMode = 0;
  61. int starting_level;
  62. short NumGames=0;
  63. unsigned Flags=0;
  64. boolean LoadShapes = true;
  65. boolean EASYMODEON = false;
  66. void DisplayIntroText(void);
  67. /*
  68. =============================================================================
  69. LOCAL VARIABLES
  70. =============================================================================
  71. */
  72. //===========================================================================
  73. #if 0
  74. // JAB Hack begin
  75. #define MyInterrupt 0x60
  76. void interrupt (*intaddr)();
  77. void interrupt (*oldintaddr)();
  78. char *JHParmStrings[] = {"no386",nil};
  79. void
  80. jabhack(void)
  81. {
  82. extern void far jabhack2(void);
  83. extern int far CheckIs386(void);
  84. int i;
  85. oldintaddr = getvect(MyInterrupt);
  86. for (i = 1;i < _argc;i++)
  87. if (US_CheckParm(_argv[i],JHParmStrings) == 0)
  88. return;
  89. if (CheckIs386())
  90. {
  91. jabhack2();
  92. setvect(MyInterrupt,intaddr);
  93. }
  94. }
  95. void
  96. jabunhack(void)
  97. {
  98. setvect(MyInterrupt,oldintaddr);
  99. }
  100. // JAB Hack end
  101. #endif
  102. //===========================================================================
  103. /*
  104. =====================
  105. =
  106. = NewGame
  107. =
  108. = Set up new game to start from the beginning
  109. =
  110. =====================
  111. */
  112. void NewGame (void)
  113. {
  114. if (!loadedgame)
  115. {
  116. memset (&gamestate,0,sizeof(gamestate));
  117. gamestate.mapon = starting_level;
  118. gamestate.body = MAXBODY;
  119. }
  120. BGFLAGS = BGF_NOT_LIGHTNING;
  121. Flags &= FL_CLEAR;
  122. boltsleft = bolttimer = 0;
  123. // memset (gamestate.levels,-1,sizeof(gamestate.levels));
  124. }
  125. //===========================================================================
  126. #define RLETAG 0xABCD
  127. /*
  128. ==================
  129. =
  130. = SaveTheGame
  131. =
  132. ==================
  133. */
  134. boolean SaveTheGame(int file)
  135. {
  136. word i,compressed,expanded;
  137. objtype *o;
  138. memptr bigbuffer;
  139. // save the sky and ground colors
  140. if (!CA_FarWrite(file,(void far *)&skycolor,sizeof(skycolor)))
  141. return(false);
  142. if (!CA_FarWrite(file,(void far *)&groundcolor,sizeof(groundcolor)))
  143. return(false);
  144. if (!CA_FarWrite(file,(void far *)&FreezeTime,sizeof(FreezeTime)))
  145. return(false);
  146. if (!CA_FarWrite(file,(void far *)&gamestate,sizeof(gamestate)))
  147. return(false);
  148. if (!CA_FarWrite(file,(void far *)&EASYMODEON,sizeof(EASYMODEON)))
  149. return(false);
  150. expanded = mapwidth * mapheight * 2;
  151. MM_GetPtr (&bigbuffer,expanded);
  152. for (i = 0;i < 3;i+=2) // Write planes 0 and 2
  153. {
  154. //
  155. // leave a word at start of compressed data for compressed length
  156. //
  157. compressed = (unsigned)CA_RLEWCompress ((unsigned huge *)mapsegs[i]
  158. ,expanded,((unsigned huge *)bigbuffer)+1,RLETAG);
  159. *(unsigned huge *)bigbuffer = compressed;
  160. if (!CA_FarWrite(file,(void far *)bigbuffer,compressed+2) )
  161. {
  162. MM_FreePtr (&bigbuffer);
  163. return(false);
  164. }
  165. }
  166. for (o = player;o;o = o->next)
  167. if (!CA_FarWrite(file,(void far *)o,sizeof(objtype)))
  168. {
  169. MM_FreePtr (&bigbuffer);
  170. return(false);
  171. }
  172. MM_FreePtr (&bigbuffer);
  173. return(true);
  174. }
  175. //===========================================================================
  176. /*
  177. ==================
  178. =
  179. = LoadTheGame
  180. =
  181. ==================
  182. */
  183. boolean LoadTheGame(int file)
  184. {
  185. unsigned i,x,y;
  186. objtype *obj,*prev,*next,*followed;
  187. unsigned compressed,expanded;
  188. unsigned far *map,tile;
  189. memptr bigbuffer;
  190. screenpage = 0;
  191. FreeUpMemory();
  192. playstate = ex_loadedgame;
  193. // load the sky and ground colors
  194. if (!CA_FarRead(file,(void far *)&skycolor,sizeof(skycolor)))
  195. return(false);
  196. if (!CA_FarRead(file,(void far *)&groundcolor,sizeof(groundcolor)))
  197. return(false);
  198. if (!CA_FarRead(file,(void far *)&FreezeTime,sizeof(FreezeTime)))
  199. return(false);
  200. if (!CA_FarRead(file,(void far *)&gamestate,sizeof(gamestate)))
  201. return(false);
  202. if (!CA_FarRead(file,(void far *)&EASYMODEON,sizeof(EASYMODEON)))
  203. return(false);
  204. SetupGameLevel (); // load in and cache the base old level
  205. if (!FindFile(Filename,"SAVE GAME",-1))
  206. Quit("Error: Can't find saved game file!");
  207. expanded = mapwidth * mapheight * 2;
  208. MM_GetPtr (&bigbuffer,expanded);
  209. for (i = 0;i < 3;i+=2) // Read planes 0 and 2
  210. {
  211. if (!CA_FarRead(file,(void far *)&compressed,sizeof(compressed)) )
  212. {
  213. MM_FreePtr (&bigbuffer);
  214. return(false);
  215. }
  216. if (!CA_FarRead(file,(void far *)bigbuffer,compressed) )
  217. {
  218. MM_FreePtr (&bigbuffer);
  219. return(false);
  220. }
  221. CA_RLEWexpand ((unsigned huge *)bigbuffer,
  222. (unsigned huge *)mapsegs[i],expanded,RLETAG);
  223. }
  224. MM_FreePtr (&bigbuffer);
  225. //
  226. // copy the wall data to a data segment array again, to handle doors and
  227. // bomb walls that are allready opened
  228. //
  229. memset (tilemap,0,sizeof(tilemap));
  230. memset (actorat,0,sizeof(actorat));
  231. map = mapsegs[0];
  232. for (y=0;y<mapheight;y++)
  233. for (x=0;x<mapwidth;x++)
  234. {
  235. tile = *map++;
  236. if (tile<NUMFLOORS)
  237. {
  238. if (tile != INVISIBLEWALL)
  239. tilemap[x][y] = tile;
  240. if (tile>0)
  241. (unsigned)actorat[x][y] = tile;
  242. }
  243. }
  244. // Read the object list back in - assumes at least one object in list
  245. InitObjList ();
  246. new = player;
  247. while (true)
  248. {
  249. prev = new->prev;
  250. next = new->next;
  251. if (!CA_FarRead(file,(void far *)new,sizeof(objtype)))
  252. return(false);
  253. followed = new->next;
  254. new->prev = prev;
  255. new->next = next;
  256. actorat[new->tilex][new->tiley] = new; // drop a new marker
  257. if (followed)
  258. GetNewObj (false);
  259. else
  260. break;
  261. }
  262. return(true);
  263. }
  264. //===========================================================================
  265. /*
  266. ==================
  267. =
  268. = ResetGame
  269. =
  270. ==================
  271. */
  272. void ResetGame(void)
  273. {
  274. NewGame ();
  275. ca_levelnum--;
  276. ca_levelbit>>=1;
  277. CA_ClearMarks();
  278. ca_levelbit<<=1;
  279. ca_levelnum++;
  280. }
  281. //===========================================================================
  282. /*
  283. ==========================
  284. =
  285. = ShutdownId
  286. =
  287. = Shuts down all ID_?? managers
  288. =
  289. ==========================
  290. */
  291. void ShutdownId (void)
  292. {
  293. US_Shutdown ();
  294. #ifndef PROFILE
  295. SD_Shutdown ();
  296. IN_Shutdown ();
  297. #endif
  298. VW_Shutdown ();
  299. CA_Shutdown ();
  300. MM_Shutdown ();
  301. }
  302. //===========================================================================
  303. /*
  304. ==========================
  305. =
  306. = InitGame
  307. =
  308. = Load a few things right away
  309. =
  310. ==========================
  311. */
  312. void InitGame (void)
  313. {
  314. unsigned segstart,seglength;
  315. int i,x,y;
  316. unsigned *blockstart;
  317. // US_TextScreen();
  318. MM_Startup ();
  319. VW_Startup ();
  320. #ifndef PROFILE
  321. IN_Startup ();
  322. SD_Startup ();
  323. #endif
  324. US_Startup ();
  325. CA_Startup ();
  326. US_Setup ();
  327. US_SetLoadSaveHooks(LoadTheGame,SaveTheGame,ResetGame);
  328. //
  329. // load in and lock down some basic chunks
  330. //
  331. CA_ClearMarks ();
  332. CA_MarkGrChunk(STARTFONT);
  333. CA_MarkGrChunk(STARTTILE8);
  334. CA_MarkGrChunk(STARTTILE8M);
  335. CA_MarkGrChunk(HAND1PICM);
  336. CA_MarkGrChunk(NORTHICONSPR);
  337. CA_CacheMarks (NULL);
  338. MM_SetLock (&grsegs[STARTFONT],true);
  339. MM_SetLock (&grsegs[STARTTILE8],true);
  340. MM_SetLock (&grsegs[STARTTILE8M],true);
  341. MM_SetLock (&grsegs[HAND1PICM],true);
  342. fontcolor = WHITE;
  343. //
  344. // build some tables
  345. //
  346. for (i=0;i<MAPSIZE;i++)
  347. nearmapylookup[i] = &tilemap[0][0]+MAPSIZE*i;
  348. for (i=0;i<PORTTILESHIGH;i++)
  349. uwidthtable[i] = UPDATEWIDE*i;
  350. blockstart = &blockstarts[0];
  351. for (y=0;y<UPDATEHIGH;y++)
  352. for (x=0;x<UPDATEWIDE;x++)
  353. *blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;
  354. BuildTables (); // 3-d tables
  355. SetupScaling ();
  356. #ifndef PROFILE
  357. // US_FinishTextScreen();
  358. #endif
  359. #if 0
  360. //
  361. // reclaim the memory from the linked in text screen
  362. //
  363. segstart = FP_SEG(&introscn);
  364. seglength = 4000/16;
  365. if (FP_OFF(&introscn))
  366. {
  367. segstart++;
  368. seglength--;
  369. }
  370. MML_UseSpace (segstart,seglength);
  371. #endif
  372. VW_SetScreenMode (GRMODE);
  373. ge_textmode = false;
  374. // VW_ColorBorder (3);
  375. VW_ClearVideo (BLACK);
  376. //
  377. // initialize variables
  378. //
  379. updateptr = &update[0];
  380. *(unsigned *)(updateptr + UPDATEWIDE*PORTTILESHIGH) = UPDATETERMINATE;
  381. bufferofs = 0;
  382. displayofs = 0;
  383. VW_SetLineWidth(SCREENWIDTH);
  384. }
  385. //===========================================================================
  386. void clrscr (void); // can't include CONIO.H because of name conflicts...
  387. /*
  388. ==========================
  389. =
  390. = Quit
  391. =
  392. ==========================
  393. */
  394. void Quit (char *error, ...)
  395. {
  396. short exit_code=0;
  397. unsigned finscreen;
  398. va_list ap;
  399. va_start(ap,error);
  400. #ifndef CATALOG
  401. if (!error)
  402. {
  403. CA_SetAllPurge ();
  404. CA_CacheGrChunk (PIRACY);
  405. finscreen = (unsigned)grsegs[PIRACY];
  406. }
  407. #endif
  408. ShutdownId ();
  409. if (error && *error)
  410. {
  411. vprintf(error,ap);
  412. exit_code = 1;
  413. }
  414. #ifndef CATALOG
  415. else
  416. if (!NoWait)
  417. {
  418. movedata (finscreen,0,0xb800,0,4000);
  419. bioskey (0);
  420. }
  421. #endif
  422. va_end(ap);
  423. #ifndef CATALOG
  424. if (!error)
  425. {
  426. _argc = 2;
  427. _argv[1] = "LAST.SHL";
  428. _argv[2] = "ENDSCN.SCN";
  429. _argv[3] = NULL;
  430. if (execv("LOADSCN.EXE", _argv) == -1)
  431. {
  432. clrscr();
  433. puts("Couldn't find executable LOADSCN.EXE.\n");
  434. exit(1);
  435. }
  436. }
  437. #endif
  438. exit(exit_code);
  439. }
  440. //===========================================================================
  441. /*
  442. ==================
  443. =
  444. = TEDDeath
  445. =
  446. ==================
  447. */
  448. void TEDDeath(void)
  449. {
  450. ShutdownId();
  451. execlp("TED5.EXE","TED5.EXE","/LAUNCH",NULL);
  452. }
  453. //===========================================================================
  454. /*
  455. ====================
  456. =
  457. = DisplayDepartment
  458. =
  459. ====================
  460. */
  461. void DisplayDepartment(char *text)
  462. {
  463. short temp;
  464. // bufferofs = 0;
  465. PrintY = 5;
  466. WindowX = 17;
  467. WindowW = 168;
  468. VW_Bar(WindowX,PrintY+1,WindowW,7,0);
  469. temp = fontcolor;
  470. fontcolor = 10;
  471. US_CPrintLine (text);
  472. fontcolor = temp;
  473. }
  474. /*
  475. =====================
  476. =
  477. = DemoLoop
  478. =
  479. =====================
  480. */
  481. static char *ParmStrings[] = {"easy","normal","hard",""};
  482. void DemoLoop (void)
  483. {
  484. /////////////////////////////////////////////////////////////////////////////
  485. // main game cycle
  486. /////////////////////////////////////////////////////////////////////////////
  487. displayofs = bufferofs = 0;
  488. VW_Bar (0,0,320,200,0);
  489. VW_SetScreen(0,0);
  490. //
  491. // Read in all the graphic images needed for the title sequence
  492. //
  493. VW_WaitVBL(1);
  494. IN_ReadControl(0,&control);
  495. // set EASYMODE
  496. //
  497. if (stricmp(_argv[2], "1") == 0)
  498. EASYMODEON = true;
  499. else
  500. EASYMODEON = false;
  501. // restore game
  502. //
  503. if (stricmp(_argv[3], "1") == 0)
  504. {
  505. VW_FadeOut();
  506. bufferofs = displayofs = 0;
  507. VW_Bar(0,0,320,200,0);
  508. if (GE_LoadGame())
  509. {
  510. loadedgame = true;
  511. playstate = ex_loadedgame;
  512. Keyboard[sc_Enter] = true;
  513. VW_Bar(0,0,320,200,0);
  514. ColoredPalette();
  515. }
  516. VW_Bar(0,0,320,200,0);
  517. VW_FadeIn();
  518. }
  519. // Play a game
  520. //
  521. restartgame = gd_Normal;
  522. NewGame();
  523. GameLoop();
  524. }
  525. //-------------------------------------------------------------------------
  526. // DisplayIntroText()
  527. //-------------------------------------------------------------------------
  528. void DisplayIntroText()
  529. {
  530. PresenterInfo pi;
  531. #ifdef TEXT_PRESENTER
  532. char *toptext = "You stand before the gate leading into the Towne "
  533. "of Morbidity.... "
  534. "^XX";
  535. char *bottomtext = "Enter now boldly to defeat the evil Nemesis "
  536. "deep inside the catacombs."
  537. "
  538. "^XX";
  539. #endif
  540. char oldfontcolor=fontcolor;
  541. fontcolor = 14;
  542. #ifdef TEXT_PRESENTER
  543. pi.xl = 0;
  544. pi.yl = 0;
  545. pi.xh = 319;
  546. pi.yh = 1;
  547. pi.bgcolor = 0;
  548. pi.script[0] = (char far *)toptext;
  549. Presenter(&pi);
  550. pi.yl = 160;
  551. pi.yh = 161;
  552. pi.script[0] = (char far *)bottomtext;
  553. Presenter(&pi);
  554. #else
  555. PrintY = 1;
  556. PrintX = 0;
  557. WindowX = 0;
  558. WindowW = 320;
  559. US_Print (" A chilling wind greets you at the entrance\n");
  560. US_Print (" to the Sanctuary of the Dead.\n");
  561. PrintY = 180;
  562. fontcolor = 9;
  563. US_Print (" Shall you proceed as\n");
  564. fontcolor = 14;
  565. US_Print (" N");
  566. fontcolor = 9;
  567. US_Print ("ovice or");
  568. fontcolor = 14;
  569. US_Print (" W");
  570. fontcolor = 9;
  571. US_Print ("arrior ?");
  572. #endif
  573. fontcolor = oldfontcolor;
  574. }
  575. #if 0
  576. boolean ChooseGameLevel()
  577. {
  578. char choices[] = {sc_Escape,sc_E,sc_N,sc_H,0},ch;
  579. CenterWindow(20,10);
  580. US_Print("\n Choose difficulty level:\n");
  581. US_Print(" (E)asy\n");
  582. US_Print(" (N)ormal\n");
  583. US_Print(" (H)ard\n");
  584. US_Print("\n (ESC)ape aborts\n");
  585. // VW_UpdateScreen();
  586. if ((ch=GetKeyChoice(choices)) == sc_Escape)
  587. {
  588. while (Keyboard[sc_Escape]);
  589. LastScan = 0;
  590. return(false);
  591. }
  592. if (ch == sc_E)
  593. restartgame = gd_Easy;
  594. else
  595. if (ch == sc_N)
  596. restartgame = gd_Normal;
  597. else
  598. restartgame = gd_Hard;
  599. return(true);
  600. }
  601. #endif
  602. //===========================================================================
  603. /*
  604. ==========================
  605. =
  606. = SetupScalePic
  607. =
  608. ==========================
  609. */
  610. void SetupScalePic (unsigned picnum)
  611. {
  612. unsigned scnum;
  613. if (picnum == 1)
  614. return;
  615. scnum = picnum-FIRSTSCALEPIC;
  616. if (shapedirectory[scnum])
  617. {
  618. MM_SetPurge (&(memptr)shapedirectory[scnum],0);
  619. return; // allready in memory
  620. }
  621. CA_CacheGrChunk (picnum);
  622. DeplanePic (picnum);
  623. shapesize[scnum] = BuildCompShape (&shapedirectory[scnum]);
  624. grneeded[picnum]&= ~ca_levelbit;
  625. MM_FreePtr (&grsegs[picnum]);
  626. }
  627. //===========================================================================
  628. /*
  629. ==========================
  630. =
  631. = SetupScaleWall
  632. =
  633. ==========================
  634. */
  635. void SetupScaleWall (unsigned picnum)
  636. {
  637. int x,y;
  638. unsigned scnum;
  639. byte far *dest;
  640. if (picnum == 1)
  641. return;
  642. scnum = picnum-FIRSTWALLPIC;
  643. if (walldirectory[scnum])
  644. {
  645. MM_SetPurge (&walldirectory[scnum],0);
  646. return; // allready in memory
  647. }
  648. CA_CacheGrChunk (picnum);
  649. DeplanePic (picnum);
  650. MM_GetPtr(&walldirectory[scnum],64*64);
  651. dest = (byte far *)walldirectory[scnum];
  652. for (x=0;x<64;x++)
  653. for (y=0;y<64;y++)
  654. *dest++ = spotvis[y][x];
  655. grneeded[picnum]&= ~ca_levelbit;
  656. MM_FreePtr (&grsegs[picnum]);
  657. }
  658. //===========================================================================
  659. /*
  660. ==========================
  661. =
  662. = SetupScaling
  663. =
  664. ==========================
  665. */
  666. void SetupScaling (void)
  667. {
  668. int i,x,y;
  669. byte far *dest;
  670. //
  671. // build the compiled scalers
  672. //
  673. for (i=1;i<=VIEWWIDTH/2;i++)
  674. BuildCompScale (i*2,&scaledirectory[i]);
  675. }
  676. //===========================================================================
  677. int showscorebox;
  678. void RF_FixOfs (void)
  679. {
  680. }
  681. void HelpScreens (void)
  682. {
  683. }
  684. #if 0
  685. /*
  686. ==================
  687. =
  688. = CheckMemory
  689. =
  690. ==================
  691. */
  692. #define MINMEMORY 400000l
  693. void CheckMemory(void)
  694. {
  695. unsigned finscreen;
  696. if (Flags & FL_NOMEMCHECK)
  697. return;
  698. if (mminfo.nearheap+mminfo.farheap+mminfo.EMSmem+mminfo.XMSmem
  699. >= MINMEMORY)
  700. return;
  701. CA_CacheGrChunk (OUTOFMEM);
  702. finscreen = (unsigned)grsegs[OUTOFMEM];
  703. ShutdownId ();
  704. movedata (finscreen,7,0xb800,0,4000);
  705. gotoxy (1,24);
  706. exit(1);
  707. }
  708. #endif
  709. //===========================================================================
  710. /*
  711. ==========================
  712. =
  713. = main
  714. =
  715. ==========================
  716. */
  717. char *MainParmStrings[] = {"q","l","ver","nomemcheck","helptest",nil};
  718. void main (void)
  719. {
  720. short i;
  721. starting_level = 0;
  722. for (i = 1;i < _argc;i++)
  723. {
  724. switch (US_CheckParm(_argv[i],MainParmStrings))
  725. {
  726. case 0:
  727. Flags |= FL_QUICK;
  728. break;
  729. case 1:
  730. starting_level = atoi(_argv[i]+1);
  731. if ((starting_level < 0) || (starting_level > LASTMAP-1))
  732. starting_level = 0;
  733. break;
  734. case 2:
  735. printf("%s\n", GAMENAME);
  736. printf("Copyright 1992-93 Softdisk Publishing\n");
  737. printf("%s %s\n",VERSION,REVISION);
  738. printf("\n");
  739. exit(0);
  740. break;
  741. case 3:
  742. Flags |= FL_NOMEMCHECK;
  743. break;
  744. case 4:
  745. Flags |= (FL_HELPTEST|FL_QUICK);
  746. break;
  747. }
  748. }
  749. if (stricmp(_argv[1], "^(a@&r`"))
  750. Quit("You must type CATAPOC to run CATACOMB APOCALYPSE\n");
  751. #if 0
  752. MainHelpText.xl = 0;
  753. MainHelpText.yl = 0;
  754. MainHelpText.xh = 639;
  755. MainHelpText.yh = 199;
  756. MainHelpText.bgcolor = 7;
  757. MainHelpText.ltcolor = 15;
  758. MainHelpText.dkcolor = 8;
  759. #endif
  760. // jabhack();
  761. randomize();
  762. InitGame ();
  763. // CheckMemory ();
  764. LoadLatchMem ();
  765. // if (!LoadTextFile("MAINHELP."EXT,&MainHelpText))
  766. // Quit("Can't load MAINHELP."EXT);
  767. #ifdef PROFILE
  768. NewGame ();
  769. GameLoop ();
  770. #endif
  771. DemoLoop();
  772. Quit(NULL);
  773. }
  774. //-------------------------------------------------------------------------
  775. // Display640()
  776. //-------------------------------------------------------------------------
  777. void Display640(void)
  778. {
  779. // Can you believe it takes all this just to change to 640 mode!!???!
  780. //
  781. VW_ScreenToScreen(0,FREESTART-STATUSLEN,40,80);
  782. VW_SetLineWidth(80);
  783. MoveScreen(0,0);
  784. VW_Bar (0,0,640,200,0);
  785. VW_SetScreenMode(EGA640GR);
  786. VW_SetLineWidth(80);
  787. BlackPalette();
  788. }
  789. //-------------------------------------------------------------------------
  790. // Display320()
  791. //-------------------------------------------------------------------------
  792. void Display320(void)
  793. {
  794. // Can you believe it takes all this just to change to 320 mode!!???!
  795. //
  796. VW_ColorBorder(0);
  797. VW_FadeOut();
  798. VW_SetLineWidth(40);
  799. MoveScreen(0,0);
  800. VW_Bar (0,0,320,200,0);
  801. VW_SetScreenMode(EGA320GR);
  802. VW_SetLineWidth(40);
  803. BlackPalette();
  804. VW_ScreenToScreen(FREESTART-STATUSLEN,0,40,80);
  805. }
  806. void PrintHelp(void)
  807. {
  808. char oldfontcolor = fontcolor;
  809. PrintY = 1;
  810. WindowX = 135;
  811. WindowW = 640;
  812. VW_FadeOut();
  813. bufferofs = displayofs = screenloc[0];
  814. VW_Bar(0,0,320,200,0);
  815. Display640();
  816. VW_Bar(0, 0, 640, 200, 7);
  817. fontcolor = (7 ^ 1);
  818. US_Print ("\n\n SUMMARY OF GAME CONTROLS\n\n");
  819. fontcolor = (7 ^ 4);
  820. US_Print (" ACTION\n\n");
  821. US_Print ("Arrow keys, joystick, or mouse\n");
  822. US_Print ("TAB or V while turning\n");
  823. US_Print ("ALT or Button 2 while turning\n");
  824. US_Print ("CTRL or Button 1\n");
  825. US_Print ("Z\n");
  826. US_Print ("X or Enter\n");
  827. US_Print ("F1\n");
  828. US_Print ("F2\n");
  829. US_Print ("F3\n");
  830. US_Print ("F4\n");
  831. US_Print ("F5\n");
  832. US_Print ("ESC\n\n");
  833. fontcolor = (7 ^ 0);
  834. #ifndef CATALOG
  835. US_Print (" (See complete Instructions for more info)\n");
  836. #endif
  837. US_Print ("\n copyright (c) 1992-93 Softdisk Publishing\n");
  838. fontcolor = (7 ^ 8);
  839. PrintX = 400;
  840. PrintY = 37;
  841. WindowX = 400;
  842. US_Print (" REACTION\n\n");
  843. US_Print ("Move and turn\n");
  844. US_Print ("Turn quickly (Quick Turn)\n");
  845. US_Print ("Move sideways\n");
  846. US_Print ("Shoot a Missile\n");
  847. US_Print ("Shoot a Zapper\n");
  848. US_Print ("Shoot an Xterminator\n");
  849. US_Print ("Help (this screen)\n");
  850. US_Print ("Sound control\n");
  851. US_Print ("Save game position\n");
  852. US_Print ("Restore a saved game\n");
  853. US_Print ("Joystick control\n");
  854. US_Print ("System options\n\n\n");
  855. VW_UpdateScreen();
  856. VW_FadeIn();
  857. VW_ColorBorder(8 | 56);
  858. IN_Ack();
  859. Display320();
  860. fontcolor = oldfontcolor;
  861. }