Exemplo n.º 1
0
void CLogicBoad::Start()
{
	if (isPaused)
		return;

	isStarted = true;
	isFallingFinished = false;
	numLinesRemoved = 0;
	ClearBoard();

	stTetrisDrawText cmd;
	if (m_user && m_user->m_GameRoom) {
		CGameRoom* pRoom = m_user->m_GameRoom;
		for (int i =0 ;i  < 2; ++i) {
			CPlayer* pUser = pRoom->m_vPlayer[i];
			if (pUser) {
				if (pUser != m_user) {
					cmd.isMe = false;
					sprintf(cmd.szDrawText,"%s得分%d:",m_user->szAccount,numLinesRemoved);
				}else {
					cmd.isMe = true;
					sprintf(cmd.szDrawText,"您的得分:%d",numLinesRemoved);
				}
				pUser->SendToMe((stBaseCmd*)&cmd,sizeof(cmd));
			}
		}
	}

	NewPiece();
}
Exemplo n.º 2
0
void Board::OnTimer(wxCommandEvent& event)
{
    if (isFallingFinished) {
        isFallingFinished = false;
        NewPiece();
    } else {
        OneLineDown();
    }
}
Exemplo n.º 3
0
void CLogicBoad::OnTimer()
{
    if (isFallingFinished) {
        isFallingFinished = false;
        NewPiece();
    } else {
        OneLineDown();
    }
}
Exemplo n.º 4
0
void CLogicBoad::OnTimer()
{
	if (isPaused || !isStarted)
		return ;
	if (isFallingFinished) {
		isFallingFinished = false;
		NewPiece();
	} else {
		OneLineDown();
	}
}
Exemplo n.º 5
0
void CLogicBoad::Start()
{
    if (isPaused)
        return;

    isStarted = true;
    isFallingFinished = false;
    numLinesRemoved = 0;
    ClearBoard();

    NewPiece();
}
Exemplo n.º 6
0
void CLogicBoad::PieceDropped()
{
	for (int i = 0; i < 4; ++i) {
		int x = curX + curPiece.x(i);
		int y = curY - curPiece.y(i);
		ShapeAt(x, y) = curPiece.GetShape();
	}

	RemoveFullLines();

	if (!isFallingFinished)
		NewPiece();
}
Exemplo n.º 7
0
void Board::Start()
{
    if (isPaused)
        return;

    isStarted = true;
    isFallingFinished = false;
    numLinesRemoved = 0;
    ClearBoard();

    NewPiece();
    timer->Start(500);
}
Exemplo n.º 8
0
Arquivo: SPLITCUT.C Projeto: ems/TMS
void SplitPiece( Piece *piece )
{
	 Segment     *segment;
	 cron_t		 cost;

	 if( piece == NULL )
		  return;

	 // Attempt to split this piece into chunks roughly the size of
	 // 1/2 of a 2-piece run..
	 segment = StraightFindForwardCut( piece->segmentStart, piece->segmentEnd,
												FeasiblePieceCoster, DesirablePieceCoster,
												&cost );

	 // Classify the piece according to how it was cut.
	 if( segment == NULL )
	 {
		  // This piece cannot be cut further.
		  ChangePieceStatus( piece, Invalid );
	 }
	 else if( segment == piece->segmentEnd )
	 {
		  // This piece is fine the way it is.
		  ChangePieceStatus( piece, Valid );
	 }
	 else
	 {
		  // We need to split this piece.
		  Piece *pieceNew = NewPiece();
		  pieceNew->status = Valid;
		  PieceInsert( pieceNew );

		  // Set up the segments of this piece.
		  pieceNew->segmentStart = piece->segmentStart;
		  pieceNew->segmentEnd = segment;

		  // Update the given piece to reflect the split.
		  // Leave the leftover piece on the unexamined piece list.
		  piece->segmentStart = segment->next;
	 }
}