+++ /dev/null
-/* Catacomb Apocalypse Source Code\r
- * Copyright (C) 1993-2014 Flat Rock Software\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License along\r
- * with this program; if not, write to the Free Software Foundation, Inc.,\r
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
- */\r
-\r
-// C3_MAIN.C\r
-\r
-#define CATALOG\r
-\r
-#include <time.h>\r
-#include <stdarg.h>\r
-\r
-#include "DEF.H"\r
-#include "GELIB.H"\r
-#pragma hdrstop\r
-#include <dir.h>\r
-\r
-/*\r
-=============================================================================\r
-\r
- LOCAL CONSTANTS\r
-\r
-=============================================================================\r
-*/\r
-\r
-\r
-/*\r
-=============================================================================\r
-\r
- GLOBAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-\r
-typedef enum demo_screens {sc_logo,sc_title,sc_credits1,sc_credits2,sc_credits3,sc_credits4,sc_end} demo_screens;\r
-struct Shape shape,\r
- SdLogoShp,\r
- TitleShp,\r
- CreditBKShp,\r
- Credit1Shp,\r
- Credit2Shp,\r
- Credit3Shp,\r
- Credit4Shp,\r
- Credit5Shp,\r
- Credit6Shp,\r
- Credit7Shp,\r
- Credit8Shp,\r
- Credit9Shp,\r
- Credit10Shp;\r
-\r
-\r
-PresenterInfo MainHelpText;\r
-\r
-GameDiff restartgame;\r
-boolean loadedgame,abortgame,ingame;\r
-\r
-\r
-memptr scalesegs[NUMPICS];\r
-char str[80],str2[20];\r
-unsigned tedlevelnum;\r
-boolean tedlevel;\r
-gametype gamestate;\r
-exittype playstate;\r
-char SlowMode = 0;\r
-int starting_level;\r
-\r
-short NumGames=0;\r
-unsigned Flags=0;\r
-\r
-boolean LoadShapes = true;\r
-boolean EASYMODEON = false;\r
-\r
-void DisplayIntroText(void);\r
-\r
-/*\r
-=============================================================================\r
-\r
- LOCAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-\r
-\r
-\r
-//===========================================================================\r
-\r
-#if 0\r
-// JAB Hack begin\r
-#define MyInterrupt 0x60\r
-void interrupt (*intaddr)();\r
-void interrupt (*oldintaddr)();\r
- char *JHParmStrings[] = {"no386",nil};\r
-\r
-void\r
-jabhack(void)\r
-{\r
-extern void far jabhack2(void);\r
-extern int far CheckIs386(void);\r
-\r
- int i;\r
-\r
- oldintaddr = getvect(MyInterrupt);\r
-\r
- for (i = 1;i < _argc;i++)\r
- if (US_CheckParm(_argv[i],JHParmStrings) == 0)\r
- return;\r
-\r
- if (CheckIs386())\r
- {\r
- jabhack2();\r
- setvect(MyInterrupt,intaddr);\r
- }\r
-}\r
-\r
-void\r
-jabunhack(void)\r
-{\r
- setvect(MyInterrupt,oldintaddr);\r
-}\r
-// JAB Hack end\r
-#endif\r
-\r
-//===========================================================================\r
-\r
-/*\r
-=====================\r
-=\r
-= NewGame\r
-=\r
-= Set up new game to start from the beginning\r
-=\r
-=====================\r
-*/\r
-\r
-void NewGame (void)\r
-{\r
- if (!loadedgame)\r
- {\r
- memset (&gamestate,0,sizeof(gamestate));\r
- gamestate.mapon = starting_level;\r
- gamestate.body = MAXBODY;\r
- }\r
-\r
- BGFLAGS = BGF_NOT_LIGHTNING;\r
- Flags &= FL_CLEAR;\r
-\r
- boltsleft = bolttimer = 0;\r
-\r
-// memset (gamestate.levels,-1,sizeof(gamestate.levels));\r
-}\r
-\r
-//===========================================================================\r
-\r
-#define RLETAG 0xABCD\r
-\r
-/*\r
-==================\r
-=\r
-= SaveTheGame\r
-=\r
-==================\r
-*/\r
-\r
-boolean SaveTheGame(int file)\r
-{\r
- word i,compressed,expanded;\r
- objtype *o;\r
- memptr bigbuffer;\r
-\r
- // save the sky and ground colors\r
- if (!CA_FarWrite(file,(void far *)&skycolor,sizeof(skycolor)))\r
- return(false);\r
- if (!CA_FarWrite(file,(void far *)&groundcolor,sizeof(groundcolor)))\r
- return(false);\r
-\r
- if (!CA_FarWrite(file,(void far *)&FreezeTime,sizeof(FreezeTime)))\r
- return(false);\r
-\r
- if (!CA_FarWrite(file,(void far *)&gamestate,sizeof(gamestate)))\r
- return(false);\r
-\r
- if (!CA_FarWrite(file,(void far *)&EASYMODEON,sizeof(EASYMODEON)))\r
- return(false);\r
-\r
- expanded = mapwidth * mapheight * 2;\r
- MM_GetPtr (&bigbuffer,expanded);\r
-\r
- for (i = 0;i < 3;i+=2) // Write planes 0 and 2\r
- {\r
-//\r
-// leave a word at start of compressed data for compressed length\r
-//\r
- compressed = (unsigned)CA_RLEWCompress ((unsigned huge *)mapsegs[i]\r
- ,expanded,((unsigned huge *)bigbuffer)+1,RLETAG);\r
-\r
- *(unsigned huge *)bigbuffer = compressed;\r
-\r
- if (!CA_FarWrite(file,(void far *)bigbuffer,compressed+2) )\r
- {\r
- MM_FreePtr (&bigbuffer);\r
- return(false);\r
- }\r
- }\r
-\r
- for (o = player;o;o = o->next)\r
- if (!CA_FarWrite(file,(void far *)o,sizeof(objtype)))\r
- {\r
- MM_FreePtr (&bigbuffer);\r
- return(false);\r
- }\r
-\r
- MM_FreePtr (&bigbuffer);\r
-\r
- return(true);\r
-}\r
-\r
-//===========================================================================\r
-\r
-\r
-/*\r
-==================\r
-=\r
-= LoadTheGame\r
-=\r
-==================\r
-*/\r
-\r
-boolean LoadTheGame(int file)\r
-{\r
- unsigned i,x,y;\r
- objtype *obj,*prev,*next,*followed;\r
- unsigned compressed,expanded;\r
- unsigned far *map,tile;\r
- memptr bigbuffer;\r
-\r
- screenpage = 0;\r
- FreeUpMemory();\r
-\r
- playstate = ex_loadedgame;\r
- // load the sky and ground colors\r
- if (!CA_FarRead(file,(void far *)&skycolor,sizeof(skycolor)))\r
- return(false);\r
- if (!CA_FarRead(file,(void far *)&groundcolor,sizeof(groundcolor)))\r
- return(false);\r
-\r
- if (!CA_FarRead(file,(void far *)&FreezeTime,sizeof(FreezeTime)))\r
- return(false);\r
-\r
- if (!CA_FarRead(file,(void far *)&gamestate,sizeof(gamestate)))\r
- return(false);\r
-\r
- if (!CA_FarRead(file,(void far *)&EASYMODEON,sizeof(EASYMODEON)))\r
- return(false);\r
-\r
- SetupGameLevel (); // load in and cache the base old level\r
-\r
- if (!FindFile(Filename,"SAVE GAME",-1))\r
- Quit("Error: Can't find saved game file!");\r
-\r
- expanded = mapwidth * mapheight * 2;\r
- MM_GetPtr (&bigbuffer,expanded);\r
-\r
- for (i = 0;i < 3;i+=2) // Read planes 0 and 2\r
- {\r
- if (!CA_FarRead(file,(void far *)&compressed,sizeof(compressed)) )\r
- {\r
- MM_FreePtr (&bigbuffer);\r
- return(false);\r
- }\r
-\r
- if (!CA_FarRead(file,(void far *)bigbuffer,compressed) )\r
- {\r
- MM_FreePtr (&bigbuffer);\r
- return(false);\r
- }\r
-\r
- CA_RLEWexpand ((unsigned huge *)bigbuffer,\r
- (unsigned huge *)mapsegs[i],expanded,RLETAG);\r
- }\r
-\r
- MM_FreePtr (&bigbuffer);\r
-//\r
-// copy the wall data to a data segment array again, to handle doors and\r
-// bomb walls that are allready opened\r
-//\r
- memset (tilemap,0,sizeof(tilemap));\r
- memset (actorat,0,sizeof(actorat));\r
- map = mapsegs[0];\r
- for (y=0;y<mapheight;y++)\r
- for (x=0;x<mapwidth;x++)\r
- {\r
- tile = *map++;\r
- if (tile<NUMFLOORS)\r
- {\r
- if (tile != INVISIBLEWALL)\r
- tilemap[x][y] = tile;\r
- if (tile>0)\r
- (unsigned)actorat[x][y] = tile;\r
- }\r
- }\r
-\r
-\r
- // Read the object list back in - assumes at least one object in list\r
-\r
- InitObjList ();\r
- new = player;\r
- while (true)\r
- {\r
- prev = new->prev;\r
- next = new->next;\r
- if (!CA_FarRead(file,(void far *)new,sizeof(objtype)))\r
- return(false);\r
- followed = new->next;\r
- new->prev = prev;\r
- new->next = next;\r
- actorat[new->tilex][new->tiley] = new; // drop a new marker\r
-\r
- if (followed)\r
- GetNewObj (false);\r
- else\r
- break;\r
- }\r
-\r
- return(true);\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==================\r
-=\r
-= ResetGame\r
-=\r
-==================\r
-*/\r
-\r
-void ResetGame(void)\r
-{\r
- NewGame ();\r
-\r
- ca_levelnum--;\r
- ca_levelbit>>=1;\r
- CA_ClearMarks();\r
- ca_levelbit<<=1;\r
- ca_levelnum++;\r
-}\r
-\r
-//===========================================================================\r
-\r
-\r
-/*\r
-==========================\r
-=\r
-= ShutdownId\r
-=\r
-= Shuts down all ID_?? managers\r
-=\r
-==========================\r
-*/\r
-\r
-void ShutdownId (void)\r
-{\r
- US_Shutdown ();\r
-#ifndef PROFILE\r
- SD_Shutdown ();\r
- IN_Shutdown ();\r
-#endif\r
- VW_Shutdown ();\r
- CA_Shutdown ();\r
- MM_Shutdown ();\r
-}\r
-\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==========================\r
-=\r
-= InitGame\r
-=\r
-= Load a few things right away\r
-=\r
-==========================\r
-*/\r
-\r
-void InitGame (void)\r
-{\r
- unsigned segstart,seglength;\r
- int i,x,y;\r
- unsigned *blockstart;\r
-\r
-// US_TextScreen();\r
-\r
- MM_Startup ();\r
- VW_Startup ();\r
-#ifndef PROFILE\r
- IN_Startup ();\r
- SD_Startup ();\r
-#endif\r
- US_Startup ();\r
-\r
- CA_Startup ();\r
-\r
- US_Setup ();\r
-\r
- US_SetLoadSaveHooks(LoadTheGame,SaveTheGame,ResetGame);\r
-\r
-\r
-//\r
-// load in and lock down some basic chunks\r
-//\r
-\r
- CA_ClearMarks ();\r
-\r
- CA_MarkGrChunk(STARTFONT);\r
- CA_MarkGrChunk(STARTTILE8);\r
- CA_MarkGrChunk(STARTTILE8M);\r
- CA_MarkGrChunk(HAND1PICM);\r
-\r
- CA_MarkGrChunk(NORTHICONSPR);\r
- CA_CacheMarks (NULL);\r
-\r
- MM_SetLock (&grsegs[STARTFONT],true);\r
- MM_SetLock (&grsegs[STARTTILE8],true);\r
- MM_SetLock (&grsegs[STARTTILE8M],true);\r
- MM_SetLock (&grsegs[HAND1PICM],true);\r
-\r
- fontcolor = WHITE;\r
-\r
-\r
-//\r
-// build some tables\r
-//\r
- for (i=0;i<MAPSIZE;i++)\r
- nearmapylookup[i] = &tilemap[0][0]+MAPSIZE*i;\r
-\r
- for (i=0;i<PORTTILESHIGH;i++)\r
- uwidthtable[i] = UPDATEWIDE*i;\r
-\r
- blockstart = &blockstarts[0];\r
- for (y=0;y<UPDATEHIGH;y++)\r
- for (x=0;x<UPDATEWIDE;x++)\r
- *blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;\r
-\r
- BuildTables (); // 3-d tables\r
-\r
- SetupScaling ();\r
-\r
-#ifndef PROFILE\r
-// US_FinishTextScreen();\r
-#endif\r
-\r
-#if 0\r
-//\r
-// reclaim the memory from the linked in text screen\r
-//\r
- segstart = FP_SEG(&introscn);\r
- seglength = 4000/16;\r
- if (FP_OFF(&introscn))\r
- {\r
- segstart++;\r
- seglength--;\r
- }\r
- MML_UseSpace (segstart,seglength);\r
-#endif\r
-\r
- VW_SetScreenMode (GRMODE);\r
- ge_textmode = false;\r
-// VW_ColorBorder (3);\r
- VW_ClearVideo (BLACK);\r
-\r
-//\r
-// initialize variables\r
-//\r
- updateptr = &update[0];\r
- *(unsigned *)(updateptr + UPDATEWIDE*PORTTILESHIGH) = UPDATETERMINATE;\r
- bufferofs = 0;\r
- displayofs = 0;\r
- VW_SetLineWidth(SCREENWIDTH);\r
-}\r
-\r
-//===========================================================================\r
-\r
-void clrscr (void); // can't include CONIO.H because of name conflicts...\r
-\r
-/*\r
-==========================\r
-=\r
-= Quit\r
-=\r
-==========================\r
-*/\r
-\r
-void Quit (char *error, ...)\r
-{\r
- short exit_code=0;\r
- unsigned finscreen;\r
-\r
- va_list ap;\r
-\r
- va_start(ap,error);\r
-\r
-#ifndef CATALOG\r
- if (!error)\r
- {\r
- CA_SetAllPurge ();\r
- CA_CacheGrChunk (PIRACY);\r
- finscreen = (unsigned)grsegs[PIRACY];\r
- }\r
-#endif\r
-\r
- ShutdownId ();\r
-\r
- if (error && *error)\r
- {\r
- vprintf(error,ap);\r
- exit_code = 1;\r
- }\r
-#ifndef CATALOG\r
- else\r
- if (!NoWait)\r
- {\r
- movedata (finscreen,0,0xb800,0,4000);\r
- bioskey (0);\r
- }\r
-#endif\r
-\r
- va_end(ap);\r
-\r
-#ifndef CATALOG\r
- if (!error)\r
- {\r
- _argc = 2;\r
- _argv[1] = "LAST.SHL";\r
- _argv[2] = "ENDSCN.SCN";\r
- _argv[3] = NULL;\r
- if (execv("LOADSCN.EXE", _argv) == -1)\r
- {\r
- clrscr();\r
- puts("Couldn't find executable LOADSCN.EXE.\n");\r
- exit(1);\r
- }\r
- }\r
-#endif\r
-\r
- exit(exit_code);\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==================\r
-=\r
-= TEDDeath\r
-=\r
-==================\r
-*/\r
-\r
-void TEDDeath(void)\r
-{\r
- ShutdownId();\r
- execlp("TED5.EXE","TED5.EXE","/LAUNCH",NULL);\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-====================\r
-=\r
-= DisplayDepartment\r
-=\r
-====================\r
-*/\r
-void DisplayDepartment(char *text)\r
-{\r
- short temp;\r
-\r
-// bufferofs = 0;\r
- PrintY = 5;\r
- WindowX = 17;\r
- WindowW = 168;\r
-\r
- VW_Bar(WindowX,PrintY+1,WindowW,7,0);\r
- temp = fontcolor;\r
- fontcolor = 10;\r
- US_CPrintLine (text);\r
- fontcolor = temp;\r
-}\r
-\r
-\r
-\r
-/*\r
-=====================\r
-=\r
-= DemoLoop\r
-=\r
-=====================\r
-*/\r
-\r
-static char *ParmStrings[] = {"easy","normal","hard",""};\r
-\r
-void DemoLoop (void)\r
-{\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// main game cycle\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
- displayofs = bufferofs = 0;\r
- VW_Bar (0,0,320,200,0);\r
- VW_SetScreen(0,0);\r
-\r
-//\r
-// Read in all the graphic images needed for the title sequence\r
-//\r
- VW_WaitVBL(1);\r
- IN_ReadControl(0,&control);\r
-\r
-// set EASYMODE\r
-//\r
- if (stricmp(_argv[2], "1") == 0)\r
- EASYMODEON = true;\r
- else\r
- EASYMODEON = false;\r
-\r
-// restore game\r
-//\r
- if (stricmp(_argv[3], "1") == 0)\r
- {\r
- VW_FadeOut();\r
- bufferofs = displayofs = 0;\r
- VW_Bar(0,0,320,200,0);\r
- if (GE_LoadGame())\r
- {\r
- loadedgame = true;\r
- playstate = ex_loadedgame;\r
- Keyboard[sc_Enter] = true;\r
- VW_Bar(0,0,320,200,0);\r
- ColoredPalette();\r
- }\r
- VW_Bar(0,0,320,200,0);\r
- VW_FadeIn();\r
- }\r
-\r
- // Play a game\r
- //\r
- restartgame = gd_Normal;\r
- NewGame();\r
- GameLoop();\r
-}\r
-\r
-//-------------------------------------------------------------------------\r
-// DisplayIntroText()\r
-//-------------------------------------------------------------------------\r
-void DisplayIntroText()\r
-{\r
- PresenterInfo pi;\r
-\r
-#ifdef TEXT_PRESENTER\r
- char *toptext = "You stand before the gate leading into the Towne "\r
- "of Morbidity.... "\r
- "^XX";\r
-\r
- char *bottomtext = "Enter now boldly to defeat the evil Nemesis "\r
- "deep inside the catacombs."\r
- "\r
- "^XX";\r
-#endif\r
-\r
- char oldfontcolor=fontcolor;\r
-\r
- fontcolor = 14;\r
-\r
-\r
-#ifdef TEXT_PRESENTER\r
- pi.xl = 0;\r
- pi.yl = 0;\r
- pi.xh = 319;\r
- pi.yh = 1;\r
- pi.bgcolor = 0;\r
- pi.script[0] = (char far *)toptext;\r
- Presenter(&pi);\r
-\r
- pi.yl = 160;\r
- pi.yh = 161;\r
- pi.script[0] = (char far *)bottomtext;\r
- Presenter(&pi);\r
-\r
-#else\r
- PrintY = 1;\r
- PrintX = 0;\r
- WindowX = 0;\r
- WindowW = 320;\r
-\r
-\r
- US_Print (" A chilling wind greets you at the entrance\n");\r
- US_Print (" to the Sanctuary of the Dead.\n");\r
-\r
- PrintY = 180;\r
-\r
- fontcolor = 9;\r
- US_Print (" Shall you proceed as\n");\r
- fontcolor = 14;\r
- US_Print (" N");\r
- fontcolor = 9;\r
- US_Print ("ovice or");\r
- fontcolor = 14;\r
- US_Print (" W");\r
- fontcolor = 9;\r
- US_Print ("arrior ?");\r
-\r
-#endif\r
-\r
- fontcolor = oldfontcolor;\r
-}\r
-\r
-#if 0\r
-boolean ChooseGameLevel()\r
-{\r
- char choices[] = {sc_Escape,sc_E,sc_N,sc_H,0},ch;\r
-\r
- CenterWindow(20,10);\r
-\r
- US_Print("\n Choose difficulty level:\n");\r
- US_Print(" (E)asy\n");\r
- US_Print(" (N)ormal\n");\r
- US_Print(" (H)ard\n");\r
- US_Print("\n (ESC)ape aborts\n");\r
-\r
-// VW_UpdateScreen();\r
- if ((ch=GetKeyChoice(choices)) == sc_Escape)\r
- {\r
- while (Keyboard[sc_Escape]);\r
- LastScan = 0;\r
- return(false);\r
- }\r
-\r
- if (ch == sc_E)\r
- restartgame = gd_Easy;\r
- else\r
- if (ch == sc_N)\r
- restartgame = gd_Normal;\r
- else\r
- restartgame = gd_Hard;\r
-\r
- return(true);\r
-}\r
-#endif\r
-\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==========================\r
-=\r
-= SetupScalePic\r
-=\r
-==========================\r
-*/\r
-\r
-void SetupScalePic (unsigned picnum)\r
-{\r
- unsigned scnum;\r
-\r
- if (picnum == 1)\r
- return;\r
-\r
- scnum = picnum-FIRSTSCALEPIC;\r
-\r
- if (shapedirectory[scnum])\r
- {\r
- MM_SetPurge (&(memptr)shapedirectory[scnum],0);\r
- return; // allready in memory\r
- }\r
-\r
- CA_CacheGrChunk (picnum);\r
- DeplanePic (picnum);\r
- shapesize[scnum] = BuildCompShape (&shapedirectory[scnum]);\r
- grneeded[picnum]&= ~ca_levelbit;\r
- MM_FreePtr (&grsegs[picnum]);\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==========================\r
-=\r
-= SetupScaleWall\r
-=\r
-==========================\r
-*/\r
-\r
-void SetupScaleWall (unsigned picnum)\r
-{\r
- int x,y;\r
- unsigned scnum;\r
- byte far *dest;\r
-\r
- if (picnum == 1)\r
- return;\r
-\r
- scnum = picnum-FIRSTWALLPIC;\r
-\r
- if (walldirectory[scnum])\r
- {\r
- MM_SetPurge (&walldirectory[scnum],0);\r
- return; // allready in memory\r
- }\r
-\r
- CA_CacheGrChunk (picnum);\r
- DeplanePic (picnum);\r
- MM_GetPtr(&walldirectory[scnum],64*64);\r
- dest = (byte far *)walldirectory[scnum];\r
- for (x=0;x<64;x++)\r
- for (y=0;y<64;y++)\r
- *dest++ = spotvis[y][x];\r
- grneeded[picnum]&= ~ca_levelbit;\r
- MM_FreePtr (&grsegs[picnum]);\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==========================\r
-=\r
-= SetupScaling\r
-=\r
-==========================\r
-*/\r
-\r
-void SetupScaling (void)\r
-{\r
- int i,x,y;\r
- byte far *dest;\r
-\r
-//\r
-// build the compiled scalers\r
-//\r
- for (i=1;i<=VIEWWIDTH/2;i++)\r
- BuildCompScale (i*2,&scaledirectory[i]);\r
-}\r
-\r
-//===========================================================================\r
-\r
-int showscorebox;\r
-\r
-void RF_FixOfs (void)\r
-{\r
-}\r
-\r
-void HelpScreens (void)\r
-{\r
-}\r
-\r
-\r
-#if 0\r
-/*\r
-==================\r
-=\r
-= CheckMemory\r
-=\r
-==================\r
-*/\r
-\r
-#define MINMEMORY 400000l\r
-\r
-void CheckMemory(void)\r
-{\r
- unsigned finscreen;\r
-\r
- if (Flags & FL_NOMEMCHECK)\r
- return;\r
-\r
- if (mminfo.nearheap+mminfo.farheap+mminfo.EMSmem+mminfo.XMSmem\r
- >= MINMEMORY)\r
- return;\r
-\r
- CA_CacheGrChunk (OUTOFMEM);\r
- finscreen = (unsigned)grsegs[OUTOFMEM];\r
- ShutdownId ();\r
- movedata (finscreen,7,0xb800,0,4000);\r
- gotoxy (1,24);\r
- exit(1);\r
-}\r
-#endif\r
-\r
-//===========================================================================\r
-\r
-\r
-/*\r
-==========================\r
-=\r
-= main\r
-=\r
-==========================\r
-*/\r
-\r
-char *MainParmStrings[] = {"q","l","ver","nomemcheck","helptest",nil};\r
-\r
-void main (void)\r
-{\r
- short i;\r
-\r
- starting_level = 0;\r
-\r
- for (i = 1;i < _argc;i++)\r
- {\r
- switch (US_CheckParm(_argv[i],MainParmStrings))\r
- {\r
- case 0:\r
- Flags |= FL_QUICK;\r
- break;\r
-\r
- case 1:\r
- starting_level = atoi(_argv[i]+1);\r
- if ((starting_level < 0) || (starting_level > LASTMAP-1))\r
- starting_level = 0;\r
- break;\r
-\r
- case 2:\r
- printf("%s\n", GAMENAME);\r
- printf("Copyright 1992-93 Softdisk Publishing\n");\r
- printf("%s %s\n",VERSION,REVISION);\r
- printf("\n");\r
- exit(0);\r
- break;\r
-\r
- case 3:\r
- Flags |= FL_NOMEMCHECK;\r
- break;\r
-\r
- case 4:\r
- Flags |= (FL_HELPTEST|FL_QUICK);\r
- break;\r
-\r
- }\r
- }\r
-\r
- if (stricmp(_argv[1], "^(a@&r`"))\r
- Quit("You must type CATAPOC to run CATACOMB APOCALYPSE\n");\r
-\r
-\r
-#if 0\r
- MainHelpText.xl = 0;\r
- MainHelpText.yl = 0;\r
- MainHelpText.xh = 639;\r
- MainHelpText.yh = 199;\r
- MainHelpText.bgcolor = 7;\r
- MainHelpText.ltcolor = 15;\r
- MainHelpText.dkcolor = 8;\r
-#endif\r
-\r
-// jabhack();\r
-\r
- randomize();\r
-\r
- InitGame ();\r
-// CheckMemory ();\r
- LoadLatchMem ();\r
-\r
-// if (!LoadTextFile("MAINHELP."EXT,&MainHelpText))\r
-// Quit("Can't load MAINHELP."EXT);\r
-\r
-#ifdef PROFILE\r
- NewGame ();\r
- GameLoop ();\r
-#endif\r
-\r
- DemoLoop();\r
- Quit(NULL);\r
-}\r
-\r
-//-------------------------------------------------------------------------\r
-// Display640()\r
-//-------------------------------------------------------------------------\r
-void Display640(void)\r
-{\r
-// Can you believe it takes all this just to change to 640 mode!!???!\r
-//\r
- VW_ScreenToScreen(0,FREESTART-STATUSLEN,40,80);\r
- VW_SetLineWidth(80);\r
- MoveScreen(0,0);\r
- VW_Bar (0,0,640,200,0);\r
- VW_SetScreenMode(EGA640GR);\r
- VW_SetLineWidth(80);\r
- BlackPalette();\r
-}\r
-\r
-//-------------------------------------------------------------------------\r
-// Display320()\r
-//-------------------------------------------------------------------------\r
-void Display320(void)\r
-{\r
-// Can you believe it takes all this just to change to 320 mode!!???!\r
-//\r
- VW_ColorBorder(0);\r
- VW_FadeOut();\r
- VW_SetLineWidth(40);\r
- MoveScreen(0,0);\r
- VW_Bar (0,0,320,200,0);\r
- VW_SetScreenMode(EGA320GR);\r
- VW_SetLineWidth(40);\r
- BlackPalette();\r
- VW_ScreenToScreen(FREESTART-STATUSLEN,0,40,80);\r
-}\r
-\r
-void PrintHelp(void)\r
-{\r
- char oldfontcolor = fontcolor;\r
- PrintY = 1;\r
- WindowX = 135;\r
- WindowW = 640;\r
-\r
- VW_FadeOut();\r
- bufferofs = displayofs = screenloc[0];\r
- VW_Bar(0,0,320,200,0);\r
-\r
- Display640();\r
-\r
- VW_Bar(0, 0, 640, 200, 7);\r
-\r
- fontcolor = (7 ^ 1);\r
- US_Print ("\n\n SUMMARY OF GAME CONTROLS\n\n");\r
-\r
- fontcolor = (7 ^ 4);\r
- US_Print (" ACTION\n\n");\r
-\r
- US_Print ("Arrow keys, joystick, or mouse\n");\r
- US_Print ("TAB or V while turning\n");\r
- US_Print ("ALT or Button 2 while turning\n");\r
- US_Print ("CTRL or Button 1\n");\r
- US_Print ("Z\n");\r
- US_Print ("X or Enter\n");\r
- US_Print ("F1\n");\r
- US_Print ("F2\n");\r
- US_Print ("F3\n");\r
- US_Print ("F4\n");\r
- US_Print ("F5\n");\r
- US_Print ("ESC\n\n");\r
- fontcolor = (7 ^ 0);\r
-#ifndef CATALOG\r
- US_Print (" (See complete Instructions for more info)\n");\r
-#endif\r
- US_Print ("\n copyright (c) 1992-93 Softdisk Publishing\n");\r
-\r
- fontcolor = (7 ^ 8);\r
- PrintX = 400;\r
- PrintY = 37;\r
- WindowX = 400;\r
- US_Print (" REACTION\n\n");\r
- US_Print ("Move and turn\n");\r
- US_Print ("Turn quickly (Quick Turn)\n");\r
- US_Print ("Move sideways\n");\r
- US_Print ("Shoot a Missile\n");\r
- US_Print ("Shoot a Zapper\n");\r
- US_Print ("Shoot an Xterminator\n");\r
- US_Print ("Help (this screen)\n");\r
- US_Print ("Sound control\n");\r
- US_Print ("Save game position\n");\r
- US_Print ("Restore a saved game\n");\r
- US_Print ("Joystick control\n");\r
- US_Print ("System options\n\n\n");\r
-\r
- VW_UpdateScreen();\r
- VW_FadeIn();\r
- VW_ColorBorder(8 | 56);\r
- IN_Ack();\r
- Display320();\r
- fontcolor = oldfontcolor;\r
-}
\ No newline at end of file