X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_in_.c;h=c04d15aab2279e3123247bd3be11e196bf9eb528;hb=f99bde8f168f1af79c556eb3b88bade0665a2219;hp=9b6bc7a92e6c3733fa428a66a8189b3919974a12;hpb=2054ff3725d60adcec235977f48b91eb25f8db42;p=16.git diff --git a/src/lib/16_in_.c b/src/lib/16_in_.c index 9b6bc7a9..c04d15aa 100755 --- a/src/lib/16_in_.c +++ b/src/lib/16_in_.c @@ -36,7 +36,7 @@ // DEBUG - there are more globals // -#include "src/lib/16_in.h" +#include "src/lib/16_in_.h" #pragma hdrstop /* @@ -60,6 +60,10 @@ extern "C" { #endif +static void (*INL_KeyHook)(void); +static void interrupt (*OldKeyVect)(void); +static char *ParmStringsIN[] = {"nojoys","nomouse",nil}; + static byte far ASCIINames[] = // Unshifted ASCII for scan codes { // 0 1 2 3 4 5 6 7 8 9 A B C D E F @@ -128,22 +132,11 @@ static byte far ASCIINames[] = // Unshifted ASCII for scan codes static Direction DirTable[] = // Quick lookup for total direction { - //dir_Nortinest, - dir_North, - dir_West, - dir_None, - dir_East, - dir_South - //dir_NorthEast, - //dir_Soutinest, - //,dir_SouthEast + /*dir_NorthWest, */dir_North,/* dir_NorthEast,*/ + dir_West, dir_None, dir_East, + /*dir_SouthWest, */dir_South/*, dir_SouthEast*/ }; -static void (*INL_KeyHook)(void); -static void interrupt (*OldKeyVect)(void); - -static char *ParmStringsIN[] = {"nojoys","nomouse",nil}; - #ifdef __cplusplus } #endif @@ -155,12 +148,12 @@ static char *ParmStringsIN[] = {"nojoys","nomouse",nil}; // INL_KeyService() - Handles a keyboard interrupt (key up/down) // /////////////////////////////////////////////////////////////////////////// -void interrupt -INL_KeyService() +/*static */void interrupt +INL_KeyService(global_game_variables_t *gvar) { static boolean special; - byte k,c; - register byte temp; + byte k,c, + temp; k = inp(0x60); // Get the scan code @@ -171,7 +164,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 @@ -180,13 +173,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]; @@ -194,25 +187,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; @@ -221,7 +214,7 @@ 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]); + if(dbg_testkeyin > 0) printf("%c %u [0x%x %u] %u\n", c, c, k, k, gvar->in.Keyboard[k]); #endif outp(0x20,0x20); } @@ -366,16 +359,16 @@ done: // /////////////////////////////////////////////////////////////////////////// static void -INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive) +INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive, global_game_variables_t *gvar) { word x,y; word time; - word TimeCount = *clockw; + word TimeCount = gvar->kurokku.clock_start; JoystickDef *def; static word lasttime; IN_GetJoyAbs(joy,&x,&y); - def = inpu.JoyDefs + joy; + def = gvar->in.JoyDefs + joy; if (x < def->threshMinX) { @@ -462,9 +455,9 @@ register word result; // /////////////////////////////////////////////////////////////////////////// word -IN_GetJoyButtonsDB(word joy) +IN_GetJoyButtonsDB(word joy, global_game_variables_t *gvar) { - word TimeCount = *clockw; + word TimeCount = gvar->kurokku.clock_start; word lasttime; word result1,result2; @@ -484,12 +477,12 @@ IN_GetJoyButtonsDB(word joy) // /////////////////////////////////////////////////////////////////////////// static void -INL_StartKbd() +INL_StartKbd(global_game_variables_t *gvar) { byte far *lock_key; INL_KeyHook = 0; // Clear key hook - IN_ClearKeysDown(); + IN_ClearKeysDown(gvar); OldKeyVect = _dos_getvect(KeyInt); @@ -545,11 +538,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); @@ -563,12 +556,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; @@ -584,7 +577,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); } /////////////////////////////////////////////////////////////////////////// @@ -594,7 +587,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; @@ -608,7 +601,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); } } @@ -619,9 +612,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 @@ -632,12 +625,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; @@ -655,16 +648,16 @@ 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++) - ININFO_JoysPresent[i] = checkjoys? INL_StartJoy(i) : false; + gvar->in.JoysPresent[i] = checkjoys? INL_StartJoy(i, gvar) : false; - for (i = 0;i < MaxKbds;i++) - ININFO_KbdDefs[i] = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/}; + //for (i = 0;i < MaxKbds;i++) + // gvar->in.KbdDefs[i] = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/}; - inst.IN_Started = true; + gvar->in.IN_Started = true; } @@ -674,26 +667,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; - ININFO_KbdDefs[0].button0 = 0x1c; - ININFO_KbdDefs[0].button1 = 0x38; + gvar->in.KbdDefs[0].button0 = 0x1c; + gvar->in.KbdDefs[0].button1 = 0x38; //in.KbdDefs[0].upleft = 0x47; - ININFO_KbdDefs[0].up = 0x48; + gvar->in.KbdDefs[0].up = 0x48; //in.KbdDefs[0].upright = 0x49; - ININFO_KbdDefs[0].left = 0x4b; - ININFO_KbdDefs[0].right = 0x4d; + gvar->in.KbdDefs[0].left = 0x4b; + gvar->in.KbdDefs[0].right = 0x4d; //in.KbdDefs[0].downleft = 0x4f; - ININFO_KbdDefs[0].down = 0x50; + gvar->in.KbdDefs[0].down = 0x50; //in.KbdDefs[0].downright = 0x51; IN_SetControlType(0,player,nt); for(i=0; i>MaxPlayers;i++) @@ -706,19 +699,19 @@ IN_Default(boolean gotit,player_t *player,ControlType nt) // /////////////////////////////////////////////////////////////////////////// void -IN_Shutdown() +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; } /////////////////////////////////////////////////////////////////////////// @@ -739,13 +732,13 @@ IN_SetKeyHook(void (*hook)()) // /////////////////////////////////////////////////////////////////////////// void -IN_ClearKeysDown() +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)); } /////////////////////////////////////////////////////////////////////////// @@ -772,7 +765,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; @@ -781,7 +774,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); @@ -790,11 +783,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); @@ -808,7 +801,7 @@ IN_ReadCursor(CursorInfo *info) // /////////////////////////////////////////////////////////////////////////// void near -IN_ReadControl(word pn, player_t *player) +IN_ReadControl(word pn, player_t *player, global_game_variables_t *gvar) { boolean realdelta; #if DEMO0 @@ -852,7 +845,7 @@ register KeyboardDef *def; { case ctrl_Keyboard1: case ctrl_Keyboard2: - def = &(ININFO_KbdDefs[type - ctrl_Keyboard]); + def = &(gvar->in.KbdDefs[type - ctrl_Keyboard]); /* if (Keyboard[def->upleft]) mx = motion_Left,my = motion_Up; @@ -865,28 +858,28 @@ register KeyboardDef *def; //TODO: make this into a function that the joystick AND keyboard can use wwww if(DIRECTIONIFELSE)//(player[pn].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[pn].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; @@ -897,15 +890,15 @@ register KeyboardDef *def; } } //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; @@ -976,14 +969,14 @@ register KeyboardDef *def; #endif #ifdef __DEBUG_InputMgr__ if(dbg_testcontrolnoisy > 0) -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) +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) { //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); //printf("q=%d ", player[pn].enti.q); //printf("cpee=%c ", dirchar(conpee)); printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].enti.d), dirchar(player[pn].info.dir)); /*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); - //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 @@ -1092,13 +1085,13 @@ IN_GetScanName(ScanCode scan) // /////////////////////////////////////////////////////////////////////////// ScanCode -IN_WaitForKey() +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); } @@ -1109,13 +1102,13 @@ IN_WaitForKey() // /////////////////////////////////////////////////////////////////////////// char -IN_WaitForASCII() +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); } @@ -1125,13 +1118,13 @@ IN_WaitForASCII() // /////////////////////////////////////////////////////////////////////////// void -IN_AckBack() +IN_AckBack(global_game_variables_t *gvar) { word i; - while (!inpu.LastScan) + while (!gvar->in.LastScan) { - if (inpu.MousePresent) + if (gvar->in.MousePresent) { if (INL_GetMouseButtons()) { @@ -1143,11 +1136,11 @@ IN_AckBack() for (i = 0;i < MaxJoys;i++) { - if (inpu.JoysPresent[i]) + if (gvar->in.JoysPresent[i]) { - if (IN_GetJoyButtonsDB(i)) + if (IN_GetJoyButtonsDB(i, gvar)) { - while (IN_GetJoyButtonsDB(i)) + while (IN_GetJoyButtonsDB(i, gvar)) ; return; } @@ -1155,8 +1148,8 @@ IN_AckBack() } } - IN_ClearKey(inpu.LastScan); - inpu.LastScan = sc_None; + IN_ClearKey(gvar->in.LastScan, gvar); + gvar->in.LastScan = sc_None; } /////////////////////////////////////////////////////////////////////////// @@ -1165,25 +1158,25 @@ IN_AckBack() // /////////////////////////////////////////////////////////////////////////// void -IN_Ack() +IN_Ack(global_game_variables_t *gvar) { word i; - if (!inst.IN_Started) + if (!gvar->in.IN_Started) return; - IN_ClearKey(inpu.LastScan); - inpu.LastScan = sc_None; + IN_ClearKey(gvar->in.LastScan, gvar); + gvar->in.LastScan = sc_None; - if (inpu.MousePresent) + if (gvar->in.MousePresent) while (INL_GetMouseButtons()) ; for (i = 0;i < MaxJoys;i++) - if (inpu.JoysPresent[i]) - while (IN_GetJoyButtonsDB(i)) + if (gvar->in.JoysPresent[i]) + while (IN_GetJoyButtonsDB(i, gvar)) ; - IN_AckBack(); + IN_AckBack(gvar); } /////////////////////////////////////////////////////////////////////////// @@ -1193,19 +1186,19 @@ IN_Ack() // /////////////////////////////////////////////////////////////////////////// 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; @@ -1221,18 +1214,18 @@ IN_IsUserInput() // /////////////////////////////////////////////////////////////////////////// boolean -IN_UserInput(dword delay,boolean clear) +IN_UserInput(dword delay,boolean clear, global_game_variables_t *gvar) { - word TimeCount = *clockw; + word TimeCount = gvar->kurokku.clock_start; word lasttime; lasttime = TimeCount; do { - if (IN_IsUserInput()) + if (IN_IsUserInput(gvar)) { if (clear) - IN_AckBack(); + IN_AckBack(gvar); return(true); } } while (TimeCount - lasttime < delay); @@ -1249,10 +1242,10 @@ IN_UserInput(dword delay,boolean clear) =================== */ -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; @@ -1281,12 +1274,12 @@ byte IN_JoyButtons (void) return joybits; } -boolean IN_KeyDown(byte code) +boolean IN_KeyDown(byte code, global_game_variables_t *gvar) { #ifdef __DEBUG_InputMgr__ if(!dbg_nointest) #endif - return inpu.Keyboard[code]; + return gvar->in.Keyboard[code]; #ifdef __DEBUG_InputMgr__ else if(dbg_nointest && kbhit()) @@ -1296,28 +1289,28 @@ 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]); + if(dbg_testkeyin) printf("%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; }