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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? id_in.c

?? wolf3d游戲源代碼!非常不錯! 與大家共享! 如果大家又相關資料還請多多上傳!
?? 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
//

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩成人免费看| 色一区在线观看| 91成人看片片| 久久女同精品一区二区| 亚洲国产一区在线观看| 国产传媒久久文化传媒| 欧美久久久久免费| 亚洲天堂精品在线观看| 国产一区二区三区蝌蚪| 欧美日韩电影一区| 亚洲免费av高清| 国产成人精品免费在线| 欧美xingq一区二区| 午夜精品福利视频网站| 99re6这里只有精品视频在线观看| 日韩精品一区二| 亚洲欧洲www| 国产亚洲一区二区三区在线观看| 欧美精品丝袜久久久中文字幕| 亚洲一区二区三区四区在线观看 | 91精品国产色综合久久ai换脸| 久久精品人人做人人爽97| 日韩 欧美一区二区三区| 欧洲一区在线电影| 亚洲色图一区二区| va亚洲va日韩不卡在线观看| 国产拍欧美日韩视频二区| 韩国v欧美v日本v亚洲v| 精品三级在线观看| 狠狠狠色丁香婷婷综合久久五月| 91精品在线观看入口| 丝袜美腿亚洲一区二区图片| 欧美日本乱大交xxxxx| 日日骚欧美日韩| 欧美激情一区三区| 在线欧美日韩国产| 精品1区2区在线观看| 国内精品视频一区二区三区八戒| 精品免费视频一区二区| 国产精品一区在线| 欧美国产精品中文字幕| 不卡视频一二三| 一区二区三区日韩欧美| 欧美绝品在线观看成人午夜影视 | 国产精品九色蝌蚪自拍| 国产1区2区3区精品美女| 国产精品久久久久影院亚瑟| 99久久精品一区二区| 亚洲精品精品亚洲| 欧美高清视频一二三区 | 成人一区二区三区视频| 欧美激情在线观看视频免费| 97se亚洲国产综合自在线| 亚洲国产精品久久久男人的天堂| 在线免费观看日本一区| 蜜臀久久99精品久久久画质超高清 | 亚洲制服丝袜一区| 欧美日韩国产美| 激情亚洲综合在线| 国产精品情趣视频| 欧美中文一区二区三区| 青青草国产精品97视觉盛宴| 久久九九国产精品| 欧美性色综合网| 狠狠狠色丁香婷婷综合激情| 亚洲欧美日韩中文播放| 日韩午夜激情av| 不卡的电视剧免费网站有什么| 亚洲国产毛片aaaaa无费看 | 欧美精选在线播放| 国产成人在线免费观看| 五月综合激情网| 久久久久久久久蜜桃| 91成人免费在线视频| 国产一区中文字幕| 亚洲国产va精品久久久不卡综合 | 国产不卡视频在线播放| 亚洲国产另类精品专区| 日本一区二区三区国色天香| 欧美美女bb生活片| 91色婷婷久久久久合中文| 日韩国产精品久久| 亚洲欧美综合另类在线卡通| 日韩免费高清电影| 欧美日韩一区视频| 91日韩精品一区| 国产高清精品网站| 日本va欧美va精品发布| 亚洲免费观看高清| 国产精品免费av| 337p日本欧洲亚洲大胆精品| 欧美日韩高清一区二区不卡| 99re热这里只有精品免费视频| 国产一区二区三区在线看麻豆 | 国产精品卡一卡二卡三| 日韩精品中文字幕在线不卡尤物 | 久久久另类综合| 在线播放亚洲一区| 在线看国产一区二区| 成人一区二区在线观看| 韩日欧美一区二区三区| 老司机免费视频一区二区| 五月天久久比比资源色| 亚洲综合一二三区| 一区二区免费看| 亚洲女与黑人做爰| 亚洲特黄一级片| 国产精品毛片无遮挡高清| 国产人成亚洲第一网站在线播放 | 亚洲乱码国产乱码精品精可以看| 国产校园另类小说区| 337p粉嫩大胆噜噜噜噜噜91av | 亚洲精品国久久99热| 国产精品国产三级国产专播品爱网| 欧美精品一区二区三区很污很色的 | 国产精品电影一区二区| 中文字幕乱码一区二区免费| 中文在线资源观看网站视频免费不卡 | 亚洲欧美一区二区视频| 国产精品美女久久久久久久| 亚洲国产精品精华液2区45| 国产精品久久毛片| 亚洲情趣在线观看| 亚洲成a人v欧美综合天堂下载| 五月天亚洲精品| 久久99国产精品尤物| 国产自产高清不卡| 成人免费视频视频在线观看免费| 成人高清在线视频| 在线欧美日韩国产| 日韩小视频在线观看专区| 精品久久免费看| 亚洲欧美综合在线精品| 亚洲成a人v欧美综合天堂| 久草精品在线观看| 成人美女视频在线观看| 91在线视频播放| 91精品国产品国语在线不卡| 日韩欧美国产一区二区三区| 亚洲国产精品精华液2区45| 一区二区三区中文字幕电影 | 亚洲午夜av在线| 蜜臀av性久久久久蜜臀av麻豆| 国产精品99久久久久久久女警| 99免费精品在线| 9191成人精品久久| 天天综合日日夜夜精品| 国产一区二区福利| 在线日韩国产精品| 亚洲精品一区二区三区四区高清 | 六月丁香婷婷久久| 99久久精品国产网站| 欧美日韩精品欧美日韩精品 | 成人精品国产免费网站| 91激情五月电影| www激情久久| 亚洲午夜成aⅴ人片| 国产福利精品导航| 欧美一级日韩一级| 亚洲欧美二区三区| 国产精品资源在线看| 欧美亚洲国产一区二区三区va| 久久久不卡影院| 日韩黄色片在线观看| 99re成人在线| 国产偷国产偷亚洲高清人白洁 | 亚洲一区二区三区自拍| 国内精品伊人久久久久影院对白| 精品污污网站免费看| 国产欧美日韩综合精品一区二区| 日韩电影免费在线观看网站| 99re热视频精品| 国产精品色在线| 激情都市一区二区| 日韩三级视频在线看| 一区二区成人在线| 99麻豆久久久国产精品免费 | 精品日韩欧美在线| 亚洲成av人片一区二区| 色综合天天综合网天天看片| 久久久久国产精品人| 美女任你摸久久| 欧美区一区二区三区| 亚洲精品写真福利| av在线不卡观看免费观看| 久久精品视频在线看| 国产乱码一区二区三区| 欧美成人性福生活免费看| 午夜欧美在线一二页| 一本大道久久a久久综合婷婷| 国产精品电影一区二区| 成人av在线一区二区三区| 国产日韩欧美高清在线| 国产高清成人在线| 中文字幕免费一区| 99精品久久99久久久久| 国产精品萝li| 91捆绑美女网站| 一区二区三区国产精品| 精品视频在线免费看|