⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 russiangamedlg.cpp

📁 一个好玩的俄罗斯方块游戏
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                        board.square[board.piecex-1][board.piecey-1] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
		}
		break;
	case 4:
		{
			if(board.piecepos == 1)
			{
                if(board.piecey <= 17)
				{
                    if(board.square[board.piecex-1][board.piecey]== 0 && board.square[board.piecex][board.piecey + 1]== 0 && board.square[board.piecex+1][board.piecey + 1]== 0)
					{
                        board.square[board.piecex-1][board.piecey]= 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex+1][board.piecey + 1] = 1;
                        board.square[board.piecex-1][board.piecey-1] = 0;
                        board.square[board.piecex][board.piecey-1] = 0;
                        board.square[board.piecex+1][board.piecey] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
            else if(board.piecepos== 2)
			{
                if(board.piecey <= 16)
				{
                    if( board.square[board.piecex][board.piecey + 2]== 0 && board.square[board.piecex + 1][board.piecey+1]== 0)
					{
                        board.square[board.piecex][board.piecey + 2] = 1;
                        board.square[board.piecex+1][board.piecey+1] = 1;
                        board.square[board.piecex][board.piecey] = 0;
                        board.square[board.piecex+1][board.piecey-1] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
		}
		break;
	case 5:
		{
            if(board.piecepos == 1)
			{
                if(board.piecey <= 17)
				{
                    if(board.square[board.piecex-1][board.piecey+1]== 0 && board.square[board.piecex][board.piecey + 1]== 0 && board.square[board.piecex+1][board.piecey]== 0)
					{
                        board.square[board.piecex-1][board.piecey+1]= 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex+1][board.piecey] = 1;
                        board.square[board.piecex-1][board.piecey] = 0;
                        board.square[board.piecex][board.piecey-1] = 0;
                        board.square[board.piecex+1][board.piecey-1] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
            else if(board.piecepos== 2)
			{
                if(board.piecey <= 16)
				{
                    if( board.square[board.piecex][board.piecey + 1]== 0 && board.square[board.piecex + 1][board.piecey+2]== 0)
					{
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex+1][board.piecey+2] = 1;
                        board.square[board.piecex][board.piecey-1] = 0;
                        board.square[board.piecex+1][board.piecey] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
		}
		break;
	case 6:
		{
			if(board.piecepos == 1)
			{
                if(board.piecey <= 17)
				{
                    if(board.square[board.piecex-1][board.piecey + 1]== 0 && board.square[board.piecex][board.piecey + 1]== 0 && board.square[board.piecex+1][board.piecey + 1]== 0)
					{
                        board.square[board.piecex-1][board.piecey + 1]= 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex+1][board.piecey + 1] = 1;
                        board.square[board.piecex-1][board.piecey] = 0;
                        board.square[board.piecex][board.piecey-1] = 0;
                        board.square[board.piecex+1][board.piecey] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
            else if(board.piecepos== 2)
			{
                if(board.piecey <= 16)
				{
                    if( board.square[board.piecex][board.piecey + 2]== 0 && board.square[board.piecex + 1][board.piecey+1]== 0)
					{
                        board.square[board.piecex][board.piecey + 2] = 1;
                        board.square[board.piecex+1][board.piecey+1] = 1;
                        board.square[board.piecex][board.piecey -1] = 0;
                        board.square[board.piecex+1][board.piecey] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
            else if(board.piecepos == 3)
			{
                if(board.piecey <= 16)
				{
                    if( board.square[board.piecex-1][board.piecey + 1]== 0 && board.square[board.piecex][board.piecey+2]== 0 && board.square[board.piecex+1][board.piecey+1]== 0)
					{
                        board.square[board.piecex-1][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey+2] = 1;
						board.square[board.piecex+1][board.piecey + 1] = 1;
                        board.square[board.piecex-1][board.piecey] = 0;
                        board.square[board.piecex][board.piecey] = 0;
						board.square[board.piecex+1][board.piecey] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
            else if(board.piecepos== 4)
            {
                if(board.piecey <= 16)
				{
                    if( board.square[board.piecex-1][board.piecey+1]== 0 && board.square[board.piecex][board.piecey+2]== 0)
					{
                        board.square[board.piecex-1][board.piecey+1] = 1;
                        board.square[board.piecex][board.piecey+2] = 1;
                        board.square[board.piecex][board.piecey -1] = 0;
                        board.square[board.piecex-1][board.piecey] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
		}
		break;
	case 7:
		{
            if(board.piecey <= 17)
				{
                    if(board.square[board.piecex][board.piecey + 1]== 0 && board.square[board.piecex+1][board.piecey + 1]== 0)
					{
                        board.square[board.piecex][board.piecey + 1]= 1;
                        board.square[board.piecex+1][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey-1] = 0;
                        board.square[board.piecex+1][board.piecey-1] = 0;
                        board.piecey = board.piecey + 1;
					}
                    else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
		}
		break;
		}
		return;
}

void CRussianGameDlg::movepieceleft()
{
	int i,curpiece;
	curpiece=board.curpiece; 
	switch (curpiece)
	{
        case 1:
            if(board.piecepos== 1)
			{
                if(board.piecex >= 3)
                    if(board.square[board.piecex - 2][board.piecey]== 0)
					{
                        board.square[board.piecex - 2][board.piecey]= 1;
                        board.square[board.piecex + 2][board.piecey] = 0;
                        board.piecex = board.piecex - 1;
                    }
			}
            else if(board.piecepos == 2)
			{
                if(board.piecex >= 2)
                    if(board.square[board.piecex - 1][board.piecey - 1]== 0 && board.square[board.piecex - 1][board.piecey]== 0 && board.square[board.piecex - 1][board.piecey + 1]== 0 && board.square[board.piecex - 1][board.piecey + 2] == 0)
					{
                        for(i = board.piecey - 1;i<=board.piecey + 2;i++)
						{
                            board.square[board.piecex - 1][i] = 1;
                            board.square[board.piecex][i] = 0;
                        }
                        board.piecex = board.piecex - 1;
                    }
			}
			break;
        case 2:
            if(board.piecepos == 1)
			{
                if(board.piecex >= 3)
                    if(board.square[board.piecex - 2][board.piecey] == 0 && board.square[board.piecex - 2][board.piecey - 1]== 0)
					{
                        board.square[board.piecex - 2][board.piecey]=1;
                        board.square[board.piecex - 2][board.piecey-1] = 1;
                        board.square[board.piecex - 1][board.piecey-1] = 0;
                        board.square[board.piecex +1][board.piecey] = 0;
                        board.piecex = board.piecex - 1;
                    }
			}
            else if(board.piecepos == 2)
			{
                if(board.piecex >= 2)
                    if(board.square[board.piecex - 1][board.piecey - 1]== 0 && board.square[board.piecex - 1][board.piecey]== 0 && board.square[board.piecex - 1][board.piecey + 1]== 0)
					{
                        for(i = board.piecey - 1;i<=board.piecey + 1;i++)
						{
                            board.square[board.piecex - 1][i] = 1;
                            board.square[board.piecex][i] = 0;
                        }
                        board.square[board.piecex][board.piecey - 1] = 1;
                        board.square[board.piecex + 1][board.piecey - 1] = 0;
                        board.piecex = board.piecex - 1;
                    }
			}
            else if(board.piecepos== 3)
			{
                if(board.piecex >= 3)
                    if(board.square[board.piecex - 2][board.piecey]== 0 && board.square[board.piecex][board.piecey + 1]== 0)
					{
                        board.square[board.piecex - 2][board.piecey] = 1;
                        board.square[board.piecex][board.piecey + 1]= 1;
                        board.square[board.piecex + 1][board.piecey] = 0;
                        board.square[board.piecex + 1][board.piecey + 1] = 0;
                        board.piecex = board.piecex - 1;
                    }
			}
            else if(board.piecepos == 4)
			{
                if(board.piecex >= 3)
                    if( board.square[board.piecex - 1][board.piecey - 1] == 0 && board.square[board.piecex - 1][board.piecey]== 0 && board.square[board.piecex - 2][board.piecey + 1]== 0)
					{
                        board.square[board.piecex - 1][board.piecey - 1] = 1;
                        board.square[board.piecex - 1][board.piecey] = 1;
                        board.square[board.piecex - 2][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.square[board.piecex][board.piecey] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.piecex = board.piecex - 1;
                    }
			}
			break;
        case 3:
			if(board.piecepos == 1)
			{
                if(board.piecex >= 3)
                    if(board.square[board.piecex - 2][board.piecey] == 0 && board.square[board.piecex][board.piecey - 1]== 0)
					{
                        board.square[board.piecex - 2][board.piecey]=1;
                        board.square[board.piecex][board.piecey-1] = 1;
                        board.square[board.piecex +1][board.piecey-1] = 0;
                        board.square[board.piecex +1][board.piecey] = 0;
                        board.piecex = board.piecex - 1;
                    }
			}
            else if(board.piecepos == 2)
			{
                if(board.piecex >= 2)
                    if(board.square[board.piecex - 1][board.piecey - 1]== 0 && board.square[board.piecex - 1][board.piecey]== 0 && board.square[board.piecex - 1][board.piecey + 1]== 0)
					{
                        for(i = board.piecey - 1;i<=board.piecey + 1;i++)
						{
                            board.square[board.piecex - 1][i] = 1;
                            board.square[board.piecex][i] = 0;
                        }
                        board.square[board.piecex][board.piecey +1] = 1;
                        board.square[board.piecex + 1][board.piecey +1] = 0;
                        board.piecex = board.piecex - 1;
                    }
			}
            else if(board.piecepos== 3)
			{
                if(board.piecex >= 3)
                    if(board.square[board.piecex - 2][board.piecey]== 0 && board.square[board.piecex-2][board.piecey + 1] == 0)
					{
                        board.square[board.piecex - 2][board.piecey] = 1;
                        board.square[board.piecex-2][board.piecey + 1]= 1;
                        board.square[board.piecex + 1][board.piecey] = 0;
                        board.square[board.piecex - 1][board.piecey + 1] = 0;
                        board.piecex = board.piecex - 1;
                    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -