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

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

?? id_in.c

?? wolf3d游戲源代碼!非常不錯(cuò)! 與大家共享! 如果大家又相關(guān)資料還請(qǐng)多多上傳!
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
//
//	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
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
26uuu亚洲综合色欧美| 91国偷自产一区二区三区成为亚洲经典 | 国产寡妇亲子伦一区二区| 欧美videos大乳护士334| 免费的成人av| 国产婷婷色一区二区三区四区| 国产成人午夜99999| 中文乱码免费一区二区| 成人免费av网站| 亚洲精品国产高清久久伦理二区| 91网站最新网址| 亚洲国产欧美日韩另类综合| 欧美性生交片4| 麻豆91在线播放免费| 国产精品丝袜黑色高跟| 色噜噜狠狠色综合中国| 日韩电影在线观看网站| 国产欧美一区二区在线| 在线免费视频一区二区| 午夜av电影一区| 久久精品一区蜜桃臀影院| av爱爱亚洲一区| 秋霞午夜av一区二区三区| 国产日产精品1区| 91麻豆自制传媒国产之光| 日本va欧美va精品| 亚洲欧美在线高清| 91精品欧美久久久久久动漫| 成人免费视频免费观看| 日韩影视精彩在线| 欧美国产激情一区二区三区蜜月| 欧美日韩久久久一区| 国产黄人亚洲片| 视频一区中文字幕| 亚洲欧洲精品天堂一级| 精品三级在线看| 91视频免费播放| 99久久国产综合精品麻豆| 蜜桃视频一区二区| 伊人色综合久久天天人手人婷| 欧美tickling挠脚心丨vk| 91色乱码一区二区三区| 久久97超碰国产精品超碰| 亚洲尤物视频在线| 久久久久国产成人精品亚洲午夜| 欧美日韩黄色一区二区| 成人av在线一区二区三区| 精品一区二区日韩| 婷婷成人综合网| 亚洲视频图片小说| 亚洲国产高清在线观看视频| 一区二区三区国产精华| 99久久久国产精品| 国产精品久久久久久亚洲毛片 | 成人精品小蝌蚪| 欧美日本国产一区| 成人免费视频免费观看| 91免费在线播放| 亚洲另类在线制服丝袜| 亚洲综合在线免费观看| 中文字幕一区免费在线观看| 26uuu色噜噜精品一区二区| 欧美一级爆毛片| 欧美日韩黄色一区二区| 欧美在线观看一区| 日本韩国精品在线| 91美女福利视频| 91毛片在线观看| 色婷婷国产精品久久包臀| 不卡影院免费观看| 国产91在线看| 从欧美一区二区三区| 国产精品夜夜爽| 国产一区二区三区在线观看免费视频| 免费成人结看片| 热久久免费视频| 久久精品国产99国产精品| 男人的天堂久久精品| 久久国产日韩欧美精品| 久久成人精品无人区| 国产在线一区二区综合免费视频| 日韩av一级电影| 日本成人在线不卡视频| 日韩国产高清在线| 蜜桃av一区二区在线观看| 美女视频黄频大全不卡视频在线播放| 日本中文字幕一区二区视频| 久草精品在线观看| 国产91在线|亚洲| 99精品久久99久久久久| 欧美在线视频日韩| 91麻豆精品国产综合久久久久久| 欧美一区二区网站| 国产日韩av一区| 亚洲欧洲制服丝袜| 亚洲激情图片一区| 亚洲大片在线观看| 久久丁香综合五月国产三级网站| 粉嫩一区二区三区在线看| 91香蕉视频污| 91精品久久久久久久久99蜜臂| 日韩一区二区免费在线电影| 91精品国产91热久久久做人人 | 日韩午夜在线观看| 777色狠狠一区二区三区| 欧美日韩一区在线观看| 91精品国产欧美一区二区18| 精品视频在线免费观看| 日韩免费性生活视频播放| 91精品国产91久久综合桃花 | 亚洲激情图片一区| 亚洲一区二区不卡免费| 久久99精品久久久久久动态图| 欧美日韩精品一区二区天天拍小说 | 成人a免费在线看| 欧美综合天天夜夜久久| 精品盗摄一区二区三区| 中文字幕一区二| 日韩精品一区第一页| 福利91精品一区二区三区| 欧美三级日韩三级| 中文字幕精品一区二区三区精品| 亚洲高清中文字幕| 粉嫩在线一区二区三区视频| 欧美日韩久久一区| 国产精品初高中害羞小美女文| 日本视频一区二区| 91丝袜国产在线播放| 2019国产精品| 五月婷婷久久综合| 99热精品国产| 国产亚洲综合在线| 日韩高清不卡在线| 色综合天天综合色综合av| 久久亚洲综合色| 日韩电影免费在线看| 日本道精品一区二区三区| 久久精品亚洲麻豆av一区二区 | 欧美中文字幕一区| 日本一区二区三区在线观看| 日本欧美一区二区在线观看| 日本高清无吗v一区| 国产精品天干天干在观线| 久久国产精品99久久久久久老狼| 欧美网站大全在线观看| 国产精品久久久久久久久久免费看 | 亚洲gay无套男同| 一本到不卡免费一区二区| 国产色综合久久| 国产伦精品一区二区三区视频青涩| 5566中文字幕一区二区电影| 亚洲另类中文字| 日日夜夜精品视频免费| 亚洲成人av电影| 久久精品二区亚洲w码| 欧美日韩综合不卡| 亚洲精品国产高清久久伦理二区| 成人av在线资源网站| 亚洲国产精品精华液ab| 国产麻豆精品久久一二三| 久久影音资源网| 国产美女精品人人做人人爽 | 色综合久久六月婷婷中文字幕| 欧美经典一区二区| 成人精品国产免费网站| 欧美激情中文字幕| 国产成人免费在线视频| 欧美激情一区三区| 99精品国产热久久91蜜凸| 中文字幕在线不卡| 91麻豆免费观看| 亚洲午夜在线视频| 欧美日韩国产免费| 日韩不卡一区二区三区| 日韩一区二区三区免费看 | 岛国一区二区三区| 国产精品入口麻豆九色| av综合在线播放| 一区二区三区美女视频| 欧美日韩免费不卡视频一区二区三区| 午夜精品影院在线观看| 日韩一卡二卡三卡| 国产在线精品免费| 国产精品久久久久久久久搜平片| 91免费在线视频观看| 五月婷婷色综合| 久久久欧美精品sm网站| 91麻豆免费在线观看| 日韩黄色片在线观看| 精品国产麻豆免费人成网站| 懂色av一区二区在线播放| 亚洲婷婷综合色高清在线| 国产人伦精品一区二区| 99精品视频在线播放观看| 亚洲国产视频直播| 欧美大片一区二区三区| 丁香桃色午夜亚洲一区二区三区 | 亚洲大型综合色站| 欧美mv和日韩mv的网站| 99精品欧美一区二区三区综合在线|