void CFillTool::finaliseCommand() { // fill wherever we are! doFill(); if (m_command->changes.size() > 0) { int amount = m_command->changes.count(); bool isPlacement = !((m_whatType != CMap::Floor) && m_whatValue == 0); QString text = isPlacement ? "place " : "delete "; const char *typeName = CMap::nameForObjectType(m_whatType); if (amount > 1) { text.append(QString("%1 %2s").arg(amount).arg(typeName)); } else { text.append("one "); text.append(typeName); } if (isPlacement) text.append(QString(" of type %1").arg(m_whatValue)); m_command->setText(text); } CCommandToolBase::finaliseCommand(); }
void Game::doAction(const Actions action) { switch (action) { case GO: doGo(); break; case QUIT: doQuit(); break; case PICK: doPick(); break; case DROP: doDrop(); break; case READ: doRead(); break; case BREAK: doBreak(); break; case SEE: doSee(); break; case OPEN: doOpen(); break; case FILL: doFill(); break; case USE: doUse(); break; case PUT: doPut(); break; case NOACTION: doNothing(); break; default: doNothing(); } }
void Game::doFill() { if (object != verb) { Item toFill = player->getItem(object); if (toFill.first != "NOITEM") { if (checkAction(toFill, FILL)) { cout << "What do you want to fill the " << object << " with?" << endl; cout << ">"; getline(cin, object); Item result = room_list[current_room]->getItem(object); if (checkAction(result, FILL)) { room_list[current_room]->changeState(toFill.first); cout << "You filled the " << toFill.first << " with " << object << endl; if (toFill.first.compare("bottle") == 0) { player->removeItem("bottle"); player->pickItem(Item("water", { PUT })); } } else { cout << "You can't fill the " << toFill.first << " with a " << object << endl; return; } } else cout << "You can't fill a " << toFill.first << endl; } else cout << "You don't have a " << object << endl; } else { cout << "What do you want to fill?" << endl; cout << ">"; getline(cin, object); doFill(); } }
static void emit_html_tbl(GVJ_t * job, htmltbl_t * tbl, htmlenv_t * env) { box pts = tbl->data.box; point p = env->p; htmlcell_t **cells = tbl->u.n.cells; htmlfont_t savef; if (tbl->font) pushFontInfo(env, tbl->font, &savef); pts.LL.x += p.x; pts.UR.x += p.x; pts.LL.y += p.y; pts.UR.y += p.y; /* gvrender_begin_context(job); */ if (tbl->data.href) doAnchorStart(job, &tbl->data); if (tbl->data.bgcolor) doFill(job, tbl->data.bgcolor, pts); while (*cells) { emit_html_cell(job, *cells, env); cells++; } if (tbl->data.border) doBorder(job, tbl->data.pencolor, tbl->data.border, pts); if (tbl->data.href) doAnchorEnd(job); /* gvrender_end_context(job); */ if (tbl->font) popFontInfo(env, &savef); }
static void emit_html_cell(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env) { box pts = cp->data.box; point p = env->p; pts.LL.x += p.x; pts.UR.x += p.x; pts.LL.y += p.y; pts.UR.y += p.y; /* gvrender_begin_context(); */ if (cp->data.href) { emit_map_rect(job, pts.LL, pts.UR); doAnchorStart(job, &cp->data); } if (cp->data.bgcolor) doFill(job, cp->data.bgcolor, pts); if (cp->child.kind == HTML_TBL) emit_html_tbl(job, cp->child.u.tbl, env); else if (cp->child.kind == HTML_IMAGE) emit_html_img(job, cp->child.u.img, env); else emit_html_txt(job, cp->child.u.txt, env); if (cp->data.border) doBorder(job, cp->data.pencolor, cp->data.border, pts); if (cp->data.href) doAnchorEnd(job); /* gvrender_end_context(); */ }
void Convert2Tlv::buildToonzRaster(TRasterCM32P &rout, const TRasterP &rin1, const TRasterP &rin2) { if (rin2) assert(rin1->getSize() == rin2->getSize()); rout->clear(); std::cout << " computing inks...\n"; TRaster32P r1 = (TRaster32P)rin1; TRasterGR8P r1gr = (TRasterGR8P)rin1; TRaster32P r2 = (TRaster32P)rin2; TRasterGR8P r2gr = (TRasterGR8P)rin2; TRasterP rU, rP; if (r1gr) { rU = r1gr; rP = r2; } else if (r2gr) { rU = r2gr; rP = r1; } else if (!r1) rU = r2; else if (!r2) rU = r1; else if (firstIsUnpainted(r1, r2)) { rU = r1; rP = r2; } else { rU = r2; rP = r1; } TRasterCM32P r; if (rout->getSize() != rU->getSize()) { int dx = rout->getLx() - rU->getLx(); int dy = rout->getLy() - rU->getLy(); assert(dx >= 0 && dy >= 0); r = rout->extract(dx / 2, dy / 2, dx / 2 + rU->getLx() - 1, dy / 2 + rU->getLy() - 1); } else r = rout; if ((TRasterGR8P)rU) buildInksFromGrayTones(r, rU); else if (m_isUnpaintedFromNAA) buildInksForNAAImage(r, (TRaster32P)rU); else { int maxMatte = getMaxMatte((TRaster32P)rU); if (maxMatte == -1) buildInksFromGrayTones(r, rU); else { if (maxMatte < 255) normalize(rU, maxMatte); buildInks(r, (TRaster32P)rU /*rP,*/); } } if (m_autoclose) TAutocloser(r, AutocloseDistance, AutocloseAngle, 1, AutocloseOpacity).exec(); if (rP) { std::cout << " computing paints...\n"; doFill(r, rP); } if (m_antialiasType == 2) //remove antialias removeAntialias(r); else if (m_antialiasType == 1) //add antialias { TRasterCM32P raux(r->getSize()); TRop::antialias(r, raux, 10, m_antialiasValue); rout = raux; } }