From cc178d335220ce0be99025be734b84505cc5194b Mon Sep 17 00:00:00 2001 From: sparky4 Date: Fri, 10 Mar 2017 09:57:00 -0600 Subject: [PATCH] __seguse.txt added to show _seg usage also OpenVGMFile needs to be ported to 16_snd.c ][ ca needs huge amounts of work and i should remember what needs to be done soon also i should reverify 16_in.c to make sure it can work with other code of id engine ][ added 1.9 support wwww and fixed 16_vlpal.obj compile error\~ [it was a 8.3 file name extention error it was a simple issue wwww] [going to work on more on 16_in.c] --- ...96814ead13b3c29d8b99adef.png => meeee.png} | Bin data/spri/me.pcx | Bin 0 -> 4291 bytes data/spri/me.sht | 153 ++ db.exe | Bin 13186 -> 13224 bytes src/lib/16_in_.c | 1321 +++++++++++++++++ src/lib/16_in_.h | 308 ++++ src/lib/16_tdef.h | 53 +- src/lib/16_timer.c | 6 +- wcpu.exe | Bin 13312 -> 13398 bytes xxdiff.sh | 2 +- 10 files changed, 1838 insertions(+), 5 deletions(-) rename data/{meeee5dffbc3496814ead13b3c29d8b99adef.png => meeee.png} (100%) create mode 100755 data/spri/me.pcx create mode 100755 data/spri/me.sht create mode 100755 src/lib/16_in_.c create mode 100755 src/lib/16_in_.h diff --git a/data/meeee5dffbc3496814ead13b3c29d8b99adef.png b/data/meeee.png similarity index 100% rename from data/meeee5dffbc3496814ead13b3c29d8b99adef.png rename to data/meeee.png diff --git a/data/spri/me.pcx b/data/spri/me.pcx new file mode 100755 index 0000000000000000000000000000000000000000..6e78ab972cc4ad5394839cb30df62fd4e66e289f GIT binary patch literal 4291 zcmd5KW0j@V_zXjHQD_|fsF^iPbE&gE8pR8AZ}8V|bgO%;RQVpIGs28Q z48T}O;?^?t{A=htP6`Z7DX|UeX?m;FAt@$3X@20#lC6)Z@2g-O3NJpBy(4NQmIBNb zt+eotby#;Jq$kdB2!`jv6W~73-i|41pM5~MCtc>+(xNtc6n@kMD8f8Nn5HF6gJDw& z`hI&-fG;g-CZ@P$19{JdXF^J@9INRyICZWZ!@3uwd@A9j&@9Po?PjcarF6L&36vaz8T`=$E;z1*xw zF)x40yp5r|S8_OU*04*(L3G^D$bhe@Rn4^fjeBaI)AjMALy zDDmq!Ho-#j*YeG4zK~>AwOnmjH54XeE-;8Uq#QD?8b*pZL_-0x7MZrNTBhd46&hzOh&d)mlq2r(z3#I{y;){{rQv#pg?h~Aa4(3sd-8FT}qu%RYxWl&w2r`J}v8WmeB z`_3f|*{AMzTPqVf*WFr~d{N<*m0jCQZeQ<=Y@03jMy3fh8}rDOyqb-b4eU%z<9ib; z6&yprRi_A$us+oTx2qB`n%^;bse3?myO)7qAQB~Tvw zJBWB>ViC$j5>PFxWbVNXhxj5zQ3k^y;vOMA>@jGi)Fb?C0_E%x;vHh97Gs2FL(*6+ zujG~IOu9X4 z1o|YlZbMq+SOW2PT)-3HY(QX+5GI)v%HUgcCCKt@N`m9qlDnu9O^>Y2;x?Kvuok!Y z1_Yc9$j-sEHQA+~**B=&sJble%)$)+qn#Z~v`)+U-|ftOiF%RSbi&iK1TWQmu zInAKqoG|@+w#rdOqMoKI8K_xHT{cwEDEf_chb3(`^;y5c`~x~u#gi)LDj%t*zRFta z$|+_}KC;#WD`___eCuHJjOo!|=9_+=x7V4UB+h(hjmM2qz=lKC=`jCb`0S~eW}9HX zZjaOEC~<q&h zi=tSs*GZC0r_&$^hQndE+wF8ZzVA1iO~*O-vam=hU#l!B=HtyY$Vc7mqMh{HvlD;Z zaRT4!H(BfX`lOruDoe-nSuh^;M?ojJXbt;LziV|*8l4tvI_$;o|5z>mZ*l(@cmUP< literal 0 HcmV?d00001 diff --git a/data/spri/me.sht b/data/spri/me.sht new file mode 100755 index 00000000..b7853096 --- /dev/null +++ b/data/spri/me.sht @@ -0,0 +1,153 @@ +# MEKYUU.PCX demo sprite sheet compiler script +# (C) 2016 Jonathan Campbell + +# *spritesheet declares the section used by the sprite sheet cutting tool +# +# Sprites are declared by name (which becomes the .VRL file) at the + in the form: +# +NAME@ID +# +# Sprite names are meant for temporary use when compiling the sprite sheet into VRLs. +# At some point a longer name might be provided for use in your code. +# This will fill the CURRENT WORKING DIRECTORY with .VRL files as directed when you +# run PCXSSCUT, make sure your makefile does this in a temporary directory when +# you integrate into your build and that your cleanup commands delete these files, +# and that your .gitignore does not attempt to commit these files. + +# this format is a bit crap, but we'll improve it as needed. be patient. + +# begin spritesheet section +*spritesheet + +# ---------------- player, walking, blue shirt with white cross. Frame 2/3 could be used for standing still + +# player, forward, frame 1/3 ++MEBFCW0@10 +xy=0,0 +wh=24,32 +# player, forward, frame 2/3 ++MEBFCW1@11 +xy=24,0 +wh=24,32 +# player, forward, frame 3/3 ++MEBFCW2@12 +xy=48,0 +wh=24,32 + +# player, left, frame 1/3 ++MEBLCW0@20 +xy=0,32 +wh=24,32 +# player, left, frame 2/3 ++MEBLCW1@21 +xy=24,32 +wh=24,32 +# player, left, frame 3/3 ++MEBLCW2@22 +xy=48,32 +wh=24,32 + +# player, right, frame 1/3 ++MEBRCW0@30 +xy=0,64 +wh=24,32 +# player, right, frame 2/3 ++MEBRCW1@31 +xy=24,64 +wh=24,32 +# player, right, frame 3/3 ++MEBRCW2@32 +xy=48,64 +wh=24,32 + +# player, away, frame 1/3 ++MEBACW0@40 +xy=0,96 +wh=24,32 +# player, away, frame 2/3 ++MEBACW1@41 +xy=24,96 +wh=24,32 +# player, away, frame 3/3 ++MEBACW2@42 +xy=48,96 +wh=24,32 + +# begin animation list section. must come after sprite sheet +*animation + +# Me-tan, forward, standing and walking animation cycles ++MEBFCW_STANDING@10 +sprite=MEBFCW1 + ++MEBFCW_WALKING@11 +sprite=MEBFCW0 +delay=3 +-newframe +sprite=MEBFCW1 +delay=3 +event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" +-newframe +sprite=MEBFCW2 +delay=3 +-newframe +sprite=MEBFCW1 +delay=3 +event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" + +# Me-tan, left, standing and walking animation cycles ++MEBLCW_STANDING@20 +sprite=MEBLCW1 + ++MEBLCW_WALKING@21 +sprite=MEBLCW0 +delay=3 +-newframe +sprite=MEBLCW1 +delay=3 +event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" +-newframe +sprite=MEBLCW2 +delay=3 +-newframe +sprite=MEBLCW1 +delay=3 +event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" + +# Me-tan, right, standing and walking animation cycles ++MEBRCW_STANDING@30 +sprite=MEBRCW1 + ++MEBRCW_WALKING@31 +sprite=MEBRCW0 +delay=3 +-newframe +sprite=MEBRCW1 +delay=3 +event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" +-newframe +sprite=MEBRCW2 +delay=3 +-newframe +sprite=MEBRCW1 +delay=3 +event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" + +# Me-tan, away, standing and walking animation cycles ++MEBACW_STANDING@40 +sprite=MEBACW1 + ++MEBACW_WALKING@41 +sprite=MEBACW0 +delay=3 +-newframe +sprite=MEBACW1 +delay=3 +event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" +-newframe +sprite=MEBACW2 +delay=3 +-newframe +sprite=MEBACW1 +delay=3 +event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" + diff --git a/db.exe b/db.exe index 457a9fa192d31529e39312c63fcfc8b50357625a..587c001b44becfde111c370f0125c27fcbe93cb6 100755 GIT binary patch delta 6540 zcmZ`;3sh9sx!&i&%rL-+3i#$>aYRtUXksJ-_y`W#8bvTbFpf5TnMZRQn1S5J%Z#0x zusOqYl9RMGxlL-k>(*}C@ED$##;>)S`x$?z+zJw#>3}6)q z83A4v3CV~fBuPiecAy2gALDF5P*2Ew10fH`6Y?bR6Tk($0Sp3P11pS#lma_|Xd-CL zB;+D6e-`G=A*34E0o2bSF0u=i(?UQ032+GY#JPkl0agIbz?;Acpl}``Yk-Hq#01KR z(+PPE_zMsL;xY)y2R;H;XA*J&^ezLNP+x^PV<^K}gv?t&NG4DOR4i~2BBSyqa0|#V z6S59)1AgEwpdI)E&@UupE>H+O0nE=K&Dp3-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 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5 + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6 + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7 + }, + far SpecialNames[] = // ASCII for 0xe0 prefixed codes + { +// 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 0 + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,13 ,0 ,0 ,0 , // 1 + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 2 + 0 ,0 ,0 ,0 ,0 ,'/',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 3 + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 4 + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5 + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6 + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7 + }, + + + *ScanNames[] = // Scan code names with single chars + { + "?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?", + "Q","W","E","R","T","Y","U","I","O","P","[","]","|","?","A","S", + "D","F","G","H","J","K","L",";","\"","?","?","?","Z","X","C","V", + "B","N","M",",",".","/","?","?","?","?","?","?","?","?","?","?", + "?","?","?","?","?","?","?","?","\xf","?","-","\x15","5","\x11","+","?", + "\x13","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?", + "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?", + "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?" + }, // DEBUG - consolidate these + + + far ExtScanCodes[] = // Scan codes with >1 char names + { + 1,0xe,0xf,0x1d,0x2a,0x39,0x3a,0x3b,0x3c,0x3d,0x3e, + 0x3f,0x40,0x41,0x42,0x43,0x44,0x57,0x59,0x46,0x1c,0x36, + 0x37,0x38,0x47,0x49,0x4f,0x51,0x52,0x53,0x45,0x48, + 0x50,0x4b,0x4d,0x00 + }, + *ExtScanNames[] = // Names corresponding to ExtScanCodes + { + "Esc","BkSp","Tab","Ctrl","LShft","Space","CapsLk","F1","F2","F3","F4", + "F5","F6","F7","F8","F9","F10","F11","F12","ScrlLk","Enter","RShft", + "PrtSc","Alt","Home","PgUp","End","PgDn","Ins","Del","NumLk","Up", + "Down","Left","Right","" + }; + +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 + }; + +static void (*INL_KeyHook)(void); +static void interrupt (*OldKeyVect)(void); + +static char *ParmStringsIN[] = {"nojoys","nomouse",nil}; + +#ifdef __cplusplus +} +#endif + +// Internal routines + +/////////////////////////////////////////////////////////////////////////// +// +// INL_KeyService() - Handles a keyboard interrupt (key up/down) +// +/////////////////////////////////////////////////////////////////////////// +void interrupt +INL_KeyService() +{ +static boolean special; + byte k,c; + register byte temp; + + k = inp(0x60); // Get the scan code + + // Tell the XT keyboard controller to clear the key + outp(0x61,(temp = inp(0x61)) | 0x80); + outp(0x61,temp); + + if (k == 0xe0) // Special key prefix + special = true; + else if (k == 0xe1) // Handle Pause key + inpu.Paused = true; + else + { + if (k & 0x80) // Break code + { + k &= 0x7f; + +// DEBUG - handle special keys: ctl-alt-delete, print scrn + + inpu.Keyboard[k] = false; + } + else // Make code + { + inst.LastCode = inst.CurCode; + inst.CurCode = inpu.LastScan = k; + inpu.Keyboard[k] = true; + + if (special) + c = SpecialNames[k]; + else + { + if (k == sc_CapsLock) + { + inst.CapsLock ^= true; + // DEBUG - make caps lock light work + } + + if (inpu.Keyboard[sc_LShift] || inpu.Keyboard[sc_RShift]) // If shifted + { + c = ShiftNames[k]; + if ((c >= 'A') && (c <= 'Z') && inst.CapsLock) + c += 'a' - 'A'; + } + else + { + c = ASCIINames[k]; + if ((c >= 'a') && (c <= 'z') && inst.CapsLock) + c -= 'a' - 'A'; + } + } + if (c) + inpu.LastASCII = c; + } + + special = false; + } + + 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]); +#endif + outp(0x20,0x20); +} + +void +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 +// mouse driver +// +/////////////////////////////////////////////////////////////////////////// +static void +INL_GetMouseDelta(int *x,int *y) +{ + union REGS CPURegs; + Mouse(MDelta); + *x = CPURegs.x.cx; + *y = CPURegs.x.dx; +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_GetMouseButtons() - Gets the status of the mouse buttons from the +// mouse driver +// +/////////////////////////////////////////////////////////////////////////// +static word +INL_GetMouseButtons(void) +{ + union REGS CPURegs; + word buttons; + + Mouse(MButtons); + buttons = CPURegs.x.bx; + return(buttons); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_GetJoyAbs() - Reads the absolute position of the specified joystick +// +/////////////////////////////////////////////////////////////////////////// +void +IN_GetJoyAbs(word joy,word *xp,word *yp) +{ + byte xb,yb, + xs,ys; + word x,y; + + x = y = 0; + xs = joy? 2 : 0; // Find shift value for x axis + xb = 1 << xs; // Use shift value to get x bit mask + ys = joy? 3 : 1; // Do the same for y axis + yb = 1 << ys; + +// Read the absolute joystick values + __asm { + pushf // Save some registers + push si + push di + cli // Make sure an interrupt doesn't screw the timings + + + mov dx,0x201 + in al,dx + out dx,al // Clear the resistors + + mov ah,[xb] // Get masks into registers + mov ch,[yb] + + xor si,si // Clear count registers + xor di,di + xor bh,bh // Clear high byte of bx for later + + push bp // Don't mess up stack frame + mov bp,MaxJoyValue +#ifdef __BORLANDC__ + } +#endif +loo: +#ifdef __BORLANDC__ + __asm { +#endif + in al,dx // Get bits indicating whether all are finished + + dec bp // Check bounding register + jz done // We have a silly value - abort + + mov bl,al // Duplicate the bits + and bl,ah // Mask off useless bits (in [xb]) + add si,bx // Possibly increment count register + mov cl,bl // Save for testing later + + mov bl,al + and bl,ch // [yb] + add di,bx + + add cl,bl + jnz loo // If both bits were 0, drop out +#ifdef __BORLANDC__ + } +#endif +done: +#ifdef __BORLANDC__ + __asm { +#endif + pop bp + + mov cl,[xs] // Get the number of bits to shift + shr si,cl // and shift the count that many times + + mov cl,[ys] + shr di,cl + + mov [x],si // Store the values into the variables + mov [y],di + + pop di + pop si + popf // Restore the registers + } + + *xp = x; + *yp = y; +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_GetJoyDelta() - Returns the relative movement of the specified +// joystick (from +/-127, scaled adaptively) +// +/////////////////////////////////////////////////////////////////////////// +static void +INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive) +{ + word x,y; + word time; + word TimeCount = *clockw; + JoystickDef *def; +static word lasttime; + + IN_GetJoyAbs(joy,&x,&y); + def = inpu.JoyDefs + joy; + + if (x < def->threshMinX) + { + if (x < def->joyMinX) + x = def->joyMinX; + + x = -(x - def->threshMinX); + x *= def->joyMultXL; + x >>= JoyScaleShift; + *dx = (x > 127)? -127 : -x; + } + else if (x > def->threshMaxX) + { + if (x > def->joyMaxX) + x = def->joyMaxX; + + x = x - def->threshMaxX; + x *= def->joyMultXH; + x >>= JoyScaleShift; + *dx = (x > 127)? 127 : x; + } + else + *dx = 0; + + if (y < def->threshMinY) + { + if (y < def->joyMinY) + y = def->joyMinY; + + y = -(y - def->threshMinY); + y *= def->joyMultYL; + y >>= JoyScaleShift; + *dy = (y > 127)? -127 : -y; + } + else if (y > def->threshMaxY) + { + if (y > def->joyMaxY) + y = def->joyMaxY; + + y = y - def->threshMaxY; + y *= def->joyMultYH; + y >>= JoyScaleShift; + *dy = (y > 127)? 127 : y; + } + else + *dy = 0; + + if (adaptive) + { + time = (TimeCount - lasttime) / 2; + if (time) + { + if (time > 8) + time = 8; + *dx *= time; + *dy *= time; + } + } + lasttime = TimeCount; +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_GetJoyButtons() - Returns the button status of the specified +// joystick +// +/////////////////////////////////////////////////////////////////////////// +static word +INL_GetJoyButtons(word joy) +{ +register word result; + + result = inp(0x201); // Get all the joystick buttons + result >>= joy? 6 : 4; // Shift into bits 0-1 + result &= 3; // Mask off the useless bits + result ^= 3; + return(result); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_GetJoyButtonsDB() - Returns the de-bounced button status of the +// specified joystick +// +/////////////////////////////////////////////////////////////////////////// +word +IN_GetJoyButtonsDB(word joy) +{ + word TimeCount = *clockw; + word lasttime; + word result1,result2; + + do + { + result1 = INL_GetJoyButtons(joy); + lasttime = TimeCount; + while(TimeCount == lasttime) + result2 = INL_GetJoyButtons(joy); + } while(result1 != result2); + return(result1); +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_StartKbd() - Sets up my keyboard stuff for use +// +/////////////////////////////////////////////////////////////////////////// +static void +INL_StartKbd() +{ + byte far *lock_key; + INL_KeyHook = 0; // Clear key hook + + IN_ClearKeysDown(); + + OldKeyVect = _dos_getvect(KeyInt); + + // turn off num-lock via BIOS + lock_key = MK_FP(0x040, 0x017); // Pointing to the address of the bios shift state keys + *lock_key&=(~(16 | 32 | 64)); // toggle off the locks by changing the values of the 4th, 5th, and 6th bits of the address byte of 0040:0017 + OldKeyVect(); // call BIOS keyhandler to change keyboard lights + _dos_setvect(KeyInt,INL_KeyService); +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_ShutKbd() - Restores keyboard control to the BIOS +// +/////////////////////////////////////////////////////////////////////////// +static void +INL_ShutKbd(void) +{ + pokeb(0x40,0x17,peekb(0x40,0x17) & 0xfaf0); // Clear ctrl/alt/shift flags + + _dos_setvect(KeyInt,OldKeyVect); +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_StartMouse() - Detects and sets up the mouse +// +/////////////////////////////////////////////////////////////////////////// +static boolean +INL_StartMouse(void) +{ + union REGS CPURegs; + if(_dos_getvect(MouseInt)) + { + Mouse(MReset); + if(CPURegs.x.ax == 0xffff) + return(true); + } + return(false); +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_ShutMouse() - Cleans up after the mouse +// +/////////////////////////////////////////////////////////////////////////// +static void +INL_ShutMouse(void) +{ +} + +// +// INL_SetJoyScale() - Sets up scaling values for the specified joystick +// +static void +INL_SetJoyScale(word joy) +{ + JoystickDef *def; + + def = &(inpu.JoyDefs[joy]); + def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX); + def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX); + def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY); + def->joyMultYH = JoyScaleMax / (def->joyMaxY - def->threshMaxY); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale() +// to set up scaling values +// +/////////////////////////////////////////////////////////////////////////// +void +IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy) +{ + word d,r; + JoystickDef *def; + + def = &(inpu.JoyDefs[joy]); + + def->joyMinX = minx; + def->joyMaxX = maxx; + r = maxx - minx; + d = r / 3; + def->threshMinX = ((r / 2) - d) + minx; + def->threshMaxX = ((r / 2) + d) + minx; + + def->joyMinY = miny; + def->joyMaxY = maxy; + r = maxy - miny; + d = r / 3; + def->threshMinY = ((r / 2) - d) + miny; + def->threshMaxY = ((r / 2) + d) + miny; + + INL_SetJoyScale(joy); +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_StartJoy() - Detects & auto-configures the specified joystick +// The auto-config assumes the joystick is centered +// +/////////////////////////////////////////////////////////////////////////// +static boolean +INL_StartJoy(word joy) +{ + word x,y; + + IN_GetJoyAbs(joy,&x,&y); + + if + ( + ((x == 0) || (x > MaxJoyValue - 10)) + || ((y == 0) || (y > MaxJoyValue - 10)) + ) + return(false); + else + { + IN_SetupJoy(joy,0,x * 2,0,y * 2); + return(true); + } +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_ShutJoy() - Cleans up the joystick stuff +// +/////////////////////////////////////////////////////////////////////////// +static void +INL_ShutJoy(word joy) +{ + inpu.JoysPresent[joy] = false; +} + +// Public routines + +/////////////////////////////////////////////////////////////////////////// +// +// IN_Startup() - Starts up the Input Mgr +// +/////////////////////////////////////////////////////////////////////////// +void +IN_Startup() +{ + boolean checkjoys,checkmouse; + word i; + + if (inst.IN_Started) + return; + + checkjoys = true; + checkmouse = true; + for (i = 1;i < _argc;i++) + { + switch (US_CheckParm(_argv[i],ParmStringsIN)) + { + case 0: + checkjoys = false; + break; + case 1: + checkmouse = false; + break; + } + } + + INL_StartKbd(); + inpu.MousePresent = checkmouse? INL_StartMouse() : false; + + for (i = 0;i < MaxJoys;i++) + inpu.JoysPresent[i] = checkjoys? INL_StartJoy(i) : false; + + {{0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51}}; + inst.IN_Started = true; + +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_Default() - Sets up default conditions for the Input Mgr +// +/////////////////////////////////////////////////////////////////////////// +void +IN_Default(boolean gotit,player_t *player,ControlType nt) +{ + int i; + if + ( + (!gotit) + || ((nt == ctrl_Joystick1) && !inpu.JoysPresent[0]) + || ((nt == ctrl_Joystick2) && !inpu.JoysPresent[1]) + || ((nt == ctrl_Mouse) && !inpu.MousePresent) + ) + nt = ctrl_Keyboard1; + inpu.KbdDefs[0].button0 = 0x1c; + inpu.KbdDefs[0].button1 = 0x38; + //in.KbdDefs[0].upleft = 0x47; + inpu.KbdDefs[0].up = 0x48; + //in.KbdDefs[0].upright = 0x49; + inpu.KbdDefs[0].left = 0x4b; + inpu.KbdDefs[0].right = 0x4d; + //in.KbdDefs[0].downleft = 0x4f; + inpu.KbdDefs[0].down = 0x50; + //in.KbdDefs[0].downright = 0x51; + IN_SetControlType(0,player,nt); + for(i=0; i>MaxPlayers;i++) + player[i].enti.d =2; +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_Shutdown() - Shuts down the Input Mgr +// +/////////////////////////////////////////////////////////////////////////// +void +IN_Shutdown() +{ + word i; + + if (!inst.IN_Started) + return; + + INL_ShutMouse(); + for (i = 0;i < MaxJoys;i++) + INL_ShutJoy(i); + INL_ShutKbd(); + + inst.IN_Started = false; +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_SetKeyHook() - Sets the routine that gets called by INL_KeyService() +// everytime a real make/break code gets hit +// +/////////////////////////////////////////////////////////////////////////// +void +IN_SetKeyHook(void (*hook)()) +{ + INL_KeyHook = hook; +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_ClearKeyDown() - Clears the keyboard array +// +/////////////////////////////////////////////////////////////////////////// +void +IN_ClearKeysDown() +{ + //int i; + + inpu.LastScan = sc_None; + inpu.LastASCII = key_None; + memset (inpu.Keyboard,0,sizeof(inpu.Keyboard)); +} + +/////////////////////////////////////////////////////////////////////////// +// +// INL_AdjustCursor() - Internal routine of common code from IN_ReadCursor() +// +/////////////////////////////////////////////////////////////////////////// +static void +INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy) +{ + if (buttons & (1 << 0)) + info->button0 = true; + if (buttons & (1 << 1)) + info->button1 = true; + + info->x += dx; + info->y += dy; +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_ReadCursor() - Reads the input devices and fills in the cursor info +// struct +// +/////////////////////////////////////////////////////////////////////////// +void +IN_ReadCursor(CursorInfo *info) +{ + word i, + buttons; + int dx,dy; + + info->x = info->y = 0; + info->button0 = info->button1 = false; + + if (inpu.MousePresent) + { + buttons = INL_GetMouseButtons(); + INL_GetMouseDelta(&dx,&dy); + INL_AdjustCursor(info,buttons,dx,dy); + } + + for (i = 0;i < MaxJoys;i++) + { + if (!inpu.JoysPresent[i]) + continue; + + buttons = INL_GetJoyButtons(i); + INL_GetJoyDelta(i,&dx,&dy,true); + dx /= 64; + dy /= 64; + INL_AdjustCursor(info,buttons,dx,dy); + } +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_ReadControl() - Reads the device associated with the specified +// player and fills in the control info struct +// +/////////////////////////////////////////////////////////////////////////// +void near +IN_ReadControl(word pn, player_t *player) +{ + boolean realdelta; +#if DEMO0 + byte dbyte; +#endif + word buttons; + int dx,dy; + Motion mx,my; + ControlType type; + sword conpee; + byte dir=DirTable[2]; +register KeyboardDef *def; + + dx = dy = 0; + mx = my = motion_None; + buttons = 0; + +#if DEMO0 + if (DemoMode == demo_Playback) + { + dbyte = DemoBuffer[DemoOffset + 1]; + my = (dbyte & 3) - 1; + mx = ((dbyte >> 2) & 3) - 1; + buttons = (dbyte >> 4) & 3; + + if (!(--DemoBuffer[DemoOffset])) + { + DemoOffset += 2; + if (DemoOffset >= DemoSize) + DemoMode = demo_PlayDone; + } + + realdelta = false; + } + else if (DemoMode == demo_PlayDone) + Quit ("Demo playback exceeded"); + else + { +#endif + switch (type = player[pn].Controls) + { + case ctrl_Keyboard1: + case ctrl_Keyboard2: + def = &(inpu.KbdDefs[type - ctrl_Keyboard]); + +/* if (Keyboard[def->upleft]) + mx = motion_Left,my = motion_Up; + else if (Keyboard[def->upright]) + mx = motion_Right,my = motion_Up; + else if (Keyboard[def->downleft]) + mx = motion_Left,my = motion_Down; + else if (Keyboard[def->downright]) + mx = motion_Right,my = motion_Down;*/ +//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])) + 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])) + 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; } + 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; } + break; + default: + break; + } +#ifdef __DEBUG_InputMgr__ + //if(dbg_testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c ", dirchar(player[pn].pdir)); } +#endif + } + } + //input from player + if (inpu.Keyboard[def->button0]) + buttons += 1 << 0; + if (inpu.Keyboard[def->button1]) + buttons += 1 << 1; + realdelta = false; + break; + case ctrl_Joystick1: + case ctrl_Joystick2: + INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy,false); + buttons = INL_GetJoyButtons(type - ctrl_Joystick); + realdelta = true; + break; + case ctrl_Mouse: + INL_GetMouseDelta(&dx,&dy); + buttons = INL_GetMouseButtons(); + realdelta = true; + break; + } +#ifdef DEMO0 + } +#endif + + if (realdelta) + { + mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None); + my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None); + } + else + { + dx = mx;// * 127; + dy = my;// * 127; + } + + player[pn].info.x = dx; + player[pn].info.xaxis = mx; + player[pn].info.y = dy; + player[pn].info.yaxis = my; + player[pn].info.button0 = buttons & (1 << 0); + player[pn].info.button1 = buttons & (1 << 1); + player[pn].info.button2 = buttons & (1 << 2); + player[pn].info.button3 = buttons & (1 << 3); +// player[pn].info.dir = DirTable[((my + 1) * 3) + (mx + 1)]; + conpee=(((my + 1) * 2) + (mx + 1))-1; + player[pn].info.dir = DirTable[conpee]; + + if(DirTable[conpee]!=2) player[pn].pdir=DirTable[conpee]; + if(player[pn].enti.q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None))) + { + if(dir==2) player[pn].enti.d = player[pn].info.dir; + else player[pn].enti.d = DirTable[dir]; + } + +#if DEMO0 + if (DemoMode == demo_Record) + { + // Pack the control info into a byte + dbyte = (buttons << 4) | ((mx + 1) << 2) | (my + 1); + + if + ( + (DemoBuffer[DemoOffset + 1] == dbyte) + && (DemoBuffer[DemoOffset] < 255) + ) + (DemoBuffer[DemoOffset])++; + else + { + if (DemoOffset || DemoBuffer[DemoOffset]) + DemoOffset += 2; + + if (DemoOffset >= DemoSize) + Quit ("Demo buffer overflow"); + + DemoBuffer[DemoOffset] = 1; + DemoBuffer[DemoOffset + 1] = dbyte; + } + } +#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) +{ + //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]); + printf("\n"); +} +#endif +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_SetControlType() - Sets the control type to be used by the specified +// player +// +/////////////////////////////////////////////////////////////////////////// +void +IN_SetControlType(word pn,player_t *player,ControlType type) +{ + // DEBUG - check that requested type is present? + player[pn].Controls = type; +} + +#if DEMO0 +/////////////////////////////////////////////////////////////////////////// +// +// IN_StartDemoRecord() - Starts the demo recording, using a buffer the +// size passed. Returns if the buffer allocation was successful +// +/////////////////////////////////////////////////////////////////////////// +boolean +IN_StartDemoRecord(word bufsize) +{ + if (!bufsize) + return(false); + + MM_GetPtr((memptr *)&DemoBuffer,bufsize); + DemoMode = demo_Record; + DemoSize = bufsize & ~1; + DemoOffset = 0; + DemoBuffer[0] = DemoBuffer[1] = 0; + + return(true); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_StartDemoPlayback() - Plays back the demo pointed to of the given size +// +/////////////////////////////////////////////////////////////////////////// +void +IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize) +{ + DemoBuffer = buffer; + DemoMode = demo_Playback; + DemoSize = bufsize & ~1; + DemoOffset = 0; +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_StopDemo() - Turns off demo mode +// +/////////////////////////////////////////////////////////////////////////// +void +IN_StopDemo(void) +{ + if ((DemoMode == demo_Record) && DemoOffset) + DemoOffset += 2; + + DemoMode = demo_Off; +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_FreeDemoBuffer() - Frees the demo buffer, if it's been allocated +// +/////////////////////////////////////////////////////////////////////////// +void +IN_FreeDemoBuffer(void) +{ + if (DemoBuffer) + MM_FreePtr((memptr *)&DemoBuffer); +} +#endif + + +/////////////////////////////////////////////////////////////////////////// +// +// IN_GetScanName() - Returns a string containing the name of the +// specified scan code +// +/////////////////////////////////////////////////////////////////////////// +byte * +IN_GetScanName(ScanCode scan) +{ + byte **p; + ScanCode far *s; + + for (s = ExtScanCodes,p = ExtScanNames;*s;p++,s++) + if (*s == scan) + return(*p); + + return(ScanNames[scan]); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_WaitForKey() - Waits for a scan code, then clears LastScan and +// returns the scan code +// +/////////////////////////////////////////////////////////////////////////// +ScanCode +IN_WaitForKey() +{ + ScanCode result; + + while (!(result = inpu.LastScan)) + ; + inpu.LastScan = 0; + return(result); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and +// returns the ASCII value +// +/////////////////////////////////////////////////////////////////////////// +char +IN_WaitForASCII() +{ + char result; + + while (!(result = inpu.LastASCII)) + ; + inpu.LastASCII = '\0'; + return(result); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_AckBack() - Waits for either an ASCII keypress or a button press +// +/////////////////////////////////////////////////////////////////////////// +void +IN_AckBack() +{ + word i; + + while (!inpu.LastScan) + { + if (inpu.MousePresent) + { + if (INL_GetMouseButtons()) + { + while (INL_GetMouseButtons()) + ; + return; + } + } + + for (i = 0;i < MaxJoys;i++) + { + if (inpu.JoysPresent[i]) + { + if (IN_GetJoyButtonsDB(i)) + { + while (IN_GetJoyButtonsDB(i)) + ; + return; + } + } + } + } + + IN_ClearKey(inpu.LastScan); + inpu.LastScan = sc_None; +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_Ack() - Clears user input & then calls IN_AckBack() +// +/////////////////////////////////////////////////////////////////////////// +void +IN_Ack() +{ + word i; + + if (!inst.IN_Started) + return; + + IN_ClearKey(inpu.LastScan); + inpu.LastScan = sc_None; + + if (inpu.MousePresent) + while (INL_GetMouseButtons()) + ; + for (i = 0;i < MaxJoys;i++) + if (inpu.JoysPresent[i]) + while (IN_GetJoyButtonsDB(i)) + ; + + IN_AckBack(); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_IsUserInput() - Returns true if a key has been pressed or a button +// is down +// +/////////////////////////////////////////////////////////////////////////// +boolean +IN_IsUserInput() +{ + boolean result; + word i; + + result = inpu.LastScan; + + if (inpu.MousePresent) + if (INL_GetMouseButtons()) + result = true; + + for (i = 0;i < MaxJoys;i++) + if (inpu.JoysPresent[i]) + if (INL_GetJoyButtons(i)) + result = true; + + return(result); +} + +/////////////////////////////////////////////////////////////////////////// +// +// IN_UserInput() - Waits for the specified delay time (in ticks) or the +// user pressing a key or a mouse button. If the clear flag is set, it +// then either clears the key or waits for the user to let the mouse +// button up. +// +/////////////////////////////////////////////////////////////////////////// +boolean +IN_UserInput(dword delay,boolean clear) +{ + word TimeCount = *clockw; + word lasttime; + + lasttime = TimeCount; + do + { + if (IN_IsUserInput()) + { + if (clear) + IN_AckBack(); + return(true); + } + } while (TimeCount - lasttime < delay); + return(false); +} + +//=========================================================================== + +/* +=================== += += IN_MouseButtons += +=================== +*/ + +byte IN_MouseButtons (void) +{ + union REGS CPURegs; + if (inpu.MousePresent) + { + Mouse(MButtons); + return CPURegs.x.bx; + } + else + return 0; +} + + +/* +=================== += += IN_JoyButtons += +=================== +*/ + +byte IN_JoyButtons (void) +{ + byte joybits; + + joybits = inp(0x201); // Get all the joystick buttons + joybits >>= 4; // only the high bits are useful + joybits ^= 15; // return with 1=pressed + + return joybits; +} + +boolean IN_KeyDown(byte code) +{ +#ifdef __DEBUG_InputMgr__ + if(!dbg_nointest) +#endif + return inpu.Keyboard[code]; +#ifdef __DEBUG_InputMgr__ + else + if(dbg_nointest && kbhit()) + return 1; + else + return 0; +#endif +} + +void IN_ClearKey(byte code) +{ + inpu.Keyboard[code] = false; + if(code == inpu.LastScan) + inpu.LastScan = sc_None; + } + +boolean IN_qb(byte kee) +{ +#ifdef __DEBUG_InputMgr__ + if(dbg_testkeyin) printf("%u\n", inpu.Keyboard[kee]); +#endif + if(inpu.Keyboard[kee]==true) return 1; + else return 0; +} + +ScanCode IN_GetLastScan() +{ + return inpu.LastScan; +} + +ScanCode IN_GetCurCode() +{ + return inst.CurCode; +} diff --git a/src/lib/16_in_.h b/src/lib/16_in_.h new file mode 100755 index 00000000..39519c20 --- /dev/null +++ b/src/lib/16_in_.h @@ -0,0 +1,308 @@ +/* Catacomb Apocalypse Source Code + * Copyright (C) 1993-2014 Flat Rock Software + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +// +// ID Engine +// ID_IN.h - Header file for Input Manager +// v1.0d1w +// By Jason Blochowiak +// Open Watcom port by sparky4 +// + +#ifndef __16_IN__ +#define __16_IN__ + +#include +#include "src/lib/16_head.h" +#include "src/lib/16_timer.h" +#ifdef __WATCOMC__ //borland C BCEXMM.EXE +#include "src/lib/16_dbg.h" +#include "src/lib/16_spri.h" +#include "src/lib/16_enti.h" +//#include "src/lib/bitmap.h" //old format +#endif + +//if else for gfxtesting and direction +//player[pn].d == 2 || +//player[pn].d != 2 || +#define DIRECTIONIFELSE (player[pn].info.dir == 2) +//#define NDIRECTIONIFELSE (player[pn].info.dir != 2) + +#define KeyInt 9 // The keyboard ISR number + +// Stuff for the joystick +#define JoyScaleMax 32768 +#define JoyScaleShift 8 +#define MaxJoyValue 5000 + +//#define MaxPlayers 2//future plans for multiple playable charaters and being able to alternate +#define MaxKbds 2 +#define MaxJoys 2 +#define MaxPads 2 +#define NumCodes 128 + +//typedef byte ScanCode; +#define sc_None 0 +#define sc_Bad 0xff +#define sc_Return 0x1c +#define sc_Enter sc_Return +#define sc_Escape 0x01 +#define sc_Space 0x39 +#define sc_BackSpace 0x0e +#define sc_Tab 0x0f +#define sc_Alt 0x38 +#define sc_Control 0x1d +#define sc_CapsLock 0x3a +#define sc_LShift 0x2a +#define sc_RShift 0x36 +#define sc_UpArrow 0x48 +#define sc_DownArrow 0x50 +#define sc_LeftArrow 0x4b +#define sc_RightArrow 0x4d +#define sc_Insert 0x52 +#define sc_Delete 0x53 +#define sc_Home 0x47 +#define sc_End 0x4f +#define sc_PgUp 0x49 +#define sc_PgDn 0x51 +#define sc_F1 0x3b +#define sc_F2 0x3c +#define sc_F3 0x3d +#define sc_F4 0x3e +#define sc_F5 0x3f +#define sc_F6 0x40 +#define sc_F7 0x41 +#define sc_F8 0x42 +#define sc_F9 0x43 +#define sc_F10 0x44 +#define sc_F11 0x57 +#define sc_F12 0x59 + +#define sc_1 0x02 +#define sc_2 0x03 +#define sc_3 0x04 +#define sc_4 0x05 +#define sc_5 0x06 +#define sc_6 0x07 +#define sc_7 0x08 +#define sc_8 0x09 +#define sc_9 0x0a +#define sc_0 0x0b + +#define sc_A 0x1e +#define sc_B 0x30 +#define sc_C 0x2e +#define sc_D 0x20 +#define sc_E 0x12 +#define sc_F 0x21 +#define sc_G 0x22 +#define sc_H 0x23 +#define sc_I 0x17 +#define sc_J 0x24 +#define sc_K 0x25 +#define sc_L 0x26 +#define sc_M 0x32 +#define sc_N 0x31 +#define sc_O 0x18 +#define sc_P 0x19 +#define sc_Q 0x10 +#define sc_R 0x13 +#define sc_S 0x1f +#define sc_T 0x14 +#define sc_U 0x16 +#define sc_V 0x2f +#define sc_W 0x11 +#define sc_X 0x2d +#define sc_Y 0x15 +#define sc_Z 0x2c + +#define key_None 0 +#define key_Return 0x0d +#define key_Enter key_Return +#define key_Escape 0x1b +#define key_Space 0x20 +#define key_BackSpace 0x08 +#define key_Tab 0x09 +#define key_Delete 0x7f + +#define key_LSuper 0x5b +#define key_RSuper 0x5c +#define key_Menu 0x5d + +// Stuff for the mouse +#define MReset 0 +#define MButtons 3 +#define MDelta 11 + +#define MouseInt 0x33 +#ifdef DEMO0 +typedef enum { + demo_Off,demo_Record,demo_Playback,demo_PlayDone + } Demo; +#endif +//moved to 16_tdef.h +/*typedef enum { + //ctrl_None, // MDM (GAMERS EDGE) - added + ctrl_Keyboard, + ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2, + ctrl_Joystick, + ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2, + ctrl_Mouse, + } ControlType; +typedef enum { + motion_Left = -1,motion_Up = -1, + motion_None = 0, + motion_Right = 1,motion_Down = 1 + } Motion; +typedef enum { + dir_North,//dir_NorthEast, + dir_West,//dir_Nortinest, + dir_None, + dir_East,//,dir_SouthEast, + dir_South,//dir_Soutinest, + } Direction; +typedef struct { + boolean near button0,button1,button2,button3; + int near x,y; + Motion near xaxis,yaxis; + Direction near dir; + } CursorInfo; + +typedef struct { + ScanCode near button0,button1, + //upleft, + up, + down, + left, + right + //upright, + //downleft, + //,downright + ; + } KeyboardDef; +typedef struct { + word near joyMinX,joyMinY, + threshMinX,threshMinY, + threshMaxX,threshMaxY, + joyMaxX,joyMaxY, + joyMultXL,joyMultYL, + joyMultXH,joyMultYH; + } JoystickDef; + +typedef struct +{ + int x; //player exact position on the viewable map + int y; //player exact position on the viewable map + int tx; //player tile position on the viewable map + int ty; //player tile position on the viewable map + int triggerx; //player's trigger box tile position on the viewable map + int triggery; //player's trigger box tile position on the viewable map + int sheetsetx; //NOT USED YET! player sprite sheet set on the image x + int sheetsety; //NOT USED YET! player sprite sheet set on the image y + byte d; //direction to render sprite!! wwww + byte q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www + byte near pdir; //previous direction~ + word speed; //player speed! + word spt; //speed per tile +#ifdef __WATCOMC__ + struct sprite *spri; //supposively the sprite sheet data + memptr gr; + entity_t *ent; +#endif + bitmap_t *data; //supposively the sprite sheet data//old format + bitmap_t bmp; + sword hp; //hitpoints of the player + int persist_aniframe; // gonna be increased to 1 before being used, so 0 is ok for default + CursorInfo info; + ControlType Controls; +//newer vars + int dx, dy, delta; //TODO: what is this? ^^ +} player_t;*/ + +/* +============================================================================= + + GLOBAL VARIABLES + +============================================================================= +*/ +/*extern struct inconfig +{ + boolean MousePresent; + boolean JoysPresent[MaxJoys]; + boolean Keyboard[NumCodes]; + boolean Paused; + char LastASCII; + ScanCode LastScan; + + KeyboardDef KbdDefs[MaxKbds]; + JoystickDef JoyDefs[MaxJoys]; +} inpu;*/ + +#ifdef DEMO0 + static Demo DemoMode = demo_Off; + static byte /*_seg*/ *DemoBuffer; + static word DemoOffset,DemoSize; +#endif + +// Internal routines +extern void interrupt INL_KeyService(); +extern void Mouse(int x); +//static void INL_GetMouseDelta(int *x,int *y); +//static word INL_GetMouseButtons(void); +extern void IN_GetJoyAbs(word joy,word *xp,word *yp); +//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive); +//static word INL_GetJoyButtons(word joy); +extern word IN_GetJoyButtonsDB(word joy); +//static void INL_StartKbd(void); +//static void INL_ShutKbd(void); +//static boolean INL_StartMouse(void); +//static void INL_ShutMouse(void); +//static void INL_SetJoyScale(word joy); +extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy); +//static boolean INL_StartJoy(word joy); +//static void INL_ShutJoy(word joy); +extern void IN_Startup(); +extern void IN_Default(boolean gotit,player_t *player,ControlType nt); +extern void IN_Shutdown(); +extern void IN_SetKeyHook(void (*hook)()); +extern void IN_ClearKeysDown(); +//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy); +extern void IN_ReadCursor(CursorInfo *info); +extern void near IN_ReadControl(word pn, player_t *player); +extern void IN_SetControlType(word pn,player_t *player,ControlType type); +#if DEMO0 +extern boolean IN_StartDemoRecord(word bufsize); +extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize); +extern void IN_StopDemo(void); +extern void IN_FreeDemoBuffer(void); +#endif +extern byte *IN_GetScanName(ScanCode scan); +extern ScanCode IN_WaitForKey(); +extern char IN_WaitForASCII(); +extern void IN_AckBack(); +extern void IN_Ack(); +extern boolean IN_IsUserInput(); +extern boolean IN_UserInput(dword delay,boolean clear); +extern boolean IN_KeyDown(byte code); +extern void IN_ClearKey(byte code); +extern boolean IN_qb(byte kee); +extern ScanCode IN_GetLastScan(); +extern ScanCode IN_GetCurCode(); + +#endif diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index f0f39876..9cb36102 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -189,7 +189,29 @@ typedef struct { //from 16_in //========================================================================== -#define MaxPlayers 2//future plans for multiple playable charaters and being able to alternate +#define KeyInt 9 // The keyboard ISR number + +// +// mouse constants +// +#define MReset 0 +#define MButtons 3 +#define MDelta 11 + +#define MouseInt 0x33 +//#define Mouse(x) _AX = x,geninterrupt(MouseInt) + +// +// joystick constants +// +#define JoyScaleMax 32768 +#define JoyScaleShift 8 +#define MaxJoyValue 5000 + +#define MaxPlayers 4 +#define MaxKbds 2 +#define MaxJoys 2 +#define NumCodes 128 typedef byte ScanCode; @@ -241,6 +263,33 @@ typedef struct { joyMultXH,joyMultYH; } JoystickDef; +typedef struct// instat +{ + boolean IN_Started; + boolean CapsLock; + ScanCode CurCode,LastCode; +} in_status_t; + +typedef struct// inconfig +{ + in_status_t instat; +// +// configuration variables +// + boolean Keyboard[NumCodes], + JoysPresent[MaxJoys], + MousePresent, + JoyPadPresent; + +// Global variables + boolean Paused; + char LastASCII; + ScanCode LastScan; + + KeyboardDef KbdDefs[MaxKbds]; + JoystickDef JoyDefs[MaxJoys]; +} in_info_t; + //========================================================================== typedef struct @@ -571,7 +620,9 @@ typedef struct loghandle_t handle; //handles for file logging kurokku_t kurokku; //clock struct mminfo_t mm; mminfotype mmi; // mm stuff +//++++ in_info_t in; // 16_in info player_t player[MaxPlayers]; // player vars +//==== word far* clockw; /* 18.2hz clock */ } global_game_variables_t; #ifdef __WATCOMC__ diff --git a/src/lib/16_timer.c b/src/lib/16_timer.c index a9dba5d5..affe6738 100755 --- a/src/lib/16_timer.c +++ b/src/lib/16_timer.c @@ -22,14 +22,14 @@ #include "src/lib/16_timer.h" -static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ +//static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ clock_t start_timer(global_game_variables_t *gv) { gv->kurokku.t = clock(); gv->kurokku.tiku = 0; gv->video.sfip = 0; - gv->kurokku.clock_start = *clockw; - gv->kurokku.clock = clockw; + gv->kurokku.clock_start = 0x046C; /* 18.2hz clock */ + gv->kurokku.clock = (word far*) 0x046C; /* 18.2hz clock */ gv->kurokku.wcpu = WCPU_detectcpu(); //turn this off if XT diff --git a/wcpu.exe b/wcpu.exe index 6a5fae4e3fd918f9bbf60ed7c83cc5b9a7215290..75555b8f4ac5243f4dd7f320d6194fee1db70d66 100755 GIT binary patch delta 6245 zcmZ`-4_H*!mA~)KFaraO2#5-bU~v44GR9R2I2waPOw}N4M#T!*cH6bvZoUL(AZ_i; zm?%*+J9O~ zNFy*(Oh_);X0)#X3cj^-gnXM4auyf|ehQxBz;il681RmskfT61@Oxlq5+PHKgsd_W z57~={U!wB~U{Nw5Ex>EQPk;c>4V2^CI$#{n)hUGR0o=ej;3kl2BE$o<0Ef`;eYAbR z5b&E+Lh`2*@}I!}03XgE5Hc6|0`S5@LcS0D1PB5j01{wcM2G|6fj5CM z;L*jHFmM4F2Il52A!H@c0Q?Ae1%q~@?FSM+F`v#|zoppEZtvRM_ZhJ*=Oxltc4E)0 z#V7Ks0%KH&Y#)o184i%9b(e5!1qAsr$Ee;{pV zAonoW7UYKpZY2I(x?^z#0`?PrNEfkmyg`KE;>eLF&K9;^6~gcDdxW%ZR(?fdZx@Wb z)$UTdpiYm4w?PYL>wzkU6U3=|bmYxN!Gmv;gHIkQIa_FX<4s~|vHV25sQZeim$Vs9 z5&klN@{PAif#nQg;5~X@_kJ&3{M)z5$U&d&5R{z}P-y2N(q=wFI)9BOKsvk7yhk4X z->3N7fjI3vj@KXwD5`0koLMq){wh_Qp;$XMo6vJKg9JEk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