\r
#include "src/lib/16_in.h"\r
\r
+word testkeyin=1,testcontrolnoisy=0;\r
+\r
/*\r
=============================================================================\r
\r
\r
static Direction DirTable[] = // Quick lookup for total direction\r
{\r
- //dir_Nortinest,
- dir_North,
+ //dir_Nortinest,\r
+ dir_North,\r
dir_West,\r
- dir_None, \r
- dir_East,
- dir_South
+ dir_None,\r
+ dir_East,\r
+ dir_South\r
//dir_NorthEast,\r
//dir_Soutinest,\r
//,dir_SouthEast\r
\r
if (INL_KeyHook && !special)\r
INL_KeyHook();\r
- #ifdef TESTKEYIN\r
- printf("%c %x %u\n", c, k, inpu.Keyboard[k]);\r
- #endif\r
+//#ifdef TESTKEYIN\r
+ if(testkeyin > 0) printf("%c [0x%x %u] %u\n", c, k, k, inpu.Keyboard[k]);\r
+//endif\r
outp(0x20,0x20);\r
}\r
\r
INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive)\r
{\r
word x,y;\r
- dword time;\r
- dword TimeCount = *clockdw;\r
+ word time;\r
+ word TimeCount = *clockw;\r
JoystickDef *def;\r
-static dword lasttime;\r
+static word lasttime;\r
\r
IN_GetJoyAbs(joy,&x,&y);\r
def = inpu.JoyDefs + joy;\r
word\r
IN_GetJoyButtonsDB(word joy)\r
{\r
- dword TimeCount = *clockdw;\r
- dword lasttime;\r
+ word TimeCount = *clockw;\r
+ word lasttime;\r
word result1,result2;\r
\r
do\r
// player and fills in the control info struct\r
//\r
///////////////////////////////////////////////////////////////////////////\r
-void\r
+void near\r
IN_ReadControl(int playnum,player_t *player)\r
{\r
boolean realdelta;\r
int dx,dy;\r
Motion mx,my;\r
ControlType type;\r
+ sword conpee;\r
register KeyboardDef *def;\r
\r
dx = dy = 0;\r
mx = motion_Left,my = motion_Down;\r
else if (Keyboard[def->downright])\r
mx = motion_Right,my = motion_Down;*/\r
-\r
if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){\r
- if (inpu.Keyboard[def->up])\r
+ if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down] && player[playnum].d == 2))// || player[playnum].info.dir == 0)\r
my = motion_Up;\r
- else if (inpu.Keyboard[def->down])\r
+ if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up] && player[playnum].d == 2))// || player[playnum].info.dir == 4)\r
my = motion_Down;\r
-\r
}else if(!inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]){\r
- if (inpu.Keyboard[def->left])\r
+ if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right] && player[playnum].d == 2))// || player[playnum].info.dir == 1)\r
mx = motion_Left;\r
- else if (inpu.Keyboard[def->right])\r
+ if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left] && player[playnum].d == 2))// || player[playnum].info.dir == 3)\r
mx = motion_Right;\r
}\r
+ //input from player\r
if (inpu.Keyboard[def->button0])\r
buttons += 1 << 0;\r
if (inpu.Keyboard[def->button1])\r
}\r
else\r
{\r
- dx = mx * 127;\r
- dy = my * 127;\r
+ dx = mx;// * 127;\r
+ dy = my;// * 127;\r
}\r
\r
player[playnum].info.x = dx;\r
player[playnum].info.button1 = buttons & (1 << 1);\r
player[playnum].info.button2 = buttons & (1 << 2);\r
player[playnum].info.button3 = buttons & (1 << 3);\r
-// player[playnum].info.dir = DirTable[((my + 1) * 3) + (mx + 1)];
- player[playnum].info.dir = DirTable[(((my + 1) * 2) + (mx + 1))-1];\r
+// player[playnum].info.dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
+ conpee=(((my + 1) * 2) + (mx + 1));\r
+ if(conpee) conpee--;\r
+ player[playnum].info.dir = DirTable[conpee];\r
+ if(player[playnum].q==1 && (mx!=motion_None || my!=motion_None))\r
+ {\r
+ player[playnum].d = player[playnum].info.dir;\r
+ }\r
\r
#if DEMO0\r
if (DemoMode == demo_Record)\r
}\r
}\r
#endif\r
-#ifdef TESTCONTROLNOISY
-if(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])
-{
- printf("(mx)=%d ", mx);
- printf("(my)=%d ", my);
- printf("dir=%d\n", player[playnum].info.dir);
+//#ifdef TESTCONTROLNOISY\r
+if(testcontrolnoisy > 0)\r
+if((inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])&& player[playnum].info.dir!=2)\r
+{\r
+ printf("(mx)=%d ", mx);\r
+ printf("(my)=%d ", my);\r
+ printf("dir=%d\n", player[playnum].info.dir);\r
}\r
-#endif\r
+//#endif\r
}\r
\r
///////////////////////////////////////////////////////////////////////////\r
boolean\r
IN_UserInput(dword delay,boolean clear)\r
{\r
- dword TimeCount = *clockdw;\r
- dword lasttime;\r
+ word TimeCount = *clockw;\r
+ word lasttime;\r
\r
lasttime = TimeCount;\r
do\r
\r
boolean IN_qb(byte kee)\r
{\r
- printf("%u\n", inpu.Keyboard[kee]);\r
+//#ifdef TESTKEYIN\r
+// if(testkeyin > 0) printf("%u\n", inpu.Keyboard[kee]);\r
+//#endif\r
if(inpu.Keyboard[kee]==true) return 1;\r
else return 0;\r
}\r