void drawPiece(BITMAP *scr, Piece *p) { int x = p->x * FACE_WIDTH - p->z * EDGE_WIDTH + BOARD_XOFF; int y = p->y * FACE_HEIGHT - p->z * EDGE_HEIGHT + BOARD_YOFF; paintPiece(scr, x, y, p); if(p->mode) { int i; for(i = 3; --i;) rect(scr, x + 5 - i, y + 5 - i, x + (FACE_WIDTH - 5) + i, y + (FACE_HEIGHT - 5) + i, p->mode); } if(editing && p->z == 0) { if(p->x == 15) line(scr, x + FACE_WIDTH, y, x + FACE_WIDTH, y + FACE_HEIGHT, SELECTED); if(p->y == 8) line(scr, x, y + FACE_HEIGHT, x + FACE_WIDTH, y + FACE_HEIGHT, SELECTED); } }
void SlvPainter::paint(BaseGLWidget* context, bool fTargets, int singleChoise, int upToStep, ELinesDraw cfgLines) const { M_ASSERT(m_scube != nullptr); M_ASSERT(m_scube->shape != nullptr); context->model.translate(0,0,+1); //cout << "*****" << endl; if (singleChoise < 0) { for (int f = 0; f < m_scube->dt.size(); ++f) { if (upToStep >= 0 && f >= upToStep) // step by step support break; if (m_scube->dt[f].abs_sc == -1) // piece not there (solution transformed) continue; mglCheckErrorsC("x3"); paintPiece(f, context, fTargets); mglCheckErrorsC("x4"); if ((!fTargets) && (cfgLines != LINES_NONE)) { bool linesSingle = false; if (upToStep >= 0) // step by step support { // this is somewhat of a PATCH that doesn't work completely well to make the edges have somewhat proper lines // since we don't want to regenerate to IFS for every stage (and even that doesn't work so well, see flat10x10) const int *knei = m_scube->shape->faces[f].nei; linesSingle = (knei[0] > upToStep) || (knei[1] > upToStep) || (knei[2] > upToStep) || (knei[3] > upToStep); } paintLines(f, linesSingle, context, cfgLines); mglCheckErrorsC("x5"); } } } else { paintPiece(singleChoise, context, fTargets); if ((!fTargets) && (cfgLines == LINES_ALL)) // in single choise, do lines only if ALL (and not if BLACK) paintLines(singleChoise, true, context, cfgLines); } }