diff options
Diffstat (limited to 'src/gui/statuspopup.cpp')
-rw-r--r-- | src/gui/statuspopup.cpp | 411 |
1 files changed, 38 insertions, 373 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); } |