From 0279dd54ae3dfbaede4a10eb65cdacc9c24ba610 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Sun, 3 Apr 2016 12:57:47 -0500 Subject: [PATCH] wwww --- src/lib/16_in.c | 41 +++++++++++++++++++++++++++++++++++------ src/lib/16_in.h | 8 -------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 61d6e689..1863e2ad 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -51,7 +51,6 @@ struct inconfig { boolean MousePresent; boolean JoysPresent[MaxJoys]; -// boolean JoyPadPresent[MaxPads]; boolean Keyboard[NumCodes]; boolean Paused; char LastASCII; @@ -59,7 +58,6 @@ struct inconfig KeyboardDef KbdDefs[MaxKbds]; JoystickDef JoyDefs[MaxJoys]; -// JoypadDef JoypadDefs[MaxPads]; } inpu; //extern inconfig inpu; @@ -380,6 +378,41 @@ static word lasttime; IN_GetJoyAbs(joy,&x,&y); def = inpu.JoyDefs + joy; + //TODO: inject p16 input controls! + //which is this + /* if(DIRECTIONIFELSE) + { + if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){ + if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])) + my = motion_Up; + if((inpu.Keyboard[def->down] && !inpu.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])) + mx = motion_Left; + if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left]))// || player[pn].pdir != 1) + mx = motion_Right; + }else + //if(mx+my!=1 && mx+my!=-1 && mx!=my!=0) + { //2 keys pressed + switch (player[pn].pdir) + { + case 0: + case 4: + if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right])) dir = DirTable[1]; + else if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left])) dir = DirTable[3]; + break; + case 1: + case 3: + if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])) dir = DirTable[0]; + else if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up])) dir = DirTable[4]; + break; + default: + break; + } + if(testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c ", dirchar(player[pn].pdir)); } + }//else printf(" "); + }*/ if (x < def->threshMinX) { if (x < def->joyMinX) @@ -678,8 +711,6 @@ IN_Default(boolean gotit,player_t *player,ControlType nt) || ((nt == ctrl_Joystick1) && !inpu.JoysPresent[0]) || ((nt == ctrl_Joystick2) && !inpu.JoysPresent[1]) || ((nt == ctrl_Mouse) && !inpu.MousePresent) -// || ((nt == ctrl_Joypad1) && !inpu.JoyPadPresent[0]) -// || ((nt == ctrl_Joypad2) && !inpu.JoyPadPresent[1]) ) nt = ctrl_Keyboard1; inpu.KbdDefs[0].button0 = 0x1c; @@ -898,8 +929,6 @@ register KeyboardDef *def; buttons += 1 << 1; realdelta = false; break; -// case ctrl_Joypad1: -// case ctrl_Joypad2: case ctrl_Joystick1: case ctrl_Joystick2: INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy,false); diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 9b270585..ec9b56a2 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -169,8 +169,6 @@ typedef enum { ctrl_Joystick, ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2, ctrl_Mouse, -// ctrl_Joypad, -// ctrl_Joypad1 = ctrl_Joypad,ctrl_Joypad2 } ControlType; typedef enum { motion_Left = -1,motion_Up = -1, @@ -211,10 +209,6 @@ typedef struct { joyMultXL,joyMultYL, joyMultXH,joyMultYH; } JoystickDef; -// typedef struct -// { -// boolean w; -// } JoypadDef; typedef struct { @@ -252,7 +246,6 @@ typedef struct { boolean MousePresent; boolean JoysPresent[MaxJoys]; - boolean JoyPadPresent[MaxPads]; boolean Keyboard[NumCodes]; boolean Paused; char LastASCII; @@ -260,7 +253,6 @@ typedef struct KeyboardDef KbdDefs[MaxKbds]; JoystickDef JoyDefs[MaxJoys]; - JoypadDef JoypadDefs[MaxPads]; } inpu;*/ #ifdef DEMO0 -- 2.39.2