]> 4ch.mooo.com Git - 16.git/commitdiff
__seguse.txt added to show _seg usage also OpenVGMFile needs to be ported to 16_snd...
authorsparky4 <sparky4@cock.li>
Mon, 13 Mar 2017 14:23:36 +0000 (09:23 -0500)
committersparky4 <sparky4@cock.li>
Mon, 13 Mar 2017 14:23:36 +0000 (09:23 -0500)
26 files changed:
.gitignore
MEMINFO.16W [new file with mode: 0755]
makefile
src/0.c
src/16.c
src/inputest.c
src/lib/16_in.c
src/lib/16_in.h
src/lib/16_in_.c [deleted file]
src/lib/16_in_.h [deleted file]
src/lib/16_in__.c [deleted file]
src/lib/16_in__.h [deleted file]
src/lib/16_t.h
src/lib/16_tail.c
src/lib/16_tail.h
src/scroll.c
src/test.c
src/util/git/git_con.fig [moved from git_con.fig with 100% similarity]
src/util/git/git_igno.re [moved from git_igno.re with 89% similarity]
src/util/git/git_modu.les [moved from git_modu.les with 100% similarity]
src/util/gitgit_con.fig [new file with mode: 0755]
src/util/gitgit_igno.re [new file with mode: 0755]
src/util/gitgit_modu.les [new file with mode: 0755]
src/vgmtest.c
src/vrstest.c
src/zcroll.c

index 15ee4357276cf654c9f3b49a0271b631860260eb..70ed7d7559f36ad034ae916e1aac57babd351473 100755 (executable)
@@ -17,8 +17,8 @@ makefile~
 README~\r
 TODO~\r
 LICENCE~\r
-*.mah\r
-*.MAH\r
+*.meh\r
+*.MEH\r
 __wcl__.lnk\r
 !bcexmm.map\r
 !makefile\r
diff --git a/MEMINFO.16W b/MEMINFO.16W
new file mode 100755 (executable)
index 0000000..e69de29
index 216243e03f2e1182382672f3090ed078a712e646..f650f020f614f23573ea6aacb4be77447311ae27 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -64,6 +64,7 @@ DATADIR=data$(DIRSEP)
 SPRI=$(DATADIR)/spri
 SRC=src
 UTIL=$(SRC)/util
+GITCONFIGDIR=$(UTIL)/git
 SRCLIB=$(SRC)/lib
 JSMNLIB=$(SRCLIB)/jsmn
 NYANLIB=$(SRCLIB)/nyan
@@ -109,7 +110,7 @@ Z_FLAGS=-zk0 -zc -zp8 -zm
 O_FLAGS=-opnr -oe=24 -oil+ -outback -ohm                               -zp4##-ei
 T_FLAGS=-bt=dos -wx -m$(MEMORYMODE) -0 -fpi87 -d1 -fo=.$(OBJ) ##-e=65536
 
-DBUGFLAGS=-fm=$^&.mah -fd=$^&
+DBUGFLAGS=-fm=$^&.meh -fd=$^&
 CPPFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1
 !ifeq DEBUGSERIAL 1
 CPPFLAGS += -DDEBUGSERIAL
@@ -125,8 +126,7 @@ LIBFLAGS=$(WLIBQ) -b -n
 VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
 #OLDLIBOBJS=bitmap.$(OBJ) 16render.$(OBJ)
 GFXLIBOBJS = 16_vl.$(OBJ) 16_vlpal.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16_vrs.$(OBJ) 16_spri.$(OBJ) $(OLDLIBOBJS)
-16LIBNOINOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ)
-16LIBOBJS = $(16LIBNOINOBJS) 16_in.$(OBJ) 16_enti.$(OBJ)
+16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_head.$(OBJ) 16_in.$(OBJ) 16_enti.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ)
 DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
 !ifeq DEBUGSERIAL 1
 DOSLIBOBJ += 8250.$(OBJ)
@@ -243,7 +243,6 @@ fonttest.exe:        fonttest.$(OBJ) gfx.lib
 #fonttes0.exe: fonttes0.$(OBJ) $(16LIB)
 fontgfx.exe:   fontgfx.$(OBJ) gfx.lib $(DOSLIB)
 inputest.exe:   inputest.$(OBJ) $(16LIB) $(DOSLIB) gfx.lib
-inntest.exe:    inntest.$(OBJ) $(16LIBNOINOBJS) 16_in__.$(OBJ)
 #sountest.exe: sountest.$(OBJ) $(16LIB)
 pcxtest.exe:   pcxtest.$(OBJ) gfx.lib $(DOSLIB) $(16LIB)
 vrstest.exe:   vrstest.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
@@ -284,7 +283,6 @@ fonttest.$(OBJ):$(SRC)/fonttest.c
 #fonttes0.$(OBJ): $(SRC)/fonttes0.c
 fontgfx.$(OBJ):$(SRC)/fontgfx.c
 inputest.$(OBJ):$(SRC)/inputest.c
-inntest.$(OBJ):$(SRC)/inntest.c
 #sountest.$(OBJ): $(SRC)/sountest.c
 #miditest.$(OBJ): $(SRC)/miditest.c
 #testemm.$(OBJ):$(SRC)/testemm.c
@@ -339,7 +337,6 @@ mapread.$(OBJ):$(SRCLIB)/mapread.c $(SRCLIB)/mapread.h
 16_map.$(OBJ):$(SRCLIB)/16_map.c $(SRCLIB)/16_map.h
 16_timer.$(OBJ):$(SRCLIB)/16_timer.c $(SRCLIB)/16_timer.h
 16_in.$(OBJ):   $(SRCLIB)/16_in.c $(SRCLIB)/16_in.h
-16_in__.$(OBJ):         $(SRCLIB)/16_in__.c $(SRCLIB)/16_in.h
 16_rf.$(OBJ):   $(SRCLIB)/16_rf.c      $(SRCLIB)/16_rf.h
 16_mm.$(OBJ):   $(SRCLIB)/16_mm.c      $(SRCLIB)/16_mm.h
 16_pm.$(OBJ):   $(SRCLIB)/16_pm.c      $(SRCLIB)/16_pm.h
@@ -404,9 +401,9 @@ nuke: .symbolic
        @wmake comp
 
 backupconfig: .symbolic
-       @$(COPYCOMMAND) .git$(DIRSEP)config git_con.fig
-       @$(COPYCOMMAND) .gitmodules git_modu.les
-       @$(COPYCOMMAND) .gitignore git_igno.re
+       @$(COPYCOMMAND) .git$(DIRSEP)config $(GITCONFIGDIR)git_con.fig
+       @$(COPYCOMMAND) .gitmodules $(GITCONFIGDIR)git_modu.les
+       @$(COPYCOMMAND) .gitignore $(GITCONFIGDIR)git_igno.re
 
 comp: .symbolic
        @*upx -9 $(EXEC)
@@ -482,9 +479,9 @@ reinitlibs: .symbolic
        @wmake -h initlibs
 
 initlibs: .symbolic
-       @$(COPYCOMMAND) git_con.fig .git/config
-       @$(COPYCOMMAND) git_modu.les .gitmodules
-       @$(COPYCOMMAND) git_igno.re .gitignore
+       @$(COPYCOMMAND) $(GITCONFIGDIR)git_con.fig .git/config
+       @$(COPYCOMMAND) $(GITCONFIGDIR)git_modu.les .gitmodules
+       @$(COPYCOMMAND) $(GITCONFIGDIR)git_igno.re .gitignore
        @wmake -h getlib
        @cd 16
        @git clone https://github.com/FlatRockSoft/CatacombApocalypse.git
diff --git a/src/0.c b/src/0.c
index ba9ced8030eb1fbd679062c17c7c224f6d2fdf6a..80ff31bbd6529ab2effb7bf26a7628d13006da89 100755 (executable)
--- a/src/0.c
+++ b/src/0.c
@@ -103,7 +103,7 @@ int main(int argc,char **argv)
        if (vrl_lineoffs == NULL) return 1;\r
 \r
        IN_Startup();\r
-       IN_Default(0,&gvar.player,ctrl_Keyboard1);\r
+       IN_Default(0,&gvar.player[0],ctrl_Keyboard1);\r
        EN_initPlayer(&gvar.player, 0, &gvar.video);\r
 \r
        /* setup camera and screen~ */\r
@@ -141,14 +141,14 @@ int main(int argc,char **argv)
 \r
                while(!IN_KeyDown(sc_Escape))\r
                {\r
-                       IN_ReadControl(0,&gvar.player);\r
-                       if(IN_KeyDown(68)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1,1); } //f10\r
+                       IN_ReadControl(&gvar.player[0]);\r
+                       if(IN_KeyDown(68)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1); } //f10\r
                        TAIL_PANKEYFUN;\r
                        if(IN_KeyDown(sc_Space) || zerostoppause)       //space\r
                        {\r
                                anim=!anim;\r
                                DRAWCORNERBOXES;\r
-                               if(!zerostoppause) IN_UserInput(1,1); else zerostoppause=0;\r
+                               if(!zerostoppause) IN_UserInput(1); else zerostoppause=0;\r
                        }\r
                        if(IN_KeyDown(sc_R)){\r
                                gvar.video.page[0].dx=gvar.video.page[0].dy=gvar.video.page[1].dx=gvar.video.page[1].dy=16;\r
@@ -214,7 +214,7 @@ draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header
                }\r
        }\r
 \r
-       IN_UserInput(1,1);\r
+       IN_UserInput(1);\r
 \r
 //===========================================================================//\r
 \r
index 55ea5400e59810b05d20350a73c9ee2b6213460f..a96b1c495de738a594f791d6041a335277a664c4 100755 (executable)
--- a/src/16.c
+++ b/src/16.c
@@ -39,11 +39,11 @@ main(int argc, char *argv[])
        modexSavePalFile("data/g.pal", gvar.video.palette);\r
        VGAmodeX(1, 1, &gvar);\r
 //     modexPalBlack();        //so player will not see loadings~\r
-       IN_Default(0,&gvar.player,ctrl_Joystick);\r
+       IN_Default(0,&gvar.player[0],ctrl_Joystick);\r
        //modexprint(&screen, 32, 32, 1, 2, 0, "a", 1);\r
        while(ENGI_EXIT != engi_stat)\r
        {\r
-               IN_ReadControl(0,&gvar.player);\r
+               IN_ReadControl(&gvar.player[0]);\r
                if(IN_KeyDown(sc_Escape)) engi_stat = ENGI_EXIT;\r
                shinku(&gvar);\r
                _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);\r
index 1ba8b22729d67bde156df17820bab14caf524da9..2b2d564b9e411b7154e8c8a24909e1c5015dab10 100755 (executable)
@@ -35,10 +35,12 @@ main(int argc, char *argv[])
        start_timer(&gvar);\r
        //Startup16(&gvar);\r
        IN_Startup();\r
-       //IN_Default(0,&gvar.player,ctrl_Joystick1);\r
-       //IN_SetControlType(0,&gvar.player,ctrl_Joystick1);\r
-       IN_Default(0,&gvar.player,ctrl_Keyboard1);\r
-       IN_SetControlType(0,&gvar.player,ctrl_Keyboard1);\r
+       IN_Default(0,&gvar.player[0],\r
+ctrl_Keyboard1);\r
+//ctrl_Joystick1);\r
+       IN_SetControlType(&gvar.player[0],\r
+ctrl_Keyboard1);\r
+//ctrl_Joystick1);\r
 \r
        gvar.player[0].enti.q=1;\r
        gvar.player[0].enti.d=2;\r
@@ -50,7 +52,7 @@ main(int argc, char *argv[])
        while(!IN_KeyDown(sc_Escape))\r
        {\r
 //0000         shinkutxt(&gvar);\r
-               IN_ReadControl(0, &gvar.player);\r
+               IN_ReadControl(&gvar.player[0]);\r
                switch(gvar.player[0].enti.d)\r
                {\r
                //right movement\r
index c2550ec764ef43a65c0815c3967d5155d73667b6..f3a807661d2b4f231042a00457605be0e6f7ca51 100755 (executable)
@@ -1,21 +1,3 @@
-/* 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
 //\r
 //     ID Engine\r
 //     ID_IN.c - Input Manager\r
@@ -81,10 +63,6 @@ static struct instat {
        ScanCode        CurCode,LastCode;\r
 } inst;\r
 \r
-static void                    (*INL_KeyHook)(void);\r
-static void interrupt  (*OldKeyVect)(void);\r
-static char                    *ParmStringsIN[] = {"nojoys","nomouse",nil};\r
-\r
 static byte        far ASCIINames[] =          // Unshifted ASCII for scan codes\r
                                        {\r
 //      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
@@ -157,6 +135,10 @@ static     Direction       DirTable[] =            // Quick lookup for total direction
 }\r
 #endif\r
 \r
+static void                    (*INL_KeyHook)(void);\r
+static void interrupt  (*OldKeyVect)(void);\r
+static char                    *ParmStringsIN[] = {"nojoys","nomouse",nil};\r
+\r
 //     Internal routines\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -164,18 +146,18 @@ static    Direction       DirTable[] =            // Quick lookup for total direction
 //     INL_KeyService() - Handles a keyboard interrupt (key up/down)\r
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
-void interrupt\r
-INL_KeyService()\r
+/*static */void interrupt\r
+INL_KeyService(void)\r
 {\r
 static boolean special;\r
                byte    k,c,\r
                                temp;\r
 \r
-       k = inp(0x60);  // Get the scan code\r
+       k = inportb(0x60);      // Get the scan code\r
 \r
        // Tell the XT keyboard controller to clear the key\r
-       outp(0x61,(temp = inp(0x61)) | 0x80);\r
-       outp(0x61,temp);\r
+       outportb(0x61,(temp = inportb(0x61)) | 0x80);\r
+       outportb(0x61,temp);\r
 \r
        if (k == 0xe0)          // Special key prefix\r
                special = true;\r
@@ -232,11 +214,10 @@ static    boolean special;
 #ifdef __DEBUG_InputMgr__\r
        if(dbg_testkeyin > 0) printf("%c        %u      [0x%x %u]       %u\n", c, c, k, k, inpu.Keyboard[k]);\r
 #endif\r
-       outp(0x20,0x20);\r
+       outportb(0x20,0x20);\r
 }\r
 \r
-void\r
-Mouse(int x)\r
+void INL_Mouse(int x)\r
 {\r
        //union REGS CPURegs;\r
        //x = CPURegs.x.ax;\r
@@ -371,14 +352,12 @@ done:
 ///////////////////////////////////////////////////////////////////////////\r
 //\r
 //     INL_GetJoyDelta() - Returns the relative movement of the specified\r
-//             joystick (from +/-127, scaled adaptively)\r
+//             joystick (from +/-127)\r
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive)\r
+void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/)\r
 {\r
        word            x,y;\r
-       word    time;\r
        word TimeCount = *clockw;\r
        JoystickDef     *def;\r
 static word    lasttime;\r
@@ -431,18 +410,17 @@ static    word    lasttime;
        }\r
        else\r
                *dy = 0;\r
-\r
-       if (adaptive)\r
-       {\r
-               time = (TimeCount - lasttime) / 2;\r
-               if (time)\r
-               {\r
-                       if (time > 8)\r
-                               time = 8;\r
-                       *dx *= time;\r
-                       *dy *= time;\r
-               }\r
-       }\r
+//     if (adaptive)\r
+//     {\r
+//             time = (TimeCount - lasttime) / 2;\r
+//             if (time)\r
+//             {\r
+//                     if (time > 8)\r
+//                             time = 8;\r
+//                     *dx *= time;\r
+//                     *dy *= time;\r
+//             }\r
+//     }\r
        lasttime = TimeCount;\r
 }\r
 \r
@@ -457,7 +435,7 @@ INL_GetJoyButtons(word joy)
 {\r
 register       word    result;\r
 \r
-       result = inp(0x201);    // Get all the joystick buttons\r
+       result = inportb(0x201);        // Get all the joystick buttons\r
        result >>= joy? 6 : 4;  // Shift into bits 0-1\r
        result &= 3;                            // Mask off the useless bits\r
        result ^= 3;\r
@@ -482,6 +460,7 @@ IN_GetJoyButtonsDB(word joy)
                result1 = INL_GetJoyButtons(joy);\r
                lasttime = TimeCount;\r
                while(TimeCount == lasttime)\r
+                       //;\r
                result2 = INL_GetJoyButtons(joy);\r
        } while(result1 != result2);\r
        return(result1);\r
@@ -493,20 +472,14 @@ IN_GetJoyButtonsDB(word joy)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 static void\r
-INL_StartKbd()\r
+INL_StartKbd(void)\r
 {\r
-       byte far *lock_key;\r
-       INL_KeyHook = 0;        // Clear key hook\r
+       INL_KeyHook = NULL;     // Clear key hook\r
 \r
        IN_ClearKeysDown();\r
 \r
-       OldKeyVect = _dos_getvect(KeyInt);\r
-\r
-       // turn off num-lock via BIOS\r
-       lock_key = MK_FP(0x040, 0x017); // Pointing to the address of the bios shift state keys\r
-       *lock_key&=(~(16 | 32 | 64)); // toggle off the locks by changing the values of the 4th, 5th, and 6th bits of the address byte of 0040:0017\r
-       OldKeyVect();   // call BIOS keyhandler to change keyboard lights\r
-       _dos_setvect(KeyInt,INL_KeyService);\r
+       OldKeyVect = getvect(KeyInt);//IN_KbdLED();\r
+       setvect(KeyInt,INL_KeyService);\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -519,7 +492,7 @@ INL_ShutKbd(void)
 {\r
        pokeb(0x40,0x17,peekb(0x40,0x17) & 0xfaf0);     // Clear ctrl/alt/shift flags\r
 \r
-       _dos_setvect(KeyInt,OldKeyVect);\r
+       setvect(KeyInt,OldKeyVect);\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -530,14 +503,26 @@ INL_ShutKbd(void)
 static boolean\r
 INL_StartMouse(void)\r
 {\r
-       union REGS CPURegs;\r
-       if(_dos_getvect(MouseInt))\r
+#if 0\r
+       if (getvect(MouseInt))\r
        {\r
                Mouse(MReset);\r
-               if(CPURegs.x.ax == 0xffff)\r
+               if (_AX == 0xffff)\r
                        return(true);\r
        }\r
        return(false);\r
+#endif\r
+       byte far *vector;\r
+\r
+\r
+       if ((vector=MK_FP(peek(0,0x33*4+2),peek(0,0x33*4)))==NULL)\r
+       return false;\r
+\r
+       if (*vector == 207)\r
+               return false;\r
+\r
+       Mouse(MReset);\r
+       return true;\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -701,7 +686,7 @@ IN_Default(boolean gotit,player_t *player,ControlType nt)
        //in.KbdDefs[0].downleft = 0x4f;\r
        inpu.KbdDefs[0].down = 0x50;\r
        //in.KbdDefs[0].downright = 0x51;\r
-       IN_SetControlType(0,player,nt);\r
+       IN_SetControlType(player,nt);\r
        for(i=0; i>MaxPlayers;i++)\r
                player[i].enti.d =2;\r
 }\r
@@ -712,7 +697,7 @@ IN_Default(boolean gotit,player_t *player,ControlType nt)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_Shutdown()\r
+IN_Shutdown(void)\r
 {\r
        word    i;\r
 \r
@@ -741,11 +726,11 @@ IN_SetKeyHook(void (*hook)())
 \r
 ///////////////////////////////////////////////////////////////////////////\r
 //\r
-//     IN_ClearKeyDown() - Clears the keyboard array\r
+//     IN_ClearKeysDown() - Clears the keyboard array\r
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_ClearKeysDown()\r
+IN_ClearKeysDown(void)\r
 {\r
        //int   i;\r
 \r
@@ -800,21 +785,25 @@ IN_ReadCursor(CursorInfo *info)
                        continue;\r
 \r
                buttons = INL_GetJoyButtons(i);\r
-               INL_GetJoyDelta(i,&dx,&dy,true);\r
+               INL_GetJoyDelta(i,&dx,&dy/*,true*/);\r
                dx /= 64;\r
                dy /= 64;\r
                INL_AdjustCursor(info,buttons,dx,dy);\r
        }\r
 }\r
 \r
+//if else for gfxtesting and direction\r
+#define DIRECTIONIFELSE        (player->info.dir == 2)\r
+//#define NDIRECTIONIFELSE     (player->info.dir != 2)\r
+\r
 ///////////////////////////////////////////////////////////////////////////\r
 //\r
 //     IN_ReadControl() - Reads the device associated with the specified\r
 //             player and fills in the control info struct\r
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
-void near\r
-IN_ReadControl(word pn, player_t *player)\r
+void\r
+IN_ReadControl(player_t *player)\r
 {\r
                        boolean         realdelta;\r
 #if DEMO0\r
@@ -854,7 +843,7 @@ register    KeyboardDef     *def;
        else\r
        {\r
 #endif\r
-               switch (type = player[pn].Controls)\r
+               switch (type = player->Controls)\r
                {\r
                case ctrl_Keyboard1:\r
                case ctrl_Keyboard2:\r
@@ -869,7 +858,7 @@ register    KeyboardDef     *def;
                        else if (Keyboard[def->downright])\r
                                mx = motion_Right,my = motion_Down;*/\r
 //TODO: make this into a function that the joystick AND keyboard can use wwww\r
-                       if(DIRECTIONIFELSE)//(player[pn].info.dir == 2)\r
+                       if(DIRECTIONIFELSE)//(player->info.dir == 2)\r
                        {\r
                        if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){\r
                                if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]))\r
@@ -882,7 +871,7 @@ register    KeyboardDef     *def;
                                if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left]))\r
                                        mx = motion_Right;\r
                        }else{  //2 keys pressed\r
-                                       switch (player[pn].pdir)\r
+                                       switch (player->pdir)\r
                                        {\r
                                                case 0:\r
                                                case 4:\r
@@ -898,7 +887,7 @@ register    KeyboardDef     *def;
                                                break;\r
                                        }\r
 #ifdef __DEBUG_InputMgr__\r
-                                       //if(dbg_testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c        ", dirchar(player[pn].pdir)); }\r
+                                       //if(dbg_testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c        ", dirchar(player->pdir)); }\r
 #endif\r
                                }\r
                        }\r
@@ -911,7 +900,7 @@ register    KeyboardDef     *def;
                        break;\r
                case ctrl_Joystick1:\r
                case ctrl_Joystick2:\r
-                       INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy,false);\r
+                       INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy/*,false*/);\r
                        buttons = INL_GetJoyButtons(type - ctrl_Joystick);\r
                        realdelta = true;\r
                        break;\r
@@ -936,23 +925,23 @@ register  KeyboardDef     *def;
                dy = my;// * 127;\r
        }\r
 \r
-       player[pn].info.x = dx;\r
-       player[pn].info.xaxis = mx;\r
-       player[pn].info.y = dy;\r
-       player[pn].info.yaxis = my;\r
-       player[pn].info.button0 = buttons & (1 << 0);\r
-       player[pn].info.button1 = buttons & (1 << 1);\r
-       player[pn].info.button2 = buttons & (1 << 2);\r
-       player[pn].info.button3 = buttons & (1 << 3);\r
-//     player[pn].info.dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
+       player->info.x = dx;\r
+       player->info.xaxis = mx;\r
+       player->info.y = dy;\r
+       player->info.yaxis = my;\r
+       player->info.button0 = buttons & (1 << 0);\r
+       player->info.button1 = buttons & (1 << 1);\r
+       player->info.button2 = buttons & (1 << 2);\r
+       player->info.button3 = buttons & (1 << 3);\r
+//     player->info.dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
        conpee=(((my + 1) * 2) + (mx + 1))-1;\r
-       player[pn].info.dir = DirTable[conpee];\r
+       player->info.dir = DirTable[conpee];\r
 \r
-       if(DirTable[conpee]!=2) player[pn].pdir=DirTable[conpee];\r
-       if(player[pn].enti.q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None)))\r
+       if(DirTable[conpee]!=2) player->pdir=DirTable[conpee];\r
+       if(player->enti.q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None)))\r
        {\r
-               if(dir==2) player[pn].enti.d = player[pn].info.dir;\r
-               else player[pn].enti.d = DirTable[dir];\r
+               if(dir==2) player->enti.d = player->info.dir;\r
+               else player->enti.d = DirTable[dir];\r
        }\r
 \r
 #if DEMO0\r
@@ -982,13 +971,13 @@ register  KeyboardDef     *def;
 #endif\r
 #ifdef __DEBUG_InputMgr__\r
 if(dbg_testcontrolnoisy > 0)\r
-if(player[pn].info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])*/ || player[pn].enti.q>1)\r
+if(player->info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])*/ || player->enti.q>1)\r
 {\r
-       //printf("b1=%u b2=%u b3=%u b4=%u       ", player[pn].info.button0, player[pn].info.button1, player[pn].info.button2, player[pn].info.button3);\r
-       //printf("q=%d ", player[pn].enti.q);\r
+       //printf("b1=%u b2=%u b3=%u b4=%u       ", player->info.button0, player->info.button1, player->info.button2, player->info.button3);\r
+       //printf("q=%d ", player->enti.q);\r
        //printf("cpee=%c ", dirchar(conpee));\r
-       printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].enti.d), dirchar(player[pn].info.dir));\r
-       /*if(realdelta) */printf("dx=%d dy=%d   mx=%d   my=%d", player[pn].info.x, player[pn].info.y, player[pn].info.xaxis, player[pn].info.yaxis);\r
+       printf("pdir=%c d=%c dir=%c ", dirchar(player->pdir), dirchar(player->enti.d), dirchar(player->info.dir));\r
+       /*if(realdelta) */printf("dx=%d dy=%d   mx=%d   my=%d", player->info.x, player->info.y, player->info.xaxis, player->info.yaxis);\r
        //else if(!realdelta) printf("%c%d %c%d %c%d %c%d", dirchar(0), inpu.Keyboard[def->up], dirchar(4), inpu.Keyboard[def->down], dirchar(1), inpu.Keyboard[def->left], dirchar(3), inpu.Keyboard[def->right]);\r
        printf("\n");\r
 }\r
@@ -1002,10 +991,10 @@ if(player[pn].info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] |
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_SetControlType(word pn,player_t *player,ControlType type)\r
+IN_SetControlType(player_t *player,ControlType type)\r
 {\r
        // DEBUG - check that requested type is present?\r
-       player[pn].Controls = type;\r
+       player->Controls = type;\r
 }\r
 \r
 #if DEMO0\r
@@ -1098,7 +1087,7 @@ IN_GetScanName(ScanCode scan)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 ScanCode\r
-IN_WaitForKey()\r
+IN_WaitForKey(void)\r
 {\r
        ScanCode        result;\r
 \r
@@ -1115,7 +1104,7 @@ IN_WaitForKey()
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 char\r
-IN_WaitForASCII()\r
+IN_WaitForASCII(void)\r
 {\r
        char            result;\r
 \r
@@ -1127,69 +1116,66 @@ IN_WaitForASCII()
 \r
 ///////////////////////////////////////////////////////////////////////////\r
 //\r
-//     IN_AckBack() - Waits for either an ASCII keypress or a button press\r
+//     IN_Ack() - waits for a button or key press.  If a button is down, upon\r
+// calling, it must be released for it to be recognized\r
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_AckBack()\r
+\r
+boolean        btnstate[8];\r
+\r
+void IN_StartAck(void)\r
 {\r
-       word    i;\r
+       unsigned        i,buttons;\r
 \r
-       while (!inpu.LastScan)\r
-       {\r
-               if (inpu.MousePresent)\r
-               {\r
-                       if (INL_GetMouseButtons())\r
-                       {\r
-                               while (INL_GetMouseButtons())\r
-                                       ;\r
-                               return;\r
-                       }\r
-               }\r
+//\r
+// get initial state of everything\r
+//\r
+       IN_ClearKeysDown();\r
+       memset (btnstate,0,sizeof(btnstate));\r
 \r
-               for (i = 0;i < MaxJoys;i++)\r
-               {\r
-                       if (inpu.JoysPresent[i])\r
-                       {\r
-                               if (IN_GetJoyButtonsDB(i))\r
-                               {\r
-                                       while (IN_GetJoyButtonsDB(i))\r
-                                               ;\r
-                                       return;\r
-                               }\r
-                       }\r
-               }\r
-       }\r
+       buttons = IN_JoyButtons () << 4;\r
+       if (inpu.MousePresent)\r
+               buttons |= IN_MouseButtons ();\r
 \r
-       IN_ClearKey(inpu.LastScan);\r
-       inpu.LastScan = sc_None;\r
+       for (i=0;i<8;i++,buttons>>=1)\r
+               if (buttons&1)\r
+                       btnstate[i] = true;\r
 }\r
 \r
-///////////////////////////////////////////////////////////////////////////\r
+\r
+boolean IN_CheckAck (void)\r
+{\r
+       unsigned        i,buttons;\r
+\r
 //\r
-//     IN_Ack() - Clears user input & then calls IN_AckBack()\r
+// see if something has been pressed\r
 //\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_Ack()\r
-{\r
-       word    i;\r
+       if (inpu.LastScan)\r
+               return true;\r
 \r
-       if (!inst.IN_Started)\r
-               return;\r
+       buttons = IN_JoyButtons () << 4;\r
+       if (inpu.MousePresent)\r
+               buttons |= IN_MouseButtons ();\r
 \r
-       IN_ClearKey(inpu.LastScan);\r
-       inpu.LastScan = sc_None;\r
+       for (i=0;i<8;i++,buttons>>=1)\r
+               if ( buttons&1 )\r
+               {\r
+                       if (!btnstate[i])\r
+                               return true;\r
+               }\r
+               else\r
+                       btnstate[i]=false;\r
+\r
+       return false;\r
+}\r
 \r
-       if (inpu.MousePresent)\r
-               while (INL_GetMouseButtons())\r
-                                       ;\r
-       for (i = 0;i < MaxJoys;i++)\r
-               if (inpu.JoysPresent[i])\r
-                       while (IN_GetJoyButtonsDB(i))\r
-                               ;\r
 \r
-       IN_AckBack();\r
+void IN_Ack (void)\r
+{\r
+       IN_StartAck ();\r
+\r
+       while (!IN_CheckAck ())\r
+       ;\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -1226,21 +1212,17 @@ IN_IsUserInput()
 //             button up.\r
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
-boolean\r
-IN_UserInput(dword delay,boolean clear)\r
+boolean IN_UserInput(word delay)\r
 {\r
        word TimeCount = *clockw;\r
        word    lasttime;\r
 \r
        lasttime = TimeCount;\r
+       IN_StartAck ();\r
        do\r
        {\r
-               if (IN_IsUserInput())\r
-               {\r
-                       if (clear)\r
-                               IN_AckBack();\r
-                       return(true);\r
-               }\r
+               if (IN_CheckAck())\r
+                       return true;\r
        } while (TimeCount - lasttime < delay);\r
        return(false);\r
 }\r
@@ -1280,7 +1262,7 @@ byte      IN_JoyButtons (void)
 {\r
        byte joybits;\r
 \r
-       joybits = inp(0x201);   // Get all the joystick buttons\r
+       joybits = inportb(0x201);       // Get all the joystick buttons\r
        joybits >>= 4;                          // only the high bits are useful\r
        joybits ^= 15;                          // return with 1=pressed\r
 \r
@@ -1327,3 +1309,13 @@ ScanCode IN_GetCurCode()
 {\r
        return inst.CurCode;\r
 }\r
+\r
+void IN_KbdLED()\r
+{\r
+       byte far *lock_key;\r
+\r
+       // turn off num-lock via BIOS\r
+       lock_key = MK_FP(0x040, 0x017); // Pointing to the address of the bios shift state keys\r
+       *lock_key&=(~(16 | 32 | 64)); // toggle off the locks by changing the values of the 4th, 5th, and 6th bits of the address byte of 0040:0017\r
+       OldKeyVect();   // call BIOS keyhandler to change keyboard lights\r
+}\r
index 86980fe8b4aa51d6c32225d0a7b382d12bcb4ff5..540cc4d4fedc0d456835727f72d374ac8197732e 100755 (executable)
@@ -1,21 +1,3 @@
-/* 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
 //\r
 //     ID Engine\r
 //     ID_IN.h - Header file for Input Manager\r
 #include "src/lib/16_dbg.h"\r
 #include "src/lib/16_spri.h"\r
 #include "src/lib/16_enti.h"\r
-//#include "src/lib/bitmap.h"  //old format\r
 #endif\r
 \r
-//if else for gfxtesting and direction\r
-//player[pn].d == 2 ||\r
-//player[pn].d != 2 ||\r
-#define DIRECTIONIFELSE        (player[pn].info.dir == 2)\r
-//#define NDIRECTIONIFELSE     (player[pn].info.dir != 2)\r
-\r
 #define        KeyInt  9       // The keyboard ISR number\r
 \r
 // Stuff for the joystick\r
@@ -53,7 +28,6 @@
 //#define      MaxPlayers              2//future plans for multiple playable charaters and being able to alternate\r
 #define        MaxKbds         2\r
 #define        MaxJoys         2\r
-#define        MaxPads         2\r
 #define        NumCodes        128\r
 \r
 //typedef      byte            ScanCode;\r
@@ -218,48 +192,48 @@ typedef   struct          {
 #endif\r
 \r
 //     Internal routines\r
-void interrupt INL_KeyService();\r
-void Mouse(int x);\r
-//static void INL_GetMouseDelta(int *x,int *y);\r
-//static word INL_GetMouseButtons(void);\r
-void IN_GetJoyAbs(word joy,word *xp,word *yp);\r
-//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);\r
-//static word INL_GetJoyButtons(word joy);\r
-word IN_GetJoyButtonsDB(word joy);\r
-//static void INL_StartKbd(void);\r
-//static void INL_ShutKbd(void);\r
-//static boolean INL_StartMouse(void);\r
-//static void INL_ShutMouse(void);\r
-//static void INL_SetJoyScale(word joy);\r
-void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);\r
-//static boolean INL_StartJoy(word joy);\r
-//static void INL_ShutJoy(word joy);\r
-void IN_Startup();\r
-void IN_Default(boolean gotit,player_t *player,ControlType nt);\r
-void IN_Shutdown();\r
-void IN_SetKeyHook(void (*hook)());\r
-void IN_ClearKeysDown();\r
-//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);\r
-void IN_ReadCursor(CursorInfo *info);\r
-void near IN_ReadControl(word pn, player_t *player);\r
-void IN_SetControlType(word pn,player_t *player,ControlType type);\r
+extern void            IN_Startup(void),IN_Shutdown(void),\r
+                                       IN_Default(boolean gotit,player_t *player,ControlType nt),\r
+                                       IN_SetKeyHook(void (*)()),\r
+                                       IN_ClearKeysDown(void),\r
+                                       IN_ReadCursor(CursorInfo *),\r
+                                       IN_ReadControl(player_t *player),\r
+                                       IN_SetControlType(player_t *player,ControlType type),\r
+                                       IN_GetJoyAbs(word joy,word *xp,word *yp),\r
+                                       IN_SetupJoy(word joy,word minx,word maxx,\r
+                                                               word miny,word maxy),\r
+#if DEMO0\r
+                                       IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
+#endif\r
+                                       IN_Ack(void),IN_AckBack(void);\r
+extern boolean         IN_UserInput(word delay);\r
+extern char            IN_WaitForASCII(void);\r
+extern ScanCode        IN_WaitForKey(void);\r
+extern word            IN_GetJoyButtonsDB(word joy);\r
+extern byte            *IN_GetScanName(ScanCode);\r
+\r
+\r
+byte   IN_MouseButtons (void);\r
+byte   IN_JoyButtons (void);\r
+\r
+void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/);\r
+void IN_StartAck(void);\r
+boolean IN_CheckAck (void);\r
+boolean IN_IsUserInput();\r
+#define Mouse(x)         INL_Mouse(x)\r
+//void IN_SetKeyHook(void (*hook)());\r
 #if DEMO0\r
 boolean IN_StartDemoRecord(word bufsize);\r
-void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
+void IN_StartDemoPlayback(byte *buffer,word bufsize);\r
 void IN_StopDemo(void);\r
 void IN_FreeDemoBuffer(void);\r
 #endif\r
-byte *IN_GetScanName(ScanCode scan);\r
-ScanCode IN_WaitForKey();\r
-char IN_WaitForASCII();\r
-void IN_AckBack();\r
-void IN_Ack();\r
-boolean IN_IsUserInput();\r
-boolean IN_UserInput(dword delay,boolean clear);\r
-boolean IN_KeyDown(byte code);\r
-void IN_ClearKey(byte code);\r
-boolean IN_qb(byte kee);\r
-ScanCode IN_GetLastScan();\r
-ScanCode IN_GetCurCode();\r
+\r
+boolean        IN_KeyDown(byte code),\r
+               IN_qb(byte kee);\r
+void           IN_ClearKey(byte code),\r
+               IN_KbdLED();\r
+ScanCode       IN_GetLastScan(),\r
+               IN_GetCurCode();\r
 \r
 #endif\r
diff --git a/src/lib/16_in_.c b/src/lib/16_in_.c
deleted file mode 100755 (executable)
index c04d15a..0000000
+++ /dev/null
@@ -1,1316 +0,0 @@
-/* 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
-//\r
-//     ID Engine\r
-//     ID_IN.c - Input Manager\r
-//     v1.0d1w\r
-//     By Jason Blochowiak\r
-//     Open Watcom port by sparky4\r
-//\r
-\r
-//\r
-//     This module handles dealing with the various input devices\r
-//\r
-//     Depends on: Memory Mgr (for demo recording), Sound Mgr (for timing stuff),\r
-//                             User Mgr (for command line parms)\r
-//\r
-//     Globals:\r
-//             LastScan - The keyboard scan code of the last key pressed\r
-//             LastASCII - The ASCII value of the last key pressed\r
-//     DEBUG - there are more globals\r
-//\r
-\r
-#include "src/lib/16_in_.h"\r
-#pragma        hdrstop\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                       GLOBAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-// moved to 16_tdef.h\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                       LOCAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-\r
-#ifdef __cplusplus             /* Function must be declared C style */\r
-extern "C" {\r
-#endif\r
-\r
-static void                    (*INL_KeyHook)(void);\r
-static void interrupt  (*OldKeyVect)(void);\r
-static char                    *ParmStringsIN[] = {"nojoys","nomouse",nil};\r
-\r
-static byte        far ASCIINames[] =          // Unshifted ASCII for scan codes\r
-                                       {\r
-//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
-       0  ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8  ,9  ,        // 0\r
-       'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0  ,'a','s',        // 1\r
-       'd','f','g','h','j','k','l',';',39 ,'`',0  ,92 ,'z','x','c','v',        // 2\r
-       'b','n','m',',','.','/',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',        // 4\r
-       '2','3','0',127,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
-                                       },\r
-                                       far ShiftNames[] =              // Shifted ASCII for scan codes\r
-                                       {\r
-//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
-       0  ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',8  ,9  ,        // 0\r
-       'Q','W','E','R','T','Y','U','I','O','P','{','}',13 ,0  ,'A','S',        // 1\r
-       'D','F','G','H','J','K','L',':',34 ,'~',0  ,'|','Z','X','C','V',        // 2\r
-       'B','N','M','<','>','?',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',        // 4\r
-       '2','3','0',127,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
-                                       },\r
-                                       far SpecialNames[] =    // ASCII for 0xe0 prefixed codes\r
-                                       {\r
-//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 0\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,13 ,0  ,0  ,0  ,        // 1\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 2\r
-       0  ,0  ,0  ,0  ,0  ,'/',0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 4\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
-                                       },\r
-\r
-\r
-                                       *ScanNames[] =          // Scan code names with single chars\r
-                                       {\r
-       "?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?",\r
-       "Q","W","E","R","T","Y","U","I","O","P","[","]","|","?","A","S",\r
-       "D","F","G","H","J","K","L",";","\"","?","?","?","Z","X","C","V",\r
-       "B","N","M",",",".","/","?","?","?","?","?","?","?","?","?","?",\r
-       "?","?","?","?","?","?","?","?","\xf","?","-","\x15","5","\x11","+","?",\r
-       "\x13","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",\r
-       "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",\r
-       "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?"\r
-                                       },      // DEBUG - consolidate these\r
-\r
-\r
-                                       far ExtScanCodes[] =    // Scan codes with >1 char names\r
-                                       {\r
-       1,0xe,0xf,0x1d,0x2a,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,\r
-       0x3f,0x40,0x41,0x42,0x43,0x44,0x57,0x59,0x46,0x1c,0x36,\r
-       0x37,0x38,0x47,0x49,0x4f,0x51,0x52,0x53,0x45,0x48,\r
-       0x50,0x4b,0x4d,0x00\r
-                                       },\r
-                                       *ExtScanNames[] =       // Names corresponding to ExtScanCodes\r
-                                       {\r
-       "Esc","BkSp","Tab","Ctrl","LShft","Space","CapsLk","F1","F2","F3","F4",\r
-       "F5","F6","F7","F8","F9","F10","F11","F12","ScrlLk","Enter","RShft",\r
-       "PrtSc","Alt","Home","PgUp","End","PgDn","Ins","Del","NumLk","Up",\r
-       "Down","Left","Right",""\r
-                                       };\r
-\r
-static Direction       DirTable[] =            // Quick lookup for total direction\r
-                                       {\r
-                                               /*dir_NorthWest,        */dir_North,/*  dir_NorthEast,*/\r
-                                               dir_West,               dir_None,       dir_East,\r
-                                               /*dir_SouthWest,        */dir_South/*,  dir_SouthEast*/\r
-                                       };\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-//     Internal routines\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_KeyService() - Handles a keyboard interrupt (key up/down)\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-/*static */void interrupt\r
-INL_KeyService(global_game_variables_t *gvar)\r
-{\r
-static boolean special;\r
-               byte    k,c,\r
-                               temp;\r
-\r
-       k = inp(0x60);  // Get the scan code\r
-\r
-       // Tell the XT keyboard controller to clear the key\r
-       outp(0x61,(temp = inp(0x61)) | 0x80);\r
-       outp(0x61,temp);\r
-\r
-       if (k == 0xe0)          // Special key prefix\r
-               special = true;\r
-       else if (k == 0xe1)     // Handle Pause key\r
-               gvar->in.Paused = true;\r
-       else\r
-       {\r
-               if (k & 0x80)   // Break code\r
-               {\r
-                       k &= 0x7f;\r
-\r
-// DEBUG - handle special keys: ctl-alt-delete, print scrn\r
-\r
-                       gvar->in.Keyboard[k] = false;\r
-               }\r
-               else                    // Make code\r
-               {\r
-                       gvar->in.LastCode = gvar->in.CurCode;\r
-                       gvar->in.CurCode = gvar->in.LastScan = k;\r
-                       gvar->in.Keyboard[k] = true;\r
-\r
-                       if (special)\r
-                               c = SpecialNames[k];\r
-                       else\r
-                       {\r
-                               if (k == sc_CapsLock)\r
-                               {\r
-                                       gvar->in.CapsLock ^= true;\r
-                                       // DEBUG - make caps lock light work\r
-                               }\r
-\r
-                               if (gvar->in.Keyboard[sc_LShift] || gvar->in.Keyboard[sc_RShift])       // If shifted\r
-                               {\r
-                                       c = ShiftNames[k];\r
-                                       if ((c >= 'A') && (c <= 'Z') && gvar->in.CapsLock)\r
-                                               c += 'a' - 'A';\r
-                               }\r
-                               else\r
-                               {\r
-                                       c = ASCIINames[k];\r
-                                       if ((c >= 'a') && (c <= 'z') && gvar->in.CapsLock)\r
-                                               c -= 'a' - 'A';\r
-                               }\r
-                       }\r
-                       if (c)\r
-                               gvar->in.LastASCII = c;\r
-               }\r
-\r
-               special = false;\r
-       }\r
-\r
-       if (INL_KeyHook && !special)\r
-               INL_KeyHook();\r
-#ifdef __DEBUG_InputMgr__\r
-       if(dbg_testkeyin > 0) printf("%c        %u      [0x%x %u]       %u\n", c, c, k, k, gvar->in.Keyboard[k]);\r
-#endif\r
-       outp(0x20,0x20);\r
-}\r
-\r
-void\r
-Mouse(int x)\r
-{\r
-       //union REGS CPURegs;\r
-       //x = CPURegs.x.ax;\r
-       __asm {\r
-               mov     ax,x\r
-               int     MouseInt\r
-       }\r
-       //int86(MouseInt,&CPURegs,&CPURegs);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_GetMouseDelta() - Gets the amount that the mouse has moved from the\r
-//             mouse driver\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_GetMouseDelta(int *x,int *y)\r
-{\r
-       union REGS CPURegs;\r
-       Mouse(MDelta);\r
-       *x = CPURegs.x.cx;\r
-       *y = CPURegs.x.dx;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_GetMouseButtons() - Gets the status of the mouse buttons from the\r
-//             mouse driver\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static word\r
-INL_GetMouseButtons(void)\r
-{\r
-       union REGS CPURegs;\r
-       word    buttons;\r
-\r
-       Mouse(MButtons);\r
-       buttons = CPURegs.x.bx;\r
-       return(buttons);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_GetJoyAbs() - Reads the absolute position of the specified joystick\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_GetJoyAbs(word joy,word *xp,word *yp)\r
-{\r
-       byte    xb,yb,\r
-                       xs,ys;\r
-       word    x,y;\r
-\r
-       x = y = 0;\r
-       xs = joy? 2 : 0;                // Find shift value for x axis\r
-       xb = 1 << xs;                   // Use shift value to get x bit mask\r
-       ys = joy? 3 : 1;                // Do the same for y axis\r
-       yb = 1 << ys;\r
-\r
-// Read the absolute joystick values\r
-       __asm {\r
-               pushf                           // Save some registers\r
-               push    si\r
-               push    di\r
-               cli                                     // Make sure an interrupt doesn't screw the timings\r
-\r
-\r
-               mov             dx,0x201\r
-               in              al,dx\r
-               out             dx,al           // Clear the resistors\r
-\r
-               mov             ah,[xb]         // Get masks into registers\r
-               mov             ch,[yb]\r
-\r
-               xor             si,si           // Clear count registers\r
-               xor             di,di\r
-               xor             bh,bh           // Clear high byte of bx for later\r
-\r
-               push    bp                      // Don't mess up stack frame\r
-               mov             bp,MaxJoyValue\r
-#ifdef __BORLANDC__\r
-       }\r
-#endif\r
-loo:\r
-#ifdef __BORLANDC__\r
-       __asm {\r
-#endif\r
-               in              al,dx           // Get bits indicating whether all are finished\r
-\r
-               dec             bp                      // Check bounding register\r
-               jz              done            // We have a silly value - abort\r
-\r
-               mov             bl,al           // Duplicate the bits\r
-               and             bl,ah           // Mask off useless bits (in [xb])\r
-               add             si,bx           // Possibly increment count register\r
-               mov             cl,bl           // Save for testing later\r
-\r
-               mov             bl,al\r
-               and             bl,ch           // [yb]\r
-               add             di,bx\r
-\r
-               add             cl,bl\r
-               jnz             loo             // If both bits were 0, drop out\r
-#ifdef __BORLANDC__\r
-       }\r
-#endif\r
-done:\r
-#ifdef __BORLANDC__\r
-       __asm {\r
-#endif\r
-               pop             bp\r
-\r
-               mov             cl,[xs]         // Get the number of bits to shift\r
-               shr             si,cl           //  and shift the count that many times\r
-\r
-               mov             cl,[ys]\r
-               shr             di,cl\r
-\r
-               mov             [x],si          // Store the values into the variables\r
-               mov             [y],di\r
-\r
-               pop             di\r
-               pop             si\r
-               popf                            // Restore the registers\r
-       }\r
-\r
-       *xp = x;\r
-       *yp = y;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_GetJoyDelta() - Returns the relative movement of the specified\r
-//             joystick (from +/-127, scaled adaptively)\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive, global_game_variables_t *gvar)\r
-{\r
-       word            x,y;\r
-       word    time;\r
-       word TimeCount = gvar->kurokku.clock_start;\r
-       JoystickDef     *def;\r
-static word    lasttime;\r
-\r
-       IN_GetJoyAbs(joy,&x,&y);\r
-       def = gvar->in.JoyDefs + joy;\r
-\r
-       if (x < def->threshMinX)\r
-       {\r
-               if (x < def->joyMinX)\r
-                       x = def->joyMinX;\r
-\r
-               x = -(x - def->threshMinX);\r
-               x *= def->joyMultXL;\r
-               x >>= JoyScaleShift;\r
-               *dx = (x > 127)? -127 : -x;\r
-       }\r
-       else if (x > def->threshMaxX)\r
-       {\r
-               if (x > def->joyMaxX)\r
-                       x = def->joyMaxX;\r
-\r
-               x = x - def->threshMaxX;\r
-               x *= def->joyMultXH;\r
-               x >>= JoyScaleShift;\r
-               *dx = (x > 127)? 127 : x;\r
-       }\r
-       else\r
-               *dx = 0;\r
-\r
-       if (y < def->threshMinY)\r
-       {\r
-               if (y < def->joyMinY)\r
-                       y = def->joyMinY;\r
-\r
-               y = -(y - def->threshMinY);\r
-               y *= def->joyMultYL;\r
-               y >>= JoyScaleShift;\r
-               *dy = (y > 127)? -127 : -y;\r
-       }\r
-       else if (y > def->threshMaxY)\r
-       {\r
-               if (y > def->joyMaxY)\r
-                       y = def->joyMaxY;\r
-\r
-               y = y - def->threshMaxY;\r
-               y *= def->joyMultYH;\r
-               y >>= JoyScaleShift;\r
-               *dy = (y > 127)? 127 : y;\r
-       }\r
-       else\r
-               *dy = 0;\r
-\r
-       if (adaptive)\r
-       {\r
-               time = (TimeCount - lasttime) / 2;\r
-               if (time)\r
-               {\r
-                       if (time > 8)\r
-                               time = 8;\r
-                       *dx *= time;\r
-                       *dy *= time;\r
-               }\r
-       }\r
-       lasttime = TimeCount;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_GetJoyButtons() - Returns the button status of the specified\r
-//             joystick\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static word\r
-INL_GetJoyButtons(word joy)\r
-{\r
-register       word    result;\r
-\r
-       result = inp(0x201);    // Get all the joystick buttons\r
-       result >>= joy? 6 : 4;  // Shift into bits 0-1\r
-       result &= 3;                            // Mask off the useless bits\r
-       result ^= 3;\r
-       return(result);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_GetJoyButtonsDB() - Returns the de-bounced button status of the\r
-//             specified joystick\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-word\r
-IN_GetJoyButtonsDB(word joy, global_game_variables_t *gvar)\r
-{\r
-       word TimeCount = gvar->kurokku.clock_start;\r
-       word    lasttime;\r
-       word            result1,result2;\r
-\r
-       do\r
-       {\r
-               result1 = INL_GetJoyButtons(joy);\r
-               lasttime = TimeCount;\r
-               while(TimeCount == lasttime)\r
-               result2 = INL_GetJoyButtons(joy);\r
-       } while(result1 != result2);\r
-       return(result1);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_StartKbd() - Sets up my keyboard stuff for use\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_StartKbd(global_game_variables_t *gvar)\r
-{\r
-       byte far *lock_key;\r
-       INL_KeyHook = 0;        // Clear key hook\r
-\r
-       IN_ClearKeysDown(gvar);\r
-\r
-       OldKeyVect = _dos_getvect(KeyInt);\r
-\r
-       // turn off num-lock via BIOS\r
-       lock_key = MK_FP(0x040, 0x017); // Pointing to the address of the bios shift state keys\r
-       *lock_key&=(~(16 | 32 | 64)); // toggle off the locks by changing the values of the 4th, 5th, and 6th bits of the address byte of 0040:0017\r
-       OldKeyVect();   // call BIOS keyhandler to change keyboard lights\r
-       _dos_setvect(KeyInt,INL_KeyService);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_ShutKbd() - Restores keyboard control to the BIOS\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_ShutKbd(void)\r
-{\r
-       pokeb(0x40,0x17,peekb(0x40,0x17) & 0xfaf0);     // Clear ctrl/alt/shift flags\r
-\r
-       _dos_setvect(KeyInt,OldKeyVect);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_StartMouse() - Detects and sets up the mouse\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static boolean\r
-INL_StartMouse(void)\r
-{\r
-       union REGS CPURegs;\r
-       if(_dos_getvect(MouseInt))\r
-       {\r
-               Mouse(MReset);\r
-               if(CPURegs.x.ax == 0xffff)\r
-                       return(true);\r
-       }\r
-       return(false);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_ShutMouse() - Cleans up after the mouse\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_ShutMouse(void)\r
-{\r
-}\r
-\r
-//\r
-//     INL_SetJoyScale() - Sets up scaling values for the specified joystick\r
-//\r
-static void\r
-INL_SetJoyScale(word joy, global_game_variables_t *gvar)\r
-{\r
-       JoystickDef     *def;\r
-\r
-       def = &(gvar->in.JoyDefs[joy]);\r
-       def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX);\r
-       def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX);\r
-       def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY);\r
-       def->joyMultYH = JoyScaleMax / (def->joyMaxY - def->threshMaxY);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale()\r
-//             to set up scaling values\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy, global_game_variables_t *gvar)\r
-{\r
-       word            d,r;\r
-       JoystickDef     *def;\r
-\r
-       def = &(gvar->in.JoyDefs[joy]);\r
-\r
-       def->joyMinX = minx;\r
-       def->joyMaxX = maxx;\r
-       r = maxx - minx;\r
-       d = r / 3;\r
-       def->threshMinX = ((r / 2) - d) + minx;\r
-       def->threshMaxX = ((r / 2) + d) + minx;\r
-\r
-       def->joyMinY = miny;\r
-       def->joyMaxY = maxy;\r
-       r = maxy - miny;\r
-       d = r / 3;\r
-       def->threshMinY = ((r / 2) - d) + miny;\r
-       def->threshMaxY = ((r / 2) + d) + miny;\r
-\r
-       INL_SetJoyScale(joy, gvar);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_StartJoy() - Detects & auto-configures the specified joystick\r
-//                                     The auto-config assumes the joystick is centered\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static boolean\r
-INL_StartJoy(word joy, global_game_variables_t *gvar)\r
-{\r
-       word            x,y;\r
-\r
-       IN_GetJoyAbs(joy,&x,&y);\r
-\r
-       if\r
-       (\r
-               ((x == 0) || (x > MaxJoyValue - 10))\r
-       ||      ((y == 0) || (y > MaxJoyValue - 10))\r
-       )\r
-               return(false);\r
-       else\r
-       {\r
-               IN_SetupJoy(joy,0,x * 2,0,y * 2, gvar);\r
-               return(true);\r
-       }\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_ShutJoy() - Cleans up the joystick stuff\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_ShutJoy(word joy, global_game_variables_t *gvar)\r
-{\r
-       gvar->in.JoysPresent[joy] = false;\r
-}\r
-\r
-//     Public routines\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_Startup() - Starts up the Input Mgr\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_Startup(global_game_variables_t *gvar)\r
-{\r
-       boolean checkjoys,checkmouse;\r
-       word    i;\r
-\r
-       if (gvar->in.IN_Started)\r
-               return;\r
-\r
-       checkjoys = true;\r
-       checkmouse = true;\r
-       for (i = 1;i < _argc;i++)\r
-       {\r
-               switch (US_CheckParm(_argv[i],ParmStringsIN))\r
-               {\r
-               case 0:\r
-                       checkjoys = false;\r
-                       break;\r
-               case 1:\r
-                       checkmouse = false;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       INL_StartKbd(gvar);\r
-       gvar->in.MousePresent = checkmouse? INL_StartMouse() : false;\r
-\r
-       for (i = 0;i < MaxJoys;i++)\r
-               gvar->in.JoysPresent[i] = checkjoys? INL_StartJoy(i, gvar) : false;\r
-\r
-       //for (i = 0;i < MaxKbds;i++)\r
-       //      gvar->in.KbdDefs[i] = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/};\r
-\r
-       gvar->in.IN_Started = true;\r
-\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_Default() - Sets up default conditions for the Input Mgr\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar)\r
-{\r
-       int i;\r
-       if\r
-       (\r
-               (!gotit)\r
-       ||      ((nt == ctrl_Joystick1) && !gvar->in.JoysPresent[0])\r
-       ||      ((nt == ctrl_Joystick2) && !gvar->in.JoysPresent[1])\r
-       ||      ((nt == ctrl_Mouse) && !gvar->in.MousePresent)\r
-       )\r
-               nt = ctrl_Keyboard1;\r
-       gvar->in.KbdDefs[0].button0 = 0x1c;\r
-       gvar->in.KbdDefs[0].button1 = 0x38;\r
-       //in.KbdDefs[0].upleft = 0x47;\r
-       gvar->in.KbdDefs[0].up = 0x48;\r
-       //in.KbdDefs[0].upright = 0x49;\r
-       gvar->in.KbdDefs[0].left = 0x4b;\r
-       gvar->in.KbdDefs[0].right = 0x4d;\r
-       //in.KbdDefs[0].downleft = 0x4f;\r
-       gvar->in.KbdDefs[0].down = 0x50;\r
-       //in.KbdDefs[0].downright = 0x51;\r
-       IN_SetControlType(0,player,nt);\r
-       for(i=0; i>MaxPlayers;i++)\r
-               player[i].enti.d =2;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_Shutdown() - Shuts down the Input Mgr\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_Shutdown(global_game_variables_t *gvar)\r
-{\r
-       word    i;\r
-\r
-       if (!gvar->in.IN_Started)\r
-               return;\r
-\r
-       INL_ShutMouse();\r
-       for (i = 0;i < MaxJoys;i++)\r
-               INL_ShutJoy(i, gvar);\r
-       INL_ShutKbd();\r
-\r
-       gvar->in.IN_Started = false;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_SetKeyHook() - Sets the routine that gets called by INL_KeyService()\r
-//                     everytime a real make/break code gets hit\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_SetKeyHook(void (*hook)())\r
-{\r
-       INL_KeyHook = hook;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_ClearKeyDown() - Clears the keyboard array\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_ClearKeysDown(global_game_variables_t *gvar)\r
-{\r
-       //int   i;\r
-\r
-       gvar->in.LastScan = sc_None;\r
-       gvar->in.LastASCII = key_None;\r
-       memset (gvar->in.Keyboard,0,sizeof(gvar->in.Keyboard));\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_AdjustCursor() - Internal routine of common code from IN_ReadCursor()\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy)\r
-{\r
-       if (buttons & (1 << 0))\r
-               info->button0 = true;\r
-       if (buttons & (1 << 1))\r
-               info->button1 = true;\r
-\r
-       info->x += dx;\r
-       info->y += dy;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_ReadCursor() - Reads the input devices and fills in the cursor info\r
-//             struct\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_ReadCursor(CursorInfo *info, global_game_variables_t *gvar)\r
-{\r
-       word    i,\r
-                       buttons;\r
-       int             dx,dy;\r
-\r
-       info->x = info->y = 0;\r
-       info->button0 = info->button1 = false;\r
-\r
-       if (gvar->in.MousePresent)\r
-       {\r
-               buttons = INL_GetMouseButtons();\r
-               INL_GetMouseDelta(&dx,&dy);\r
-               INL_AdjustCursor(info,buttons,dx,dy);\r
-       }\r
-\r
-       for (i = 0;i < MaxJoys;i++)\r
-       {\r
-               if (!gvar->in.JoysPresent[i])\r
-                       continue;\r
-\r
-               buttons = INL_GetJoyButtons(i);\r
-               INL_GetJoyDelta(i,&dx,&dy,true, gvar);\r
-               dx /= 64;\r
-               dy /= 64;\r
-               INL_AdjustCursor(info,buttons,dx,dy);\r
-       }\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_ReadControl() - Reads the device associated with the specified\r
-//             player and fills in the control info struct\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void near\r
-IN_ReadControl(word pn, player_t *player, global_game_variables_t *gvar)\r
-{\r
-                       boolean         realdelta;\r
-#if DEMO0\r
-                       byte            dbyte;\r
-#endif\r
-                       word            buttons;\r
-                       int                     dx,dy;\r
-                       Motion          mx,my;\r
-                       ControlType     type;\r
-                       sword conpee;\r
-                       byte dir=DirTable[2];\r
-register       KeyboardDef     *def;\r
-\r
-       dx = dy = 0;\r
-       mx = my = motion_None;\r
-       buttons = 0;\r
-\r
-#if DEMO0\r
-       if (DemoMode == demo_Playback)\r
-       {\r
-               dbyte = DemoBuffer[DemoOffset + 1];\r
-               my = (dbyte & 3) - 1;\r
-               mx = ((dbyte >> 2) & 3) - 1;\r
-               buttons = (dbyte >> 4) & 3;\r
-\r
-               if (!(--DemoBuffer[DemoOffset]))\r
-               {\r
-                       DemoOffset += 2;\r
-                       if (DemoOffset >= DemoSize)\r
-                               DemoMode = demo_PlayDone;\r
-               }\r
-\r
-               realdelta = false;\r
-       }\r
-       else if (DemoMode == demo_PlayDone)\r
-               Quit ("Demo playback exceeded");\r
-       else\r
-       {\r
-#endif\r
-               switch (type = player[pn].Controls)\r
-               {\r
-               case ctrl_Keyboard1:\r
-               case ctrl_Keyboard2:\r
-                       def = &(gvar->in.KbdDefs[type - ctrl_Keyboard]);\r
-\r
-/*                     if (Keyboard[def->upleft])\r
-                               mx = motion_Left,my = motion_Up;\r
-                       else if (Keyboard[def->upright])\r
-                               mx = motion_Right,my = motion_Up;\r
-                       else if (Keyboard[def->downleft])\r
-                               mx = motion_Left,my = motion_Down;\r
-                       else if (Keyboard[def->downright])\r
-                               mx = motion_Right,my = motion_Down;*/\r
-//TODO: make this into a function that the joystick AND keyboard can use wwww\r
-                       if(DIRECTIONIFELSE)//(player[pn].info.dir == 2)\r
-                       {\r
-                       if(!gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right]){\r
-                               if((gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down]))\r
-                                       my = motion_Up;\r
-                               if((gvar->in.Keyboard[def->down] && !gvar->in.Keyboard[def->up]))\r
-                                       my = motion_Down;\r
-                       }else if(!gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down]){\r
-                               if((gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right]))\r
-                                       mx = motion_Left;\r
-                               if((gvar->in.Keyboard[def->right] && !gvar->in.Keyboard[def->left]))\r
-                                       mx = motion_Right;\r
-                       }else{  //2 keys pressed\r
-                                       switch (player[pn].pdir)\r
-                                       {\r
-                                               case 0:\r
-                                               case 4:\r
-                                                       if((gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right])){ dir = DirTable[1]; }//mx = motion_Left; }\r
-                                                       else if((gvar->in.Keyboard[def->right] && !gvar->in.Keyboard[def->left])){ dir = DirTable[3]; }//mx = motion_Right; }\r
-                                               break;\r
-                                               case 1:\r
-                                               case 3:\r
-                                                       if((gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down])){ dir = DirTable[0]; }//my = motion_Up; }\r
-                                                       else if((gvar->in.Keyboard[def->down] && !gvar->in.Keyboard[def->up])){ dir = DirTable[4]; }//my = motion_Down; }\r
-                                               break;\r
-                                               default:\r
-                                               break;\r
-                                       }\r
-#ifdef __DEBUG_InputMgr__\r
-                                       //if(dbg_testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c        ", dirchar(player[pn].pdir)); }\r
-#endif\r
-                               }\r
-                       }\r
-                       //input from player\r
-                       if (gvar->in.Keyboard[def->button0])\r
-                               buttons += 1 << 0;\r
-                       if (gvar->in.Keyboard[def->button1])\r
-                               buttons += 1 << 1;\r
-                       realdelta = false;\r
-                       break;\r
-               case ctrl_Joystick1:\r
-               case ctrl_Joystick2:\r
-                       INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy,false, gvar);\r
-                       buttons = INL_GetJoyButtons(type - ctrl_Joystick);\r
-                       realdelta = true;\r
-                       break;\r
-               case ctrl_Mouse:\r
-                       INL_GetMouseDelta(&dx,&dy);\r
-                       buttons = INL_GetMouseButtons();\r
-                       realdelta = true;\r
-                       break;\r
-               }\r
-#ifdef DEMO0\r
-       }\r
-#endif\r
-\r
-       if (realdelta)\r
-       {\r
-               mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None);\r
-               my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None);\r
-       }\r
-       else\r
-       {\r
-               dx = mx;// * 127;\r
-               dy = my;// * 127;\r
-       }\r
-\r
-       player[pn].info.x = dx;\r
-       player[pn].info.xaxis = mx;\r
-       player[pn].info.y = dy;\r
-       player[pn].info.yaxis = my;\r
-       player[pn].info.button0 = buttons & (1 << 0);\r
-       player[pn].info.button1 = buttons & (1 << 1);\r
-       player[pn].info.button2 = buttons & (1 << 2);\r
-       player[pn].info.button3 = buttons & (1 << 3);\r
-//     player[pn].info.dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
-       conpee=(((my + 1) * 2) + (mx + 1))-1;\r
-       player[pn].info.dir = DirTable[conpee];\r
-\r
-       if(DirTable[conpee]!=2) player[pn].pdir=DirTable[conpee];\r
-       if(player[pn].enti.q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None)))\r
-       {\r
-               if(dir==2) player[pn].enti.d = player[pn].info.dir;\r
-               else player[pn].enti.d = DirTable[dir];\r
-       }\r
-\r
-#if DEMO0\r
-       if (DemoMode == demo_Record)\r
-       {\r
-               // Pack the control info into a byte\r
-               dbyte = (buttons << 4) | ((mx + 1) << 2) | (my + 1);\r
-\r
-               if\r
-               (\r
-                       (DemoBuffer[DemoOffset + 1] == dbyte)\r
-               &&      (DemoBuffer[DemoOffset] < 255)\r
-               )\r
-                       (DemoBuffer[DemoOffset])++;\r
-               else\r
-               {\r
-                       if (DemoOffset || DemoBuffer[DemoOffset])\r
-                               DemoOffset += 2;\r
-\r
-                       if (DemoOffset >= DemoSize)\r
-                               Quit ("Demo buffer overflow");\r
-\r
-                       DemoBuffer[DemoOffset] = 1;\r
-                       DemoBuffer[DemoOffset + 1] = dbyte;\r
-               }\r
-       }\r
-#endif\r
-#ifdef __DEBUG_InputMgr__\r
-if(dbg_testcontrolnoisy > 0)\r
-if(player[pn].info.dir!=2/*(gvar->in.Keyboard[def->up] || gvar->in.Keyboard[def->down] || gvar->in.Keyboard[def->left] || gvar->in.Keyboard[def->right])*/ || player[pn].enti.q>1)\r
-{\r
-       //printf("b1=%u b2=%u b3=%u b4=%u       ", player[pn].info.button0, player[pn].info.button1, player[pn].info.button2, player[pn].info.button3);\r
-       //printf("q=%d ", player[pn].enti.q);\r
-       //printf("cpee=%c ", dirchar(conpee));\r
-       printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].enti.d), dirchar(player[pn].info.dir));\r
-       /*if(realdelta) */printf("dx=%d dy=%d   mx=%d   my=%d", player[pn].info.x, player[pn].info.y, player[pn].info.xaxis, player[pn].info.yaxis);\r
-       //else if(!realdelta) printf("%c%d %c%d %c%d %c%d", dirchar(0), gvar->in.Keyboard[def->up], dirchar(4), gvar->in.Keyboard[def->down], dirchar(1), gvar->in.Keyboard[def->left], dirchar(3), gvar->in.Keyboard[def->right]);\r
-       printf("\n");\r
-}\r
-#endif\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_SetControlType() - Sets the control type to be used by the specified\r
-//             player\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_SetControlType(word pn,player_t *player,ControlType type)\r
-{\r
-       // DEBUG - check that requested type is present?\r
-       player[pn].Controls = type;\r
-}\r
-\r
-#if DEMO0\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_StartDemoRecord() - Starts the demo recording, using a buffer the\r
-//             size passed. Returns if the buffer allocation was successful\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-boolean\r
-IN_StartDemoRecord(word bufsize)\r
-{\r
-       if (!bufsize)\r
-               return(false);\r
-\r
-       MM_GetPtr((memptr *)&DemoBuffer,bufsize);\r
-       DemoMode = demo_Record;\r
-       DemoSize = bufsize & ~1;\r
-       DemoOffset = 0;\r
-       DemoBuffer[0] = DemoBuffer[1] = 0;\r
-\r
-       return(true);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_StartDemoPlayback() - Plays back the demo pointed to of the given size\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize)\r
-{\r
-       DemoBuffer = buffer;\r
-       DemoMode = demo_Playback;\r
-       DemoSize = bufsize & ~1;\r
-       DemoOffset = 0;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_StopDemo() - Turns off demo mode\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_StopDemo(void)\r
-{\r
-       if ((DemoMode == demo_Record) && DemoOffset)\r
-               DemoOffset += 2;\r
-\r
-       DemoMode = demo_Off;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_FreeDemoBuffer() - Frees the demo buffer, if it's been allocated\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_FreeDemoBuffer(void)\r
-{\r
-       if (DemoBuffer)\r
-               MM_FreePtr((memptr *)&DemoBuffer);\r
-}\r
-#endif\r
-\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_GetScanName() - Returns a string containing the name of the\r
-//             specified scan code\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-byte *\r
-IN_GetScanName(ScanCode scan)\r
-{\r
-       byte            **p;\r
-       ScanCode        far *s;\r
-\r
-       for (s = ExtScanCodes,p = ExtScanNames;*s;p++,s++)\r
-               if (*s == scan)\r
-                       return(*p);\r
-\r
-       return(ScanNames[scan]);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_WaitForKey() - Waits for a scan code, then clears LastScan and\r
-//             returns the scan code\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-ScanCode\r
-IN_WaitForKey(global_game_variables_t *gvar)\r
-{\r
-       ScanCode        result;\r
-\r
-       while (!(result = gvar->in.LastScan))\r
-               ;\r
-       gvar->in.LastScan = 0;\r
-       return(result);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and\r
-//             returns the ASCII value\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-char\r
-IN_WaitForASCII(global_game_variables_t *gvar)\r
-{\r
-       char            result;\r
-\r
-       while (!(result = gvar->in.LastASCII))\r
-               ;\r
-       gvar->in.LastASCII = '\0';\r
-       return(result);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_AckBack() - Waits for either an ASCII keypress or a button press\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_AckBack(global_game_variables_t *gvar)\r
-{\r
-       word    i;\r
-\r
-       while (!gvar->in.LastScan)\r
-       {\r
-               if (gvar->in.MousePresent)\r
-               {\r
-                       if (INL_GetMouseButtons())\r
-                       {\r
-                               while (INL_GetMouseButtons())\r
-                                       ;\r
-                               return;\r
-                       }\r
-               }\r
-\r
-               for (i = 0;i < MaxJoys;i++)\r
-               {\r
-                       if (gvar->in.JoysPresent[i])\r
-                       {\r
-                               if (IN_GetJoyButtonsDB(i, gvar))\r
-                               {\r
-                                       while (IN_GetJoyButtonsDB(i, gvar))\r
-                                               ;\r
-                                       return;\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       IN_ClearKey(gvar->in.LastScan, gvar);\r
-       gvar->in.LastScan = sc_None;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_Ack() - Clears user input & then calls IN_AckBack()\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_Ack(global_game_variables_t *gvar)\r
-{\r
-       word    i;\r
-\r
-       if (!gvar->in.IN_Started)\r
-               return;\r
-\r
-       IN_ClearKey(gvar->in.LastScan, gvar);\r
-       gvar->in.LastScan = sc_None;\r
-\r
-       if (gvar->in.MousePresent)\r
-               while (INL_GetMouseButtons())\r
-                                       ;\r
-       for (i = 0;i < MaxJoys;i++)\r
-               if (gvar->in.JoysPresent[i])\r
-                       while (IN_GetJoyButtonsDB(i, gvar))\r
-                               ;\r
-\r
-       IN_AckBack(gvar);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_IsUserInput() - Returns true if a key has been pressed or a button\r
-//             is down\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-boolean\r
-IN_IsUserInput(global_game_variables_t *gvar)\r
-{\r
-       boolean result;\r
-       word    i;\r
-\r
-       result = gvar->in.LastScan;\r
-\r
-       if (gvar->in.MousePresent)\r
-               if (INL_GetMouseButtons())\r
-                       result = true;\r
-\r
-       for (i = 0;i < MaxJoys;i++)\r
-               if (gvar->in.JoysPresent[i])\r
-                       if (INL_GetJoyButtons(i))\r
-                               result = true;\r
-\r
-       return(result);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_UserInput() - Waits for the specified delay time (in ticks) or the\r
-//             user pressing a key or a mouse button. If the clear flag is set, it\r
-//             then either clears the key or waits for the user to let the mouse\r
-//             button up.\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-boolean\r
-IN_UserInput(dword delay,boolean clear, global_game_variables_t *gvar)\r
-{\r
-       word TimeCount = gvar->kurokku.clock_start;\r
-       word    lasttime;\r
-\r
-       lasttime = TimeCount;\r
-       do\r
-       {\r
-               if (IN_IsUserInput(gvar))\r
-               {\r
-                       if (clear)\r
-                               IN_AckBack(gvar);\r
-                       return(true);\r
-               }\r
-       } while (TimeCount - lasttime < delay);\r
-       return(false);\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-===================\r
-=\r
-= IN_MouseButtons\r
-=\r
-===================\r
-*/\r
-\r
-byte   IN_MouseButtons (global_game_variables_t *gvar)\r
-{\r
-       union REGS CPURegs;\r
-       if (gvar->in.MousePresent)\r
-       {\r
-               Mouse(MButtons);\r
-               return CPURegs.x.bx;\r
-       }\r
-       else\r
-               return 0;\r
-}\r
-\r
-\r
-/*\r
-===================\r
-=\r
-= IN_JoyButtons\r
-=\r
-===================\r
-*/\r
-\r
-byte   IN_JoyButtons (void)\r
-{\r
-       byte joybits;\r
-\r
-       joybits = inp(0x201);   // Get all the joystick buttons\r
-       joybits >>= 4;                          // only the high bits are useful\r
-       joybits ^= 15;                          // return with 1=pressed\r
-\r
-       return joybits;\r
-}\r
-\r
-boolean IN_KeyDown(byte code, global_game_variables_t *gvar)\r
-{\r
-#ifdef __DEBUG_InputMgr__\r
-       if(!dbg_nointest)\r
-#endif\r
-       return gvar->in.Keyboard[code];\r
-#ifdef __DEBUG_InputMgr__\r
-       else\r
-               if(dbg_nointest && kbhit())\r
-                       return 1;\r
-               else\r
-                       return 0;\r
-#endif\r
-}\r
-\r
-void IN_ClearKey(byte code, global_game_variables_t *gvar)\r
-{\r
-       gvar->in.Keyboard[code] = false;\r
-       if(code == gvar->in.LastScan)\r
-               gvar->in.LastScan = sc_None;\r
-       }\r
-\r
-boolean IN_qb(byte kee, global_game_variables_t *gvar)\r
-{\r
-#ifdef __DEBUG_InputMgr__\r
-       if(dbg_testkeyin) printf("%u\n", gvar->in.Keyboard[kee]);\r
-#endif\r
-       if(gvar->in.Keyboard[kee]==true) return 1;\r
-       else return 0;\r
-}\r
-\r
-ScanCode IN_GetLastScan(global_game_variables_t *gvar)\r
-{\r
-       return gvar->in.LastScan;\r
-}\r
-\r
-ScanCode IN_GetCurCode(global_game_variables_t *gvar)\r
-{\r
-       return gvar->in.CurCode;\r
-}\r
diff --git a/src/lib/16_in_.h b/src/lib/16_in_.h
deleted file mode 100755 (executable)
index f84b3a4..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/* 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
-//\r
-//     ID Engine\r
-//     ID_IN.h - Header file for Input Manager\r
-//     v1.0d1w\r
-//     By Jason Blochowiak\r
-//     Open Watcom port by sparky4\r
-//\r
-\r
-#ifndef        __16_IN__\r
-#define        __16_IN__\r
-\r
-#include <string.h>\r
-#include "src/lib/16_head.h"\r
-#include "src/lib/16_timer.h"\r
-#ifdef __WATCOMC__     //borland C BCEXMM.EXE\r
-#include "src/lib/16_dbg.h"\r
-#include "src/lib/16_spri.h"\r
-#include "src/lib/16_enti.h"\r
-//#include "src/lib/bitmap.h"  //old format\r
-#endif\r
-\r
-//if else for gfxtesting and direction\r
-//player[pn].d == 2 ||\r
-//player[pn].d != 2 ||\r
-#define DIRECTIONIFELSE        (player[pn].info.dir == 2)\r
-//#define NDIRECTIONIFELSE     (player[pn].info.dir != 2)\r
-\r
-#define        KeyInt  9       // The keyboard ISR number\r
-\r
-// Stuff for the joystick\r
-#define        JoyScaleMax             32768\r
-#define        JoyScaleShift   8\r
-#define        MaxJoyValue             5000\r
-\r
-//#define      MaxPlayers              2//future plans for multiple playable charaters and being able to alternate\r
-#define        MaxKbds         2\r
-#define        MaxJoys         2\r
-#define        MaxPads         2\r
-#define        NumCodes        128\r
-\r
-//typedef      byte            ScanCode;\r
-#define        sc_None                 0\r
-#define        sc_Bad                  0xff\r
-#define        sc_Return               0x1c\r
-#define        sc_Enter                sc_Return\r
-#define        sc_Escape               0x01\r
-#define        sc_Space                0x39\r
-#define        sc_BackSpace    0x0e\r
-#define        sc_Tab                  0x0f\r
-#define        sc_Alt                  0x38\r
-#define        sc_Control              0x1d\r
-#define        sc_CapsLock             0x3a\r
-#define        sc_LShift               0x2a\r
-#define        sc_RShift               0x36\r
-#define        sc_UpArrow              0x48\r
-#define        sc_DownArrow    0x50\r
-#define        sc_LeftArrow    0x4b\r
-#define        sc_RightArrow   0x4d\r
-#define        sc_Insert               0x52\r
-#define        sc_Delete               0x53\r
-#define        sc_Home                 0x47\r
-#define        sc_End                  0x4f\r
-#define        sc_PgUp                 0x49\r
-#define        sc_PgDn                 0x51\r
-#define        sc_F1                   0x3b\r
-#define        sc_F2                   0x3c\r
-#define        sc_F3                   0x3d\r
-#define        sc_F4                   0x3e\r
-#define        sc_F5                   0x3f\r
-#define        sc_F6                   0x40\r
-#define        sc_F7                   0x41\r
-#define        sc_F8                   0x42\r
-#define        sc_F9                   0x43\r
-#define        sc_F10                  0x44\r
-#define        sc_F11                  0x57\r
-#define        sc_F12                  0x59\r
-\r
-#define        sc_1                    0x02\r
-#define        sc_2                    0x03\r
-#define        sc_3                    0x04\r
-#define        sc_4                    0x05\r
-#define        sc_5                    0x06\r
-#define        sc_6                    0x07\r
-#define        sc_7                    0x08\r
-#define        sc_8                    0x09\r
-#define        sc_9                    0x0a\r
-#define        sc_0                    0x0b\r
-\r
-#define        sc_A                    0x1e\r
-#define        sc_B                    0x30\r
-#define        sc_C                    0x2e\r
-#define        sc_D                    0x20\r
-#define        sc_E                    0x12\r
-#define        sc_F                    0x21\r
-#define        sc_G                    0x22\r
-#define        sc_H                    0x23\r
-#define        sc_I                    0x17\r
-#define        sc_J                    0x24\r
-#define        sc_K                    0x25\r
-#define        sc_L                    0x26\r
-#define        sc_M                    0x32\r
-#define        sc_N                    0x31\r
-#define        sc_O                    0x18\r
-#define        sc_P                    0x19\r
-#define        sc_Q                    0x10\r
-#define        sc_R                    0x13\r
-#define        sc_S                    0x1f\r
-#define        sc_T                    0x14\r
-#define        sc_U                    0x16\r
-#define        sc_V                    0x2f\r
-#define        sc_W                    0x11\r
-#define        sc_X                    0x2d\r
-#define        sc_Y                    0x15\r
-#define        sc_Z                    0x2c\r
-\r
-#define        key_None                0\r
-#define        key_Return              0x0d\r
-#define        key_Enter               key_Return\r
-#define        key_Escape              0x1b\r
-#define        key_Space               0x20\r
-#define        key_BackSpace   0x08\r
-#define        key_Tab                 0x09\r
-#define        key_Delete              0x7f\r
-\r
-#define        key_LSuper                      0x5b\r
-#define        key_RSuper                      0x5c\r
-#define        key_Menu                        0x5d\r
-\r
-//     Stuff for the mouse\r
-#define        MReset          0\r
-#define        MButtons        3\r
-#define        MDelta          11\r
-\r
-#define        MouseInt        0x33\r
-#ifdef DEMO0\r
-typedef        enum            {\r
-                                               demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
-                                       } Demo;\r
-#endif\r
-//moved to 16_tdef.h\r
-/*typedef      enum            {\r
-                                               //ctrl_None,                            // MDM (GAMERS EDGE) - added\r
-                                               ctrl_Keyboard,\r
-                                                       ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
-                                               ctrl_Joystick,\r
-                                                       ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
-                                               ctrl_Mouse,\r
-                                       } ControlType;\r
-typedef        enum            {\r
-                                               motion_Left = -1,motion_Up = -1,\r
-                                               motion_None = 0,\r
-                                               motion_Right = 1,motion_Down = 1\r
-                                       } Motion;\r
-typedef        enum            {\r
-                                               dir_North,//dir_NorthEast,\r
-                                               dir_West,//dir_Nortinest,\r
-                                               dir_None,\r
-                                               dir_East,//,dir_SouthEast,\r
-                                               dir_South,//dir_Soutinest,\r
-                                       } Direction;\r
-typedef        struct          {\r
-                                               boolean near    button0,button1,button2,button3;\r
-                                               int     near            x,y;\r
-                                               Motion  near    xaxis,yaxis;\r
-                                               Direction near  dir;\r
-                                       } CursorInfo;\r
-\r
-typedef        struct          {\r
-                                               ScanCode near   button0,button1,\r
-                                                                       //upleft,\r
-                                                                       up,\r
-                                                                       down,\r
-                                                                       left,\r
-                                                                       right\r
-                                                                       //upright,\r
-                                                                       //downleft,\r
-                                                                       //,downright\r
-                                                                       ;\r
-                                       } KeyboardDef;\r
-typedef        struct          {\r
-                                               word    near    joyMinX,joyMinY,\r
-                                                                       threshMinX,threshMinY,\r
-                                                                       threshMaxX,threshMaxY,\r
-                                                                       joyMaxX,joyMaxY,\r
-                                                                       joyMultXL,joyMultYL,\r
-                                                                       joyMultXH,joyMultYH;\r
-                                       } JoystickDef;*/\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                       GLOBAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-#ifdef DEMO0\r
-               static Demo             DemoMode = demo_Off;\r
-               static byte /*_seg*/    *DemoBuffer;\r
-               static word             DemoOffset,DemoSize;\r
-#endif\r
-\r
-//     Internal routines\r
-//void interrupt INL_KeyService(global_game_variables_t *gvar);\r
-void Mouse(int x);\r
-//static void INL_GetMouseDelta(int *x,int *y);\r
-//static word INL_GetMouseButtons(void);\r
-void IN_GetJoyAbs(word joy,word *xp,word *yp);\r
-//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);\r
-//static word INL_GetJoyButtons(word joy);\r
-word IN_GetJoyButtonsDB(word joy, global_game_variables_t *gvar);\r
-//static void INL_StartKbd(void);\r
-//static void INL_ShutKbd(void);\r
-//static boolean INL_StartMouse(void);\r
-//static void INL_ShutMouse(void);\r
-//static void INL_SetJoyScale(word joy);\r
-void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy, global_game_variables_t *gvar);\r
-//static boolean INL_StartJoy(word joy);\r
-//static void INL_ShutJoy(word joy);\r
-void IN_Startup(global_game_variables_t *gvar);\r
-void IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar);\r
-void IN_Shutdown(global_game_variables_t *gvar);\r
-void IN_SetKeyHook(void (*hook)());\r
-void IN_ClearKeysDown(global_game_variables_t *gvar);\r
-//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);\r
-void IN_ReadCursor(CursorInfo *info, global_game_variables_t *gvar);\r
-void near IN_ReadControl(word pn, player_t *player, global_game_variables_t *gvar);\r
-void IN_SetControlType(word pn,player_t *player,ControlType type);\r
-#if DEMO0\r
-boolean IN_StartDemoRecord(word bufsize);\r
-void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
-void IN_StopDemo(void);\r
-void IN_FreeDemoBuffer(void);\r
-#endif\r
-byte *IN_GetScanName(ScanCode scan);\r
-ScanCode IN_WaitForKey(global_game_variables_t *gvar);\r
-char IN_WaitForASCII(global_game_variables_t *gvar);\r
-void IN_AckBack(global_game_variables_t *gvar);\r
-void IN_Ack(global_game_variables_t *gvar);\r
-boolean IN_IsUserInput(global_game_variables_t *gvar);\r
-boolean IN_UserInput(dword delay,boolean clear, global_game_variables_t *gvar);\r
-boolean IN_KeyDown(byte code, global_game_variables_t *gvar);\r
-void IN_ClearKey(byte code, global_game_variables_t *gvar);\r
-boolean IN_qb(byte kee, global_game_variables_t *gvar);\r
-ScanCode IN_GetLastScan(global_game_variables_t *gvar);\r
-ScanCode IN_GetCurCode(global_game_variables_t *gvar);\r
-\r
-#endif\r
diff --git a/src/lib/16_in__.c b/src/lib/16_in__.c
deleted file mode 100755 (executable)
index 2534af7..0000000
+++ /dev/null
@@ -1,991 +0,0 @@
-//\r
-//     ID Engine\r
-//     ID_IN.c - Input Manager\r
-//     v1.0d1w\r
-//     By Jason Blochowiak\r
-//     Open Watcom port by sparky4\r
-//\r
-\r
-//\r
-//     This module handles dealing with the various input devices\r
-//\r
-//     Depends on: Memory Mgr (for demo recording), Sound Mgr (for timing stuff),\r
-//                             User Mgr (for command line parms)\r
-//\r
-//     Globals:\r
-//             LastScan - The keyboard scan code of the last key pressed\r
-//             LastASCII - The ASCII value of the last key pressed\r
-//     DEBUG - there are more globals\r
-//\r
-\r
-#include "src/lib/16_in__.h"\r
-#pragma        hdrstop\r
-\r
-#define        KeyInt          9       // The keyboard ISR number\r
-\r
-//\r
-// mouse constants\r
-//\r
-#define        MReset          0\r
-#define        MButtons        3\r
-#define        MDelta          11\r
-\r
-#define        MouseInt        0x33\r
-#define        Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
-\r
-//\r
-// joystick constants\r
-//\r
-#define        JoyScaleMax             32768\r
-#define        JoyScaleShift   8\r
-#define        MaxJoyValue             5000\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                       GLOBAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-\r
-//\r
-// configuration variables\r
-//\r
-boolean                        MousePresent;\r
-boolean                        JoysPresent[MaxJoys];\r
-boolean                        JoyPadPresent;\r
-\r
-\r
-//     Global variables\r
-               boolean         Keyboard[NumCodes];\r
-               boolean         Paused;\r
-               char            LastASCII;\r
-               ScanCode        LastScan;\r
-\r
-               KeyboardDef     KbdDefs = {{0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51}};\r
-               JoystickDef     JoyDefs[MaxJoys];\r
-               ControlType     Controls[MaxPlayers];\r
-\r
-               dword   MouseDownCount;\r
-\r
-               Demo            DemoMode = demo_Off;\r
-               byte _seg       *DemoBuffer;\r
-               word            DemoOffset,DemoSize;\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                       LOCAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-static byte        far ASCIINames[] =          // Unshifted ASCII for scan codes\r
-                                       {\r
-//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
-       0  ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8  ,9  ,        // 0\r
-       'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0  ,'a','s',        // 1\r
-       'd','f','g','h','j','k','l',';',39 ,'`',0  ,92 ,'z','x','c','v',        // 2\r
-       'b','n','m',',','.','/',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',        // 4\r
-       '2','3','0',127,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
-                                       },\r
-                                       far ShiftNames[] =              // Shifted ASCII for scan codes\r
-                                       {\r
-//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
-       0  ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',8  ,9  ,        // 0\r
-       'Q','W','E','R','T','Y','U','I','O','P','{','}',13 ,0  ,'A','S',        // 1\r
-       'D','F','G','H','J','K','L',':',34 ,'~',0  ,'|','Z','X','C','V',        // 2\r
-       'B','N','M','<','>','?',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',        // 4\r
-       '2','3','0',127,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
-                                       },\r
-                                       far SpecialNames[] =    // ASCII for 0xe0 prefixed codes\r
-                                       {\r
-//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 0\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,13 ,0  ,0  ,0  ,        // 1\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 2\r
-       0  ,0  ,0  ,0  ,0  ,'/',0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 4\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
-       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
-                                       };\r
-\r
-\r
-static boolean         IN_Started;\r
-static boolean         CapsLock;\r
-static ScanCode        CurCode,LastCode;\r
-\r
-static Direction       DirTable[] =            // Quick lookup for total direction\r
-                                       {\r
-                                               dir_NorthWest,  dir_North,      dir_NorthEast,\r
-                                               dir_West,               dir_None,       dir_East,\r
-                                               dir_SouthWest,  dir_South,      dir_SouthEast\r
-                                       };\r
-\r
-static void                    (*INL_KeyHook)(void);\r
-static void interrupt  (*OldKeyVect)(void);\r
-\r
-static char                    *ParmStrings[] = {"nojoys","nomouse",nil};\r
-\r
-//     Internal routines\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_KeyService() - Handles a keyboard interrupt (key up/down)\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void interrupt\r
-INL_KeyService(void)\r
-{\r
-static boolean special;\r
-               byte    k,c,\r
-                               temp;\r
-               int             i;\r
-\r
-       k = inp(0x60);  // Get the scan code\r
-\r
-       // Tell the XT keyboard controller to clear the key\r
-       outportb(0x61,(temp = inp(0x61)) | 0x80);\r
-       outportb(0x61,temp);\r
-\r
-       if (k == 0xe0)          // Special key prefix\r
-               special = true;\r
-       else if (k == 0xe1)     // Handle Pause key\r
-               Paused = true;\r
-       else\r
-       {\r
-               if (k & 0x80)   // Break code\r
-               {\r
-                       k &= 0x7f;\r
-\r
-// DEBUG - handle special keys: ctl-alt-delete, print scrn\r
-\r
-                       Keyboard[k] = false;\r
-               }\r
-               else                    // Make code\r
-               {\r
-                       LastCode = CurCode;\r
-                       CurCode = LastScan = k;\r
-                       Keyboard[k] = true;\r
-\r
-                       if (special)\r
-                               c = SpecialNames[k];\r
-                       else\r
-                       {\r
-                               if (k == sc_CapsLock)\r
-                               {\r
-                                       CapsLock ^= true;\r
-                                       // DEBUG - make caps lock light work\r
-                               }\r
-\r
-                               if (Keyboard[sc_LShift] || Keyboard[sc_RShift]) // If shifted\r
-                               {\r
-                                       c = ShiftNames[k];\r
-                                       if ((c >= 'A') && (c <= 'Z') && CapsLock)\r
-                                               c += 'a' - 'A';\r
-                               }\r
-                               else\r
-                               {\r
-                                       c = ASCIINames[k];\r
-                                       if ((c >= 'a') && (c <= 'z') && CapsLock)\r
-                                               c -= 'a' - 'A';\r
-                               }\r
-                       }\r
-                       if (c)\r
-                               LastASCII = c;\r
-               }\r
-\r
-               special = false;\r
-       }\r
-\r
-       if (INL_KeyHook && !special)\r
-               INL_KeyHook();\r
-       outportb(0x20,0x20);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_GetMouseDelta() - Gets the amount that the mouse has moved from the\r
-//             mouse driver\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_GetMouseDelta(int *x,int *y)\r
-{\r
-       Mouse(MDelta);\r
-       *x = _CX;\r
-       *y = _DX;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_GetMouseButtons() - Gets the status of the mouse buttons from the\r
-//             mouse driver\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static word\r
-INL_GetMouseButtons(void)\r
-{\r
-       word    buttons;\r
-\r
-       Mouse(MButtons);\r
-       buttons = _BX;\r
-       return(buttons);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_GetJoyAbs() - Reads the absolute position of the specified joystick\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_GetJoyAbs(word joy,word *xp,word *yp)\r
-{\r
-       byte    xb,yb,\r
-                       xs,ys;\r
-       word    x,y;\r
-\r
-       x = y = 0;\r
-       xs = joy? 2 : 0;                // Find shift value for x axis\r
-       xb = 1 << xs;                   // Use shift value to get x bit mask\r
-       ys = joy? 3 : 1;                // Do the same for y axis\r
-       yb = 1 << ys;\r
-\r
-// Read the absolute joystick values\r
-asm            pushf                           // Save some registers\r
-asm            push    si\r
-asm            push    di\r
-asm            cli                                     // Make sure an interrupt doesn't screw the timings\r
-\r
-\r
-asm            mov             dx,0x201\r
-asm            in              al,dx\r
-asm            out             dx,al           // Clear the resistors\r
-\r
-asm            mov             ah,[xb]         // Get masks into registers\r
-asm            mov             ch,[yb]\r
-\r
-asm            xor             si,si           // Clear count registers\r
-asm            xor             di,di\r
-asm            xor             bh,bh           // Clear high byte of bx for later\r
-\r
-asm            push    bp                      // Don't mess up stack frame\r
-asm            mov             bp,MaxJoyValue\r
-\r
-loop:\r
-asm            in              al,dx           // Get bits indicating whether all are finished\r
-\r
-asm            dec             bp                      // Check bounding register\r
-asm            jz              done            // We have a silly value - abort\r
-\r
-asm            mov             bl,al           // Duplicate the bits\r
-asm            and             bl,ah           // Mask off useless bits (in [xb])\r
-asm            add             si,bx           // Possibly increment count register\r
-asm            mov             cl,bl           // Save for testing later\r
-\r
-asm            mov             bl,al\r
-asm            and             bl,ch           // [yb]\r
-asm            add             di,bx\r
-\r
-asm            add             cl,bl\r
-asm            jnz             loop            // If both bits were 0, drop out\r
-\r
-done:\r
-asm     pop            bp\r
-\r
-asm            mov             cl,[xs]         // Get the number of bits to shift\r
-asm            shr             si,cl           //  and shift the count that many times\r
-\r
-asm            mov             cl,[ys]\r
-asm            shr             di,cl\r
-\r
-asm            mov             [x],si          // Store the values into the variables\r
-asm            mov             [y],di\r
-\r
-asm            pop             di\r
-asm            pop             si\r
-asm            popf                            // Restore the registers\r
-\r
-       *xp = x;\r
-       *yp = y;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_GetJoyDelta() - Returns the relative movement of the specified\r
-//             joystick (from +/-127)\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void INL_GetJoyDelta(word joy,int *dx,int *dy)\r
-{\r
-       word            x,y;\r
-       dword   time;\r
-       JoystickDef     *def;\r
-static dword   lasttime;\r
-\r
-       IN_GetJoyAbs(joy,&x,&y);\r
-       def = JoyDefs + joy;\r
-\r
-       if (x < def->threshMinX)\r
-       {\r
-               if (x < def->joyMinX)\r
-                       x = def->joyMinX;\r
-\r
-               x = -(x - def->threshMinX);\r
-               x *= def->joyMultXL;\r
-               x >>= JoyScaleShift;\r
-               *dx = (x > 127)? -127 : -x;\r
-       }\r
-       else if (x > def->threshMaxX)\r
-       {\r
-               if (x > def->joyMaxX)\r
-                       x = def->joyMaxX;\r
-\r
-               x = x - def->threshMaxX;\r
-               x *= def->joyMultXH;\r
-               x >>= JoyScaleShift;\r
-               *dx = (x > 127)? 127 : x;\r
-       }\r
-       else\r
-               *dx = 0;\r
-\r
-       if (y < def->threshMinY)\r
-       {\r
-               if (y < def->joyMinY)\r
-                       y = def->joyMinY;\r
-\r
-               y = -(y - def->threshMinY);\r
-               y *= def->joyMultYL;\r
-               y >>= JoyScaleShift;\r
-               *dy = (y > 127)? -127 : -y;\r
-       }\r
-       else if (y > def->threshMaxY)\r
-       {\r
-               if (y > def->joyMaxY)\r
-                       y = def->joyMaxY;\r
-\r
-               y = y - def->threshMaxY;\r
-               y *= def->joyMultYH;\r
-               y >>= JoyScaleShift;\r
-               *dy = (y > 127)? 127 : y;\r
-       }\r
-       else\r
-               *dy = 0;\r
-\r
-       lasttime = TimeCount;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_GetJoyButtons() - Returns the button status of the specified\r
-//             joystick\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static word\r
-INL_GetJoyButtons(word joy)\r
-{\r
-register       word    result;\r
-\r
-       result = inp(0x201);    // Get all the joystick buttons\r
-       result >>= joy? 6 : 4;  // Shift into bits 0-1\r
-       result &= 3;                            // Mask off the useless bits\r
-       result ^= 3;\r
-       return(result);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_GetJoyButtonsDB() - Returns the de-bounced button status of the\r
-//             specified joystick\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-word\r
-IN_GetJoyButtonsDB(word joy)\r
-{\r
-       dword   lasttime;\r
-       word            result1,result2;\r
-\r
-       do\r
-       {\r
-               result1 = INL_GetJoyButtons(joy);\r
-               lasttime = TimeCount;\r
-               while (TimeCount == lasttime)\r
-                       ;\r
-               result2 = INL_GetJoyButtons(joy);\r
-       } while (result1 != result2);\r
-       return(result1);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_StartKbd() - Sets up my keyboard stuff for use\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_StartKbd(void)\r
-{\r
-       INL_KeyHook = NULL;                     // no key hook routine\r
-\r
-       IN_ClearKeysDown();\r
-\r
-       OldKeyVect = getvect(KeyInt);\r
-       setvect(KeyInt,INL_KeyService);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_ShutKbd() - Restores keyboard control to the BIOS\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_ShutKbd(void)\r
-{\r
-       poke(0x40,0x17,peek(0x40,0x17) & 0xfaf0);       // Clear ctrl/alt/shift flags\r
-\r
-       setvect(KeyInt,OldKeyVect);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_StartMouse() - Detects and sets up the mouse\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static boolean\r
-INL_StartMouse(void)\r
-{\r
-#if 0\r
-       if (getvect(MouseInt))\r
-       {\r
-               Mouse(MReset);\r
-               if (_AX == 0xffff)\r
-                       return(true);\r
-       }\r
-       return(false);\r
-#endif\r
- union REGS regs;\r
- unsigned char far *vector;\r
-\r
-\r
- if ((vector=MK_FP(peek(0,0x33*4+2),peek(0,0x33*4)))==NULL)\r
-   return false;\r
-\r
- if (*vector == 207)\r
-   return false;\r
-\r
- Mouse(MReset);\r
- return true;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_ShutMouse() - Cleans up after the mouse\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_ShutMouse(void)\r
-{\r
-}\r
-\r
-//\r
-//     INL_SetJoyScale() - Sets up scaling values for the specified joystick\r
-//\r
-static void\r
-INL_SetJoyScale(word joy)\r
-{\r
-       JoystickDef     *def;\r
-\r
-       def = &JoyDefs[joy];\r
-       def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX);\r
-       def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX);\r
-       def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY);\r
-       def->joyMultYH = JoyScaleMax / (def->joyMaxY - def->threshMaxY);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale()\r
-//             to set up scaling values\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)\r
-{\r
-       word            d,r;\r
-       JoystickDef     *def;\r
-\r
-       def = &JoyDefs[joy];\r
-\r
-       def->joyMinX = minx;\r
-       def->joyMaxX = maxx;\r
-       r = maxx - minx;\r
-       d = r / 3;\r
-       def->threshMinX = ((r / 2) - d) + minx;\r
-       def->threshMaxX = ((r / 2) + d) + minx;\r
-\r
-       def->joyMinY = miny;\r
-       def->joyMaxY = maxy;\r
-       r = maxy - miny;\r
-       d = r / 3;\r
-       def->threshMinY = ((r / 2) - d) + miny;\r
-       def->threshMaxY = ((r / 2) + d) + miny;\r
-\r
-       INL_SetJoyScale(joy);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_StartJoy() - Detects & auto-configures the specified joystick\r
-//                                     The auto-config assumes the joystick is centered\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static boolean\r
-INL_StartJoy(word joy)\r
-{\r
-       word            x,y;\r
-\r
-       IN_GetJoyAbs(joy,&x,&y);\r
-\r
-       if\r
-       (\r
-               ((x == 0) || (x > MaxJoyValue - 10))\r
-       ||      ((y == 0) || (y > MaxJoyValue - 10))\r
-       )\r
-               return(false);\r
-       else\r
-       {\r
-               IN_SetupJoy(joy,0,x * 2,0,y * 2);\r
-               return(true);\r
-       }\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     INL_ShutJoy() - Cleans up the joystick stuff\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static void\r
-INL_ShutJoy(word joy)\r
-{\r
-       JoysPresent[joy] = false;\r
-}\r
-\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_Startup() - Starts up the Input Mgr\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_Startup(void)\r
-{\r
-       boolean checkjoys,checkmouse;\r
-       word    i;\r
-\r
-       if (IN_Started)\r
-               return;\r
-\r
-       checkjoys = true;\r
-       checkmouse = true;\r
-       for (i = 1;i < _argc;i++)\r
-       {\r
-               switch (US_CheckParm(_argv[i],ParmStrings))\r
-               {\r
-               case 0:\r
-                       checkjoys = false;\r
-                       break;\r
-               case 1:\r
-                       checkmouse = false;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       INL_StartKbd();\r
-       MousePresent = checkmouse? INL_StartMouse() : false;\r
-\r
-       for (i = 0;i < MaxJoys;i++)\r
-               JoysPresent[i] = checkjoys? INL_StartJoy(i) : false;\r
-\r
-       IN_Started = true;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_Default() - Sets up default conditions for the Input Mgr\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_Default(boolean gotit,ControlType in)\r
-{\r
-       if\r
-       (\r
-               (!gotit)\r
-       ||      ((in == ctrl_Joystick1) && !JoysPresent[0])\r
-       ||      ((in == ctrl_Joystick2) && !JoysPresent[1])\r
-       ||      ((in == ctrl_Mouse) && !MousePresent)\r
-       )\r
-               in = ctrl_Keyboard1;\r
-       IN_SetControlType(0,in);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_Shutdown() - Shuts down the Input Mgr\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_Shutdown(void)\r
-{\r
-       word    i;\r
-\r
-       if (!IN_Started)\r
-               return;\r
-\r
-       INL_ShutMouse();\r
-       for (i = 0;i < MaxJoys;i++)\r
-               INL_ShutJoy(i);\r
-       INL_ShutKbd();\r
-\r
-       IN_Started = false;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_SetKeyHook() - Sets the routine that gets called by INL_KeyService()\r
-//                     everytime a real make/break code gets hit\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_SetKeyHook(void (*hook)())\r
-{\r
-       INL_KeyHook = hook;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_ClearKeysDown() - Clears the keyboard array\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_ClearKeysDown(void)\r
-{\r
-       int     i;\r
-\r
-       LastScan = sc_None;\r
-       LastASCII = key_None;\r
-       memset (Keyboard,0,sizeof(Keyboard));\r
-}\r
-\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_ReadControl() - Reads the device associated with the specified\r
-//             player and fills in the control info struct\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_ReadControl(int player,CursorInfo *info)\r
-{\r
-                       boolean         realdelta;\r
-                       byte            dbyte;\r
-                       word            buttons;\r
-                       int                     dx,dy;\r
-                       Motion          mx,my;\r
-                       ControlType     type;\r
-register       KeyboardDef     *def;\r
-\r
-       dx = dy = 0;\r
-       mx = my = motion_None;\r
-       buttons = 0;\r
-\r
-       if (DemoMode == demo_Playback)\r
-       {\r
-               dbyte = DemoBuffer[DemoOffset + 1];\r
-               my = (dbyte & 3) - 1;\r
-               mx = ((dbyte >> 2) & 3) - 1;\r
-               buttons = (dbyte >> 4) & 3;\r
-\r
-               if (!(--DemoBuffer[DemoOffset]))\r
-               {\r
-                       DemoOffset += 2;\r
-                       if (DemoOffset >= DemoSize)\r
-                               DemoMode = demo_PlayDone;\r
-               }\r
-\r
-               realdelta = false;\r
-       }\r
-       else if (DemoMode == demo_PlayDone)\r
-               Quit("Demo playback exceeded");\r
-       else\r
-       {\r
-               switch (type = Controls[player])\r
-               {\r
-               case ctrl_Keyboard:\r
-                       def = &KbdDefs;\r
-\r
-                       if (Keyboard[def->upleft])\r
-                               mx = motion_Left,my = motion_Up;\r
-                       else if (Keyboard[def->upright])\r
-                               mx = motion_Right,my = motion_Up;\r
-                       else if (Keyboard[def->downleft])\r
-                               mx = motion_Left,my = motion_Down;\r
-                       else if (Keyboard[def->downright])\r
-                               mx = motion_Right,my = motion_Down;\r
-\r
-                       if (Keyboard[def->up])\r
-                               my = motion_Up;\r
-                       else if (Keyboard[def->down])\r
-                               my = motion_Down;\r
-\r
-                       if (Keyboard[def->left])\r
-                               mx = motion_Left;\r
-                       else if (Keyboard[def->right])\r
-                               mx = motion_Right;\r
-\r
-                       if (Keyboard[def->button0])\r
-                               buttons += 1 << 0;\r
-                       if (Keyboard[def->button1])\r
-                               buttons += 1 << 1;\r
-                       realdelta = false;\r
-                       break;\r
-               case ctrl_Joystick1:\r
-               case ctrl_Joystick2:\r
-                       INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy);\r
-                       buttons = INL_GetJoyButtons(type - ctrl_Joystick);\r
-                       realdelta = true;\r
-                       break;\r
-               case ctrl_Mouse:\r
-                       INL_GetMouseDelta(&dx,&dy);\r
-                       buttons = INL_GetMouseButtons();\r
-                       realdelta = true;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if (realdelta)\r
-       {\r
-               mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None);\r
-               my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None);\r
-       }\r
-       else\r
-       {\r
-               dx = mx * 127;\r
-               dy = my * 127;\r
-       }\r
-\r
-       info->x = dx;\r
-       info->xaxis = mx;\r
-       info->y = dy;\r
-       info->yaxis = my;\r
-       info->button0 = buttons & (1 << 0);\r
-       info->button1 = buttons & (1 << 1);\r
-       info->button2 = buttons & (1 << 2);\r
-       info->button3 = buttons & (1 << 3);\r
-       info->dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
-\r
-       if (DemoMode == demo_Record)\r
-       {\r
-               // Pack the control info into a byte\r
-               dbyte = (buttons << 4) | ((mx + 1) << 2) | (my + 1);\r
-\r
-               if\r
-               (\r
-                       (DemoBuffer[DemoOffset + 1] == dbyte)\r
-               &&      (DemoBuffer[DemoOffset] < 255)\r
-               )\r
-                       (DemoBuffer[DemoOffset])++;\r
-               else\r
-               {\r
-                       if (DemoOffset || DemoBuffer[DemoOffset])\r
-                               DemoOffset += 2;\r
-\r
-                       if (DemoOffset >= DemoSize)\r
-                               Quit("Demo buffer overflow");\r
-\r
-                       DemoBuffer[DemoOffset] = 1;\r
-                       DemoBuffer[DemoOffset + 1] = dbyte;\r
-               }\r
-       }\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_SetControlType() - Sets the control type to be used by the specified\r
-//             player\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-void\r
-IN_SetControlType(int player,ControlType type)\r
-{\r
-       // DEBUG - check that requested type is present?\r
-       Controls[player] = type;\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_WaitForKey() - Waits for a scan code, then clears LastScan and\r
-//             returns the scan code\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-ScanCode\r
-IN_WaitForKey(void)\r
-{\r
-       ScanCode        result;\r
-\r
-       while (!(result = LastScan))\r
-               ;\r
-       LastScan = 0;\r
-       return(result);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and\r
-//             returns the ASCII value\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-char\r
-IN_WaitForASCII(void)\r
-{\r
-       char            result;\r
-\r
-       while (!(result = LastASCII))\r
-               ;\r
-       LastASCII = '\0';\r
-       return(result);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_Ack() - waits for a button or key press.  If a button is down, upon\r
-// calling, it must be released for it to be recognized\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-\r
-boolean        btnstate[8];\r
-\r
-void IN_StartAck(void)\r
-{\r
-       unsigned        i,buttons;\r
-\r
-//\r
-// get initial state of everything\r
-//\r
-       IN_ClearKeysDown();\r
-       memset (btnstate,0,sizeof(btnstate));\r
-\r
-       buttons = IN_JoyButtons () << 4;\r
-       if (MousePresent)\r
-               buttons |= IN_MouseButtons ();\r
-\r
-       for (i=0;i<8;i++,buttons>>=1)\r
-               if (buttons&1)\r
-                       btnstate[i] = true;\r
-}\r
-\r
-\r
-boolean IN_CheckAck (void)\r
-{\r
-       unsigned        i,buttons;\r
-\r
-//\r
-// see if something has been pressed\r
-//\r
-       if (LastScan)\r
-               return true;\r
-\r
-       buttons = IN_JoyButtons () << 4;\r
-       if (MousePresent)\r
-               buttons |= IN_MouseButtons ();\r
-\r
-       for (i=0;i<8;i++,buttons>>=1)\r
-               if ( buttons&1 )\r
-               {\r
-                       if (!btnstate[i])\r
-                               return true;\r
-               }\r
-               else\r
-                       btnstate[i]=false;\r
-\r
-       return false;\r
-}\r
-\r
-\r
-void IN_Ack (void)\r
-{\r
-       IN_StartAck ();\r
-\r
-       while (!IN_CheckAck ())\r
-       ;\r
-}\r
-\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-//     IN_UserInput() - Waits for the specified delay time (in ticks) or the\r
-//             user pressing a key or a mouse button. If the clear flag is set, it\r
-//             then either clears the key or waits for the user to let the mouse\r
-//             button up.\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-boolean IN_UserInput(dword delay)\r
-{\r
-       dword   lasttime;\r
-\r
-       lasttime = TimeCount;\r
-       IN_StartAck ();\r
-       do\r
-       {\r
-               if (IN_CheckAck())\r
-                       return true;\r
-       } while (TimeCount - lasttime < delay);\r
-       return(false);\r
-}\r
-\r
-//===========================================================================\r
-\r
-/*\r
-===================\r
-=\r
-= IN_MouseButtons\r
-=\r
-===================\r
-*/\r
-\r
-byte   IN_MouseButtons (void)\r
-{\r
-       if (MousePresent)\r
-       {\r
-               Mouse(MButtons);\r
-               return _BX;\r
-       }\r
-       else\r
-               return 0;\r
-}\r
-\r
-\r
-/*\r
-===================\r
-=\r
-= IN_JoyButtons\r
-=\r
-===================\r
-*/\r
-\r
-byte   IN_JoyButtons (void)\r
-{\r
-       unsigned joybits;\r
-\r
-       joybits = inp(0x201);   // Get all the joystick buttons\r
-       joybits >>= 4;                          // only the high bits are useful\r
-       joybits ^= 15;                          // return with 1=pressed\r
-\r
-       return joybits;\r
-}\r
-\r
-\r
diff --git a/src/lib/16_in__.h b/src/lib/16_in__.h
deleted file mode 100755 (executable)
index f493ce6..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-//\r
-//     ID Engine\r
-//     ID_IN.h - Header file for Input Manager\r
-//     v1.0d1w\r
-//     By Jason Blochowiak\r
-//     Open Watcom port by sparky4\r
-//\r
-\r
-#ifndef        __16_IN__\r
-#define        __16_IN__\r
-#include "src/lib/16_head.h"\r
-\r
-#ifdef __DEBUG__\r
-#define        __DEBUG_InputMgr__\r
-#endif\r
-\r
-#define        MaxPlayers      4\r
-#define        MaxKbds         2\r
-#define        MaxJoys         2\r
-#define        NumCodes        128\r
-\r
-typedef        byte            ScanCode;\r
-#define        sc_None                 0\r
-#define        sc_Bad                  0xff\r
-#define        sc_Return               0x1c\r
-#define        sc_Enter                sc_Return\r
-#define        sc_Escape               0x01\r
-#define        sc_Space                0x39\r
-#define        sc_BackSpace    0x0e\r
-#define        sc_Tab                  0x0f\r
-#define        sc_Alt                  0x38\r
-#define        sc_Control              0x1d\r
-#define        sc_CapsLock             0x3a\r
-#define        sc_LShift               0x2a\r
-#define        sc_RShift               0x36\r
-#define        sc_UpArrow              0x48\r
-#define        sc_DownArrow    0x50\r
-#define        sc_LeftArrow    0x4b\r
-#define        sc_RightArrow   0x4d\r
-#define        sc_Insert               0x52\r
-#define        sc_Delete               0x53\r
-#define        sc_Home                 0x47\r
-#define        sc_End                  0x4f\r
-#define        sc_PgUp                 0x49\r
-#define        sc_PgDn                 0x51\r
-#define        sc_F1                   0x3b\r
-#define        sc_F2                   0x3c\r
-#define        sc_F3                   0x3d\r
-#define        sc_F4                   0x3e\r
-#define        sc_F5                   0x3f\r
-#define        sc_F6                   0x40\r
-#define        sc_F7                   0x41\r
-#define        sc_F8                   0x42\r
-#define        sc_F9                   0x43\r
-#define        sc_F10                  0x44\r
-#define        sc_F11                  0x57\r
-#define        sc_F12                  0x59\r
-\r
-#define        sc_1                    0x02\r
-#define        sc_2                    0x03\r
-#define        sc_3                    0x04\r
-#define        sc_4                    0x05\r
-#define        sc_5                    0x06\r
-#define        sc_6                    0x07\r
-#define        sc_7                    0x08\r
-#define        sc_8                    0x09\r
-#define        sc_9                    0x0a\r
-#define        sc_0                    0x0b\r
-\r
-#define        sc_A                    0x1e\r
-#define        sc_B                    0x30\r
-#define        sc_C                    0x2e\r
-#define        sc_D                    0x20\r
-#define        sc_E                    0x12\r
-#define        sc_F                    0x21\r
-#define        sc_G                    0x22\r
-#define        sc_H                    0x23\r
-#define        sc_I                    0x17\r
-#define        sc_J                    0x24\r
-#define        sc_K                    0x25\r
-#define        sc_L                    0x26\r
-#define        sc_M                    0x32\r
-#define        sc_N                    0x31\r
-#define        sc_O                    0x18\r
-#define        sc_P                    0x19\r
-#define        sc_Q                    0x10\r
-#define        sc_R                    0x13\r
-#define        sc_S                    0x1f\r
-#define        sc_T                    0x14\r
-#define        sc_U                    0x16\r
-#define        sc_V                    0x2f\r
-#define        sc_W                    0x11\r
-#define        sc_X                    0x2d\r
-#define        sc_Y                    0x15\r
-#define        sc_Z                    0x2c\r
-\r
-#define        key_None                0\r
-#define        key_Return              0x0d\r
-#define        key_Enter               key_Return\r
-#define        key_Escape              0x1b\r
-#define        key_Space               0x20\r
-#define        key_BackSpace   0x08\r
-#define        key_Tab                 0x09\r
-#define        key_Delete              0x7f\r
-\r
-//     Stuff for the mouse\r
-#define        MReset          0\r
-#define        MButtons        3\r
-#define        MDelta          11\r
-\r
-#define        MouseInt        0x33\r
-#define        Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
-\r
-#ifdef DEMO0\r
-typedef        enum            {\r
-                                               demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
-                                       } Demo;\r
-#endif\r
-//moved to 16_tdef.h\r
-/*typedef      enum            {\r
-                                               //ctrl_None,                            // MDM (GAMERS EDGE) - added\r
-                                               ctrl_Keyboard,\r
-                                                       ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
-                                               ctrl_Joystick,\r
-                                                       ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
-                                               ctrl_Mouse,\r
-                                       } ControlType;\r
-typedef        enum            {\r
-                                               motion_Left = -1,motion_Up = -1,\r
-                                               motion_None = 0,\r
-                                               motion_Right = 1,motion_Down = 1\r
-                                       } Motion;\r
-typedef        enum            {\r
-                                               dir_North,//dir_NorthEast,\r
-                                               dir_West,//dir_Nortinest,\r
-                                               dir_None,\r
-                                               dir_East,//,dir_SouthEast,\r
-                                               dir_South,//dir_Soutinest,\r
-                                       } Direction;\r
-typedef        struct          {\r
-                                               boolean near    button0,button1,button2,button3;\r
-                                               int     near            x,y;\r
-                                               Motion  near    xaxis,yaxis;\r
-                                               Direction near  dir;\r
-                                       } CursorInfo;\r
-\r
-typedef        struct          {\r
-                                               ScanCode near   button0,button1,\r
-                                                                       //upleft,\r
-                                                                       up,\r
-                                                                       down,\r
-                                                                       left,\r
-                                                                       right\r
-                                                                       //upright,\r
-                                                                       //downleft,\r
-                                                                       //,downright\r
-                                                                       ;\r
-                                       } KeyboardDef;\r
-typedef        struct          {\r
-                                               word    near    joyMinX,joyMinY,\r
-                                                                       threshMinX,threshMinY,\r
-                                                                       threshMaxX,threshMaxY,\r
-                                                                       joyMaxX,joyMaxY,\r
-                                                                       joyMultXL,joyMultYL,\r
-                                                                       joyMultXH,joyMultYH;\r
-                                       } JoystickDef;*/\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                       GLOBAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-#ifdef DEMO0\r
-               static Demo             DemoMode = demo_Off;\r
-               static byte /*_seg*/    *DemoBuffer;\r
-               static word             DemoOffset,DemoSize;\r
-#endif\r
-\r
-// Function prototypes\r
-#define        IN_KeyDown(code)        (Keyboard[(code)])\r
-#define        IN_ClearKey(code)       {Keyboard[code] = false;\\r
-                                                       if (code == LastScan) LastScan = sc_None;}\r
-\r
-// DEBUG - put names in prototypes\r
-extern void            IN_Startup(void),IN_Shutdown(void),\r
-                                       IN_Default(boolean gotit,ControlType in),\r
-                                       IN_SetKeyHook(void (*)()),\r
-                                       IN_ClearKeysDown(void),\r
-                                       IN_ReadCursor(CursorInfo *),\r
-                                       IN_ReadControl(int,CursorInfo *),\r
-                                       IN_SetControlType(int,ControlType),\r
-                                       IN_GetJoyAbs(word joy,word *xp,word *yp),\r
-                                       IN_SetupJoy(word joy,word minx,word maxx,\r
-                                                               word miny,word maxy),\r
-                                       IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
-                                       IN_Ack(void),IN_AckBack(void);\r
-extern boolean         IN_UserInput(dword delay);\r
-extern char            IN_WaitForASCII(void);\r
-extern ScanCode        IN_WaitForKey(void);\r
-extern word            IN_GetJoyButtonsDB(word joy);\r
-extern byte            *IN_GetScanName(ScanCode);\r
-\r
-\r
-byte   IN_MouseButtons (void);\r
-byte   IN_JoyButtons (void);\r
-\r
-void INL_GetJoyDelta(word joy,int *dx,int *dy);\r
-void IN_StartAck(void);\r
-boolean IN_CheckAck (void);\r
-\r
-#endif\r
index d04b382d5df6b6e2306a5027201b6507361e034f..a42051a5a710cca277d2bc335bd42833db327d7d 100755 (executable)
@@ -65,9 +65,24 @@ MK_FP(segment value, 0)*/
 \r
 typedef void _seg * memptr;\r
 \r
-#ifdef __WATCOMC__\r
+#ifdef __WATCOMC__     //functions found in borland c but not watcom c\r
 #define _argv __argv\r
 #define _argc __argc\r
+#define geninterrupt(n) int86(n,&CPURegs,&CPURegs);\r
+\r
+#define peekb(segm,ofs) (*(byte far*)MK_FP((segm),(ofs)))\r
+#define peek(segm,ofs) (*(word far*)MK_FP((segm),(ofs)))\r
+#define pokeb(segm,ofs,value) (peekb((segm),(ofs)) = (byte)(value))\r
+#define poke(segm,ofs,value) (peek((segm),(ofs)) = (word)(value))\r
+\r
+#define inportb(port)         inp(port)\r
+#define inport(port)         inpw(port)\r
+#define outportb(port, val)   outp(port, val)\r
+#define outport(port, val)   outpw(port, val)\r
+\r
+//#define asm __asm\r
+#define getvect _dos_getvect\r
+#define setvect _dos_setvect\r
 \r
 //from http://www.verycomputer.com/3_65d875cc818b54ec_1.htm\r
 void clrscr(void);\r
index 7b5fdcb4de0c44ea65d8a5809290383c367d39d7..557c4968930439d4c1efb3d89e8a87a70589d1d4 100755 (executable)
@@ -79,7 +79,7 @@ void Startup16(global_game_variables_t *gvar)
 #ifdef __DEBUG_InputMgr__\r
        if(!dbg_nointest)\r
 #endif\r
-       IN_Startup(gvar);\r
+       IN_Startup();\r
 #endif\r
 #ifdef __16_PM__\r
        PM_Startup(gvar);\r
@@ -110,7 +110,7 @@ void Shutdown16(global_game_variables_t *gvar)
 #ifdef __DEBUG_InputMgr__\r
        if(!dbg_nointest)\r
 #endif\r
-       IN_Shutdown(gvar);\r
+       IN_Shutdown();\r
 #endif\r
        CA_Shutdown(gvar);\r
        MM_Shutdown(gvar);\r
index 26b37fab5b36e2d0c3b9a138378a0cc560818017..ecb3ba527e6b4bdb9721cd94241c7cc402d5107a 100755 (executable)
 #include "src/lib/testpatt.h"\r
 \r
 #define TAIL_FUNCTIONKEYFUNCTIONS \\r
-       if(IN_KeyDown(88)){ panswitch=!panswitch;                                                       IN_UserInput(1,1); } \\r
+       if(IN_KeyDown(88)){ panswitch=!panswitch;                                                       IN_UserInput(1); } \\r
        TAIL_FUNCTIONKEYFUNCTIONS0EXE\r
 \r
 #define TAIL_FUNCTIONKEYFUNCTIONS0EXE \\r
-       if(IN_KeyDown(sc_F4)){ turboXT(12);                                                                     IN_UserInput(1,1); } \\r
-       if(IN_KeyDown(87/*sc_F11*/)){ pagedelayrendermap=!pagedelayrendermap;           IN_UserInput(1,1); } \\r
-       if(IN_KeyDown(68/*sc_F10*/)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap;         IN_UserInput(1,1); } \\r
-       if(IN_KeyDown(sc_F9)){ pagenorendermap=!pagenorendermap;                                IN_UserInput(1,1); } \\r
-       if(IN_KeyDown(sc_F8)){ gvar.video.bgps=!gvar.video.bgps;                                        IN_UserInput(1,1); } \\r
-       if(IN_KeyDown(sc_F7)){ ZC_ShowMV(&mv, 0, 1);                                                    IN_UserInput(1,1); } \\r
-       if(IN_KeyDown(sc_F6)){ ZC_ShowMV(&mv, 0, 0);                                                    IN_UserInput(1,1); } \\r
-       if(IN_KeyDown(sc_T)){ gvar.video.rss=!gvar.video.rss;                                           IN_UserInput(1,1); } \\r
-       if(IN_KeyDown(sc_P)){ modexpdump(&gvar.video.page[0]);                                  IN_UserInput(1,1); }\r
+       if(IN_KeyDown(sc_F4)){ turboXT(12);                                                                     IN_UserInput(1); } \\r
+       if(IN_KeyDown(87/*sc_F11*/)){ pagedelayrendermap=!pagedelayrendermap;           IN_UserInput(1); } \\r
+       if(IN_KeyDown(68/*sc_F10*/)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap;         IN_UserInput(1); } \\r
+       if(IN_KeyDown(sc_F9)){ pagenorendermap=!pagenorendermap;                                IN_UserInput(1); } \\r
+       if(IN_KeyDown(sc_F8)){ gvar.video.bgps=!gvar.video.bgps;                                        IN_UserInput(1); } \\r
+       if(IN_KeyDown(sc_F7)){ ZC_ShowMV(&mv, 0, 1);                                                    IN_UserInput(1); } \\r
+       if(IN_KeyDown(sc_F6)){ ZC_ShowMV(&mv, 0, 0);                                                    IN_UserInput(1); } \\r
+       if(IN_KeyDown(sc_T)){ gvar.video.rss=!gvar.video.rss;                                           IN_UserInput(1); } \\r
+       if(IN_KeyDown(sc_P)){ modexpdump(&gvar.video.page[0]);                                  IN_UserInput(1); }\r
 \r
 #define TAIL_PANKEYFUN \\r
        TAIL_PANKEYFUNZC \\r
        if(IN_KeyDown(sc_X)){ TESTBG12 } \\r
        if(IN_KeyDown(sc_C)){ TESTBG34 } \\r
        if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 1, 1); \\r
-       if(IN_KeyDown(sc_I)){ dbg_maptext=!dbg_maptext; IN_UserInput(1,1); }\r
+       if(IN_KeyDown(sc_I)){ dbg_maptext=!dbg_maptext; IN_UserInput(1); }\r
 /*     if(IN_KeyDown(sc_PgDn)){ \\r
                rotateR(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
-               VL_UpdatePaletteWrite(&gvar.video.palette, 0);          IN_UserInput(1,1); } \\r
+               VL_UpdatePaletteWrite(&gvar.video.palette, 0);          IN_UserInput(1); } \\r
        if(IN_KeyDown(sc_PgUp)){ \\r
                rotateL(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
-               VL_UpdatePaletteWrite(&gvar.video.palette, 0);          IN_UserInput(1,1); }*/\r
+               VL_UpdatePaletteWrite(&gvar.video.palette, 0);          IN_UserInput(1); }*/\r
 \r
 void DebugMemory_(global_game_variables_t *gvar, boolean q);\r
 void Shutdown16(global_game_variables_t *gvar);\r
index 7fb6f755e137606516e5225ee90f603850faab67..228c1a897d0ee20c1547ca2c52149af09d7a77f1 100755 (executable)
@@ -68,7 +68,7 @@ void main(int argc, char *argv[])
 \r
 #endif\r
        /*      input!  */\r
-       IN_Default(0, &gvar.gvar.player,ctrl_Keyboard1);\r
+       IN_Default(0, &gvar.gvar.player[0],ctrl_Keyboard1);\r
 \r
        /* save the palette */\r
 #ifdef MODEX\r
@@ -191,14 +191,14 @@ void main(int argc, char *argv[])
        //debugging binds!\r
 #ifdef MODEX\r
 #ifdef FADE\r
-       if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page);  IN_UserInput(1,1); } //p\r
+       if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page);  IN_UserInput(1); } //p\r
        /*if(IN_KeyDown(22)){\r
        paloffset=0; modexPalBlack(); modexPalUpdate(PCXBMPVAR, &paloffset, 0, 0);\r
        printf("1paloffset      =       %d\n", paloffset/3);\r
         modexPalUpdate(map.tiles->data, &paloffset, 0, 0);\r
        printf("2paloffset      =       %d\n", paloffset/3);\r
         modexpdump(mv[0].page); modexpdump(mv[1].page);\r
-               IN_UserInput(1,1);\r
+               IN_UserInput(1);\r
        }*/\r
 #endif\r
 #endif\r
@@ -209,7 +209,7 @@ void main(int argc, char *argv[])
                modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 3);\r
                modexClearRegion(mv[3].page, 0, 0, mv[3].page->width, mv[3].page->height, 4);\r
                modexClearRegion(mv[3].page, 0, 0, 20, 36, 15);\r
-               //IN_UserInput(1,1);\r
+               //IN_UserInput(1);\r
        }\r
 \r
        FUNCTIONKEYFUNCTIONS\r
@@ -218,7 +218,7 @@ void main(int argc, char *argv[])
 \r
        //9\r
 #ifdef FADE\r
-               if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(gvar.video.dpal); IN_UserInput(1,1); }\r
+               if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(gvar.video.dpal); IN_UserInput(1); }\r
 #endif\r
                if(IN_KeyDown(sc_R)){ modexPalOverscan(rand()%56); } //r\r
 \r
index acd6886a6598d5e0ff38f251166f58c2426080f2..37116b283d6b80178503ccadcc7311255c7673a4 100755 (executable)
@@ -87,7 +87,7 @@ void main(int argc, char *argv[])
        //====modexPalBlack();\r
 \r
        //IN_Startup();\r
-       IN_Default(0,&gvar.player,ctrl_Keyboard1);\r
+       IN_Default(0,&gvar.player[0],ctrl_Keyboard1);\r
        EN_initPlayer(&gvar.player, 0, &gvar.video);\r
 \r
        VGAmodeX(1, 1, &gvar);\r
@@ -140,7 +140,7 @@ void main(int argc, char *argv[])
        startclk = *clockw;\r
        while(!IN_KeyDown(sc_Escape))\r
        {\r
-               IN_ReadControl(0,&gvar.player);\r
+               IN_ReadControl(&gvar.player[0]);\r
                ZC_panPageManual(&mv, &gvar.player, 0);\r
                //[gvar.video.sp]\r
                //ZC_MVSync(&mv);\r
@@ -201,7 +201,7 @@ void main(int argc, char *argv[])
                        }\r
 //                     if(i>PAL_SIZE) i=0;\r
                }//9*/\r
-               if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[gvar.video.sp]); IN_UserInput(1,1); }//p\r
+               if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[gvar.video.sp]); IN_UserInput(1); }//p\r
                //VL_ShowPage(&gvar.video.page[gvar.video.sp], 0, 0);\r
                ZC_ShowMV(&mv, 0, 0);\r
        }\r
similarity index 100%
rename from git_con.fig
rename to src/util/git/git_con.fig
similarity index 89%
rename from git_igno.re
rename to src/util/git/git_igno.re
index 15ee4357276cf654c9f3b49a0271b631860260eb..70ed7d7559f36ad034ae916e1aac57babd351473 100755 (executable)
@@ -17,8 +17,8 @@ makefile~
 README~\r
 TODO~\r
 LICENCE~\r
-*.mah\r
-*.MAH\r
+*.meh\r
+*.MEH\r
 __wcl__.lnk\r
 !bcexmm.map\r
 !makefile\r
similarity index 100%
rename from git_modu.les
rename to src/util/git/git_modu.les
diff --git a/src/util/gitgit_con.fig b/src/util/gitgit_con.fig
new file mode 100755 (executable)
index 0000000..f07fc6d
--- /dev/null
@@ -0,0 +1,23 @@
+[core]
+       repositoryformatversion = 0
+       filemode = true
+       bare = false
+       logallrefupdates = true
+[remote "x4"]
+       url = ssh://sparky4@4ch.mooo.com:26/var/www/16/16.git
+       fetch = +refs/heads/*:refs/remotes/x4/*
+[branch "master"]
+       remote = origin
+       merge = refs/heads/master
+[remote "origin"]
+       url = git@github.com:sparky4/16.git
+       fetch = +refs/heads/*:refs/remotes/origin/*
+[remote "sf"]
+       url = ssh://sparky4q@git.code.sf.net/p/project16/code
+       fetch = +refs/heads/*:refs/remotes/sf/*
+[remote "jp"]
+       url = ssh://sparky4@git.osdn.jp:/gitroot/proj16/16.git
+       fetch = +refs/heads/*:refs/remotes/jp/*
+[remote "bb"]
+       url = git@bitbucket.org:sparky4/16.git
+       fetch = +refs/heads/*:refs/remotes/bb/*
diff --git a/src/util/gitgit_igno.re b/src/util/gitgit_igno.re
new file mode 100755 (executable)
index 0000000..70ed7d7
--- /dev/null
@@ -0,0 +1,32 @@
+# Lines starting with '#' are considered comments.\r
+# Ignore (generated) html files,\r
+*.html\r
+*.htm\r
+!proj16.bfproject\r
+*.obj\r
+*.OBJ\r
+*.[O]\r
+*.BCO\r
+*.*~\r
+FUCK\r
+*.err\r
+*.ERR\r
+*.lib\r
+*.LIB\r
+makefile~\r
+README~\r
+TODO~\r
+LICENCE~\r
+*.meh\r
+*.MEH\r
+__wcl__.lnk\r
+!bcexmm.map\r
+!makefile\r
+!modex.lib\r
+img\r
+!.git/config\r
+!.gitmodules\r
+# except foo.html which is maintained by hand.\r
+#!foo.html\r
+# Ignore objects and archives.\r
+*.[oa]\r
diff --git a/src/util/gitgit_modu.les b/src/util/gitgit_modu.les
new file mode 100755 (executable)
index 0000000..11d69bb
--- /dev/null
@@ -0,0 +1,23 @@
+[submodule "src/lib/doslib"]
+        path = src/lib/doslib
+        url = https://github.com/joncampbell123/doslib.git
+
+[submodule "src/lib/jsmn"]
+       path = src/lib/jsmn
+       url = https://github.com/zserge/jsmn.git
+
+[submodule "CatacombApocalypse"]
+       path = 16/CatacombApocalypse
+       url = https://github.com/FlatRockSoft/CatacombApocalypse.git
+
+[submodule "wolf3d"]
+        path = 16/wolf3d
+        url = https://github.com/id-Software/wolf3d.git
+
+[submodule "keen"]
+        path = 16/keen
+       url = https://github.com/keendreams/keen.git
+
+[submodule "Catacomb3D"]
+        path = 16/Catacomb3D
+       url = https://github.com/FlatRockSoft/Catacomb3D.git
index f20327ebda00bcfc67a4de8cc7ba92f28290e97d..b2b1b0403c6521fdfb5f2ba136d2ab9e232d0466 100755 (executable)
@@ -56,7 +56,7 @@ main(int argc, char *argv[])
        if(argv[1]) bakapee = argv[1];\r
        else bakapee = "data/adlib.vgm";\r
        printf("%x\n", OpenVGMFile(bakapee, &pee[0]));\r
-//     IN_Startup(); IN_Default(0,&gvar.player,ctrl_Keyboard1);\r
+//     IN_Startup(); IN_Default(0,&gvar.player[0],ctrl_Keyboard1);\r
        InitEngine();\r
        PlayMusic(&pee[0]);\r
 //     while(!IN_KeyDown(sc_Escape))\r
index 4ca8346578cab4419169b95fbb498013e74a199d..9e3a9ae1460e1b694501600c6d89373f048c3e2f 100755 (executable)
@@ -145,9 +145,9 @@ void main()
                        break;\r
                }\r
                TAIL_FUNCTIONKEYDRAWJUNKNOMV\r
-               if(IN_KeyDown(sc_F7)){ VL_ShowPage(&gvar.video.page[0], 1, 1);                                                  IN_UserInput(1,1); }\r
-               if(IN_KeyDown(sc_F6)){ VL_ShowPage(&gvar.video.page[0], 1, 0);                                                  IN_UserInput(1,1); }\r
-               if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[0]);  IN_UserInput(1,1); } //p\r
+               if(IN_KeyDown(sc_F7)){ VL_ShowPage(&gvar.video.page[0], 1, 1);                                                  IN_UserInput(1); }\r
+               if(IN_KeyDown(sc_F6)){ VL_ShowPage(&gvar.video.page[0], 1, 0);                                                  IN_UserInput(1); }\r
+               if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[0]);  IN_UserInput(1); } //p\r
        }\r
        VGAmodeX(0, 1, &gvar);\r
        MM_ShowMemory(&gvar);\r
index 4f78be47c0eb4ab3073c4764e1c2ba68cf46c547..3cc838dc8eb11d38d14b68abcc468aa0bd7a4020 100755 (executable)
@@ -88,7 +88,7 @@ void main(int argc, char *argv[])
        VRS_LoadVRS(bakapee1, &gvar.player[0].enti, &gvar);\r
 \r
        // input!\r
-       IN_Default(0, &gvar.player,ctrl_Keyboard1);\r
+       IN_Default(0, &gvar.player[0],ctrl_Keyboard1);\r
 \r
        // save the palette\r
 #ifdef FADE\r
@@ -156,7 +156,7 @@ void main(int argc, char *argv[])
                //when gvar.player[0].tx or gvar.player[0].ty == 0 or gvar.player[0].tx == 20 or gvar.player[0].ty == 15 then stop because that is edge of map and you do not want to walk of the map\r
 \r
                //gvar.player movement\r
-               IN_ReadControl(0, &gvar.player);\r
+               IN_ReadControl(&gvar.player[0]);\r
                if(!panswitch){\r
                        //ZC_walk2(gvar.player[0].ent, mv);\r
                        ZC_walk(&mv, &gvar.player, 0);\r
@@ -179,7 +179,7 @@ void main(int argc, char *argv[])
                if(gvar.player[0].enti.q == (TILEWH/(gvar.player[0].enti.speed))+1 && gvar.player[0].info.dir != 2 && (gvar.player[0].enti.triggerx == 5 && gvar.player[0].enti.triggery == 5)){ gvar.player[0].enti.hp--; }\r
                //debugging binds!\r
 \r
-               if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); /*paloffset=0;*/ modexpdump(mv[0].page); IN_UserInput(1,1); } //o\r
+               if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); /*paloffset=0;*/ modexpdump(mv[0].page); IN_UserInput(1); } //o\r
                if(IN_KeyDown(22)){ modexPalUpdate0(&gvar.video.palette); } //u\r
 \r
                TAIL_FUNCTIONKEYFUNCTIONS\r
@@ -204,7 +204,7 @@ void main(int argc, char *argv[])
                        VL_LoadPalFile(bakapee1p, &gvar.video.palette);\r
                }//JK\r
 #ifdef FADE\r
-               if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(gvar.video.dpal); IN_UserInput(1,1); }\r
+               if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(gvar.video.dpal); IN_UserInput(1); }\r
 #endif\r
                if(IN_KeyDown(sc_R)){ modexPalOverscan(rand()%56); } //r\r
 \r