/** ** Draw info panel with one unit selected */ static void DrawInfoPanelSingleSelected() { DrawUnitInfo(Selected[0]); if (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == 0) { UI.StatusLine.Set(Selected[0]->Type->Name); } }
static void InfoPanel_draw_single_selection(CUnit *selUnit) { CUnit &unit = (selUnit ? *selUnit : *Selected[0]); int panelIndex; // FIXME: not correct for enemy's units if (unit.Player == ThisPlayer || ThisPlayer->IsTeamed(unit) || ThisPlayer->IsAllied(unit) || ReplayRevealMap) { if (unit.Orders[0]->Action == UnitActionBuilt || unit.Orders[0]->Action == UnitActionResearch || unit.Orders[0]->Action == UnitActionUpgradeTo || unit.Orders[0]->Action == UnitActionTrain) { panelIndex = 3; } else if (unit.Stats->Variables[MANA_INDEX].Max) { panelIndex = 2; } else { panelIndex = 1; } } else { panelIndex = 0; } DrawInfoPanelBackground(panelIndex); DrawUnitInfo(unit); if (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == 0) { UI.StatusLine.Set(unit.Type->Name); } }
static void InfoPanel_draw_no_selection() { DrawInfoPanelBackground(0); if (UnitUnderCursor && UnitUnderCursor->IsVisible(*ThisPlayer) && !UnitUnderCursor->Type->BoolFlag[ISNOTSELECTABLE_INDEX].value) { // FIXME: not correct for enemies units DrawUnitInfo(*UnitUnderCursor); } else { // FIXME: need some cool ideas for this. int x = UI.InfoPanel.X + 16; int y = UI.InfoPanel.Y + 8; CLabel label(GetGameFont()); label.Draw(x, y, "Stratagus"); y += 16; label.Draw(x, y, _("Cycle:")); label.Draw(x + 48, y, GameCycle); //Wyrmgus start // label.Draw(x + 110, y, CYCLES_PER_SECOND * VideoSyncSpeed / 100); label.Draw(x + 110, y, _("Speed:")); label.Draw(x + 110 + 53, y, CYCLES_PER_SECOND * VideoSyncSpeed / 100); //Wyrmgus end y += 20; std::string nc; std::string rc; GetDefaultTextColors(nc, rc); for (int i = 0; i < PlayerMax - 1; ++i) { if (Players[i].Type != PlayerNobody) { if (ThisPlayer->IsAllied(Players[i])) { label.SetNormalColor(FontGreen); } else if (ThisPlayer->IsEnemy(Players[i])) { label.SetNormalColor(FontRed); } else { label.SetNormalColor(nc); } label.Draw(x + 15, y, i); Video.DrawRectangleClip(ColorWhite, x, y, 12, 12); Video.FillRectangleClip(Players[i].Color, x + 1, y + 1, 10, 10); //Wyrmgus start // label.Draw(x + 27, y, Players[i].Name); label.Draw(x + 27, y, _(Players[i].Name.c_str())); //the score was appearing on top of the faction name // label.Draw(x + 117, y, Players[i].Score); //Wyrmgus end y += 14; } } } }
static void InfoPanel_draw_single_selection(CUnit *selUnit) { CUnit &unit = (selUnit ? *selUnit : *Selected[0]); int panelIndex; // FIXME: not correct for enemy's units if (unit.Player == ThisPlayer || ThisPlayer->IsTeamed(unit) || ThisPlayer->IsAllied(unit) || ReplayRevealMap) { if (unit.Orders[0]->Action == UnitActionBuilt || unit.Orders[0]->Action == UnitActionResearch || unit.Orders[0]->Action == UnitActionUpgradeTo || unit.Orders[0]->Action == UnitActionTrain) { panelIndex = 3; } else if (unit.Stats->Variables[MANA_INDEX].Max) { panelIndex = 2; } else { panelIndex = 1; } } else { panelIndex = 0; } DrawInfoPanelBackground(panelIndex); //Wyrmgus start //draw icon panel frame, if any if ( Preference.InfoPanelFrameG && (unit.CurrentAction() != UnitActionTrain || static_cast<COrder_Train *>(unit.CurrentOrder())->GetUnitType().Stats[unit.Player->Index].Costs[TimeCost] == 0) //don't stop showing the info panel frame for a quick moment if the time cost is 0 && (unit.CurrentAction() != UnitActionUpgradeTo || static_cast<COrder_UpgradeTo *>(unit.CurrentOrder())->GetUnitType().Stats[unit.Player->Index].Costs[TimeCost] == 0) && (unit.CurrentAction() != UnitActionResearch || static_cast<COrder_Research *>(unit.CurrentOrder())->GetUpgrade().Costs[TimeCost] == 0) && unit.CurrentAction() != UnitActionBuilt && !unit.IsEnemy(*ThisPlayer) && (unit.Player->Type != PlayerNeutral || unit.Type->GivesResource) ) { Preference.InfoPanelFrameG->DrawClip(UI.InfoPanel.X - 4, UI.InfoPanel.Y + 93); } //Wyrmgus end DrawUnitInfo(unit); if (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == 0) { //Wyrmgus start // UI.StatusLine.Set(unit.Type->Name); if (!Preference.NoStatusLineTooltips) { UI.StatusLine.Set(unit.GetMessageName()); } DrawGenericPopup(unit.GetMessageName(), UI.SingleSelectedButton->X, UI.SingleSelectedButton->Y); //Wyrmgus end } }
/** ** Draw info panel with no units selected */ static void DrawInfoPanelNoneSelected() { // Check if a unit is under the cursor if (UnitUnderCursor && UnitUnderCursor->IsVisible(ThisPlayer)) { DrawUnitInfo(UnitUnderCursor); return; } std::string nc; std::string rc; int x = UI.InfoPanel.X + 16; int y = UI.InfoPanel.Y + 8; VideoDrawText(x, y, GameFont, "Bos Wars"); y += 16; VideoDrawText(x, y, GameFont, "Cycle:"); VideoDrawNumber(x + 48, y, GameFont, GameCycle); VideoDrawNumber(x + 110, y, GameFont, CYCLES_PER_SECOND * VideoSyncSpeed / 100); y += 20; GetDefaultTextColors(nc, rc); for (int i = 0; i < PlayerMax - 1; ++i) { if (Players[i].Type != PlayerNobody) { if (ThisPlayer->Allied & (1 << Players[i].Index)) { SetDefaultTextColors(FontGreen, rc); } else if (ThisPlayer->Enemy & (1 << Players[i].Index)) { SetDefaultTextColors(FontRed, rc); } else { SetDefaultTextColors(nc, rc); } VideoDrawNumber(x + 15, y, GameFont, i); Video.DrawRectangle(ColorWhite,x, y, 12, 12); Video.FillRectangle(Players[i].Color, x + 1, y + 1, 10, 10); VideoDrawText(x + 27, y, GameFont,Players[i].Name); VideoDrawNumber(x + 117, y, GameFont,Players[i].Score); y += 14; } } SetDefaultTextColors(nc, rc); }
/** ** Draw info panel. ** ** Panel: ** neutral - neutral or opponent ** normal - not 1,3,4 ** magic unit - magic units ** construction - under construction */ void CInfoPanel::Draw(void) { int i; if (NumSelected) { if (NumSelected > 1) { // // If there are more units selected draw their pictures and a health bar // DrawInfoPanelBackground(0); for (i = 0; i < (NumSelected > (int)UI.SelectedButtons.size() ? (int)UI.SelectedButtons.size() : NumSelected); ++i) { Selected[i]->Type->Icon.Icon->DrawUnitIcon(ThisPlayer, UI.SelectedButtons[i].Style, (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == i) ? (IconActive | (MouseButtons & LeftButton)) : 0, UI.SelectedButtons[i].X, UI.SelectedButtons[i].Y, ""); UiDrawLifeBar(Selected[i], UI.SelectedButtons[i].X, UI.SelectedButtons[i].Y); if (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == i) { UI.StatusLine.Set(Selected[i]->Type->Name); } } if (NumSelected > (int)UI.SelectedButtons.size()) { char buf[5]; sprintf(buf, "+%u", static_cast<unsigned int> (NumSelected - UI.SelectedButtons.size())); VideoDrawText(UI.MaxSelectedTextX, UI.MaxSelectedTextY, UI.MaxSelectedFont, buf); } return; } else { // FIXME: not correct for enemy's units if (Selected[0]->Player == ThisPlayer || ThisPlayer->IsTeamed(Selected[0]) || ThisPlayer->IsAllied(Selected[0]) || ReplayRevealMap) { if (Selected[0]->Orders[0]->Action == UnitActionBuilt || Selected[0]->Orders[0]->Action == UnitActionResearch || Selected[0]->Orders[0]->Action == UnitActionUpgradeTo || Selected[0]->Orders[0]->Action == UnitActionTrain) { i = 3; } else if (Selected[0]->Stats->Variables[MANA_INDEX].Max) { i = 2; } else { i = 1; } } else { i = 0; } DrawInfoPanelBackground(i); DrawUnitInfo(Selected[0]); if (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == 0) { UI.StatusLine.Set(Selected[0]->Type->Name); } return; } } // Nothing selected DrawInfoPanelBackground(0); if (UnitUnderCursor && UnitUnderCursor->IsVisible(ThisPlayer)) { // FIXME: not correct for enemies units DrawUnitInfo(UnitUnderCursor); } else { int x; int y; std::string nc; std::string rc; // FIXME: need some cool ideas for this. x = UI.InfoPanel.X + 16; y = UI.InfoPanel.Y + 8; VideoDrawText(x, y, GameFont, "Stratagus"); y += 16; VideoDrawText(x, y, GameFont, "Cycle:"); VideoDrawNumber(x + 48, y, GameFont, GameCycle); VideoDrawNumber(x + 110, y, GameFont, CYCLES_PER_SECOND * VideoSyncSpeed / 100); y += 20; GetDefaultTextColors(nc, rc); for (i = 0; i < PlayerMax - 1; ++i) { if (Players[i].Type != PlayerNobody) { if (ThisPlayer->Allied & (1 << Players[i].Index)) { SetDefaultTextColors(FontGreen, rc); } else if (ThisPlayer->Enemy & (1 << Players[i].Index)) { SetDefaultTextColors(FontRed, rc); } else { SetDefaultTextColors(nc, rc); } VideoDrawNumber(x + 15, y, GameFont, i); Video.DrawRectangle(ColorWhite,x, y, 12, 12); Video.FillRectangle(Players[i].Color, x + 1, y + 1, 10, 10); VideoDrawText(x + 27, y, GameFont,Players[i].Name); VideoDrawNumber(x + 117, y, GameFont,Players[i].Score); y += 14; } } SetDefaultTextColors(nc, rc); } }