From 6c49efb1f9ef6e2e326ceb08e1ac0e41fd18ee18 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 23 Mar 2017 13:11:26 -0500 Subject: [PATCH] __seguse.txt added to show _seg usage also OpenVGMFile needs to be ported to 16_snd.c ][ ca needs huge amounts of work and i should remember what needs to be done soon also i should reverify 16_in.c to make sure it can work with other code of id engine] going to port rest of code to borland c some time so we can use the core components of id engine here [going to add 16_us.c eventually but the debug system and CA_ PM_ and MM_ usage is priority now] i fixed a bad bug on building the code initionally ^^; [working on inntest.exe again ][global var breaking so i should make a work around --- makefile | 4 +- src/inntest.c | 30 ++--- src/lib/16_in_1.c | 236 +++++++++++++++++++------------------ src/lib/16_in_1.h | 28 ++--- src/util/shbat/winnbuil.sh | 2 + 5 files changed, 153 insertions(+), 147 deletions(-) create mode 100755 src/util/shbat/winnbuil.sh diff --git a/makefile b/makefile index fb475d5d..eeb4d5ac 100755 --- a/makefile +++ b/makefile @@ -34,7 +34,7 @@ # comment this out on game release. # serial output goes to COM1 at 9600 baud 1 stop bit odd parity. # serial output is plain text ASCII. -DEBUGSERIAL=1 +DEBUGSERIAL=0 DELLOGFILE=1 @@ -263,7 +263,7 @@ 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_1.$(OBJ) +inntest.exe: inntest.$(OBJ) $(16LIBNOINOBJS) 16_in_1.$(OBJ) $(DOSLIB) gfx.lib #sountest.exe: sountest.$(OBJ) $(16LIB) pcxtest.exe: pcxtest.$(OBJ) gfx.lib $(DOSLIB) $(16LIB) vrstest.exe: vrstest.$(OBJ) $(16LIB) gfx.lib $(DOSLIB) diff --git a/src/inntest.c b/src/inntest.c index 598303a6..5655e5ae 100755 --- a/src/inntest.c +++ b/src/inntest.c @@ -26,23 +26,23 @@ void probe_dos(){} void cpu_probe(){} -int probe_vga(){ return 0; } -void VGAmodeX(){} +//int probe_vga(){ return 0; } +//void VGAmodeX(){} void main(int argc, char *argv[]) { static global_game_variables_t gvar; - //extern struct inconfig inpu; - dbg_testkeyin=0; - dbg_testcontrolnoisy=1; - start_timer(&gvar); + dbg_nointest=0; + dbg_testkeyin=1; + dbg_testcontrolnoisy=0; + start_timer(&gvar); printf("."); //Startup16(&gvar); - IN_Startup(&gvar); + IN_Startup(&gvar); printf("."); //IN_Default(0,&gvar.player,ctrl_Joystick1); //IN_SetControlType(0,&gvar.player,ctrl_Joystick1); - IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar); - IN_SetControlType(&gvar.player[0],ctrl_Keyboard1); + IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar); printf("."); + IN_SetControlType(&gvar.player[0],ctrl_Keyboard1); printf("."); gvar.player[0].enti.q=1; gvar.player[0].enti.d=2; @@ -51,11 +51,12 @@ main(int argc, char *argv[]) //0000 nibbletest(){} //0000 booleantest(){} //printf("dbg_testkeyin=%u dbg_testcontrolnoisy=%u dbg_nogvar.playerinpu=%u\nloop if this is not responsive then please KILL or reset machine sorry!!\n", dbg_testkeyin, dbg_testcontrolnoisy, dbg_nogvar.playerinpu); + printf("\nloop\n"); while(!IN_KeyDown(sc_Escape, &gvar)) { //0000 shinkutxt(&gvar); IN_ReadControl(&gvar.player[0], &gvar); - switch(gvar.player[0].enti.d) +/* switch(gvar.player[0].enti.d) { //right movement case 3: @@ -88,10 +89,11 @@ main(int argc, char *argv[]) gvar.player[0].enti.q++; } else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; } break; - } - //printf("%u\n", IN_KeyDown(sc_Escape)); - //if( - IN_qb(sc_9, &gvar);//>0) printf("IN_qb(sc_9)=%u\n", IN_qb(sc_9)); + }*/ + //printf("%u\n", IN_KeyDown(sc_Escape, &gvar)); + //if(gvar.in.Keyboard[sc_Escape]) + printf("gvar.in.Keyboard[sc_Escape]=%u\n", gvar.in.Keyboard[sc_Escape]); + //IN_qb(sc_Enter, &gvar);//>0) printf("IN_qb(sc_9)=%u\n", IN_qb(sc_9)); if(IN_KeyDown(88, &gvar)) //speed { switch(gvar.kurokku.fpscap) diff --git a/src/lib/16_in_1.c b/src/lib/16_in_1.c index 84e1266e..60657a95 100755 --- a/src/lib/16_in_1.c +++ b/src/lib/16_in_1.c @@ -39,7 +39,7 @@ // DEBUG - there are more globals // -#include "src/lib/16_in.h" +#include "src/lib/16_in_1.h" #pragma hdrstop static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ @@ -64,7 +64,7 @@ static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ JoystickDef JoyDefs[MaxJoys]; } inpu;*/ -//inpu.KbdDefs = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/}; +//gvar->in.KbdDefs = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/}; /* ============================================================================= @@ -168,7 +168,7 @@ static char *ParmStringsIN[] = {"nojoys","nomouse",nil}; // /////////////////////////////////////////////////////////////////////////// /*static */void interrupt -INL_KeyService(void)//! +INL_KeyService(global_game_variables_t *gvar)//! { static boolean special; byte k,c, @@ -183,7 +183,7 @@ static boolean special; if (k == 0xe0) // Special key prefix special = true; else if (k == 0xe1) // Handle Pause key - inpu.Paused = true; + gvar->in.Paused = true; else { if (k & 0x80) // Break code @@ -192,13 +192,13 @@ static boolean special; // DEBUG - handle special keys: ctl-alt-delete, print scrn - inpu.Keyboard[k] = false; + gvar->in.Keyboard[k] = false; } else // Make code { - inst.LastCode = inst.CurCode; - inst.CurCode = inpu.LastScan = k; - inpu.Keyboard[k] = true; + gvar->in.LastCode = gvar->in.CurCode; + gvar->in.CurCode = gvar->in.LastScan = k; + gvar->in.Keyboard[k] = true; if (special) c = SpecialNames[k]; @@ -206,25 +206,25 @@ static boolean special; { if (k == sc_CapsLock) { - inst.CapsLock ^= true; + gvar->in.CapsLock ^= true; // DEBUG - make caps lock light work } - if (inpu.Keyboard[sc_LShift] || inpu.Keyboard[sc_RShift]) // If shifted + if (gvar->in.Keyboard[sc_LShift] || gvar->in.Keyboard[sc_RShift]) // If shifted { c = ShiftNames[k]; - if ((c >= 'A') && (c <= 'Z') && inst.CapsLock) + if ((c >= 'A') && (c <= 'Z') && gvar->in.CapsLock) c += 'a' - 'A'; } else { c = ASCIINames[k]; - if ((c >= 'a') && (c <= 'z') && inst.CapsLock) + if ((c >= 'a') && (c <= 'z') && gvar->in.CapsLock) c -= 'a' - 'A'; } } if (c) - inpu.LastASCII = c; + gvar->in.LastASCII = c; } special = false; @@ -232,8 +232,8 @@ static boolean special; if (INL_KeyHook && !special) INL_KeyHook(); -#ifdef __DEBUG_InputMgr__ - if(dbg_testkeyin > 0) printf("%c %u [0x%x %u] %u\n", c, c, k, k, inpu.Keyboard[k]); +#ifdef __DEBUG_InputMgr2__ + if(dbg_testkeyin > 0) printf("%c %u [0x%x %u] %u\n", c, c, k, k, gvar->in.Keyboard[k]); #endif outportb(0x20,0x20); } @@ -376,7 +376,7 @@ done: // joystick (from +/-127) // /////////////////////////////////////////////////////////////////////////// -void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/)//! +void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/, global_game_variables_t *gvar)//! { word x,y; word TimeCount = *clockw; @@ -384,7 +384,7 @@ void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/)//! static word lasttime; IN_GetJoyAbs(joy,&x,&y); - def = inpu.JoyDefs + joy; + def = gvar->in.JoyDefs + joy; if (x < def->threshMinX) { @@ -493,11 +493,11 @@ IN_GetJoyButtonsDB(word joy) // /////////////////////////////////////////////////////////////////////////// static void -INL_StartKbd(void) +INL_StartKbd(global_game_variables_t *gvar) { INL_KeyHook = NULL; // Clear key hook - IN_ClearKeysDown(); + IN_ClearKeysDown(gvar); OldKeyVect = getvect(KeyInt);//IN_KbdLED(); setvect(KeyInt,INL_KeyService); @@ -560,11 +560,11 @@ INL_ShutMouse(void) // INL_SetJoyScale() - Sets up scaling values for the specified joystick // static void -INL_SetJoyScale(word joy) +INL_SetJoyScale(word joy, global_game_variables_t *gvar) { JoystickDef *def; - def = &(inpu.JoyDefs[joy]); + def = &(gvar->in.JoyDefs[joy]); def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX); def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX); def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY); @@ -578,12 +578,12 @@ INL_SetJoyScale(word joy) // /////////////////////////////////////////////////////////////////////////// void -IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)//! +IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy, global_game_variables_t *gvar)//! { word d,r; JoystickDef *def; - def = &(inpu.JoyDefs[joy]); + def = &(gvar->in.JoyDefs[joy]); def->joyMinX = minx; def->joyMaxX = maxx; @@ -599,7 +599,7 @@ IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)//! def->threshMinY = ((r / 2) - d) + miny; def->threshMaxY = ((r / 2) + d) + miny; - INL_SetJoyScale(joy); + INL_SetJoyScale(joy, gvar); } /////////////////////////////////////////////////////////////////////////// @@ -609,7 +609,7 @@ IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)//! // /////////////////////////////////////////////////////////////////////////// static boolean -INL_StartJoy(word joy) +INL_StartJoy(word joy, global_game_variables_t *gvar) { word x,y; @@ -623,7 +623,7 @@ INL_StartJoy(word joy) return(false); else { - IN_SetupJoy(joy,0,x * 2,0,y * 2); + IN_SetupJoy(joy,0,x * 2,0,y * 2, gvar); return(true); } } @@ -634,9 +634,9 @@ INL_StartJoy(word joy) // /////////////////////////////////////////////////////////////////////////// static void -INL_ShutJoy(word joy)//! +INL_ShutJoy(word joy, global_game_variables_t *gvar)//! { - inpu.JoysPresent[joy] = false; + gvar->in.JoysPresent[joy] = false; } // Public routines @@ -647,12 +647,12 @@ INL_ShutJoy(word joy)//! // /////////////////////////////////////////////////////////////////////////// void -IN_Startup()//! +IN_Startup(global_game_variables_t *gvar)//! { boolean checkjoys,checkmouse; word i; - if (inst.IN_Started) + if (gvar->in.IN_Started) return; checkjoys = true; @@ -670,13 +670,13 @@ IN_Startup()//! } } - INL_StartKbd(); - inpu.MousePresent = checkmouse? INL_StartMouse() : false; + INL_StartKbd(gvar); + gvar->in.MousePresent = checkmouse? INL_StartMouse() : false; for (i = 0;i < MaxJoys;i++) - inpu.JoysPresent[i] = checkjoys? INL_StartJoy(i) : false; + gvar->in.JoysPresent[i] = checkjoys? INL_StartJoy(i, gvar) : false; - inst.IN_Started = true; + gvar->in.IN_Started = true; } @@ -686,26 +686,26 @@ IN_Startup()//! // /////////////////////////////////////////////////////////////////////////// void -IN_Default(boolean gotit,player_t *player,ControlType nt)//! +IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar)//! { int i; if ( (!gotit) - || ((nt == ctrl_Joystick1) && !inpu.JoysPresent[0]) - || ((nt == ctrl_Joystick2) && !inpu.JoysPresent[1]) - || ((nt == ctrl_Mouse) && !inpu.MousePresent) + || ((nt == ctrl_Joystick1) && !gvar->in.JoysPresent[0]) + || ((nt == ctrl_Joystick2) && !gvar->in.JoysPresent[1]) + || ((nt == ctrl_Mouse) && !gvar->in.MousePresent) ) nt = ctrl_Keyboard1; - inpu.KbdDefs[0].button0 = 0x1c; - inpu.KbdDefs[0].button1 = 0x38; + gvar->in.KbdDefs[0].button0 = 0x1c; + gvar->in.KbdDefs[0].button1 = 0x38; //in.KbdDefs[0].upleft = 0x47; - inpu.KbdDefs[0].up = 0x48; + gvar->in.KbdDefs[0].up = 0x48; //in.KbdDefs[0].upright = 0x49; - inpu.KbdDefs[0].left = 0x4b; - inpu.KbdDefs[0].right = 0x4d; + gvar->in.KbdDefs[0].left = 0x4b; + gvar->in.KbdDefs[0].right = 0x4d; //in.KbdDefs[0].downleft = 0x4f; - inpu.KbdDefs[0].down = 0x50; + gvar->in.KbdDefs[0].down = 0x50; //in.KbdDefs[0].downright = 0x51; IN_SetControlType(player,nt); for(i=0; i>MaxPlayers;i++) @@ -718,19 +718,19 @@ IN_Default(boolean gotit,player_t *player,ControlType nt)//! // /////////////////////////////////////////////////////////////////////////// void -IN_Shutdown(void)//! +IN_Shutdown(global_game_variables_t *gvar)//! { word i; - if (!inst.IN_Started) + if (!gvar->in.IN_Started) return; INL_ShutMouse(); for (i = 0;i < MaxJoys;i++) - INL_ShutJoy(i); + INL_ShutJoy(i, gvar); INL_ShutKbd(); - inst.IN_Started = false; + gvar->in.IN_Started = false; } /////////////////////////////////////////////////////////////////////////// @@ -751,13 +751,13 @@ IN_SetKeyHook(void (*hook)()) // /////////////////////////////////////////////////////////////////////////// void -IN_ClearKeysDown(void)//! +IN_ClearKeysDown(global_game_variables_t *gvar)//! { //int i; - inpu.LastScan = sc_None; - inpu.LastASCII = key_None; - memset (inpu.Keyboard,0,sizeof(inpu.Keyboard)); + gvar->in.LastScan = sc_None; + gvar->in.LastASCII = key_None; + memset (gvar->in.Keyboard,0,sizeof(gvar->in.Keyboard)); } /////////////////////////////////////////////////////////////////////////// @@ -784,7 +784,7 @@ INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy) // /////////////////////////////////////////////////////////////////////////// void -IN_ReadCursor(CursorInfo *info)//! +IN_ReadCursor(CursorInfo *info, global_game_variables_t *gvar)//! { word i, buttons; @@ -793,7 +793,7 @@ IN_ReadCursor(CursorInfo *info)//! info->x = info->y = 0; info->button0 = info->button1 = false; - if (inpu.MousePresent) + if (gvar->in.MousePresent) { buttons = INL_GetMouseButtons(); INL_GetMouseDelta(&dx,&dy); @@ -802,11 +802,11 @@ IN_ReadCursor(CursorInfo *info)//! for (i = 0;i < MaxJoys;i++) { - if (!inpu.JoysPresent[i]) + if (!gvar->in.JoysPresent[i]) continue; buttons = INL_GetJoyButtons(i); - INL_GetJoyDelta(i,&dx,&dy/*,true*/); + INL_GetJoyDelta(i,&dx,&dy/*,true*/, gvar); dx /= 64; dy /= 64; INL_AdjustCursor(info,buttons,dx,dy); @@ -824,7 +824,7 @@ IN_ReadCursor(CursorInfo *info)//! // /////////////////////////////////////////////////////////////////////////// void -IN_ReadControl(player_t *player)//! +IN_ReadControl(player_t *player, global_game_variables_t *gvar)//! { boolean realdelta; #if DEMO0 @@ -868,7 +868,7 @@ register KeyboardDef *def; { case ctrl_Keyboard1: case ctrl_Keyboard2: - def = &(inpu.KbdDefs[type - ctrl_Keyboard]); + def = &(gvar->in.KbdDefs[type - ctrl_Keyboard]); /* if (Keyboard[def->upleft]) mx = motion_Left,my = motion_Up; @@ -881,47 +881,47 @@ register KeyboardDef *def; //TODO: make this into a function that the joystick AND keyboard can use wwww if(DIRECTIONIFELSE)//(player->info.dir == 2) { - if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){ - if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])) + if(!gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right]){ + if((gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down])) my = motion_Up; - if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up])) + if((gvar->in.Keyboard[def->down] && !gvar->in.Keyboard[def->up])) my = motion_Down; - }else if(!inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]){ - if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right])) + }else if(!gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down]){ + if((gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right])) mx = motion_Left; - if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left])) + if((gvar->in.Keyboard[def->right] && !gvar->in.Keyboard[def->left])) mx = motion_Right; }else{ //2 keys pressed switch (player->pdir) { case 0: case 4: - if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right])){ dir = DirTable[1]; }//mx = motion_Left; } - else if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left])){ dir = DirTable[3]; }//mx = motion_Right; } + if((gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right])){ dir = DirTable[1]; }//mx = motion_Left; } + else if((gvar->in.Keyboard[def->right] && !gvar->in.Keyboard[def->left])){ dir = DirTable[3]; }//mx = motion_Right; } break; case 1: case 3: - if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])){ dir = DirTable[0]; }//my = motion_Up; } - else if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up])){ dir = DirTable[4]; }//my = motion_Down; } + if((gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down])){ dir = DirTable[0]; }//my = motion_Up; } + else if((gvar->in.Keyboard[def->down] && !gvar->in.Keyboard[def->up])){ dir = DirTable[4]; }//my = motion_Down; } break; default: break; } -#ifdef __DEBUG_InputMgr__ +#ifdef __DEBUG_InputMgr2__ //if(dbg_testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c ", dirchar(player->pdir)); } #endif } } //input from player - if (inpu.Keyboard[def->button0]) + if (gvar->in.Keyboard[def->button0]) buttons += 1 << 0; - if (inpu.Keyboard[def->button1]) + if (gvar->in.Keyboard[def->button1]) buttons += 1 << 1; realdelta = false; break; case ctrl_Joystick1: case ctrl_Joystick2: - INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy/*,false*/); + INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy/*,false*/, gvar); buttons = INL_GetJoyButtons(type - ctrl_Joystick); realdelta = true; break; @@ -990,16 +990,16 @@ register KeyboardDef *def; } } #endif -#ifdef __DEBUG_InputMgr__ +#ifdef __DEBUG_InputMgr2__ if(dbg_testcontrolnoisy > 0) -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) +if(player->info.dir!=2/*(gvar->in.Keyboard[def->up] || gvar->in.Keyboard[def->down] || gvar->in.Keyboard[def->left] || gvar->in.Keyboard[def->right])*/ || player->enti.q>1) { //printf("b1=%u b2=%u b3=%u b4=%u ", player->info.button0, player->info.button1, player->info.button2, player->info.button3); //printf("q=%d ", player->enti.q); //printf("cpee=%c ", dirchar(conpee)); printf("pdir=%c d=%c dir=%c ", dirchar(player->pdir), dirchar(player->enti.d), dirchar(player->info.dir)); /*if(realdelta) */printf("dx=%d dy=%d mx=%d my=%d", player->info.x, player->info.y, player->info.xaxis, player->info.yaxis); - //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]); + //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]); printf("\n"); } #endif @@ -1108,13 +1108,13 @@ IN_GetScanName(ScanCode scan) // /////////////////////////////////////////////////////////////////////////// ScanCode -IN_WaitForKey(void)//! +IN_WaitForKey(global_game_variables_t *gvar)//! { ScanCode result; - while (!(result = inpu.LastScan)) + while (!(result = gvar->in.LastScan)) ; - inpu.LastScan = 0; + gvar->in.LastScan = 0; return(result); } @@ -1125,13 +1125,13 @@ IN_WaitForKey(void)//! // /////////////////////////////////////////////////////////////////////////// char -IN_WaitForASCII(void)//! +IN_WaitForASCII(global_game_variables_t *gvar)//! { char result; - while (!(result = inpu.LastASCII)) + while (!(result = gvar->in.LastASCII)) ; - inpu.LastASCII = '\0'; + gvar->in.LastASCII = '\0'; return(result); } @@ -1144,19 +1144,19 @@ IN_WaitForASCII(void)//! boolean btnstate[8]; -void IN_StartAck(void)//! +void IN_StartAck(global_game_variables_t *gvar)//! { unsigned i,buttons; // // get initial state of everything // - IN_ClearKeysDown(); + IN_ClearKeysDown(gvar); memset (btnstate,0,sizeof(btnstate)); buttons = IN_JoyButtons () << 4; - if (inpu.MousePresent) - buttons |= IN_MouseButtons (); + if (gvar->in.MousePresent) + buttons |= IN_MouseButtons (gvar); for (i=0;i<8;i++,buttons>>=1) if (buttons&1) @@ -1164,19 +1164,19 @@ void IN_StartAck(void)//! } -boolean IN_CheckAck (void)//! +boolean IN_CheckAck (global_game_variables_t *gvar)//! { unsigned i,buttons; // // see if something has been pressed // - if (inpu.LastScan) + if (gvar->in.LastScan) return true; buttons = IN_JoyButtons () << 4; - if (inpu.MousePresent) - buttons |= IN_MouseButtons (); + if (gvar->in.MousePresent) + buttons |= IN_MouseButtons (gvar); for (i=0;i<8;i++,buttons>>=1) if ( buttons&1 ) @@ -1191,11 +1191,11 @@ boolean IN_CheckAck (void)//! } -void IN_Ack (void) +void IN_Ack (global_game_variables_t *gvar) { - IN_StartAck (); + IN_StartAck (gvar); - while (!IN_CheckAck ()) + while (!IN_CheckAck (gvar)) ; } @@ -1206,19 +1206,19 @@ void IN_Ack (void) // /////////////////////////////////////////////////////////////////////////// boolean -IN_IsUserInput()//! +IN_IsUserInput(global_game_variables_t *gvar)//! { boolean result; word i; - result = inpu.LastScan; + result = gvar->in.LastScan; - if (inpu.MousePresent) + if (gvar->in.MousePresent) if (INL_GetMouseButtons()) result = true; for (i = 0;i < MaxJoys;i++) - if (inpu.JoysPresent[i]) + if (gvar->in.JoysPresent[i]) if (INL_GetJoyButtons(i)) result = true; @@ -1233,16 +1233,16 @@ IN_IsUserInput()//! // button up. // /////////////////////////////////////////////////////////////////////////// -boolean IN_UserInput(word delay) +boolean IN_UserInput(word delay, global_game_variables_t *gvar) { word TimeCount = *clockw; word lasttime; lasttime = TimeCount; - IN_StartAck (); + IN_StartAck (gvar); do { - if (IN_CheckAck()) + if (IN_CheckAck(gvar)) return true; } while (TimeCount - lasttime < delay); return(false); @@ -1258,10 +1258,10 @@ boolean IN_UserInput(word delay) =================== */ -byte IN_MouseButtons (void)//! +byte IN_MouseButtons (global_game_variables_t *gvar)//! { union REGS CPURegs; - if (inpu.MousePresent) + if (gvar->in.MousePresent) { Mouse(MButtons); return CPURegs.x.bx; @@ -1290,13 +1290,15 @@ byte IN_JoyButtons (void) return joybits; } -boolean IN_KeyDown(byte code)//! +boolean IN_KeyDown(byte code, global_game_variables_t *gvar)//! { -#ifdef __DEBUG_InputMgr__ +#ifdef __DEBUG_InputMgr2__ + if(gvar->in.Keyboard[code]) + printf("IN_KeyDown(%c): %u\n", code, gvar->in.Keyboard[code]); if(!dbg_nointest) #endif - return inpu.Keyboard[code]; -#ifdef __DEBUG_InputMgr__ + return gvar->in.Keyboard[code]; +#ifdef __DEBUG_InputMgr2__ else if(dbg_nointest && kbhit()) return 1; @@ -1305,30 +1307,30 @@ boolean IN_KeyDown(byte code)//! #endif } -void IN_ClearKey(byte code)//! +void IN_ClearKey(byte code, global_game_variables_t *gvar)//! { - inpu.Keyboard[code] = false; - if(code == inpu.LastScan) - inpu.LastScan = sc_None; + gvar->in.Keyboard[code] = false; + if(code == gvar->in.LastScan) + gvar->in.LastScan = sc_None; } -boolean IN_qb(byte kee)//! +boolean IN_qb(byte kee, global_game_variables_t *gvar)//! { -#ifdef __DEBUG_InputMgr__ - if(dbg_testkeyin) printf("%u\n", inpu.Keyboard[kee]); +#ifdef __DEBUG_InputMgr2__ + if(dbg_testkeyin) if(gvar->in.Keyboard[kee]) printf("IN_qb(): %u\n", gvar->in.Keyboard[kee]); #endif - if(inpu.Keyboard[kee]==true) return 1; + if(gvar->in.Keyboard[kee]==true) return 1; else return 0; } -ScanCode IN_GetLastScan()//! +ScanCode IN_GetLastScan(global_game_variables_t *gvar)//! { - return inpu.LastScan; + return gvar->in.LastScan; } -ScanCode IN_GetCurCode()//! +ScanCode IN_GetCurCode(global_game_variables_t *gvar)//! { - return inst.CurCode; + return gvar->in.CurCode; } void IN_KbdLED() diff --git a/src/lib/16_in_1.h b/src/lib/16_in_1.h index c6115bf0..483574c6 100755 --- a/src/lib/16_in_1.h +++ b/src/lib/16_in_1.h @@ -38,7 +38,7 @@ #include "src/lib/16_spri.h" #include "src/lib/16_enti.h" #endif*/ - +#define __DEBUG_InputMgr2__ #define KeyInt 9 // The keyboard ISR number // Stuff for the joystick @@ -216,31 +216,31 @@ typedef struct { extern void IN_Startup(global_game_variables_t *gvar),IN_Shutdown(global_game_variables_t *gvar), IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar), IN_SetKeyHook(void (*)()), - IN_ClearKeysDown(void), - IN_ReadCursor(CursorInfo *), + IN_ClearKeysDown(global_game_variables_t *gvar), + IN_ReadCursor(CursorInfo *, global_game_variables_t *gvar), IN_ReadControl(player_t *player, global_game_variables_t *gvar), IN_SetControlType(player_t *player,ControlType type), IN_GetJoyAbs(word joy,word *xp,word *yp), IN_SetupJoy(word joy,word minx,word maxx, - word miny,word maxy), + word miny,word maxy, global_game_variables_t *gvar), #if DEMO0 IN_StopDemo(void),IN_FreeDemoBuffer(void), #endif - IN_Ack(void),IN_AckBack(void); -extern boolean IN_UserInput(word delay); -extern char IN_WaitForASCII(void); -extern ScanCode IN_WaitForKey(void); + IN_Ack(global_game_variables_t *gvar),IN_AckBack(void); +extern boolean IN_UserInput(word delay, global_game_variables_t *gvar); +extern char IN_WaitForASCII(global_game_variables_t *gvar); +extern ScanCode IN_WaitForKey(global_game_variables_t *gvar); extern word IN_GetJoyButtonsDB(word joy); extern byte *IN_GetScanName(ScanCode); -byte IN_MouseButtons (void); +byte IN_MouseButtons (global_game_variables_t *gvar); byte IN_JoyButtons (void); -void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/); -void IN_StartAck(void); -boolean IN_CheckAck (void); -boolean IN_IsUserInput(); +void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/, global_game_variables_t *gvar); +void IN_StartAck(global_game_variables_t *gvar); +boolean IN_CheckAck (global_game_variables_t *gvar); +boolean IN_IsUserInput(global_game_variables_t *gvar); #define Mouse(x) INL_Mouse(x) //void IN_SetKeyHook(void (*hook)()); #if DEMO0 @@ -252,7 +252,7 @@ void IN_FreeDemoBuffer(void); boolean IN_KeyDown(byte code, global_game_variables_t *gvar), IN_qb(byte kee, global_game_variables_t *gvar); -void IN_ClearKey(byte code), +void IN_ClearKey(byte code, global_game_variables_t *gvar), IN_KbdLED(); ScanCode IN_GetLastScan(), IN_GetCurCode(); diff --git a/src/util/shbat/winnbuil.sh b/src/util/shbat/winnbuil.sh new file mode 100755 index 00000000..e6652305 --- /dev/null +++ b/src/util/shbat/winnbuil.sh @@ -0,0 +1,2 @@ +wmake -h clean +wmake -h inntest.exe -- 2.39.5