mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
MM: MM1: Implement item discarding
This commit is contained in:
parent
56a99dc79f
commit
94cd53cac2
@ -25,6 +25,7 @@ dialogs:
|
||||
legend2: " # view other 'd' discard 's' share"
|
||||
legend3: " 'e' equip 't' trade"
|
||||
legend4: "'esc' to go back 'g' gather 'u' use"
|
||||
discard: "discard which item: 'a'-'f'?"
|
||||
equip: "equip which item: 'a'-'f'?"
|
||||
remove: "remove which item: '1'-'6'?"
|
||||
which: "which item: 'a'-'f'?"
|
||||
|
@ -47,6 +47,11 @@ void CharacterInfo::draw() {
|
||||
writeString(0, 24, STRING["dialogs.character.legend4"]);
|
||||
break;
|
||||
|
||||
case DISCARD:
|
||||
writeString(0, 20, STRING["dialogs.character.discard"]);
|
||||
escToGoBack(0);
|
||||
break;
|
||||
|
||||
case EQUIP:
|
||||
writeString(0, 20, STRING["dialogs.character.equip"]);
|
||||
escToGoBack(0);
|
||||
@ -133,6 +138,11 @@ bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
|
||||
case Common::KEYCODE_c:
|
||||
send("CastSpell", GameMessage("SPELL", 0));
|
||||
break;
|
||||
case Common::KEYCODE_d:
|
||||
if (!g_globals->_currCharacter->_backpack.empty())
|
||||
_state = DISCARD;
|
||||
redraw();
|
||||
break;
|
||||
case Common::KEYCODE_e:
|
||||
if (!g_globals->_currCharacter->_backpack.empty())
|
||||
_state = EQUIP;
|
||||
@ -167,6 +177,13 @@ bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
|
||||
}
|
||||
break;
|
||||
|
||||
case DISCARD:
|
||||
if (msg.keycode >= Common::KEYCODE_a &&
|
||||
msg.keycode <= Common::KEYCODE_f)
|
||||
discardItem(msg.keycode - Common::KEYCODE_a);
|
||||
redraw();
|
||||
break;
|
||||
|
||||
case EQUIP:
|
||||
if (msg.keycode >= Common::KEYCODE_a &&
|
||||
msg.keycode <= Common::KEYCODE_f)
|
||||
@ -305,6 +322,13 @@ bool CharacterInfo::msgGame(const GameMessage &msg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CharacterInfo::discardItem(uint index) {
|
||||
Inventory &inv = g_globals->_currCharacter->_backpack;
|
||||
if (index < inv.size())
|
||||
inv.removeAt(index);
|
||||
_state = DISPLAY;
|
||||
}
|
||||
|
||||
void CharacterInfo::equipItem(uint index) {
|
||||
Common::String errMsg;
|
||||
_state = DISPLAY;
|
||||
|
@ -41,7 +41,7 @@ class CharacterInfo : public CharacterBase, MM1::Game::EquipRemove,
|
||||
public MM1::Game::UseItem {
|
||||
private:
|
||||
enum ViewState {
|
||||
DISPLAY, EQUIP, GATHER, REMOVE, SHARE,
|
||||
DISPLAY, DISCARD, EQUIP, GATHER, REMOVE, SHARE,
|
||||
TRADE_WITH, TRADE_KIND, TRADE_ITEM, USE };
|
||||
ViewState _state = DISPLAY;
|
||||
Common::String _newName;
|
||||
@ -50,6 +50,11 @@ private:
|
||||
TransferKind _tradeKind = TK_GEMS;
|
||||
TextEntry _textEntry;
|
||||
private:
|
||||
/**
|
||||
* Discards the item at the given index
|
||||
*/
|
||||
void discardItem(uint index);
|
||||
|
||||
/**
|
||||
* Equips the item at the given index
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user