void SelectMenu::drawSelectedModInfos(int x, int y) { getMenuFont(FontManager::SIZE_1)->drawText(x, y, pSelectedMod_->getName(), true); char tmp[100]; sprintf(tmp, "COST :%d", pSelectedMod_->cost()); getMenuFont(FontManager::SIZE_1)->drawText(504, y + 14, tmp, true); getMenuFont(FontManager::SIZE_1)->drawText(504, y + 28, pSelectedMod_->desc(), true); }
void SelectMenu::drawSelectedModInfos(int x, int y) { // Draw a border around cancel button g_Screen.drawRect(502, 268, 124, 2, fs_cmn::kColorDarkGreen); g_Screen.drawRect(502, 292, 124, 2, fs_cmn::kColorDarkGreen); g_Screen.drawRect(502, 318, 124, 2, fs_cmn::kColorDarkGreen); getMenuFont(FontManager::SIZE_1)->drawText(x, y, pSelectedMod_->getName(), true); char tmp[100]; sprintf(tmp, "COST :%d", pSelectedMod_->cost()); getMenuFont(FontManager::SIZE_1)->drawText(504, y + 14, tmp, true); getMenuFont(FontManager::SIZE_1)->drawText(504, y + 28, pSelectedMod_->desc(), true); }
DebriefMenu::DebriefMenu(MenuManager *m) : Menu(m, MENU_DEBRIEF, MENU_MAIN, "mdebrief.dat", "mdeout.dat") { int y = 35; int right_x = 310; int left_x = 20; std::string str; addStatic(85, y, 545, "#DEBRIEF_TITLE", FontManager::SIZE_4, false); y = 100; menu_manager_->getMessage("DEBRIEF_SUBTITLE", str); addStatic(left_x, y, str.c_str(), FontManager::SIZE_2, true); separatorSize_ = getMenuFont(FontManager::SIZE_2)->textWidth(str.c_str(), false); y = 118; addStatic(left_x, y, "#DEBRIEF_STATUS", FontManager::SIZE_2, true); txtStatusId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_AGENTS", FontManager::SIZE_2, true); txtUsedId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_NEW_AGENT", FontManager::SIZE_2, true); txtAgentCapturedId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_TIME", FontManager::SIZE_2, true); txtTimeId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_AGT_KILLED", FontManager::SIZE_2, true); txtAgentKilledId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_CRIM_KILLED", FontManager::SIZE_2, true); txtCrimKilledId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_CIV_KILLED", FontManager::SIZE_2, true); txtCivilKilledId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_POL_KILLED", FontManager::SIZE_2, true); txtPoliceKilledId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_GUARD_KILLED", FontManager::SIZE_2, true); txtGardKilledId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_PERSUADED", FontManager::SIZE_2, true); txtConvincedId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 14; addStatic(left_x, y, "#DEBRIEF_HIT", FontManager::SIZE_2, true); txtPrecisionId_ = addStatic(right_x, y, "", FontManager::SIZE_2, true); y += 20; txtSearchId_ = addStatic(left_x, y, "", FontManager::SIZE_2, true); y += 20; txtNewWeap1Id_ = addStatic(left_x, y, "", FontManager::SIZE_2, true); y += 14; txtNewWeap2Id_ = addStatic(left_x, y, "", FontManager::SIZE_2, true); addOption(16, 346, 129, 25, "#MENU_ACC_BUT", FontManager::SIZE_2, MENU_MAP); addOption(500, 347, 128, 25, "#MENU_MAIN_BUT", FontManager::SIZE_2, MENU_MAIN); }
/*! * Creates a new button that has no text but an image. * Widget's size will be the same as the image used. Dark image * and light image should be the same size. * \param x X coordinate * \param y Y coordinate * \param dark_widget Widget drawn in front of the button when it's not highlighted * \param light_widget Widget drawn in front of the button when it's highlighted * \param visible True if button is visible on screen * \returns The newly created widget id. */ int Menu::addImageOption(int x, int y, int dark_widget, int light_widget, bool visible) { Sprite *spr = menu_manager_->menuSprites().sprite(dark_widget); Option *m = new Option(this, x, y, spr->width() * 2, spr->height() * 2, "", getMenuFont(FontManager::SIZE_1), MENU_NO_MENU, visible, true, dark_widget, light_widget); actions_.push_back(m); return m->getId(); }
int Menu::addToggleAction(int x, int y, int width, int height, const char *text, FontManager::EFontSize size, bool selected) { ToggleAction *a = new ToggleAction(this, x, y, width, height, text, getMenuFont(size), selected, &group_); group_.addButton(a); actions_.push_back(a); return a->getId(); }
/*! * Creates and adds a button to the menu. * \param x X coordinate * \param y Y coordinate * \param width Button width * \param height Button height * \param text Button label. If text starts with a '#' then * text is a property in the current language file and it is * replaced by its value. * \param size Font size * \param to Id of the next menu when button is clicked * \param visible True if button is visible on screen * \param centered True if text must centered regarding button width * \param dark_widget Widget drawn in front of the button when it's not highlighted * \param light_widget Widget drawn in front of the button when it's highlighted */ int Menu::addOption(int x, int y, int width, int height, const char *text, FontManager::EFontSize size, int to, bool visible, bool centered, int dark_widget, int light_widget) { Option *pOption = new Option(this, x, y, width, height, text, getMenuFont(size), to, visible, centered, dark_widget, light_widget); actions_.push_back(pOption); if (pOption->getHotKey().keyFunc != KFC_UNKNOWN || pOption->getHotKey().unicode != 0) { // The option already has an acceleration key registerHotKey(pOption->getHotKey().unicode, pOption->getId()); } return pOption->getId(); }
/*! * Reads a word (up to next separator : white space, new line or end of text) * and adds the word to the given line if it fits whithin the limit. * \return true if the line is complete */ bool BriefMenu::read_next_word(std::string & brief, std::string & line) { std::string new_line(line); size_t idx = 0; char last_char; // reads until a separator is met do { last_char = brief.at(idx++); if (last_char != '\n') { new_line.push_back(last_char); } } while ((idx < brief.size()) && (last_char != ' ' && last_char != '\n')); if (getMenuFont(FontManager::SIZE_2)->textWidth(new_line.c_str(), true) > 470) { // space added to end of word will produce wrong width, // we remove it and check again if (last_char == ' ') { new_line.erase(new_line.size() - 1, 1); if (getMenuFont(FontManager::SIZE_2)->textWidth(new_line.c_str(), true) > 470) // new line is too big so we can add the line as it is return true; } else // new line is too big so we can add the line as it is return true; } // we didn't reached the limit so add the word to the current line line.assign(new_line); // remove what has been read from briefing text brief.erase(0, idx); if (brief.size() == 0 || last_char == '\n') { // we reach the end of text or a new line so we can add the line return true; } return false; }
void StylesPlugin::setFonts() { if (getSystemFonts()){ if (m_saveBaseFont) QApplication::setFont(*m_saveBaseFont, true); if (m_saveMenuFont) QApplication::setFont(*m_saveMenuFont, true, "QPopupMenu"); }else{ setupDefaultFonts(); QPopupMenu m; QApplication::setFont(FontEdit::str2font(getBaseFont(), *m_saveBaseFont), true); QApplication::setFont(FontEdit::str2font(getMenuFont(), *m_saveMenuFont), true, "QPopupMenu"); } }
void SelectMenu::drawSelectedWeaponInfos(int x, int y) { char tmp[100]; getMenuFont(FontManager::SIZE_1)->drawText(x, y, pSelectedWeap_->getName(), false); sprintf(tmp, "COST :%d", pSelectedWeap_->cost()); getMenuFont(FontManager::SIZE_1)->drawText(x, y + 12, tmp, false); y += 24; if (pSelectedWeap_->ammo() >= 0) { sprintf(tmp, "AMMO :%d", pSelectedWeap_->ammo()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, tmp, false); y += 12; } if (pSelectedWeap_->range() >= 0) { sprintf(tmp, "RANGE :%d", pSelectedWeap_->range()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, tmp, false); y += 12; } if (pSelectedWeap_->damagePerShot() >= 0 && pSelectedWeap_->ammo() >= 0) { sprintf(tmp, "SHOT :%d", pSelectedWeap_->damagePerShot()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, tmp, false); y += 12; } if (selectedWInstId_ > 0 ) { WeaponInstance *wi = g_Session.teamMember(cur_agent_)->weapon(selectedWInstId_ - 1); if (pSelectedWeap_->ammo() > wi->ammoRemaining()) { int rldCost = (pSelectedWeap_->ammo() - wi->ammoRemaining()) * pSelectedWeap_->ammoCost(); sprintf(tmp, "RELOAD :%d", rldCost); getMenuFont(FontManager::SIZE_1)->drawText(x, y, tmp, false); y += 12; } } }
TextField * Menu::addTextField(int x, int y, int width, int height, FontManager::EFontSize size, int maxSize, bool displayEmpty, bool visible) { TextField *pTextField = new TextField(this, x, y, width, height, getMenuFont(size), maxSize, displayEmpty, visible); actions_.push_back(pTextField); return pTextField; }
void SelectMenu::drawSelectedWeaponInfos(int x, int y) { char tmp[100]; const int shifted_x = x + 52; getMenuFont(FontManager::SIZE_1)->drawText(x, y, pSelectedWeap_->getName(), true); y += 12; sprintf(tmp, ":%d", pSelectedWeap_->cost()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, g_App.menus().getMessage("SELECT_WPN_COST").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; if (pSelectedWeap_->ammo() >= 0) { sprintf(tmp, ":%d", pSelectedWeap_->ammo()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, g_App.menus().getMessage("SELECT_WPN_AMMO").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; } if (pSelectedWeap_->range() >= 0) { sprintf(tmp, ":%d", pSelectedWeap_->range()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, g_App.menus().getMessage("SELECT_WPN_RANGE").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; } if (pSelectedWeap_->ammoCost() >= 0 && pSelectedWeap_->ammo() >= 0) { sprintf(tmp, ":%d", pSelectedWeap_->ammoCost()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, g_App.menus().getMessage("SELECT_WPN_SHOT").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; } if (selectedWInstId_ > 0 && g_App.weapons().isAvailable(pSelectedWeap_)) { WeaponInstance *wi = g_Session.agents().squadMember(cur_agent_)->weapon(selectedWInstId_ - 1); if (wi->needsReloading()) { int rldCost = (pSelectedWeap_->ammo() - wi->ammoRemaining()) * pSelectedWeap_->ammoCost(); sprintf(tmp, ":%d", rldCost); getMenuFont(FontManager::SIZE_1)->drawText(x, y, g_App.menus().getMessage("SELECT_WPN_RELOAD").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; } } }
void SelectMenu::drawAgent() { Agent *selected = g_Session.agents().squadMember(cur_agent_); if (selected == NULL) return; int torso, arms, legs; int armsx = 188; int armsy = 152; int torsoy = 116; int legsy = 218; if (selected->isMale()) { torso = 30; arms = 40; legs = 32; } else { torso = 31; arms = 44; legs = 36; armsx += 10; armsy += 6; torsoy += 2; legsy -= 4; } if (selected->slot(Mod::MOD_LEGS)) { legs = selected->slot(Mod::MOD_LEGS)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 250, selected->slot(Mod::MOD_LEGS)->getName(), false); } if (selected->slot(Mod::MOD_ARMS)) { arms = selected->slot(Mod::MOD_ARMS)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 226, selected->slot(Mod::MOD_ARMS)->getName(), false); } menuSprites().drawSpriteXYZ(arms, armsx, armsy, 0, false, true); menuSprites().drawSpriteXYZ(torso, 224, torsoy, 0, false, true); menuSprites().drawSpriteXYZ(legs, 224, legsy, 0, false, true); if (selected->slot(Mod::MOD_CHEST)) { int chest = selected->slot(Mod::MOD_CHEST)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 202, selected->slot(Mod::MOD_CHEST)->getName(), false); int chestx = 216; int chesty = 146; if (!selected->isMale()) { chestx += 8; chesty += 2; } menu_manager_->menuSprites().drawSpriteXYZ(chest, chestx, chesty, 0, false, true); } if (selected->slot(Mod::MOD_HEART)) { int heart = selected->slot(Mod::MOD_HEART)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 160, selected->slot(Mod::MOD_HEART)->getName(), false); menu_manager_->menuSprites().drawSpriteXYZ(heart, 254, 166, 0, false, true); } if (selected->slot(Mod::MOD_EYES)) { int eyes = selected->slot(Mod::MOD_EYES)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 136, selected->slot(Mod::MOD_EYES)->getName(), false); int eyesx = 238; if (!selected->isMale()) { eyesx += 2; } menuSprites().drawSpriteXYZ(eyes, eyesx, 116, 0, false, true); } if (selected->slot(Mod::MOD_BRAIN)) { int brain = selected->slot(Mod::MOD_BRAIN)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 112, selected->slot(Mod::MOD_BRAIN)->getName(), false); int brainx = 238; if (!selected->isMale()) { brainx += 2; } menuSprites().drawSpriteXYZ(brain, brainx, 114, 0, false, true); } // restore lines over agent menu_manager_->blitFromBackground(254, 124, 30, 2); menu_manager_->blitFromBackground(264, 132, 30, 2); menu_manager_->blitFromBackground(266, 174, 36, 2); menu_manager_->blitFromBackground(252, 210, 56, 2); menu_manager_->blitFromBackground(302, 232, 10, 2); menu_manager_->blitFromBackground(264, 256, 30, 2); // write inventory for (int j = 0; j < 2; j++) for (int i = 0; i < 4 && (j * 4 + i < selected->numWeapons()); i++) { WeaponInstance *wi = selected->weapon(j * 4 + i); Weapon *pW = wi->getWeaponClass(); menuSprites().drawSpriteXYZ(pW->getSmallIconId(), 366 + i * 32, 308 + j * 32, 0, false, true); uint8 data[3] = {204, 204, 204}; if (pW->ammo() != -1) { int n = wi->ammoRemaining(); if (pW->ammo() == 0) n = 24; else { n *= 24; n /= pW->ammo(); } for (int k = 0; k < n; k++) g_Screen.scale2x(366 + i * 32 + k + 4, 308 + j * 32 + 22, 1, 3, data); } } }
void SelectMenu::drawSelectedWeaponInfos(int x, int y) { char tmp[100]; // Draw a border around cancel button g_Screen.drawRect(502, 268, 124, 2, fs_cmn::kColorDarkGreen); g_Screen.drawRect(502, 292, 124, 2, fs_cmn::kColorDarkGreen); g_Screen.drawRect(502, 318, 124, 2, fs_cmn::kColorDarkGreen); // Draw the selected weapon big icon menuSprites().drawSpriteXYZ(pSelectedWeap_->getBigIconId(), 502, 106, 0, false, true); const int shifted_x = x + 52; getMenuFont(FontManager::SIZE_1)->drawText(x, y, pSelectedWeap_->getName(), true); y += 12; sprintf(tmp, ":%d", pSelectedWeap_->cost()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, getMessage("SELECT_WPN_COST").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; if (pSelectedWeap_->usesAmmo()) { sprintf(tmp, ":%d", pSelectedWeap_->ammo()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, getMessage("SELECT_WPN_AMMO").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; } if (pSelectedWeap_->range() > 0) { sprintf(tmp, ":%d", pSelectedWeap_->range()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, getMessage("SELECT_WPN_RANGE").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; } if (pSelectedWeap_->usesAmmo()) { sprintf(tmp, ":%d", pSelectedWeap_->ammoCost()); getMenuFont(FontManager::SIZE_1)->drawText(x, y, getMessage("SELECT_WPN_SHOT").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; } if (selectedWInstId_ > 0 && g_gameCtrl.weapons().isAvailable(pSelectedWeap_)) { WeaponInstance *wi = g_gameCtrl.agents().squadMember(cur_agent_)->weapon(selectedWInstId_ - 1); if (wi->needsReloading()) { int rldCost = (pSelectedWeap_->ammo() - wi->ammoRemaining()) * pSelectedWeap_->ammoCost(); sprintf(tmp, ":%d", rldCost); getMenuFont(FontManager::SIZE_1)->drawText(x, y, getMessage("SELECT_WPN_RELOAD").c_str(), true); getMenuFont(FontManager::SIZE_1)->drawText(shifted_x, y, tmp, true); y += 12; } } }
/*! * Creates and adds a label with a fixed width to the menu. * Height will be equals to text height in the given font. * \param x X coordinate * \param y Y coordinate * \param width Width of the widget * \param text If text starts with a '#' then * text is a property in the current language file and it is * replaced by its value. * \param size Font size * \param highlighted True means text is highlighted * \returns The newly created widget id. */ int Menu::addStatic(int x, int y, int width, const char *text, FontManager::EFontSize size, bool highlighted) { MenuText m(x, y, width, text, getMenuFont(size), highlighted, true); statics_.push_back(m); return m.getId(); }
/*! * Draws the text stored in the a_page field. */ void BriefMenu::render_briefing_text() { for (int i = 0; i < kMaxLinePerPage; i++) { getMenuFont(FontManager::SIZE_2)-> drawTextCp437(24, 88 + i * 16, a_page_[i].c_str(), true); } }
Menu::Menu(Gui *gui) : _gui(gui) { assert(_gui->_engine); assert(_gui->_engine->_world); _font = getMenuFont(); MenuItem *about = new MenuItem(_gui->_builtInFonts ? "\xa9" : "\xf0"); // (c) Symbol as the most resembling apple _items.push_back(about); _items[0]->subitems.push_back(new MenuSubItem(_gui->_engine->_world->getAboutMenuItemName(), kMenuActionAbout)); MenuItem *file = new MenuItem("File"); _items.push_back(file); MenuItem *edit = new MenuItem("Edit"); _items.push_back(edit); for (int i = 0; menuSubItems[i].menunum; i++) { const MenuData *m = &menuSubItems[i]; _items[m->menunum]->subitems.push_back(new MenuSubItem(m->title, m->action, 0, m->shortcut, m->enabled)); } _commands = new MenuItem(_gui->_engine->_world->_commandsMenuName.c_str()); _items.push_back(_commands); regenCommandsMenu(); _weapons = NULL; if (!_gui->_engine->_world->_weaponMenuDisabled) { _weapons = new MenuItem(_gui->_engine->_world->_weaponsMenuName.c_str()); _items.push_back(_weapons); regenWeaponsMenu(); } // Calculate menu dimensions int y = 1; int x = 18; for (uint i = 0; i < _items.size(); i++) { int w = _font->getStringWidth(_items[i]->name); if (_items[i]->bbox.bottom == 0) { _items[i]->bbox.left = x - kMenuLeftMargin; _items[i]->bbox.top = y; _items[i]->bbox.right = x + w + kMenuSpacing - kMenuLeftMargin; _items[i]->bbox.bottom = y + _font->getFontHeight() + (_gui->_builtInFonts ? 3 : 2); } calcMenuBounds(_items[i]); x += w + kMenuSpacing; } _bbox.left = 0; _bbox.top = 0; _bbox.right = _gui->_screen.w - 1; _bbox.bottom = kMenuHeight - 1; _menuActivated = false; _activeItem = -1; _activeSubItem = -1; _screenCopy.create(_gui->_screen.w, _gui->_screen.h, Graphics::PixelFormat::createFormatCLUT8()); _tempSurface.create(_gui->_screen.w, _font->getFontHeight(), Graphics::PixelFormat::createFormatCLUT8()); }
void SelectMenu::drawAgent() { Agent *selected = g_gameCtrl.agents().squadMember(cur_agent_); if (selected == NULL) return; int torso, arms, legs; int armsx = 188; int armsy = 152; int torsoy = 116; int legsy = 218; if (selected->isMale()) { torso = 30; arms = 40; legs = 32; } else { torso = 31; arms = 44; legs = 36; armsx += 10; armsy += 6; torsoy += 2; legsy -= 4; } if (selected->slot(Mod::MOD_LEGS)) { legs = selected->slot(Mod::MOD_LEGS)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 250, selected->slot(Mod::MOD_LEGS)->getName(), false); } if (selected->slot(Mod::MOD_ARMS)) { arms = selected->slot(Mod::MOD_ARMS)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 226, selected->slot(Mod::MOD_ARMS)->getName(), false); } menuSprites().drawSpriteXYZ(arms, armsx, armsy, 0, false, true); menuSprites().drawSpriteXYZ(torso, 224, torsoy, 0, false, true); menuSprites().drawSpriteXYZ(legs, 224, legsy, 0, false, true); if (selected->slot(Mod::MOD_CHEST)) { int chest = selected->slot(Mod::MOD_CHEST)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 202, selected->slot(Mod::MOD_CHEST)->getName(), false); int chestx = 216; int chesty = 146; if (!selected->isMale()) { chestx += 8; chesty += 2; } menuSprites().drawSpriteXYZ(chest, chestx, chesty, 0, false, true); } if (selected->slot(Mod::MOD_HEART)) { int heart = selected->slot(Mod::MOD_HEART)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 160, selected->slot(Mod::MOD_HEART)->getName(), false); menuSprites().drawSpriteXYZ(heart, 254, 166, 0, false, true); } if (selected->slot(Mod::MOD_EYES)) { int eyes = selected->slot(Mod::MOD_EYES)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 136, selected->slot(Mod::MOD_EYES)->getName(), false); int eyesx = 238; if (!selected->isMale()) { eyesx += 2; } menuSprites().drawSpriteXYZ(eyes, eyesx, 116, 0, false, true); } if (selected->slot(Mod::MOD_BRAIN)) { int brain = selected->slot(Mod::MOD_BRAIN)->icon(selected->isMale()); getMenuFont(FontManager::SIZE_1)->drawText(366, 112, selected->slot(Mod::MOD_BRAIN)->getName(), false); int brainx = 238; if (!selected->isMale()) { brainx += 2; } menuSprites().drawSpriteXYZ(brain, brainx, 114, 0, false, true); } // restore lines over agent menu_manager_->blitFromBackground(254, 124, 30, 2); menu_manager_->blitFromBackground(264, 132, 30, 2); menu_manager_->blitFromBackground(266, 174, 36, 2); menu_manager_->blitFromBackground(252, 210, 56, 2); menu_manager_->blitFromBackground(302, 232, 10, 2); menu_manager_->blitFromBackground(264, 256, 30, 2); // draw inventory screenPoint pos[8]; WeaponInstance * draw_weapons[8]; for (uint8 i = 0; i < 8; ++i) { draw_weapons[i] = NULL; } for (int j = 0, k = 0; j < 2; ++j) for (int i = 0; i < 4 && (j * 4 + i < selected->numWeapons()); ++i) { // TODO: make weapon to be drawn at end WeaponInstance *wi = selected->weapon(j * 4 + i); if (wi == weapon_dragged_ && menu_manager_->isMouseDragged()) { pos[7] = weapon_pos_; draw_weapons[7] = wi; } else { draw_weapons[k] = wi; screenPoint pos_l = {366 + i * 32, 308 + j * 32}; pos[k] = pos_l; ++k; } } for (uint8 i = 0; i < 8; ++i) { WeaponInstance *wi = draw_weapons[i]; if (wi) { Weapon *pW = wi->getWeaponClass(); menuSprites().drawSpriteXYZ(pW->getSmallIconId(), pos[i].x, pos[i].y, 0, false, true); uint8 data[3] = {204, 204, 204}; if (pW->ammo() != -1) { int n = wi->ammoRemaining(); if (pW->ammo() == 0) n = 24; else { n *= 24; n /= pW->ammo(); } for (int k = 0; k < n; k++) g_Screen.scale2x(pos[i].x + k + 4, pos[i].y + 22, 1, 3, data); } } } }
/*! * Creates and adds a team list box to the menu. * \param x X coordinate * \param y Y coordinate * \param width widget width * \param height widget height * \param visible True if widget is visible on screen * \return A pointer on the widget. */ TeamListBox * Menu::addTeamListBox(int x, int y, int width, int height, bool visible) { TeamListBox *pBox = new TeamListBox(this, x, y, width, height, getMenuFont(FontManager::SIZE_1), visible); actions_.push_back(pBox); return pBox; }