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

📄 russiangamedlg.cpp

📁 一个好玩的俄罗斯方块游戏
💻 CPP
📖 第 1 页 / 共 5 页
字号:
{
    if(n<4)
	{
        for(j=4;j>=n+1;j--)
		{
			scorenum[j] = scorenum[j - 1];
            scorename[j] = scorename[j - 1];
		}
	}
    CNameDlg name;
	name.DoModal();
	heroname=AfxGetApp()->GetProfileString(_T("英雄榜"),_T("heroname"),_T("无名英雄"));
    scorename[n] =heroname;
    scorenum[n] = board.scroe;
    writescore();
    break;
}
return;
}

void CRussianGameDlg::getscore()
{
	scorenum[0]=AfxGetApp()->GetProfileInt(_T("英雄榜"),_T("scorenum1"),500);
	scorenum[1]=AfxGetApp()->GetProfileInt(_T("英雄榜"),_T("scorenum2"),500);
	scorenum[2]=AfxGetApp()->GetProfileInt(_T("英雄榜"),_T("scorenum3"),500);
	scorenum[3]=AfxGetApp()->GetProfileInt(_T("英雄榜"),_T("scorenum4"),500);
	scorenum[4]=AfxGetApp()->GetProfileInt(_T("英雄榜"),_T("scorenum5"),500);
	scorename[0]=AfxGetApp()->GetProfileString(_T("英雄榜"),_T("scorename1"),_T("无名英雄"));
	scorename[1]=AfxGetApp()->GetProfileString(_T("英雄榜"),_T("scorename2"),_T("无名英雄"));
	scorename[2]=AfxGetApp()->GetProfileString(_T("英雄榜"),_T("scorename3"),_T("无名英雄"));
	scorename[3]=AfxGetApp()->GetProfileString(_T("英雄榜"),_T("scorename4"),_T("无名英雄"));
	scorename[4]=AfxGetApp()->GetProfileString(_T("英雄榜"),_T("scorename5"),_T("无名英雄"));

}

void CRussianGameDlg::drawpiece()
{
int i,curpiece;
curpiece=board.curpiece ;
switch  (curpiece)
{
case 1:
	{
        for (i=4;i<=7;i++)
		{
            if (board.square[i][1]!=0) gameover = TRUE;
            board.square[i][1]=1;
        }
	}
	break;
case 2:
	{
        if (board.square[4][1] != 0) gameover = TRUE;
        board.square[4][1] = 1;
        for(i = 4;i<=6;i++)
		{
            if (board.square[i][2] != 0)gameover = TRUE;
            board.square[i][2] = 1;
        }
	}
	break;
case 3:
	{
        if (board.square[6][1] != 0) gameover = TRUE;
        board.square[6][1] = 1;
        for(i = 4;i<=6;i++)
		{
            if (board.square[i][2] != 0) gameover = TRUE;
            board.square[i][2] = 1;
        }
	}
	break;
case 4:
	{
        for(i = 4;i<=5;i++)
		{
            if (board.square[i][1] != 0) gameover = TRUE;
            board.square[i][1] = 1;
        }
        for(i = 5;i<=6;i++)
		{
            if (board.square[i][2] != 0) gameover = TRUE;
            board.square[i][2] = 1;
		}
	}
	break;
case 5:
	{
        for(i = 5;i<=6;i++)
		{
            if (board.square[i][1] != 0) gameover = TRUE;
            board.square[i][1] = 1;
        }
        for(i = 4;i<=5;i++)
		{
            if (board.square[i][2] != 0) gameover = TRUE;
            board.square[i][2] = 1;
		}
	}
	break;
case 6:
	{
        if (board.square[5][1] != 0) gameover = TRUE;
        board.square[5][1] = 1;
        for(i = 4;i<=6;i++)
		{
            if (board.square[i][2] != 0) gameover = TRUE;
            board.square[i][2] = 1;
        }
	}
	break;
case 7:
	{
        for(i = 5;i<=6;i++)
		{
            if (board.square[i][1] != 0) gameover = TRUE;
            board.square[i][1] = 1;
        }
        for(i = 5;i<=6;i++)
		{
            if (board.square[i][2] != 0) gameover = TRUE;
            board.square[i][2] = 1;
        }
	}
	break;
}
return;
}

void CRussianGameDlg::movepiecedown()
{
int i,curpiece;
curpiece=board.curpiece ;
	switch  (curpiece)
	{
	case 1:
	{
            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 +2][board.piecey + 1]== 0)
					{
                        for(i = board.piecex - 1;i<=board.piecex + 2;i++)
						{
                            board.square[i][board.piecey] = 0;
                            board.square[i][board.piecey + 1] = 1;
                        }
                        board.piecey = board.piecey + 1;
                    }
					else
                        newpiece = TRUE;
                }
				else
                    newpiece = TRUE;
			}
            else if (board.piecepos== 2)
			{
                if (board.piecey <= 15)
				{
                    if(board.square[board.piecex][board.piecey + 3]== 0)
					{
                        board.square[board.piecex][board.piecey + 3] = 1;
                        board.square[board.piecex][board.piecey -1] = 0;
                        board.piecey = board.piecey + 1;
                    }
					else
                        newpiece = TRUE;
				}
                else
                    newpiece = TRUE;
			}
	}
	break;
	case 2:
		{
            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 - 1] = 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== 2)
			{
                if(board.piecey <= 16)
				{
                    if( board.square[board.piecex][board.piecey + 2]== 0 && board.square[board.piecex + 1][board.piecey]== 0)
					{
                        board.square[board.piecex][board.piecey + 2] = 1;
                        board.square[board.piecex+1][board.piecey] = 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;
			}
            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+1]== 0 && board.square[board.piecex+1][board.piecey+2]== 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 + 2] = 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 + 2]== 0 && board.square[board.piecex][board.piecey+2]== 0)
					{
                        board.square[board.piecex-1][board.piecey + 2] = 1;
                        board.square[board.piecex][board.piecey+2] = 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;
	case 3:
		{
           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] = 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 + 2]== 0 && board.square[board.piecex + 1][board.piecey+2]== 0)
					{
                        board.square[board.piecex][board.piecey + 2] = 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+1] = 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 + 2]== 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 + 2] = 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] = 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]== 0 && board.square[board.piecex][board.piecey+2]== 0)
					{
                        board.square[board.piecex-1][board.piecey] = 1;
                        board.square[board.piecex][board.piecey+2] = 1;
                        board.square[board.piecex][board.piecey -1] = 0;

⌨️ 快捷键说明

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