]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/hb/kd_main.c
going to start wolf3d core core (loop with input only) work soon. I was mostly brains...
[16.git] / src / lib / hb / kd_main.c
diff --git a/src/lib/hb/kd_main.c b/src/lib/hb/kd_main.c
deleted file mode 100755 (executable)
index 69a6d3e..0000000
+++ /dev/null
@@ -1,533 +0,0 @@
-/* Keen Dreams Source Code\r
- * Copyright (C) 2014 Javier M. Chavez\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
-// KD_MAIN.C\r
-/*\r
-=============================================================================\r
-\r
-                                                       KEEN DREAMS\r
-\r
-                                       An Id Software production\r
-\r
-=============================================================================\r
-*/\r
-\r
-#include "mem.h"\r
-#include "string.h"\r
-\r
-#include "KD_DEF.H"\r
-#pragma hdrstop\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                LOCAL CONSTANTS\r
-\r
-=============================================================================\r
-*/\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                GLOBAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-\r
-char           str[80],str2[20];\r
-boolean                singlestep,jumpcheat,godmode,tedlevel;\r
-unsigned       tedlevelnum;\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                LOCAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-\r
-void   DebugMemory (void);\r
-void   TestSprites(void);\r
-int            DebugKeys (void);\r
-void   ShutdownId (void);\r
-void   Quit (char *error);\r
-void   InitGame (void);\r
-void   main (void);\r
-\r
-//===========================================================================\r
-\r
-#if FRILLS\r
-\r
-/*\r
-==================\r
-=\r
-= DebugMemory\r
-=\r
-==================\r
-*/\r
-\r
-void DebugMemory (void)\r
-{\r
-       VW_FixRefreshBuffer ();\r
-       US_CenterWindow (16,7);\r
-\r
-       US_CPrint ("Memory Usage");\r
-       US_CPrint ("------------");\r
-       US_Print ("Total     :");\r
-       US_PrintUnsigned (mminfo.mainmem/1024);\r
-       US_Print ("k\nFree      :");\r
-       US_PrintUnsigned (MM_UnusedMemory()/1024);\r
-       US_Print ("k\nWith purge:");\r
-       US_PrintUnsigned (MM_TotalFree()/1024);\r
-       US_Print ("k\n");\r
-       VW_UpdateScreen();\r
-       IN_Ack ();\r
-#if GRMODE == EGAGR\r
-       MM_ShowMemory ();\r
-#endif\r
-}\r
-\r
-/*\r
-===================\r
-=\r
-= TestSprites\r
-=\r
-===================\r
-*/\r
-\r
-#define DISPWIDTH      110\r
-#define        TEXTWIDTH   40\r
-void TestSprites(void)\r
-{\r
-       int hx,hy,sprite,oldsprite,bottomy,topx,shift;\r
-       spritetabletype far *spr;\r
-       spritetype _seg *block;\r
-       unsigned        mem,scan;\r
-\r
-\r
-       VW_FixRefreshBuffer ();\r
-       US_CenterWindow (30,17);\r
-\r
-       US_CPrint ("Sprite Test");\r
-       US_CPrint ("-----------");\r
-\r
-       hy=PrintY;\r
-       hx=(PrintX+56)&(~7);\r
-       topx = hx+TEXTWIDTH;\r
-\r
-       US_Print ("Chunk:\nWidth:\nHeight:\nOrgx:\nOrgy:\nXl:\nYl:\nXh:\nYh:\n"\r
-                         "Shifts:\nMem:\n");\r
-\r
-       bottomy = PrintY;\r
-\r
-       sprite = STARTSPRITES;\r
-       shift = 0;\r
-\r
-       do\r
-       {\r
-               if (sprite>=STARTTILE8)\r
-                       sprite = STARTTILE8-1;\r
-               else if (sprite<STARTSPRITES)\r
-                       sprite = STARTSPRITES;\r
-\r
-               spr = &spritetable[sprite-STARTSPRITES];\r
-               block = (spritetype _seg *)grsegs[sprite];\r
-\r
-               VWB_Bar (hx,hy,TEXTWIDTH,bottomy-hy,WHITE);\r
-\r
-               PrintX=hx;\r
-               PrintY=hy;\r
-               US_PrintUnsigned (sprite);US_Print ("\n");PrintX=hx;\r
-               US_PrintUnsigned (spr->width);US_Print ("\n");PrintX=hx;\r
-               US_PrintUnsigned (spr->height);US_Print ("\n");PrintX=hx;\r
-               US_PrintSigned (spr->orgx);US_Print ("\n");PrintX=hx;\r
-               US_PrintSigned (spr->orgy);US_Print ("\n");PrintX=hx;\r
-               US_PrintSigned (spr->xl);US_Print ("\n");PrintX=hx;\r
-               US_PrintSigned (spr->yl);US_Print ("\n");PrintX=hx;\r
-               US_PrintSigned (spr->xh);US_Print ("\n");PrintX=hx;\r
-               US_PrintSigned (spr->yh);US_Print ("\n");PrintX=hx;\r
-               US_PrintSigned (spr->shifts);US_Print ("\n");PrintX=hx;\r
-               if (!block)\r
-               {\r
-                       US_Print ("-----");\r
-               }\r
-               else\r
-               {\r
-                       mem = block->sourceoffset[3]+5*block->planesize[3];\r
-                       mem = (mem+15)&(~15);           // round to paragraphs\r
-                       US_PrintUnsigned (mem);\r
-               }\r
-\r
-               oldsprite = sprite;\r
-               do\r
-               {\r
-               //\r
-               // draw the current shift, then wait for key\r
-               //\r
-                       VWB_Bar(topx,hy,DISPWIDTH,bottomy-hy,WHITE);\r
-                       if (block)\r
-                       {\r
-                               PrintX = topx;\r
-                               PrintY = hy;\r
-                               US_Print ("Shift:");\r
-                               US_PrintUnsigned (shift);\r
-                               US_Print ("\n");\r
-                               VWB_DrawSprite (topx+16+shift*2,PrintY,sprite);\r
-                       }\r
-\r
-                       VW_UpdateScreen();\r
-\r
-                       scan = IN_WaitForKey ();\r
-\r
-                       switch (scan)\r
-                       {\r
-                       case sc_UpArrow:\r
-                               sprite++;\r
-                               break;\r
-                       case sc_DownArrow:\r
-                               sprite--;\r
-                               break;\r
-                       case sc_LeftArrow:\r
-                               if (--shift == -1)\r
-                                       shift = 3;\r
-                               break;\r
-                       case sc_RightArrow:\r
-                               if (++shift == 4)\r
-                                       shift = 0;\r
-                               break;\r
-                       case sc_Escape:\r
-                               return;\r
-                       }\r
-\r
-               } while (sprite == oldsprite);\r
-\r
-  } while (1);\r
-\r
-\r
-}\r
-\r
-#endif\r
-\r
-\r
-/*\r
-================\r
-=\r
-= DebugKeys\r
-=\r
-================\r
-*/\r
-int DebugKeys (void)\r
-{\r
-       boolean esc;\r
-       int level;\r
-\r
-#if FRILLS\r
-       if (Keyboard[0x12] && ingame)   // DEBUG: end + 'E' to quit level\r
-       {\r
-               if (tedlevel)\r
-                       TEDDeath();\r
-               playstate = levelcomplete;\r
-       }\r
-#endif\r
-\r
-       if (Keyboard[0x22] && ingame)           // G = god mode\r
-       {\r
-               VW_FixRefreshBuffer ();\r
-               US_CenterWindow (12,2);\r
-               if (godmode)\r
-                 US_PrintCentered ("God mode OFF");\r
-               else\r
-                 US_PrintCentered ("God mode ON");\r
-               VW_UpdateScreen();\r
-               IN_Ack();\r
-               godmode ^= 1;\r
-               return 1;\r
-       }\r
-       else if (Keyboard[0x17])                        // I = item cheat\r
-       {\r
-               VW_FixRefreshBuffer ();\r
-               US_CenterWindow (12,3);\r
-               US_PrintCentered ("Free items!");\r
-               gamestate.boobusbombs=99;\r
-               gamestate.flowerpowers=99;\r
-               gamestate.keys=99;\r
-               VW_UpdateScreen();\r
-               IN_Ack ();\r
-               return 1;\r
-       }\r
-       else if (Keyboard[0x24])                        // J = jump cheat\r
-       {\r
-               jumpcheat^=1;\r
-               VW_FixRefreshBuffer ();\r
-               US_CenterWindow (18,3);\r
-               if (jumpcheat)\r
-                       US_PrintCentered ("Jump cheat ON");\r
-               else\r
-                       US_PrintCentered ("Jump cheat OFF");\r
-               VW_UpdateScreen();\r
-               IN_Ack ();\r
-               return 1;\r
-       }\r
-#if FRILLS\r
-       else if (Keyboard[0x32])                        // M = memory info\r
-       {\r
-               DebugMemory();\r
-               return 1;\r
-       }\r
-#endif\r
-       else if (Keyboard[0x19])                        // P = pause with no screen disruptioon\r
-       {\r
-               IN_Ack();\r
-       }\r
-       else if (Keyboard[0x1f] && ingame)      // S = slow motion\r
-       {\r
-               singlestep^=1;\r
-               VW_FixRefreshBuffer ();\r
-               US_CenterWindow (18,3);\r
-               if (singlestep)\r
-                       US_PrintCentered ("Slow motion ON");\r
-               else\r
-                       US_PrintCentered ("Slow motion OFF");\r
-               VW_UpdateScreen();\r
-               IN_Ack ();\r
-               return 1;\r
-       }\r
-#if FRILLS\r
-       else if (Keyboard[0x14])                        // T = sprite test\r
-       {\r
-               TestSprites();\r
-               return 1;\r
-       }\r
-#endif\r
-       else if (Keyboard[0x11] && ingame)      // W = warp to level\r
-       {\r
-               VW_FixRefreshBuffer ();\r
-               US_CenterWindow(26,3);\r
-               PrintY+=6;\r
-               US_Print("  Warp to which level(0-16):");\r
-               VW_UpdateScreen();\r
-               esc = !US_LineInput (px,py,str,NULL,true,2,0);\r
-               if (!esc)\r
-               {\r
-                       level = atoi (str);\r
-                       if (level>=0 && level<=16)\r
-                       {\r
-                               gamestate.mapon = level;\r
-                               playstate = warptolevel;\r
-                       }\r
-               }\r
-               return 1;\r
-       }\r
-       return 0;\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
-  SD_Shutdown ();\r
-  IN_Shutdown ();\r
-  RF_Shutdown ();\r
-  VW_Shutdown ();\r
-  CA_Shutdown ();\r
-  MM_Shutdown ();\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==========================\r
-=\r
-= Quit\r
-=\r
-==========================\r
-*/\r
-\r
-void Quit (char *error)\r
-{\r
-  ShutdownId ();\r
-  if (error && *error)\r
-  {\r
-       clrscr();\r
-       puts(error);\r
-       puts("\n");\r
-       exit(1);\r
-  }\r
-       exit (0);\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==========================\r
-=\r
-= InitGame\r
-=\r
-= Load a few things right away\r
-=\r
-==========================\r
-*/\r
-\r
-#if 0\r
-#include "piracy.h"\r
-#endif\r
-\r
-void InitGame (void)\r
-{\r
-       int i;\r
-\r
-       MM_Startup ();\r
-\r
-\r
-#if 0\r
-       // Handle piracy screen...\r
-       //\r
-       movedata(FP_SEG(PIRACY),(unsigned)PIRACY,0xb800,displayofs,4000);\r
-       while ((bioskey(0)>>8) != sc_Return);\r
-#endif\r
-\r
-\r
-#if GRMODE == EGAGR\r
-       if (mminfo.mainmem < 335l*1024)\r
-       {\r
-#pragma        warn    -pro\r
-#pragma        warn    -nod\r
-               clrscr();                       // we can't include CONIO because of a name conflict\r
-#pragma        warn    +nod\r
-#pragma        warn    +pro\r
-               puts ("There is not enough memory available to play the game reliably.  You can");\r
-               puts ("play anyway, but an out of memory condition will eventually pop up.  The");\r
-               puts ("correct solution is to unload some TSRs or rename your CONFIG.SYS and");\r
-               puts ("AUTOEXEC.BAT to free up more memory.\n");\r
-               puts ("Do you want to (Q)uit, or (C)ontinue?");\r
-               i = bioskey (0);\r
-               if ( (i>>8) != sc_C)\r
-                       Quit ("");\r
-       }\r
-#endif\r
-\r
-       US_TextScreen();\r
-\r
-       VW_Startup ();\r
-       RF_Startup ();\r
-       IN_Startup ();\r
-       SD_Startup ();\r
-       US_Startup ();\r
-\r
-//     US_UpdateTextScreen();\r
-\r
-       CA_Startup ();\r
-       US_Setup ();\r
-\r
-//\r
-// load in and lock down some basic chunks\r
-//\r
-\r
-       CA_ClearMarks ();\r
-\r
-       CA_MarkGrChunk(STARTFONT);\r
-       CA_MarkGrChunk(STARTFONTM);\r
-       CA_MarkGrChunk(STARTTILE8);\r
-       CA_MarkGrChunk(STARTTILE8M);\r
-       for (i=KEEN_LUMP_START;i<=KEEN_LUMP_END;i++)\r
-               CA_MarkGrChunk(i);\r
-\r
-       CA_CacheMarks (NULL, 0);\r
-\r
-       MM_SetLock (&grsegs[STARTFONT],true);\r
-       MM_SetLock (&grsegs[STARTFONTM],true);\r
-       MM_SetLock (&grsegs[STARTTILE8],true);\r
-       MM_SetLock (&grsegs[STARTTILE8M],true);\r
-       for (i=KEEN_LUMP_START;i<=KEEN_LUMP_END;i++)\r
-               MM_SetLock (&grsegs[i],true);\r
-\r
-       CA_LoadAllSounds ();\r
-\r
-       fontcolor = WHITE;\r
-\r
-       US_FinishTextScreen();\r
-\r
-       VW_SetScreenMode (GRMODE);\r
-       VW_ClearVideo (BLACK);\r
-}\r
-\r
-\r
-\r
-//===========================================================================\r
-\r
-/*\r
-==========================\r
-=\r
-= main\r
-=\r
-==========================\r
-*/\r
-\r
-void main (void)\r
-{\r
-       short i;\r
-\r
-       if (stricmp(_argv[1], "/VER") == 0)\r
-       {\r
-               printf("\nKeen Dreams version 1.93  (Rev 1)\n");\r
-               printf("developed for use with 100%% IBM compatibles\n");\r
-               printf("that have 640K memory, DOS version 3.3 or later,\n");\r
-               printf("and an EGA or VGA display adapter.\n");\r
-               printf("Copyright 1991-1993 Softdisk Publishing.\n");\r
-               printf("Commander Keen is a trademark of Id Software.\n");\r
-               exit(0);\r
-       }\r
-\r
-       if (stricmp(_argv[1], "/?") == 0)\r
-       {\r
-               printf("\nKeen Dreams version 1.93\n");\r
-               printf("Copyright 1991-1993 Softdisk Publishing.\n\n");\r
-               printf("Commander Keen is a trademark of Id Software.\n");\r
-               printf("Type KDREAMS from the DOS prompt to run.\n\n");\r
-               printf("KDREAMS /COMP for SVGA compatibility mode\n");\r
-               printf("KDREAMS /NODR stops program hang with the drive still on\n");\r
-               printf("KDREAMS /NOAL disables AdLib and Sound Blaster detection\n");\r
-               printf("KDREAMS /NOSB disables Sound Blaster detection\n");\r
-               printf("KDREAMS /NOJOYS ignores joystick\n");\r
-               printf("KDREAMS /NOMOUSE ignores mouse\n");\r
-               printf("KDREAMS /HIDDENCARD overrides video card detection\n");\r
-               printf("KDREAMS /VER  for version and compatibility information\n");\r
-               printf("KDREAMS /? for this help information\n");\r
-               exit(0);\r
-       }\r
-\r
-       textcolor(7);\r
-       textbackground(0);\r
-\r
-       InitGame();\r
-\r
-       DemoLoop();                                     // DemoLoop calls Quit when everything is done\r
-       Quit("Demo loop exited???");\r
-}\r
-\r