diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-11-18 04:32:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-11-19 17:29:03 +0300 |
commit | 80c6992f9ccb088679cab206056caaafec33c287 (patch) | |
tree | aa3c0d0dabf97d36fa18d04c52afd1576e926442 /src/gui | |
parent | f03bacd61c383ff642694489e0e39c43d5dd893a (diff) | |
download | manaplus-80c6992f9ccb088679cab206056caaafec33c287.tar.gz manaplus-80c6992f9ccb088679cab206056caaafec33c287.tar.bz2 manaplus-80c6992f9ccb088679cab206056caaafec33c287.tar.xz manaplus-80c6992f9ccb088679cab206056caaafec33c287.zip |
Show changed yellow bar modes in debug chat tab.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/statuspopup.cpp | 411 | ||||
-rw-r--r-- | src/gui/statuspopup.h | 5 | ||||
-rw-r--r-- | src/gui/statuswindow.cpp | 289 | ||||
-rw-r--r-- | src/gui/statuswindow.h | 4 |
4 files changed, 68 insertions, 641 deletions
diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp index 5f2ec71e3..a77af4478 100644 --- a/src/gui/statuspopup.cpp +++ b/src/gui/statuspopup.cpp @@ -187,387 +187,52 @@ void StatusPopup::view(int x, int y) requestMoveToTop(); } -void StatusPopup::setLabelText(gcn::Label *label, char *text, int key) +void StatusPopup::setLabelText(gcn::Label *label, const char *text, int key) { label->setCaption(strprintf("%s %s", text, keyboard.getKeyValueString(key).c_str())); } +void StatusPopup::setLabelText2(gcn::Label *label, std::string text, int key) +{ + label->setCaption(strprintf("%s %s", text.c_str(), + keyboard.getKeyValueString(key).c_str())); + label->adjustSize(); +} + void StatusPopup::updateLabels() { if (!player_node || !viewport) return; - switch (player_node->getInvertDirection()) - { - case 0: - setLabelText(mMoveType, _("(D) default moves"), - keyboard.KEY_INVERT_DIRECTION); - break; - - case 1: - setLabelText(mMoveType, _("(I) invert moves"), - keyboard.KEY_INVERT_DIRECTION); - break; - - case 2: - setLabelText(mMoveType, _("(c) moves with some crazy moves"), - keyboard.KEY_INVERT_DIRECTION); - break; - - case 3: - setLabelText(mMoveType, _("(C) moves with crazy moves"), - keyboard.KEY_INVERT_DIRECTION); - break; - - case 4: - setLabelText(mMoveType, _("(d) double normal + crazy"), - keyboard.KEY_INVERT_DIRECTION); - break; - - default: - setLabelText(mMoveType, _("(?) move"), - keyboard.KEY_INVERT_DIRECTION); - break; - } - mMoveType->adjustSize(); - - if (player_node->getCrazyMoveType() < 10) - { - mCrazyMoveType->setCaption(strprintf("(%d) crazy move number %d %s", - player_node->getCrazyMoveType(), player_node->getCrazyMoveType(), - keyboard.getKeyValueString( - keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE).c_str())); - } - else - { - switch (player_node->getCrazyMoveType()) - { - case 10: - setLabelText(mCrazyMoveType, _("(a) custom crazy move"), - keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE); - break; - default: - setLabelText(mCrazyMoveType, _("(?) crazy move"), - keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE); - break; - } - } - mCrazyMoveType->adjustSize(); - - switch (player_node->getMoveToTargetType()) - { - case 0: - setLabelText(mMoveToTargetType, _("(0) default moves to target"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 1: - setLabelText(mMoveToTargetType, - _("(1) moves to target in distance 1"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 2: - setLabelText(mMoveToTargetType, - _("(2) moves to target in distance 2"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 3: - setLabelText(mMoveToTargetType, - _("(3) moves to target in distance 3"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 4: - setLabelText(mMoveToTargetType, - _("(5) moves to target in distance 5"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 5: - setLabelText(mMoveToTargetType, - _("(7) moves to target in distance 7"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 6: - setLabelText(mMoveToTargetType, - _("(A) moves to target in attack range"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 7: - setLabelText(mMoveToTargetType, - _("(a) archer attack range"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - default: - setLabelText(mMoveToTargetType, - _("(?) move to target"), keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - } - mMoveToTargetType->adjustSize(); - - switch (player_node->getFollowMode()) - { - case 0: - setLabelText(mFollowMode, _("(D) default follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - case 1: - setLabelText(mFollowMode, _("(R) relative follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - case 2: - setLabelText(mFollowMode, _("(M) mirror follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - case 3: - setLabelText(mFollowMode, _("(P) pet follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - default: - setLabelText(mFollowMode, _("(?) unknown follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - } - mFollowMode->adjustSize(); - - switch (player_node->getAttackWeaponType()) - { - case 1: - setLabelText(mAttackWeaponType, _("(D) default attack"), - keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); - break; - case 2: - setLabelText(mAttackWeaponType, - _("(s) switch attack without shield"), - keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); - break; - case 3: - setLabelText(mAttackWeaponType, - _("(S) switch attack with shield"), - keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); - break; - default: - setLabelText(mAttackWeaponType, _("(?) attack"), - keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); - break; - } - mAttackWeaponType->adjustSize(); - - switch (player_node->getAttackType()) - { - case 0: - setLabelText(mAttackType, _("(D) default attack"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - case 1: - setLabelText(mAttackType, _("(G) go and attack"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - case 2: - setLabelText(mAttackType, _("(A) go, attack, pickup"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - case 3: - setLabelText(mAttackType, _("(d) without auto attack"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - default: - setLabelText(mAttackType, _("(?) attack"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - } - mAttackType->adjustSize(); - - mDropCounter->setCaption(strprintf("(%d) drop counter %d %s", - player_node->getQuickDropCounter(), player_node->getQuickDropCounter(), - keyboard.getKeyValueString(keyboard.KEY_SWITCH_QUICK_DROP).c_str())); - mDropCounter->adjustSize(); - - switch (player_node->getPickUpType()) - { - case 0: - setLabelText(mPickUpType, _("(S) small pick up 1x1 cells"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 1: - setLabelText(mPickUpType, _("(D) default pick up 2x1 cells"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 2: - setLabelText(mPickUpType, _("(F) forward pick up 2x3 cells"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 3: - setLabelText(mPickUpType, _("(3) pick up 3x3 cells"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 4: - setLabelText(mPickUpType, _("(g) go and pick up in distance 4"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 5: - setLabelText(mPickUpType, _("(G) go and pick up in distance 8"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 6: - setLabelText(mPickUpType, _("(A) go and pick up in max distance"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - default: - setLabelText(mPickUpType, _("(?) pick up"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - } - mPickUpType->adjustSize(); - - switch (viewport->getDebugPath()) - { - case 0: - setLabelText(mMapType, _("(N) normal map view"), - keyboard.KEY_PATHFIND); - break; - case 1: - setLabelText(mMapType, _("(D) debug map view"), - keyboard.KEY_PATHFIND); - break; - case 2: - setLabelText(mMapType, _("(u) ultra map view"), - keyboard.KEY_PATHFIND); - break; - case 3: - setLabelText(mMapType, _("(U) ultra map view 2"), - keyboard.KEY_PATHFIND); - break; - case 4: - setLabelText(mMapType, _("(e) empty map view"), - keyboard.KEY_PATHFIND); - break; - case 5: - setLabelText(mMapType, _("(b) black & white map view"), - keyboard.KEY_PATHFIND); - break; - default: - setLabelText(mMapType, _("(?) map view"), keyboard.KEY_PATHFIND); - break; - } - mMapType->adjustSize(); - - switch (player_node->getMagicAttackType()) - { - case 0: - setLabelText(mMagicAttackType, _("(f) use #flar for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - case 1: - setLabelText(mMagicAttackType, - _("(c) use #chiza for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - case 2: - setLabelText(mMagicAttackType, - _("(I) use #ingrav for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - case 3: - setLabelText(mMagicAttackType, - _("(F) use #frillyar for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - case 4: - setLabelText(mMagicAttackType, - _("(U) use #upmarmu for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - default: - setLabelText(mMagicAttackType, _("(?) magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - } - mMagicAttackType->adjustSize(); - - switch (player_node->getPvpAttackType()) - { - case 0: - setLabelText(mPvpAttackType, _("(a) attack all players"), - keyboard.KEY_SWITCH_PVP_ATTACK); - break; - case 1: - setLabelText(mPvpAttackType, _("(f) attack not friends"), - keyboard.KEY_SWITCH_PVP_ATTACK); - break; - case 2: - setLabelText(mPvpAttackType, _("(b) attack bad relations"), - keyboard.KEY_SWITCH_PVP_ATTACK); - break; - case 3: - setLabelText(mPvpAttackType, _("(d) dont attack players"), - keyboard.KEY_SWITCH_PVP_ATTACK); - break; - default: - setLabelText(mMagicAttackType, _("(?) pvp attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - } - mPvpAttackType->adjustSize(); - - switch (player_node->getImitationMode()) - { - case 0: - setLabelText(mImitationMode, _("(D) default imitation"), - keyboard.KEY_CHANGE_IMITATION_MODE); - break; - case 1: - setLabelText(mImitationMode, _("(O) outfits imitation"), - keyboard.KEY_CHANGE_IMITATION_MODE); - break; - default: - setLabelText(mImitationMode, _("(?) imitation"), - keyboard.KEY_CHANGE_IMITATION_MODE); - break; - } - mImitationMode->adjustSize(); - - switch ((int)player_node->getAway()) - { - case 0: - setLabelText(mAwayMode, _("(O) on keyboard"), keyboard.KEY_AWAY); - break; - case 1: - setLabelText(mAwayMode, _("(A) away"), keyboard.KEY_AWAY); - break; - default: - setLabelText(mAwayMode, _("(?) away"), keyboard.KEY_AWAY); - break; - } - mAwayMode->adjustSize(); - - switch (viewport->getCameraMode()) - { - case 0: - setLabelText(mCameraMode, _("(G) game camera mode"), - keyboard.KEY_CAMERA); - break; - case 1: - setLabelText(mCameraMode, _("(F) free camera mode"), - keyboard.KEY_CAMERA); - break; - case 2: - setLabelText(mCameraMode, _("(D) design camera mode"), - keyboard.KEY_CAMERA); - break; - default: - setLabelText(mCameraMode, _("(?) away"), keyboard.KEY_CAMERA); - break; - } - mCameraMode->adjustSize(); - - if (player_node->getDisableGameModifiers()) - { - setLabelText(mDisableGameModifiers, _("Game modifiers are disabled"), - keyboard.KEY_DISABLE_GAME_MODIFIERS); - } - else - { - setLabelText(mDisableGameModifiers, _("Game modifiers are enabled"), - keyboard.KEY_DISABLE_GAME_MODIFIERS); - } - mDisableGameModifiers->adjustSize(); + setLabelText2(mMoveType, player_node->getInvertDirectionString(), + keyboard.KEY_INVERT_DIRECTION); + setLabelText2(mCrazyMoveType, player_node->getCrazyMoveTypeString(), + keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE); + setLabelText2(mMoveToTargetType, player_node->getMoveToTargetTypeString(), + keyboard.KEY_CHANGE_MOVE_TO_TARGET); + setLabelText2(mFollowMode, player_node->getFollowModeString(), + keyboard.KEY_CHANGE_FOLLOW_MODE); + setLabelText2(mAttackWeaponType, player_node->getAttackWeaponTypeString(), + keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); + setLabelText2(mAttackType, player_node->getAttackTypeString(), + keyboard.KEY_CHANGE_ATTACK_TYPE); + setLabelText2(mDropCounter, player_node->getQuickDropCounterString(), + keyboard.KEY_SWITCH_QUICK_DROP); + setLabelText2(mPickUpType, player_node->getPickUpTypeString(), + keyboard.KEY_CHANGE_PICKUP_TYPE); + setLabelText2(mMapType, player_node->getDebugPathString(), + keyboard.KEY_PATHFIND); + setLabelText2(mMagicAttackType, player_node->getMagicAttackString(), + keyboard.KEY_SWITCH_MAGIC_ATTACK); + setLabelText2(mPvpAttackType, player_node->getPvpAttackString(), + keyboard.KEY_SWITCH_PVP_ATTACK); + setLabelText2(mImitationMode, player_node->getImitationModeString(), + keyboard.KEY_CHANGE_IMITATION_MODE); + setLabelText2(mAwayMode, player_node->getAwayModeString(), + keyboard.KEY_AWAY); + setLabelText2(mCameraMode, player_node->getCameraModeString(), + keyboard.KEY_CAMERA); + setLabelText2(mDisableGameModifiers, player_node->getGameModifiersString(), + keyboard.KEY_DISABLE_GAME_MODIFIERS); } diff --git a/src/gui/statuspopup.h b/src/gui/statuspopup.h index 2af8064c5..976b5e57b 100644 --- a/src/gui/statuspopup.h +++ b/src/gui/statuspopup.h @@ -60,7 +60,10 @@ class StatusPopup : public Popup private: void updateLabels(); - void setLabelText(gcn::Label *label, char *text, int key); + + void setLabelText(gcn::Label *label, const char *text, int key); + + void setLabelText2(gcn::Label *label, std::string text, int key); gcn::Label *mMoveType; gcn::Label *mCrazyMoveType; diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 37a706baf..5ac14d132 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -624,7 +624,7 @@ void StatusWindow::updateInvSlotsBar(ProgressBar *bar) bar->setText(strprintf("%d", usedSlots)); } -std::string StatusWindow::translateLetter(char* letters) +std::string StatusWindow::translateLetter(const char* letters) { char buf[2]; char *str = gettext(letters); @@ -636,277 +636,34 @@ std::string StatusWindow::translateLetter(char* letters) return std::string(buf); } +std::string StatusWindow::translateLetter2(std::string letters) +{ + if (letters.size() < 5) + return ""; + + return std::string(gettext(letters.substr(1, 1).c_str())); +} + void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent A_UNUSED) { if (!player_node || !viewport) return; - std::string str; - - switch (player_node->getInvertDirection()) - { - case 0: - str = translateLetter(N_("(D)")); - break; - case 1: - str = translateLetter(N_("(I)")); - break; - case 2: - str = translateLetter(N_("(c)")); - break; - case 3: - str = translateLetter(N_("(C)")); - break; - case 4: - str = translateLetter(N_("(d)")); - break; - default: - str = translateLetter(N_("(?)")); - break; - } - - if (player_node->getCrazyMoveType() < 10) - str += toString(player_node->getCrazyMoveType()); - else - { - switch (player_node->getCrazyMoveType()) - { - case 10: - str += translateLetter(N_("(a)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - } - - switch (player_node->getMoveToTargetType()) - { - case 0: - str += translateLetter(N_("(0)")); - break; - case 1: - str += translateLetter(N_("(1)")); - break; - case 2: - str += translateLetter(N_("(2)")); - break; - case 3: - str += translateLetter(N_("(3)")); - break; - case 4: - str += translateLetter(N_("(5)")); - break; - case 5: - str += translateLetter(N_("(7)")); - break; - case 6: - str += translateLetter(N_("(A)")); - break; - case 7: - str += translateLetter(N_("(a)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (player_node->getFollowMode()) - { - case 0: - str += translateLetter(N_("(D)")); - break; - case 1: - str += translateLetter(N_("(R)")); - break; - case 2: - str += translateLetter(N_("(M)")); - break; - case 3: - str += translateLetter(N_("(P)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - str += " "; - switch (player_node->getAttackWeaponType()) - { - case 1: - str += translateLetter(N_("(D)")); - break; - case 2: - str += translateLetter(N_("(s)")); - break; - case 3: - str += translateLetter(N_("(S)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (player_node->getAttackType()) - { - case 0: - str += translateLetter(N_("(D)")); - break; - case 1: - str += translateLetter(N_("(G)")); - break; - case 2: - str += translateLetter(N_("(A)")); - break; - case 3: - str += translateLetter(N_("(d)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (player_node->getMagicAttackType()) - { - case 0: - str += translateLetter(N_("(f)")); - break; - case 1: - str += translateLetter(N_("(c)")); - break; - case 2: - str += translateLetter(N_("(I)")); - break; - case 3: - str += translateLetter(N_("(F)")); - break; - case 4: - str += translateLetter(N_("(U)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (player_node->getPvpAttackType()) - { - case 0: - str += translateLetter(N_("(a)")); - break; - case 1: - str += translateLetter(N_("(f)")); - break; - case 2: - str += translateLetter(N_("(b)")); - break; - case 3: - str += translateLetter(N_("(d)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - str += " " + toString(player_node->getQuickDropCounter()); - - switch (player_node->getPickUpType()) - { - case 0: - str += translateLetter(N_("(S)")); - break; - case 1: - str += translateLetter(N_("(D)")); - break; - case 2: - str += translateLetter(N_("(F)")); - break; - case 3: - str += translateLetter(N_("(3)")); - break; - case 4: - str += translateLetter(N_("(g)")); - break; - case 5: - str += translateLetter(N_("(G)")); - break; - case 6: - str += translateLetter(N_("(A)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - str += " "; - switch (viewport->getDebugPath()) - { - case 0: - str += translateLetter(N_("(N)")); - break; - case 1: - str += translateLetter(N_("(D)")); - break; - case 2: - str += translateLetter(N_("(u)")); - break; - case 3: - str += translateLetter(N_("(U)")); - break; - case 4: - str += translateLetter(N_("(e)")); - break; - case 5: - str += translateLetter(N_("(b)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - str += " "; - switch (player_node->getImitationMode()) - { - case 0: - str += translateLetter(N_("(D)")); - break; - case 1: - str += translateLetter(N_("(O)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (viewport->getCameraMode()) - { - case 0: - str += translateLetter(N_("(G)")); - break; - case 1: - str += translateLetter(N_("(F)")); - break; - case 2: - str += translateLetter(N_("(D)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch ((int)player_node->getAway()) - { - case 0: - str += translateLetter(N_("(O)")); - break; - case 1: - str += translateLetter(N_("(A)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } + bar->setText(translateLetter2(player_node->getInvertDirectionString()) + += translateLetter2(player_node->getCrazyMoveTypeString()) + += translateLetter2(player_node->getMoveToTargetTypeString()) + += translateLetter2(player_node->getFollowModeString()) + += " " + translateLetter2(player_node->getAttackWeaponTypeString()) + += translateLetter2(player_node->getAttackTypeString()) + += translateLetter2(player_node->getMagicAttackString()) + += translateLetter2(player_node->getPvpAttackString()) + += " " + translateLetter2(player_node->getQuickDropCounterString()) + += translateLetter2(player_node->getPickUpTypeString()) + += " " + translateLetter2(player_node->getDebugPathString()) + += " " + translateLetter2(player_node->getImitationModeString()) + += translateLetter2(player_node->getCameraModeString()) + += translateLetter2(player_node->getAwayModeString())); - bar->setText(str); bar->setProgress(50); if (player_node->getDisableGameModifiers()) { diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index fa957d059..0af8d4276 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -82,7 +82,9 @@ class StatusWindow : public Window, void action(const gcn::ActionEvent &event); private: - static std::string translateLetter(char* letters); + static std::string translateLetter(const char* letters); + + static std::string translateLetter2(std::string letters); /** * Status Part |