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(); }
void Board::OnTimer(wxCommandEvent& event) { if (isFallingFinished) { isFallingFinished = false; NewPiece(); } else { OneLineDown(); } }
void CLogicBoad::OnTimer() { if (isFallingFinished) { isFallingFinished = false; NewPiece(); } else { OneLineDown(); } }
void CLogicBoad::OnTimer() { if (isPaused || !isStarted) return ; if (isFallingFinished) { isFallingFinished = false; NewPiece(); } else { OneLineDown(); } }
void CLogicBoad::Start() { if (isPaused) return; isStarted = true; isFallingFinished = false; numLinesRemoved = 0; ClearBoard(); NewPiece(); }
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(); }
void Board::Start() { if (isPaused) return; isStarted = true; isFallingFinished = false; numLinesRemoved = 0; ClearBoard(); NewPiece(); timer->Start(500); }
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; } }