From: sparky4 Date: Fri, 29 Sep 2017 19:04:51 +0000 (-0500) Subject: MOUSE WORKS NOW! i should continue on the other stuff in p16 such as showmemory funct... X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=5af1604f7af6c1d1ab94299bfe6a4195b203a323 MOUSE WORKS NOW! i should continue on the other stuff in p16 such as showmemory function and palett manipulation stuff --- diff --git a/bcexmm.dsk b/bcexmm.dsk index 4848bb94..3c5be5ea 100755 Binary files a/bcexmm.dsk and b/bcexmm.dsk differ diff --git a/bcexmm.exe b/bcexmm.exe index c103df59..ddd979ba 100755 Binary files a/bcexmm.exe and b/bcexmm.exe differ diff --git a/bcexmm.prj b/bcexmm.prj index 13dcb52b..b0e8fded 100755 Binary files a/bcexmm.prj and b/bcexmm.prj differ diff --git a/src/inputest.c b/src/inputest.c index 83619cb6..e74d10c7 100755 --- a/src/inputest.c +++ b/src/inputest.c @@ -25,17 +25,17 @@ #include "src/lib/16_in.h" #include "src/lib/16_tail.h" -#define INPUTEST_JOYSTICKPADTEST -//#define INPUTEST_MOUSETEST +//#define INPUTEST_JOYSTICKPADTEST +#define INPUTEST_MOUSETEST void main(int argc, char *argv[]) { static global_game_variables_t gvar; #ifdef __DEBUG_InputMgr__ - dbg_testkeyin=1; - dbg_testcontrolnoisy=0; - dbg_joymousedelta=1; + dbg_testkeyin=0; + dbg_testcontrolnoisy=1; + dbg_joymousedelta=0; #endif start_timer(&gvar); //Startup16(&gvar); diff --git a/src/lib/16_head.c b/src/lib/16_head.c index b371d109..25be7dab 100755 --- a/src/lib/16_head.c +++ b/src/lib/16_head.c @@ -22,6 +22,11 @@ #include "src/lib/16_head.h" +//cpu reg stuff for _AX, _BX, _CX, _DX +#ifdef __WATCOMC__ +union regs CPURegs; +#endif + // big global status text buffer char global_temp_status_text[512]; char global_temp_status_text2[512]; diff --git a/src/lib/16_head.h b/src/lib/16_head.h index 8c5d5381..2d18e0af 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -161,8 +161,8 @@ extern int profilehandle,debughandle; //make it into game global #define nil ((void *)0) #ifdef __WATCOMC__ -//#define _FCORELEFT 0x90000UL+16UL -/*static union REGS CPURegs; +//----#define _FCORELEFT 0x90000UL+16UL +extern union REGS CPURegs; #define _AX CPURegs.x.ax #define _BX CPURegs.x.bx @@ -180,7 +180,7 @@ extern int profilehandle,debughandle; //make it into game global #define _DH CPURegs.h.dh #define _DL CPURegs.h.dl -#define geninterrupt(n) int86(n,&CPURegs,&CPURegs);*/ +#define geninterrupt(n) int86(n,&CPURegs,&CPURegs); typedef union REGPACK regs_t; diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 9dd9d781..bdd3d0fe 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -249,17 +249,6 @@ static boolean special; outportb(0x20,0x20); } -void INL_Mouse(int x) -{ - union REGS CPURegs; - x = CPURegs.x.ax; -/*_=_= __asm { - mov ax,x - int MouseInt - }*/ - int86(MouseInt,&CPURegs,&CPURegs); -} - /////////////////////////////////////////////////////////////////////////// // // INL_GetMouseDelta() - Gets the amount that the mouse has moved from the @@ -269,16 +258,9 @@ void INL_Mouse(int x) static void INL_GetMouseDelta(int *x,int *y) { - union REGS CPURegs; Mouse(MDelta); - *x = CPURegs.x.cx; - *y = CPURegs.x.dx; -#ifdef __DEBUG_InputMgr__ - if(dbg_joymousedelta) - { - printf("mousedelta=[%dx%d]\n", *x, *y); - } - #endif + *x = _CX; + *y = _DX; } /////////////////////////////////////////////////////////////////////////// @@ -290,11 +272,10 @@ INL_GetMouseDelta(int *x,int *y) static word INL_GetMouseButtons(void) { - union REGS CPURegs; word buttons; Mouse(MButtons); - buttons = CPURegs.x.bx; + buttons = _BX; return(buttons); } @@ -510,7 +491,7 @@ IN_GetJoyButtonsDB(word joy) // /////////////////////////////////////////////////////////////////////////// static void -INL_StartKbd() +INL_StartKbd(void) { INL_KeyHook = NULL; // Clear key hook @@ -541,15 +522,15 @@ INL_ShutKbd(void) static boolean INL_StartMouse(void) { - union REGS CPURegs; +#if 0 if (getvect(MouseInt)) { Mouse(MReset); - if (/*_AX*/CPURegs.x.ax == 0xffff) + if (_AX == 0xffff) return(true); } return(false); -#if 0 +#else byte far *vector; @@ -697,7 +678,6 @@ IN_Startup(global_game_variables_t *gvar) gvar->in.inst = &inst; gvar->in.IN_Started = true; - } /////////////////////////////////////////////////////////////////////////// @@ -857,9 +837,6 @@ IN_ReadControl(player_t *player, global_game_variables_t *gvar) sword conpee; byte dir=DirTable[2]; register KeyboardDef *def; -//#ifdef __DEBUG_InputMgr__ -//static int old_dx,old_dy; -//#endif dx = dy = 0; mx = my = motion_None; @@ -889,8 +866,7 @@ register KeyboardDef *def; #endif switch (type = player->Controls) { - case ctrl_Keyboard1: - case ctrl_Keyboard2: + case ctrl_Keyboard: def = &(gvar->in.KbdDefs[type - ctrl_Keyboard]); /* if (Keyboard[def->upleft]) @@ -965,8 +941,8 @@ register KeyboardDef *def; } else { - dx = mx;// * 127; - dy = my;// * 127; + dx = mx * 127; + dy = my * 127; } player->info.x = dx; @@ -1014,12 +990,21 @@ register KeyboardDef *def; } #endif #ifdef __DEBUG_InputMgr__ -/*if(dbg_joymousedelta) +if(dbg_joymousedelta) { - if(dx!=old_dx || dy!=old_dy) printf("dx,dy [%d,%d] %d,%d\n", dx, dy, mx, my); - if(dx!=old_dx) old_dx=dx; - if(dy!=old_dy) old_dy=dy; -}*/ + { +static int old_dx,old_dy; +static word old_buttons=0; + if(dx!=old_dx || dy!=old_dy) printf("dx,dy [%d,%d] %d,%d\n", dx, dy, mx, my); + if(dx!=old_dx) old_dx=dx; + if(dy!=old_dy) old_dy=dy; + if(old_buttons!=buttons) + { + printf(" buttons={%u,%u,%u,%u}\n", player->info.button0, player->info.button1, player->info.button2, player->info.button3); + old_buttons=buttons; + } + } +} if(dbg_testcontrolnoisy > 0) 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) @@ -1295,11 +1280,10 @@ boolean IN_UserInput(word delay, global_game_variables_t *gvar) byte IN_MouseButtons (global_game_variables_t *gvar) { - union REGS CPURegs; if (gvar->in.MousePresent) { Mouse(MButtons); - return CPURegs.x.bx; + return _BX; } else return 0; diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 84100aec..6752c49d 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -150,6 +150,8 @@ #define MDelta 11 #define MouseInt 0x33*/ +#define Mouse(x) _AX = x,geninterrupt(MouseInt) + #ifdef DEMO0 typedef enum { demo_Off,demo_Record,demo_Playback,demo_PlayDone @@ -246,8 +248,6 @@ void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/, global_game_ 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 boolean IN_StartDemoRecord(word bufsize); void IN_StartDemoPlayback(byte *buffer,word bufsize); diff --git a/src/lib/16_pm.c b/src/lib/16_pm.c index 1e7f73a2..d6eba844 100755 --- a/src/lib/16_pm.c +++ b/src/lib/16_pm.c @@ -66,28 +66,6 @@ PageListStruct far *gvar->pm.PMPages, _seg *gvar->pm.PMSegPages;*/ -static union REGS CPURegs; - -#define _AX CPURegs.x.ax -#define _BX CPURegs.x.bx -#define _CX CPURegs.x.cx -#define _DX CPURegs.x.dx - -#define _SI CPURegs.x.si - -#define _AH CPURegs.h.ah -#define _AL CPURegs.h.al -#define _BH CPURegs.h.bh -#define _BL CPURegs.h.bl -#define _CH CPURegs.h.ch -#define _CL CPURegs.h.cl -#define _DH CPURegs.h.dh -#define _DL CPURegs.h.dl - -#ifdef __WATCOMC__ -#define geninterrupt(n) int86(n,&CPURegs,&CPURegs); -#endif - static char *ParmStrings[] = {"nomain","noems","noxms",nil}; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index 4d6040cb..c8e1ee81 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -171,7 +171,6 @@ void ReadConfig(void) read(file,&mouseenabled,sizeof(mouseenabled)); read(file,&joystickenabled,sizeof(joystickenabled)); - read(file,&joypadenabled,sizeof(joypadenabled)); read(file,&joystickprogressive,sizeof(joystickprogressive)); read(file,&joystickport,sizeof(joystickport)); @@ -230,7 +229,6 @@ void ReadConfig(void) mouseenabled = true; joystickenabled = false; - joypadenabled = false; joystickport = 0; joystickprogressive = false; @@ -269,7 +267,6 @@ void WriteConfig(void) write(file,&mouseenabled,sizeof(mouseenabled)); write(file,&joystickenabled,sizeof(joystickenabled)); - write(file,&joypadenabled,sizeof(joypadenabled)); write(file,&joystickprogressive,sizeof(joystickprogressive)); write(file,&joystickport,sizeof(joystickport)); @@ -409,69 +406,6 @@ noxor: //=========================================================================== -/* -============================================================================= - - MUSIC STUFF - -============================================================================= -*/ - - -/* -================= -= -= StopMusic -= -================= -*/ - -void TL_StopMusic(global_game_variables_t *gvar) -{ - int i; - - SD_MusicOff(); - for (i = 0;i < LASTMUSIC;i++) - if (gvar->ca.audiosegs[STARTMUSIC + i]) - { - MM_SetPurge(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],3, gvar); - MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],false, gvar); - } -} - -//========================================================================== - - -/* -================= -= -= StartMusic -= -================= -*/ - -void TL_StartMusic(global_game_variables_t *gvar) -{ - musicnames chunk; - - SD_MusicOff(); - chunk = 0;//++++songs[gamestate.mapon+gamestate.episode*10]; - -// if ((chunk == -1) || (MusicMode != smm_AdLib)) -//DEBUG control panel return; - -//++++ MM_BombOnError (false,gvar); -//++++ CA_CacheAudioChunk(STARTMUSIC + chunk, gvar); -//++++ MM_BombOnError (true,gvar); -//++++ if (gvar->mm.mmerror) -//++++ gvar->mm.mmerror = false; -//++++ else -//++++ { - MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + chunk],true, gvar); - SD_StartMusic((MusicGroup far *)gvar->ca.audiosegs[STARTMUSIC + chunk]); -//++++ } -} - /* ================== = diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index 1a8e48a4..3bf8e2c5 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -135,8 +135,8 @@ void Shutdown16(global_game_variables_t *gvar), void TL_DosLibStartup(global_game_variables_t *gvar); void TL_VidInit(global_game_variables_t *gvar); boolean FizzleFade (unsigned source, unsigned dest, unsigned width, unsigned height, unsigned frames, boolean abortable, global_game_variables_t *gvar); -void TL_StartMusic(global_game_variables_t *gvar); -void TL_StopMusic(global_game_variables_t *gvar); +void PL_StartMusic(global_game_variables_t *gvar); +void PL_StopMusic(global_game_variables_t *gvar); void DebugMemory_(global_game_variables_t *gvar, boolean q); void ClearMemory (global_game_variables_t *gvar); void Quit (global_game_variables_t *gvar, char *error); diff --git a/src/lib/16_tail_.c b/src/lib/16_tail_.c index 7a7b0793..a9d9d8b3 100755 --- a/src/lib/16_tail_.c +++ b/src/lib/16_tail_.c @@ -96,3 +96,68 @@ void TL_VidInit(global_game_variables_t *gvar) if(!gvar->video.old_mode) gvar->video.old_mode = VL_vgaGetMode();//out.h.al; gvar->video.VL_Initiated = 1; } + +//=========================================================================== + +/* +============================================================================= + + MUSIC STUFF + +============================================================================= +*/ + + +/* +================= += += StopMusic += +================= +*/ + +void PL_StopMusic(global_game_variables_t *gvar) +{ + int i; + + SD_MusicOff(); + for (i = 0;i < LASTMUSIC;i++) + if (gvar->ca.audiosegs[STARTMUSIC + i]) + { + MM_SetPurge(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],3, gvar); + MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + i],false, gvar); + } +} + +//========================================================================== + + +/* +================= += += StartMusic += +================= +*/ + +void PL_StartMusic(global_game_variables_t *gvar) +{ + musicnames chunk; + + SD_MusicOff(); + chunk = 0;//++++songs[gamestate.mapon+gamestate.episode*10]; + +// if ((chunk == -1) || (MusicMode != smm_AdLib)) +//DEBUG control panel return; + +//++++ MM_BombOnError (false,gvar); +//++++ CA_CacheAudioChunk(STARTMUSIC + chunk, gvar); +//++++ MM_BombOnError (true,gvar); +//++++ if (gvar->mm.mmerror) +//++++ gvar->mm.mmerror = false; +//++++ else +//++++ { + MM_SetLock(MEMPTRCONV gvar->ca.audiosegs[STARTMUSIC + chunk],true, gvar); + SD_StartMusic((MusicGroup far *)gvar->ca.audiosegs[STARTMUSIC + chunk]); +//++++ } +} diff --git a/src/lib/doslib b/src/lib/doslib index 5c8d2638..8396a97e 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit 5c8d26388d2d89d239fd828e4518565a247ee87c +Subproject commit 8396a97ea80ddc3c2dd32c9db46a52b6c57fd194 diff --git a/src/sdtest.c b/src/sdtest.c index 4e11d113..77b968c3 100755 --- a/src/sdtest.c +++ b/src/sdtest.c @@ -37,10 +37,10 @@ void main(int argc,char **argv) IN_Startup(&gvar); printf("start\n"); SD_Startup(&gvar); - TL_StartMusic (&gvar); + PL_StartMusic (&gvar); while (!(scancode = gvar.in.inst->LastScan)){} printf("shutdown\n"); - TL_StopMusic(&gvar); + PL_StopMusic(&gvar); SD_Shutdown(&gvar); IN_Shutdown(&gvar); ShutdownCAMMPM(&gvar); diff --git a/src/xcroll.c b/src/xcroll.c index 480d517e..3f097a3c 100755 --- a/src/xcroll.c +++ b/src/xcroll.c @@ -28,10 +28,13 @@ //#define NOMAPLOAD //#define OLDPLAYERSPRITESTUFF +#define XC_CTRLTYPE ctrl_Keyboard +//Mouse #ifdef __DEBUG__ #define SCROLLEXEDEBUG boolean - dbg_nointest=1; + dbg_nointest=0, + dbg_joymousedelta=0; #endif //static map_t map; @@ -133,7 +136,8 @@ void main(int argc, char *argv[]) #endif // input! - IN_Default(0, &gvar.player[0],ctrl_Keyboard1, &gvar); + IN_Default(0, &gvar.player[0],XC_CTRLTYPE, &gvar); + IN_SetControlType(&gvar.player[0],XC_CTRLTYPE); // save the palette #ifdef FADE