亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? id_in.c

?? Wolf 3D official source code.
?? C
?? 第 1 頁 / 共 2 頁
字號:
//
//	ID Engine
//	ID_IN.c - Input Manager
//	v1.0d1
//	By Jason Blochowiak
//

//
//	This module handles dealing with the various input devices
//
//	Depends on: Memory Mgr (for demo recording), Sound Mgr (for timing stuff),
//				User Mgr (for command line parms)
//
//	Globals:
//		LastScan - The keyboard scan code of the last key pressed
//		LastASCII - The ASCII value of the last key pressed
//	DEBUG - there are more globals
//

#include "ID_HEADS.H"
#pragma	hdrstop

#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

/*
=============================================================================

					GLOBAL VARIABLES

=============================================================================
*/

//
// configuration variables
//
boolean			MousePresent;
boolean			JoysPresent[MaxJoys];
boolean			JoyPadPresent;


// 	Global variables
		boolean		Keyboard[NumCodes];
		boolean		Paused;
		char		LastASCII;
		ScanCode	LastScan;

		KeyboardDef	KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};
		JoystickDef	JoyDefs[MaxJoys];
		ControlType	Controls[MaxPlayers];

		longword	MouseDownCount;

		Demo		DemoMode = demo_Off;
		byte _seg	*DemoBuffer;
		word		DemoOffset,DemoSize;

/*
=============================================================================

					LOCAL VARIABLES

=============================================================================
*/
static	byte        far ASCIINames[] =		// Unshifted ASCII for scan codes
					{
//	 0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
	0  ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8  ,9  ,	// 0
	'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0  ,'a','s',	// 1
	'd','f','g','h','j','k','l',';',39 ,'`',0  ,92 ,'z','x','c','v',	// 2
	'b','n','m',',','.','/',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,	// 3
	0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',	// 4
	'2','3','0',127,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
					},
					far ShiftNames[] =		// Shifted ASCII for scan codes
					{
//	 0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
	0  ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',8  ,9  ,	// 0
	'Q','W','E','R','T','Y','U','I','O','P','{','}',13 ,0  ,'A','S',	// 1
	'D','F','G','H','J','K','L',':',34 ,'~',0  ,'|','Z','X','C','V',	// 2
	'B','N','M','<','>','?',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,	// 3
	0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',	// 4
	'2','3','0',127,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
					},
					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
					};


static	boolean		IN_Started;
static	boolean		CapsLock;
static	ScanCode	CurCode,LastCode;

static	Direction	DirTable[] =		// Quick lookup for total direction
					{
						dir_NorthWest,	dir_North,	dir_NorthEast,
						dir_West,		dir_None,	dir_East,
						dir_SouthWest,	dir_South,	dir_SouthEast
					};

static	void			(*INL_KeyHook)(void);
static	void interrupt	(*OldKeyVect)(void);

static	char			*ParmStrings[] = {"nojoys","nomouse",nil};

//	Internal routines

///////////////////////////////////////////////////////////////////////////
//
//	INL_KeyService() - Handles a keyboard interrupt (key up/down)
//
///////////////////////////////////////////////////////////////////////////
static void interrupt
INL_KeyService(void)
{
static	boolean	special;
		byte	k,c,
				temp;
		int		i;

	k = inportb(0x60);	// Get the scan code

	// Tell the XT keyboard controller to clear the key
	outportb(0x61,(temp = inportb(0x61)) | 0x80);
	outportb(0x61,temp);

	if (k == 0xe0)		// Special key prefix
		special = true;
	else if (k == 0xe1)	// Handle Pause key
		Paused = true;
	else
	{
		if (k & 0x80)	// Break code
		{
			k &= 0x7f;

// DEBUG - handle special keys: ctl-alt-delete, print scrn

			Keyboard[k] = false;
		}
		else			// Make code
		{
			LastCode = CurCode;
			CurCode = LastScan = k;
			Keyboard[k] = true;

			if (special)
				c = SpecialNames[k];
			else
			{
				if (k == sc_CapsLock)
				{
					CapsLock ^= true;
					// DEBUG - make caps lock light work
				}

				if (Keyboard[sc_LShift] || Keyboard[sc_RShift])	// If shifted
				{
					c = ShiftNames[k];
					if ((c >= 'A') && (c <= 'Z') && CapsLock)
						c += 'a' - 'A';
				}
				else
				{
					c = ASCIINames[k];
					if ((c >= 'a') && (c <= 'z') && CapsLock)
						c -= 'a' - 'A';
				}
			}
			if (c)
				LastASCII = c;
		}

		special = false;
	}

	if (INL_KeyHook && !special)
		INL_KeyHook();
	outportb(0x20,0x20);
}

///////////////////////////////////////////////////////////////////////////
//
//	INL_GetMouseDelta() - Gets the amount that the mouse has moved from the
//		mouse driver
//
///////////////////////////////////////////////////////////////////////////
static void
INL_GetMouseDelta(int *x,int *y)
{
	Mouse(MDelta);
	*x = _CX;
	*y = _DX;
}

///////////////////////////////////////////////////////////////////////////
//
//	INL_GetMouseButtons() - Gets the status of the mouse buttons from the
//		mouse driver
//
///////////////////////////////////////////////////////////////////////////
static word
INL_GetMouseButtons(void)
{
	word	buttons;

	Mouse(MButtons);
	buttons = _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
asm		push	si
asm		push	di
asm		cli					// Make sure an interrupt doesn't screw the timings


asm		mov		dx,0x201
asm		in		al,dx
asm		out		dx,al		// Clear the resistors

asm		mov		ah,[xb]		// Get masks into registers
asm		mov		ch,[yb]

asm		xor		si,si		// Clear count registers
asm		xor		di,di
asm		xor		bh,bh		// Clear high byte of bx for later

asm		push	bp			// Don't mess up stack frame
asm		mov		bp,MaxJoyValue

loop:
asm		in		al,dx		// Get bits indicating whether all are finished

asm		dec		bp			// Check bounding register
asm		jz		done		// We have a silly value - abort

asm		mov		bl,al		// Duplicate the bits
asm		and		bl,ah		// Mask off useless bits (in [xb])
asm		add		si,bx		// Possibly increment count register
asm		mov		cl,bl		// Save for testing later

asm		mov		bl,al
asm		and		bl,ch		// [yb]
asm		add		di,bx

asm		add		cl,bl
asm		jnz		loop 		// If both bits were 0, drop out

done:
asm     pop		bp

asm		mov		cl,[xs]		// Get the number of bits to shift
asm		shr		si,cl		//  and shift the count that many times

asm		mov		cl,[ys]
asm		shr		di,cl

asm		mov		[x],si		// Store the values into the variables
asm		mov		[y],di

asm		pop		di
asm		pop		si
asm		popf				// Restore the registers

	*xp = x;
	*yp = y;
}

///////////////////////////////////////////////////////////////////////////
//
//	INL_GetJoyDelta() - Returns the relative movement of the specified
//		joystick (from +/-127)
//
///////////////////////////////////////////////////////////////////////////
void INL_GetJoyDelta(word joy,int *dx,int *dy)
{
	word		x,y;
	longword	time;
	JoystickDef	*def;
static	longword	lasttime;

	IN_GetJoyAbs(joy,&x,&y);
	def = 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;

	lasttime = TimeCount;
}

///////////////////////////////////////////////////////////////////////////
//
//	INL_GetJoyButtons() - Returns the button status of the specified
//		joystick
//
///////////////////////////////////////////////////////////////////////////
static word
INL_GetJoyButtons(word joy)
{
register	word	result;

	result = inportb(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)
{
	longword	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(void)
{
	INL_KeyHook = NULL;			// no key hook routine

	IN_ClearKeysDown();

	OldKeyVect = getvect(KeyInt);
	setvect(KeyInt,INL_KeyService);
}

///////////////////////////////////////////////////////////////////////////
//
//	INL_ShutKbd() - Restores keyboard control to the BIOS
//
///////////////////////////////////////////////////////////////////////////
static void
INL_ShutKbd(void)
{
	poke(0x40,0x17,peek(0x40,0x17) & 0xfaf0);	// Clear ctrl/alt/shift flags

	setvect(KeyInt,OldKeyVect);
}

///////////////////////////////////////////////////////////////////////////
//
//	INL_StartMouse() - Detects and sets up the mouse
//
///////////////////////////////////////////////////////////////////////////
static boolean
INL_StartMouse(void)
{
#if 0
	if (getvect(MouseInt))
	{
		Mouse(MReset);
		if (_AX == 0xffff)
			return(true);
	}
	return(false);
#endif
 union REGS regs;
 unsigned char far *vector;


 if ((vector=MK_FP(peek(0,0x33*4+2),peek(0,0x33*4)))==NULL)
   return false;

 if (*vector == 207)
   return false;

 Mouse(MReset);
 return true;
}

///////////////////////////////////////////////////////////////////////////
//
//	INL_ShutMouse() - Cleans up after the mouse
//
///////////////////////////////////////////////////////////////////////////
static void
INL_ShutMouse(void)
{
}

//
//	INL_SetJoyScale() - Sets up scaling values for the specified joystick
//

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美日韩黄色大片| 久久99精品国产麻豆不卡| 日韩欧美高清在线| 91在线视频官网| 久久精品国产一区二区三区免费看| 国产精品狼人久久影院观看方式| 欧美一区二区三区在线观看视频 | 日本vs亚洲vs韩国一区三区二区| 国产欧美综合在线观看第十页 | 中文字幕一区日韩精品欧美| 日韩一卡二卡三卡| 在线视频综合导航| 成人精品免费看| 日韩一区二区三区免费观看| 成人av影院在线| 国产在线精品免费av| 日韩经典一区二区| 亚洲小说欧美激情另类| 国产精品美女一区二区在线观看| www国产精品av| 日韩精品一区二| 69堂成人精品免费视频| 欧美日韩视频一区二区| 色999日韩国产欧美一区二区| 成人精品免费看| 大美女一区二区三区| 国产成人免费在线观看不卡| 精品一区二区三区蜜桃| 久久精品99久久久| 久久成人av少妇免费| 蜜桃精品视频在线| 美女被吸乳得到大胸91| 美女视频黄 久久| 久久精品免费看| 青青草成人在线观看| 日韩激情中文字幕| 蜜乳av一区二区| 美女视频网站黄色亚洲| 美女一区二区视频| 久久成人久久鬼色| 精品无码三级在线观看视频| 久久精品国产亚洲高清剧情介绍| 精品影视av免费| 国产精品一区二区你懂的| 国产成人亚洲综合色影视| 国产经典欧美精品| 国产精品亚洲视频| 成人毛片老司机大片| 成人高清在线视频| 91香蕉视频污| 欧美日韩三级一区二区| 7777女厕盗摄久久久| 日韩一级完整毛片| 久久久综合激的五月天| 欧美激情自拍偷拍| 亚洲男女一区二区三区| 亚洲成av人片一区二区梦乃| 欧美96一区二区免费视频| 国内成+人亚洲+欧美+综合在线| 26uuu久久天堂性欧美| 久久久久久**毛片大全| 欧美激情一区二区三区全黄 | 一区二区三区四区乱视频| 亚洲国产综合91精品麻豆| 天天综合色天天综合色h| 日本视频一区二区| 国产精品亚洲专一区二区三区 | 欧美三级一区二区| 日韩欧美你懂的| 中文字幕日韩一区| 视频一区视频二区中文| 国产综合久久久久久鬼色| 91蝌蚪porny| 日韩视频免费直播| ...xxx性欧美| 蜜桃精品视频在线| 91碰在线视频| 精品美女一区二区三区| 亚洲欧美日韩久久精品| 久久aⅴ国产欧美74aaa| 91在线视频在线| 精品人伦一区二区色婷婷| 日韩一区在线看| 蜜臀av国产精品久久久久| 91在线观看美女| 欧美电视剧免费全集观看| 亚洲三级免费观看| 久草在线在线精品观看| 在线日韩一区二区| 国产女同互慰高潮91漫画| 三级影片在线观看欧美日韩一区二区 | 欧美精品视频www在线观看| 国产日韩一级二级三级| 日韩精品一级中文字幕精品视频免费观看 | 成人深夜福利app| 91精品国产综合久久久久| 国产精品理论片在线观看| 日本在线播放一区二区三区| 91日韩精品一区| 久久精品亚洲国产奇米99| 亚洲一区成人在线| 大桥未久av一区二区三区中文| 欧美一级在线免费| 亚洲二区视频在线| www.亚洲人| 国产日韩成人精品| 精品一区精品二区高清| 欧美另类变人与禽xxxxx| 亚洲欧美日韩国产手机在线| 国产黄色精品网站| 日韩欧美国产午夜精品| 午夜视频久久久久久| 色乱码一区二区三区88| 亚洲国产精品成人综合| 国产一区二区不卡在线| 精品日韩在线一区| 奇米影视在线99精品| 欧美妇女性影城| 亚洲综合色在线| 日本丶国产丶欧美色综合| 亚洲摸摸操操av| 91日韩一区二区三区| 自拍偷自拍亚洲精品播放| voyeur盗摄精品| 欧美国产精品专区| 成人国产电影网| 国产精品毛片a∨一区二区三区| 国产在线播放一区| 精品久久久久久亚洲综合网| 久草热8精品视频在线观看| 欧美sm极限捆绑bd| 久久精品国内一区二区三区| 欧美大片一区二区| 精品综合久久久久久8888| 精品久久久久久久人人人人传媒| 日本不卡一区二区| 欧美一级高清片| 精品一区二区三区在线播放 | 天天亚洲美女在线视频| 欧美性一区二区| 亚洲动漫第一页| 制服丝袜亚洲精品中文字幕| 欧美日韩高清在线| 毛片av中文字幕一区二区| 欧美va亚洲va香蕉在线| 国产一区二三区| 中文字幕不卡的av| 99re热视频精品| 一片黄亚洲嫩模| 欧美精品久久99久久在免费线 | 国产成人免费在线视频| 国产精品欧美一区喷水| 色综合久久久久综合体| 亚洲成人先锋电影| 精品国产免费一区二区三区四区| 国产成人免费在线| 亚洲欧洲av色图| 欧美日本一道本在线视频| 免费看日韩a级影片| 国产欧美一区二区在线| 色一区在线观看| 美女性感视频久久| 国产精品毛片高清在线完整版 | 欧美一区二区美女| 国产一区二区福利| 亚洲欧美日韩国产手机在线| 3751色影院一区二区三区| 国产麻豆一精品一av一免费 | 精品在线视频一区| 国产精品毛片大码女人| 欧美男同性恋视频网站| 国产真实乱对白精彩久久| 最新成人av在线| 欧美精品乱人伦久久久久久| 国产成人丝袜美腿| 亚洲图片欧美综合| 国产日韩欧美精品综合| 欧美少妇性性性| 成人一区二区三区视频在线观看 | 久久嫩草精品久久久精品一| 一本久久综合亚洲鲁鲁五月天| 日本成人在线视频网站| 国产精品久久久久久久久晋中| 欧美日本国产视频| 不卡av电影在线播放| 欧美日韩三级在线| av中文字幕在线不卡| 欧美bbbbb| 亚洲国产视频直播| 欧美国产一区二区| 欧美一区二区三级| 色偷偷成人一区二区三区91 | 成人av免费网站| 日本三级亚洲精品| 一区二区三区日韩在线观看| 国产亚洲一区二区在线观看| 91 com成人网| 欧美影院午夜播放| 99国产精品99久久久久久| 国产一区二区三区av电影|