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

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

?? gfx.cpp

?? nes游戲模擬器
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
		// Move to the next line.
		if (byAttributes & 0x80)
			pSurfaceMemory -= lSurfacePitch;
		else
			pSurfaceMemory += lSurfacePitch;

		// Move to the next byte in the sprite.
		pbyTileByte++;
	}

	// Restore the surface memory pointer to the beginning
	// of the scanline.
	pSurfaceMemory = pSaveVideoMemStart;

	//-------------------------------------------------------------------------
	// Draw the second part of the sprite if its a 8x16 sprite.
	// Thats located in in bit 5 of reg $2000.
	//-------------------------------------------------------------------------
	if (CPU.Memory[0x2000] & 0x20)
	{
		BYTE  byColor;             // Index into the NES palette for the sprite.
		BYTE* pbyTileByte;         // Pointer to the pattern table byte.
		BYTE* pSaveVideoMemStart = pSurfaceMemory;

		// Save all the information about the sprite.
		BYTE byYPos = abySPRRAM[(bySpriteNum*4)] + 8;
		BYTE byTileNum = abySPRRAM[(bySpriteNum*4)+1] + 1;
		BYTE byAttributes = abySPRRAM[(bySpriteNum*4)+2];
		BYTE byXPos = abySPRRAM[(bySpriteNum*4)+3];
		BYTE byUpperColor = (byAttributes & 0x3) << 2;

		// Get the pointer to the tile byte in the pattern table for the sprite.
		pbyTileByte = (byTileNum * 16) + PPU.apbyPatternTables[(CPU.Memory[0x2000]&0x08)>>3];
		
		// Move the video memory pointer to where the sprite is supposed to be horizontally.
		if (byAttributes & 0x40)
			pSurfaceMemory += (byXPos * lBytesPerPixel) + (8 * lBytesPerPixel);
		else
			pSurfaceMemory += byXPos * lBytesPerPixel;

		// Move the video memory pointer to where the sprite is supposed to be vertically.
		if (byAttributes & 0x80)
			pSurfaceMemory += ((byYPos + 8) * lSurfacePitch);
		else
			pSurfaceMemory += byYPos * lSurfacePitch;

		// Draw the sprite by drawing each tile line then moving to the next byte.
		for (int i = 0; i < 8; i++)
		{
			BYTE  byTestBit = 0x80;    // Color testing bit for the sprite tile.
			BYTE  byColorShiftVal = 7; // Number of bits to shift the color by.

			while (byTestBit != 0)
			{
				// The color is the to lower bits from the pattern table
				// obtained in the same way as a background tile plus the
				// two uppercolor bits in the lower 2 bits of the attribute
				// byte.
				byColor = ((*pbyTileByte & byTestBit) >> byColorShiftVal) |
					(((*(pbyTileByte+8) & byTestBit) >> byColorShiftVal) << 1);

				// Draw the pixel on the screen if the color is not 0.
				if (byColor != 0)
					PutSpritePixel(byColor | byUpperColor);

				// Move to the next pixel.
				if (byAttributes & 0x40)
					pSurfaceMemory -= lBytesPerPixel;
				else
					pSurfaceMemory += lBytesPerPixel;
				
				byColorShiftVal--;
				byTestBit >>= 1;
			}

			// Reset the horizontal video position for the next line.
			if (byAttributes & 0x40)
				pSurfaceMemory += (8 * lBytesPerPixel);
			else
				pSurfaceMemory -= (8 * lBytesPerPixel);

			// Move to the next line.
			if (byAttributes & 0x80)
				pSurfaceMemory -= lSurfacePitch;
			else
				pSurfaceMemory += lSurfacePitch;

			// Move to the next byte in the sprite.
			pbyTileByte++;
		}

		// Restore the surface memory pointer to the beginning
		// of the scanline.
		pSurfaceMemory = pSaveVideoMemStart;
	}
} // end DrawSprite()


//------------------------------------------------------------------------------
// Name: DrawSpriteLine()
// Desc: Draws a 8 pixel scanline for the sprite.
//------------------------------------------------------------------------------
VOID DrawSpriteLine(BYTE bySpriteNum)
{
	BYTE  byTestBit = 0x80;    // Color testing bit for the sprite tile.
	BYTE  byColorShiftVal = 7; // Number of bits to shift the color by.
	BYTE  byColor;             // Index into the NES palette for the sprite.
	BYTE* pbyScanlineByte;     // Pointer to the pattern table byte.
	BYTE* pSaveVideoMemStart = pSurfaceMemory;

	// Save all the information about the sprite.
	BYTE byYPos = abySPRRAM[(bySpriteNum*4)];
	BYTE byTileNum = abySPRRAM[(bySpriteNum*4)+1];
	BYTE byAttributes = abySPRRAM[(bySpriteNum*4)+2];
	BYTE byXPos = abySPRRAM[(bySpriteNum*4)+3];
	BYTE byUpperColor = (byAttributes & 0x3) << 2;

	// If one of the sprites scanlines is on this screen scaline,
	// then we have to draw that sprite scanline.
	if ((unsigned)(wScanline - byYPos) < 8)
	{
		// Get the pointer to the scanline byte in the pattern table for the sprite.
		pbyScanlineByte = (byTileNum * 16) + PPU.apbyPatternTables[(CPU.Memory[0x2000]&0x08)>>3];
		pbyScanlineByte += (wScanline - byYPos);
		
		// Move the video memory pointer to where the sprite is supposed to be.
		if (byAttributes & 0x40)
			pSurfaceMemory += (byXPos * lBytesPerPixel) + (7 * lBytesPerPixel);
		else
            pSurfaceMemory += byXPos * lBytesPerPixel;

		// Draw the sprite scanline.
		while (byTestBit != 0)
		{
			// The color is the to lower bits from the pattern table
			// obtained in the same way as a background tile plus the
			// two uppercolor bits in the lower 2 bits of the attribute
			// byte.
			byColor = ((*pbyScanlineByte & byTestBit) >> byColorShiftVal) |
				(((*(pbyScanlineByte+8) & byTestBit) >> byColorShiftVal) << 1) |
				byUpperColor;

			// Draw the pixel on the screen if the color is not 0.
			if (byColor != 0)
				PutSpritePixel(byColor);

			// Move to the next pixel.
			if (byAttributes & 0x40)
				pSurfaceMemory -= lBytesPerPixel;
			else
				pSurfaceMemory += lBytesPerPixel;
			
			byColorShiftVal--;
			byTestBit >>= 1;
		}

		// Restore the surface memory pointer to the beginning
		// of the scanline.
		pSurfaceMemory = pSaveVideoMemStart;
	}
} // end DrawSpriteLine()


//------------------------------------------------------------------------------
// Name: GetMaskInfo()
// Desc: Uses the color's bitmasks to calculate values which we 
//       will use to compile the pixel value.
//------------------------------------------------------------------------------
INT GetMaskInfo(DWORD dwBitmask, int* pnShift)
{
	int nPrecision = 0;
	int nShift     = 0;

	// Count the zeros on right hand side.
	while (!(dwBitmask & 0x01))
	{
		dwBitmask >>= 1;
		nShift++;
	}

	// Count the ones on right hand side.
	while (dwBitmask & 0x01)
	{
		dwBitmask >>= 1;
		nPrecision++;
	}

	// Save the shift value.
	*pnShift = nShift;

	// Return the number of ones.
	return nPrecision;
} // end GetMaskInfo()


//------------------------------------------------------------------------------
// Name: CompilePixel()
// Desc: Stores the four bytes corresponding to the compiled pixel 
//       value in a class variable.
//------------------------------------------------------------------------------
VOID CompilePixel(LPDIRECTDRAWSURFACE7 lpSurf, int nColorIndex, int r, int g, int b)
{
	DDPIXELFORMAT DDpf;    // DirectDraw pixel format structure.
	int rsz, gsz, bsz; 	   // Bitsize of field.
	int rsh, gsh, bsh;	   // 0抯 on left (the shift value).
	DWORD dwCompiledPixel; // Our pixel with r,g,b values compiled.

	// Get the pixel format.
	ZeroMemory (&DDpf, sizeof(DDpf));
	DDpf.dwSize = sizeof(DDpf);
	lpSurf->GetPixelFormat(&DDpf);

	// Get the shift and precision values and store them.
	rsz = GetMaskInfo(DDpf.dwRBitMask, &rsh);
	gsz = GetMaskInfo(DDpf.dwGBitMask, &gsh);
	bsz = GetMaskInfo(DDpf.dwBBitMask, &bsh);

	// Keep only the MSB bits of component.
	r >>= (8-rsz);
	g >>= (8-gsz);
	b >>= (8-bsz);

	// Shift them into place.
	r <<= rsh;
	g <<= gsh;
	b <<= bsh;

	// Store the compiled pixel.
	dwCompiledPixel = (DWORD)(r | g | b);
	abyColors[nColorIndex][3] = (BYTE)(dwCompiledPixel);
	abyColors[nColorIndex][2] = (BYTE)(dwCompiledPixel >>= 8);
	abyColors[nColorIndex][1] = (BYTE)(dwCompiledPixel >>= 8);
	abyColors[nColorIndex][0] = (BYTE)(dwCompiledPixel >>= 8);

	return;
} // end CompilePixel()


//------------------------------------------------------------------------------
// Name: PutBackgroundPixel()
// Desc: Puts a background pixel independant of the bit depth 
//       on the locked surface.
//------------------------------------------------------------------------------
VOID __stdcall PutBackgroundPixel(BYTE nColor)
{
	// Copy the pointer to video memory so the main one doesn't get modified.
	BYTE *pVideoMem = pSurfaceMemory;
	// Speed up the array access in the loop by storing this here.
	BYTE byColor = PPU.abyPalettes[nColor];

	// Put the number of bytes for each pixel on the surface.
	for (int i = 3; i >= FourMinusBPP; i--)
	{
		*pVideoMem = abyColors[byColor][i];
		pVideoMem++;
	}
} // end PutBackgroundPixel()


//------------------------------------------------------------------------------
// Name: PutSpritePixel()
// Desc: Puts a background pixel independant of the bit depth 
//       on the locked surface.
//------------------------------------------------------------------------------
VOID __stdcall PutSpritePixel(BYTE nColor)
{
	// Copy the pointer to video memory so the main one doesn't get modified.
	BYTE *pVideoMem = pSurfaceMemory;
	// Speed up the array access in the loop by storing this here.
	BYTE byColor = PPU.abyPalettes[0x10+nColor];

	// Put the number of bytes for each pixel on the surface.
	for (int i = 3; i >= FourMinusBPP; i--)
	{
		*pVideoMem = abyColors[byColor][i];
		pVideoMem++;
	}
} // end PutSpritePixel()


//------------------------------------------------------------------------------
// Name: ClearScreen()
// Desc: Clears the NES screen to the background color.
//------------------------------------------------------------------------------
VOID ClearScreen(COLORREF crColor)
{
	DDBLTFX ddbltfx;

	// Fill the NES screen surface with the background color.
	ddbltfx.dwSize = sizeof(DDBLTFX);
	ddbltfx.dwFillColor = crColor;
	lpddsScreen->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
} // end ClearScreen()


//------------------------------------------------------------------------------
// Name: UpdateBounds()
// Desc: Updates the rect for ......
//------------------------------------------------------------------------------
HRESULT UpdateBounds(HWND hwnd)
{
	POINT ptWindow; // Point used for converting client to window coordinates.

	// Get the client rectangle.
	GetClientRect(hwnd, &rcScreen);

	// Convert the top left coordinates.
	ptWindow.x = rcScreen.left;
	ptWindow.y = rcScreen.top;
	ClientToScreen(hwnd, &ptWindow);
	rcScreen.left = ptWindow.x;
	rcScreen.top = ptWindow.y;

	// Convert the bottom right coordinates.
	ptWindow.x = rcScreen.right;
	ptWindow.y = rcScreen.bottom;
	ClientToScreen(hwnd, &ptWindow);
	rcScreen.right = ptWindow.x;
	rcScreen.bottom = ptWindow.y;

	return S_OK;
} // end UpdateBounds()


//------------------------------------------------------------------------------
// Name: OutputText()
// Desc: Outputs text to the screen surface.
//------------------------------------------------------------------------------
VOID OutputText(LPSTR strText, INT nX, INT nY, COLORREF cfFront, COLORREF cfBack)
{
	HDC hdc;

	if (lpddsScreen->GetDC(&hdc) == DD_OK)
	{
		SetBkColor(hdc, cfBack);
		SetTextColor(hdc, cfFront);
		TextOut(hdc, nX, nY, strText, lstrlen(strText));
		lpddsScreen->ReleaseDC(hdc);
	}
} // end OutputText()

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91蜜桃免费观看视频| 捆绑紧缚一区二区三区视频| 亚洲国产精品一区二区www | 国产高清视频一区| 91成人免费网站| 国产精品卡一卡二卡三| 久久精工是国产品牌吗| 欧美日本一道本在线视频| 国产精品三级电影| 国产精品一二三| 日韩免费观看2025年上映的电影| 亚洲精品国久久99热| 成年人午夜久久久| 久久久久久日产精品| 裸体一区二区三区| 欧美精品欧美精品系列| 亚洲一卡二卡三卡四卡五卡| 色哟哟一区二区三区| 中文字幕一区二区三区乱码在线| 国产一区二区视频在线| 欧美精品一区二| 日日夜夜精品视频免费| 欧美日韩日日夜夜| 午夜影院久久久| 欧美日韩久久不卡| 亚洲小说欧美激情另类| 欧美中文字幕不卡| 亚洲国产人成综合网站| 在线免费观看不卡av| 亚洲一区二区三区四区五区中文 | 亚洲欧美偷拍卡通变态| 成人黄色免费短视频| 国产精品日日摸夜夜摸av| 国产a精品视频| 国产欧美精品一区aⅴ影院 | 欧美日本一区二区三区| 午夜精品一区在线观看| 69精品人人人人| 美女精品自拍一二三四| 精品国产乱码久久| 国产一区二区毛片| 国产精品国产三级国产aⅴ中文 | 日韩精品自拍偷拍| 国产在线播放一区三区四| 国产亚洲欧美日韩俺去了| 成人精品在线视频观看| 亚洲日本青草视频在线怡红院| 色综合久久综合网欧美综合网| 一区二区三区小说| 日韩一级在线观看| 国产成人精品亚洲777人妖| 成人免费在线视频| 欧美日韩二区三区| 激情综合五月天| 国产精品色在线| 欧美在线观看一二区| 奇米影视在线99精品| 国产午夜亚洲精品不卡| 色婷婷av一区二区三区软件| 婷婷国产在线综合| 国产色综合久久| 91精彩视频在线| 久久成人久久鬼色| 亚洲女同ⅹxx女同tv| 欧美一级欧美三级| av高清不卡在线| 免费看黄色91| 中文字幕一区日韩精品欧美| 欧美日韩激情一区二区三区| 国产一区二区美女| 亚洲 欧美综合在线网络| 国产日韩精品视频一区| 欧美日韩国产片| 成人听书哪个软件好| 日韩精品1区2区3区| 中文字幕一区二区三区四区 | 日韩伦理免费电影| 日韩欧美123| 在线免费观看成人短视频| 国产一区美女在线| 天天色综合天天| 国产精品国产自产拍高清av王其| 69堂亚洲精品首页| 91免费视频大全| 国产精品123| 蜜臀va亚洲va欧美va天堂| 亚洲欧美一区二区三区久本道91| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 亚洲婷婷在线视频| 2020国产精品自拍| 欧美肥胖老妇做爰| 色综合网色综合| 成人午夜电影小说| 国产一区二区在线观看免费| 视频一区在线视频| 亚洲成人免费观看| 亚洲精品乱码久久久久久久久 | 成人一区二区在线观看| 麻豆精品一区二区三区| 视频一区国产视频| 亚洲一区在线播放| 亚洲精品乱码久久久久久日本蜜臀| 国产精品视频在线看| 日本一区二区三区免费乱视频| 精品少妇一区二区三区日产乱码| 欧美日韩中文一区| 欧美制服丝袜第一页| 91美女视频网站| 91美女片黄在线观看91美女| 成人av电影观看| 99这里只有精品| 97成人超碰视| 色八戒一区二区三区| 色婷婷综合五月| 在线免费观看日本欧美| 欧美在线观看一二区| 精品视频1区2区| 在线不卡的av| 日韩精品中文字幕在线一区| 欧美电影免费观看完整版 | 3atv一区二区三区| 在线不卡免费av| 精品国产乱码久久| 欧美激情自拍偷拍| 一区二区三区四区视频精品免费 | 中文字幕一区二区视频| 亚洲另类春色校园小说| 亚洲一二三四区不卡| 婷婷综合另类小说色区| 蜜桃一区二区三区在线观看| 紧缚奴在线一区二区三区| 国产aⅴ综合色| 色综合久久99| 91精品久久久久久久91蜜桃| 欧美tickle裸体挠脚心vk| 中文字幕国产一区| 亚洲综合在线五月| 免费成人你懂的| 成人国产精品视频| 欧美日韩国产综合久久| 欧美成人a视频| 国产精品三级在线观看| 亚洲成年人网站在线观看| 国内精品久久久久影院一蜜桃| 成人精品电影在线观看| 欧美日韩1区2区| 久久品道一品道久久精品| 亚洲天堂精品在线观看| 免费美女久久99| va亚洲va日韩不卡在线观看| 欧美日韩另类一区| 亚洲国产高清不卡| 青青青伊人色综合久久| 成人免费高清在线观看| 欧美顶级少妇做爰| 国产精品理论片在线观看| 石原莉奈在线亚洲二区| 成人性生交大片免费看中文网站| 色噜噜夜夜夜综合网| 精品国产免费视频| 亚洲一区二区四区蜜桃| 国产精品18久久久| 欧美一级一区二区| 亚洲主播在线播放| 成人app网站| 精品国产免费视频| 首页亚洲欧美制服丝腿| 色综合欧美在线| 中文字幕不卡在线| 久久99久久99小草精品免视看| 91在线精品秘密一区二区| 精品国产一区二区国模嫣然| 亚洲va欧美va国产va天堂影院| av一区二区三区黑人| 欧美不卡一区二区| 天天色综合天天| 欧日韩精品视频| 亚洲日本青草视频在线怡红院| 国产成人在线视频网站| 精品噜噜噜噜久久久久久久久试看 | 9191久久久久久久久久久| 中文字幕不卡在线观看| 国产麻豆精品一区二区| 日韩写真欧美这视频| 亚洲bt欧美bt精品| 欧美网站一区二区| 一区二区日韩电影| 在线视频国产一区| 亚洲女同ⅹxx女同tv| 91丨九色丨黑人外教| 中文字幕在线免费不卡| 成人v精品蜜桃久久一区| 国产亚洲欧美色| 国产超碰在线一区| 国产精品久久网站| 94色蜜桃网一区二区三区| 中文字幕一区二区三区不卡| 波多野结衣在线一区| 亚洲欧洲综合另类在线| 在线观看日韩国产|