#include "src/lib/16_in.h"\r
#include "src/lib/16_tail.h"\r
\r
-#define INPUTEST_JOYSTICKPADTEST\r
-//#define INPUTEST_MOUSETEST\r
+//#define INPUTEST_JOYSTICKPADTEST\r
+#define INPUTEST_MOUSETEST\r
\r
void\r
main(int argc, char *argv[])\r
{\r
static global_game_variables_t gvar;\r
#ifdef __DEBUG_InputMgr__\r
- dbg_testkeyin=1;\r
- dbg_testcontrolnoisy=0;\r
- dbg_joymousedelta=1;\r
+ dbg_testkeyin=0;\r
+ dbg_testcontrolnoisy=1;\r
+ dbg_joymousedelta=0;\r
#endif\r
start_timer(&gvar);\r
//Startup16(&gvar);\r
\r
#include "src/lib/16_head.h"\r
\r
+//cpu reg stuff for _AX, _BX, _CX, _DX\r
+#ifdef __WATCOMC__\r
+union regs CPURegs;\r
+#endif\r
+\r
// big global status text buffer\r
char global_temp_status_text[512];\r
char global_temp_status_text2[512];\r
#define nil ((void *)0)\r
\r
#ifdef __WATCOMC__\r
-//#define _FCORELEFT 0x90000UL+16UL\r
-/*static union REGS CPURegs;\r
+//----#define _FCORELEFT 0x90000UL+16UL\r
+extern union REGS CPURegs;\r
\r
#define _AX CPURegs.x.ax\r
#define _BX CPURegs.x.bx\r
#define _DH CPURegs.h.dh\r
#define _DL CPURegs.h.dl\r
\r
-#define geninterrupt(n) int86(n,&CPURegs,&CPURegs);*/\r
+#define geninterrupt(n) int86(n,&CPURegs,&CPURegs);\r
\r
\r
typedef union REGPACK regs_t;\r
outportb(0x20,0x20);\r
}\r
\r
-void INL_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
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
-#ifdef __DEBUG_InputMgr__\r
- if(dbg_joymousedelta)\r
- {\r
- printf("mousedelta=[%dx%d]\n", *x, *y);\r
- }\r
- #endif\r
+ *x = _CX;\r
+ *y = _DX;\r
}\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
+ buttons = _BX;\r
return(buttons);\r
}\r
\r
//\r
///////////////////////////////////////////////////////////////////////////\r
static void\r
-INL_StartKbd()\r
+INL_StartKbd(void)\r
{\r
INL_KeyHook = NULL; // Clear key hook\r
\r
static boolean\r
INL_StartMouse(void)\r
{\r
- union REGS CPURegs;\r
+#if 0\r
if (getvect(MouseInt))\r
{\r
Mouse(MReset);\r
- if (/*_AX*/CPURegs.x.ax == 0xffff)\r
+ if (_AX == 0xffff)\r
return(true);\r
}\r
return(false);\r
-#if 0\r
+#else\r
byte far *vector;\r
\r
\r
gvar->in.inst = &inst;\r
\r
gvar->in.IN_Started = true;\r
-\r
}\r
\r
///////////////////////////////////////////////////////////////////////////\r
sword conpee;\r
byte dir=DirTable[2];\r
register KeyboardDef *def;\r
-//#ifdef __DEBUG_InputMgr__\r
-//static int old_dx,old_dy;\r
-//#endif\r
\r
dx = dy = 0;\r
mx = my = motion_None;\r
#endif\r
switch (type = player->Controls)\r
{\r
- case ctrl_Keyboard1:\r
- case ctrl_Keyboard2:\r
+ case ctrl_Keyboard:\r
def = &(gvar->in.KbdDefs[type - ctrl_Keyboard]);\r
\r
/* if (Keyboard[def->upleft])\r
}\r
else\r
{\r
- dx = mx;// * 127;\r
- dy = my;// * 127;\r
+ dx = mx * 127;\r
+ dy = my * 127;\r
}\r
\r
player->info.x = dx;\r
}\r
#endif\r
#ifdef __DEBUG_InputMgr__\r
-/*if(dbg_joymousedelta)\r
+if(dbg_joymousedelta)\r
{\r
- if(dx!=old_dx || dy!=old_dy) printf("dx,dy [%d,%d] %d,%d\n", dx, dy, mx, my);\r
- if(dx!=old_dx) old_dx=dx;\r
- if(dy!=old_dy) old_dy=dy;\r
-}*/\r
+ {\r
+static int old_dx,old_dy;\r
+static word old_buttons=0;\r
+ if(dx!=old_dx || dy!=old_dy) printf("dx,dy [%d,%d] %d,%d\n", dx, dy, mx, my);\r
+ if(dx!=old_dx) old_dx=dx;\r
+ if(dy!=old_dy) old_dy=dy;\r
+ if(old_buttons!=buttons)\r
+ {\r
+ printf(" buttons={%u,%u,%u,%u}\n", player->info.button0, player->info.button1, player->info.button2, player->info.button3);\r
+ old_buttons=buttons;\r
+ }\r
+ }\r
+}\r
\r
if(dbg_testcontrolnoisy > 0)\r
if(player->info.dir!=2/*(inst.Keyboard[def->up] || inst.Keyboard[def->down] || inst.Keyboard[def->left] || inst.Keyboard[def->right])*/ || player->enti.q>1)\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
+ return _BX;\r
}\r
else\r
return 0;\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
void IN_StartAck(global_game_variables_t *gvar);\r
boolean IN_CheckAck (global_game_variables_t *gvar);\r
boolean IN_IsUserInput(global_game_variables_t *gvar);\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 *buffer,word bufsize);\r
PageListStruct far *gvar->pm.PMPages,\r
_seg *gvar->pm.PMSegPages;*/\r
\r
-static union REGS CPURegs;\r
-\r
-#define _AX CPURegs.x.ax\r
-#define _BX CPURegs.x.bx\r
-#define _CX CPURegs.x.cx\r
-#define _DX CPURegs.x.dx\r
-\r
-#define _SI CPURegs.x.si\r
-\r
-#define _AH CPURegs.h.ah\r
-#define _AL CPURegs.h.al\r
-#define _BH CPURegs.h.bh\r
-#define _BL CPURegs.h.bl\r
-#define _CH CPURegs.h.ch\r
-#define _CL CPURegs.h.cl\r
-#define _DH CPURegs.h.dh\r
-#define _DL CPURegs.h.dl\r
-\r
-#ifdef __WATCOMC__\r
-#define geninterrupt(n) int86(n,&CPURegs,&CPURegs);\r
-#endif\r
-\r
static char *ParmStrings[] = {"nomain","noems","noxms",nil};\r
\r
/////////////////////////////////////////////////////////////////////////////\r
\r
read(file,&mouseenabled,sizeof(mouseenabled));\r
read(file,&joystickenabled,sizeof(joystickenabled));\r
- read(file,&joypadenabled,sizeof(joypadenabled));\r
read(file,&joystickprogressive,sizeof(joystickprogressive));\r
read(file,&joystickport,sizeof(joystickport));\r
\r
mouseenabled = true;\r
\r
joystickenabled = false;\r
- joypadenabled = false;\r
joystickport = 0;\r
joystickprogressive = false;\r
\r
\r
write(file,&mouseenabled,sizeof(mouseenabled));\r
write(file,&joystickenabled,sizeof(joystickenabled));\r
- write(file,&joypadenabled,sizeof(joypadenabled));\r
write(file,&joystickprogressive,sizeof(joystickprogressive));\r
write(file,&joystickport,sizeof(joystickport));\r
\r
\r
//===========================================================================\r
\r
-/*\r
-=============================================================================\r
-\r
- MUSIC STUFF\r
-\r
-=============================================================================\r
-*/\r
-\r
-\r
-/*\r
-=================\r
-=\r
-= StopMusic\r
-=\r
-=================\r
-*/\r
-\r
-void TL_StopMusic(global_game_variables_t *gvar)\r
-{\r
- int i;\r
-\r
- SD_MusicOff();\r
- for (i = 0;i < LASTMUSIC;i++)\r
- if (gvar->ca.audiosegs[STARTMUSIC + i])\r
- {\r
- MM_SetPurge(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],3, gvar);\r
- MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],false, gvar);\r
- }\r
-}\r
-\r
-//==========================================================================\r
-\r
-\r
-/*\r
-=================\r
-=\r
-= StartMusic\r
-=\r
-=================\r
-*/\r
-\r
-void TL_StartMusic(global_game_variables_t *gvar)\r
-{\r
- musicnames chunk;\r
-\r
- SD_MusicOff();\r
- chunk = 0;//++++songs[gamestate.mapon+gamestate.episode*10];\r
-\r
-// if ((chunk == -1) || (MusicMode != smm_AdLib))\r
-//DEBUG control panel return;\r
-\r
-//++++ MM_BombOnError (false,gvar);\r
-//++++ CA_CacheAudioChunk(STARTMUSIC + chunk, gvar);\r
-//++++ MM_BombOnError (true,gvar);\r
-//++++ if (gvar->mm.mmerror)\r
-//++++ gvar->mm.mmerror = false;\r
-//++++ else\r
-//++++ {\r
- MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + chunk],true, gvar);\r
- SD_StartMusic((MusicGroup far *)gvar->ca.audiosegs[STARTMUSIC + chunk]);\r
-//++++ }\r
-}\r
-\r
/*\r
==================\r
=\r
void TL_DosLibStartup(global_game_variables_t *gvar);\r
void TL_VidInit(global_game_variables_t *gvar);\r
boolean FizzleFade (unsigned source, unsigned dest, unsigned width, unsigned height, unsigned frames, boolean abortable, global_game_variables_t *gvar);\r
-void TL_StartMusic(global_game_variables_t *gvar);\r
-void TL_StopMusic(global_game_variables_t *gvar);\r
+void PL_StartMusic(global_game_variables_t *gvar);\r
+void PL_StopMusic(global_game_variables_t *gvar);\r
void DebugMemory_(global_game_variables_t *gvar, boolean q);\r
void ClearMemory (global_game_variables_t *gvar);\r
void Quit (global_game_variables_t *gvar, char *error);\r
if(!gvar->video.old_mode) gvar->video.old_mode = VL_vgaGetMode();//out.h.al;\r
gvar->video.VL_Initiated = 1;\r
}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=============================================================================\r
+\r
+ MUSIC STUFF\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= StopMusic\r
+=\r
+=================\r
+*/\r
+\r
+void PL_StopMusic(global_game_variables_t *gvar)\r
+{\r
+ int i;\r
+\r
+ SD_MusicOff();\r
+ for (i = 0;i < LASTMUSIC;i++)\r
+ if (gvar->ca.audiosegs[STARTMUSIC + i])\r
+ {\r
+ MM_SetPurge(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],3, gvar);\r
+ MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],false, gvar);\r
+ }\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= StartMusic\r
+=\r
+=================\r
+*/\r
+\r
+void PL_StartMusic(global_game_variables_t *gvar)\r
+{\r
+ musicnames chunk;\r
+\r
+ SD_MusicOff();\r
+ chunk = 0;//++++songs[gamestate.mapon+gamestate.episode*10];\r
+\r
+// if ((chunk == -1) || (MusicMode != smm_AdLib))\r
+//DEBUG control panel return;\r
+\r
+//++++ MM_BombOnError (false,gvar);\r
+//++++ CA_CacheAudioChunk(STARTMUSIC + chunk, gvar);\r
+//++++ MM_BombOnError (true,gvar);\r
+//++++ if (gvar->mm.mmerror)\r
+//++++ gvar->mm.mmerror = false;\r
+//++++ else\r
+//++++ {\r
+ MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + chunk],true, gvar);\r
+ SD_StartMusic((MusicGroup far *)gvar->ca.audiosegs[STARTMUSIC + chunk]);\r
+//++++ }\r
+}\r
-Subproject commit 5c8d26388d2d89d239fd828e4518565a247ee87c
+Subproject commit 8396a97ea80ddc3c2dd32c9db46a52b6c57fd194
IN_Startup(&gvar);\r
printf("start\n");\r
SD_Startup(&gvar);\r
- TL_StartMusic (&gvar);\r
+ PL_StartMusic (&gvar);\r
while (!(scancode = gvar.in.inst->LastScan)){}\r
printf("shutdown\n");\r
- TL_StopMusic(&gvar);\r
+ PL_StopMusic(&gvar);\r
SD_Shutdown(&gvar);\r
IN_Shutdown(&gvar);\r
ShutdownCAMMPM(&gvar);\r
\r
//#define NOMAPLOAD\r
//#define OLDPLAYERSPRITESTUFF\r
+#define XC_CTRLTYPE ctrl_Keyboard\r
+//Mouse\r
#ifdef __DEBUG__\r
#define SCROLLEXEDEBUG\r
boolean\r
- dbg_nointest=1;\r
+ dbg_nointest=0,\r
+ dbg_joymousedelta=0;\r
#endif\r
\r
//static map_t map;\r
#endif\r
\r
// input!\r
- IN_Default(0, &gvar.player[0],ctrl_Keyboard1, &gvar);\r
+ IN_Default(0, &gvar.player[0],XC_CTRLTYPE, &gvar);\r
+ IN_SetControlType(&gvar.player[0],XC_CTRLTYPE);\r
\r
// save the palette\r
#ifdef FADE\r