mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 18:06:26 +00:00
MM: MM1: CharacterInfo now derives from PartyView class
This commit is contained in:
parent
3792c23854
commit
e7b6593e78
@ -62,7 +62,7 @@ const CharacterInfo::IconPos CharacterInfo::ICONS[CHAR_ICONS_COUNT] = {
|
||||
|
||||
|
||||
CharacterInfo::CharacterInfo() :
|
||||
ScrollView("CharacterInfo"), _statInfo("ScrollText") {
|
||||
PartyView("CharacterInfo"), _statInfo("ScrollText") {
|
||||
_bounds = Common::Rect(0, 0, 320, 146);
|
||||
_statInfo.setReduced(true);
|
||||
|
||||
@ -82,28 +82,16 @@ CharacterInfo::CharacterInfo() :
|
||||
|
||||
bool CharacterInfo::msgFocus(const FocusMessage &msg) {
|
||||
_viewIcon.load("view.icn");
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
|
||||
|
||||
// Turn on highlight for selected character
|
||||
if (!g_globals->_currCharacter)
|
||||
g_globals->_currCharacter = &g_globals->_party[0];
|
||||
g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)true));
|
||||
|
||||
_cursorCell = 0;
|
||||
showCursor(true);
|
||||
delayFrames(CURSOR_BLINK_FRAMES);
|
||||
|
||||
return ScrollView::msgFocus(msg);
|
||||
return PartyView::msgFocus(msg);
|
||||
}
|
||||
|
||||
bool CharacterInfo::msgUnfocus(const UnfocusMessage &msg) {
|
||||
_viewIcon.clear();
|
||||
|
||||
// Turn off highlight for selected character
|
||||
g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)false));
|
||||
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
return ScrollView::msgUnfocus(msg);
|
||||
return PartyView::msgUnfocus(msg);
|
||||
}
|
||||
|
||||
bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
|
||||
@ -156,17 +144,8 @@ bool CharacterInfo::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
close();
|
||||
return true;
|
||||
} else if (msg._action >= KEYBIND_VIEW_PARTY1 &&
|
||||
msg._action <= KEYBIND_VIEW_PARTY6) {
|
||||
uint charNum = msg._action - KEYBIND_VIEW_PARTY1;
|
||||
if (charNum < g_globals->_party.size()) {
|
||||
g_globals->_currCharacter = &g_globals->_party[
|
||||
msg._action - KEYBIND_VIEW_PARTY1];
|
||||
g_events->findView("GameParty")->draw();
|
||||
redraw();
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return PartyView::msgAction(msg);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef MM1_VIEWS_ENH_CHARACTER_INFO_H
|
||||
#define MM1_VIEWS_ENH_CHARACTER_INFO_H
|
||||
|
||||
#include "mm/mm1/views_enh/scroll_view.h"
|
||||
#include "mm/mm1/views_enh/party_view.h"
|
||||
#include "mm/mm1/views_enh/scroll_popup.h"
|
||||
#include "mm/shared/xeen/sprites.h"
|
||||
|
||||
@ -32,7 +32,7 @@ namespace ViewsEnh {
|
||||
|
||||
#define CHAR_ICONS_COUNT 22
|
||||
|
||||
class CharacterInfo : public ScrollView {
|
||||
class CharacterInfo : public PartyView {
|
||||
struct IconPos {
|
||||
int _frame; int _x; int _y;
|
||||
};
|
||||
|
@ -34,14 +34,14 @@ bool PartyView::msgFocus(const FocusMessage &msg) {
|
||||
if (!g_globals->_currCharacter)
|
||||
g_globals->_currCharacter = &g_globals->_party[0];
|
||||
|
||||
g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)true));
|
||||
g_events->send("GameParty", GameMessage("CHAR_HIGHLIGHT", (int)true));
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PartyView::msgUnfocus(const UnfocusMessage &msg) {
|
||||
// Turn off highlight for selected character
|
||||
g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)false));
|
||||
g_events->send("GameParty", GameMessage("CHAR_HIGHLIGHT", (int)false));
|
||||
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
return true;
|
||||
@ -51,6 +51,22 @@ bool PartyView::msgMouseDown(const MouseDownMessage &msg) {
|
||||
return send("GameParty", msg);
|
||||
}
|
||||
|
||||
bool PartyView::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "UPDATE") {
|
||||
draw();
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PartyView::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action >= KEYBIND_VIEW_PARTY1 &&
|
||||
msg._action <= KEYBIND_VIEW_PARTY6)
|
||||
return send("GameParty", msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ViewsEnh
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
@ -38,6 +38,8 @@ public:
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
bool msgMouseDown(const MouseDownMessage &msg) override;
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace ViewsEnh
|
||||
|
@ -91,9 +91,9 @@ bool CastSpell::msgKeypress(const KeypressMessage &msg) {
|
||||
// Select a new spell
|
||||
addView("Spellbook");
|
||||
return true;
|
||||
} else {
|
||||
return PartyView::msgKeypress(msg);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CastSpell::msgAction(const ActionMessage &msg) {
|
||||
@ -101,17 +101,8 @@ bool CastSpell::msgAction(const ActionMessage &msg) {
|
||||
close();
|
||||
return true;
|
||||
|
||||
} else if (msg._action >= KEYBIND_VIEW_PARTY1 &&
|
||||
msg._action <= KEYBIND_VIEW_PARTY6) {
|
||||
uint charNum = msg._action - KEYBIND_VIEW_PARTY1;
|
||||
if (charNum < g_globals->_party.size()) {
|
||||
g_globals->_currCharacter = &g_globals->_party[
|
||||
msg._action - KEYBIND_VIEW_PARTY1];
|
||||
updateSelectedSpell();
|
||||
g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)true));
|
||||
redraw();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return PartyView::msgAction(msg);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user