mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
MM: MM1: Added Rest view
This commit is contained in:
parent
59864bf38c
commit
626273dbca
@ -540,6 +540,8 @@ enhdialogs:
|
|||||||
sp: "S.P."
|
sp: "S.P."
|
||||||
ac: "A.C."
|
ac: "A.C."
|
||||||
cond: "Cond"
|
cond: "Cond"
|
||||||
|
rest:
|
||||||
|
too_dangerous: "Too dangerous to rest here!"
|
||||||
spellbook:
|
spellbook:
|
||||||
title: "Spells for"
|
title: "Spells for"
|
||||||
spell_points: "Spell Pts"
|
spell_points: "Spell Pts"
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "mm/mm1/views_enh/map_popup.h"
|
#include "mm/mm1/views_enh/map_popup.h"
|
||||||
#include "mm/mm1/views_enh/protect.h"
|
#include "mm/mm1/views_enh/protect.h"
|
||||||
#include "mm/mm1/views_enh/quick_ref.h"
|
#include "mm/mm1/views_enh/quick_ref.h"
|
||||||
|
#include "mm/mm1/views_enh/rest.h"
|
||||||
#include "mm/mm1/views_enh/search.h"
|
#include "mm/mm1/views_enh/search.h"
|
||||||
#include "mm/mm1/views_enh/title.h"
|
#include "mm/mm1/views_enh/title.h"
|
||||||
#include "mm/mm1/views_enh/trap.h"
|
#include "mm/mm1/views_enh/trap.h"
|
||||||
@ -75,6 +76,7 @@ private:
|
|||||||
ViewsEnh::MapPopup _mapPopup;
|
ViewsEnh::MapPopup _mapPopup;
|
||||||
ViewsEnh::Protect _protect;
|
ViewsEnh::Protect _protect;
|
||||||
ViewsEnh::QuickRef _quickRef;
|
ViewsEnh::QuickRef _quickRef;
|
||||||
|
ViewsEnh::Rest _rest;
|
||||||
ViewsEnh::Search _search;
|
ViewsEnh::Search _search;
|
||||||
ViewsEnh::Title _title;
|
ViewsEnh::Title _title;
|
||||||
ViewsEnh::Trap _trap;
|
ViewsEnh::Trap _trap;
|
||||||
|
@ -78,7 +78,7 @@ bool Game::msgAction(const ActionMessage &msg) {
|
|||||||
addView("QuickRef");
|
addView("QuickRef");
|
||||||
return true;
|
return true;
|
||||||
case KEYBIND_REST:
|
case KEYBIND_REST:
|
||||||
g_events->send(GameMessage("REST"));
|
addView("Rest");
|
||||||
return true;
|
return true;
|
||||||
case KEYBIND_SEARCH:
|
case KEYBIND_SEARCH:
|
||||||
send("Search", GameMessage("SHOW"));
|
send("Search", GameMessage("SHOW"));
|
||||||
|
102
engines/mm/mm1/views_enh/rest.cpp
Normal file
102
engines/mm/mm1/views_enh/rest.cpp
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/* ScummVM - Graphic Adventure Engine
|
||||||
|
*
|
||||||
|
* ScummVM is the legal property of its developers, whose names
|
||||||
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
|
* file distributed with this source distribution.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mm/mm1/views_enh/rest.h"
|
||||||
|
#include "mm/mm1/globals.h"
|
||||||
|
#include "mm/mm1/game/rest.h"
|
||||||
|
|
||||||
|
namespace MM {
|
||||||
|
namespace MM1 {
|
||||||
|
namespace ViewsEnh {
|
||||||
|
|
||||||
|
Rest::Rest() : YesNo("Rest") {
|
||||||
|
setBounds(Common::Rect(0, 144, 234, 200));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Rest::msgFocus(const FocusMessage &msg) {
|
||||||
|
if (g_maps->_currentState & 8)
|
||||||
|
tooDangerous();
|
||||||
|
else
|
||||||
|
confirmRest();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rest::draw() {
|
||||||
|
YesNo::draw();
|
||||||
|
|
||||||
|
if (_mode == CONFIRM) {
|
||||||
|
writeString(0, 0, STRING["dialogs.game.rest.rest_here"], ALIGN_MIDDLE);
|
||||||
|
} else {
|
||||||
|
writeString(0, 0, STRING["enhdialogs.rest.too_dangerous"], ALIGN_MIDDLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Rest::msgKeypress(const KeypressMessage &msg) {
|
||||||
|
if (endDelay())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (_mode == CONFIRM) {
|
||||||
|
if (msg.keycode == Common::KEYCODE_n) {
|
||||||
|
close();
|
||||||
|
} else if (msg.keycode == Common::KEYCODE_y) {
|
||||||
|
close();
|
||||||
|
Game::Rest::check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Rest::msgAction(const ActionMessage &msg) {
|
||||||
|
if (endDelay())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (_mode == CONFIRM) {
|
||||||
|
if (msg._action == KEYBIND_ESCAPE) {
|
||||||
|
close();
|
||||||
|
} else if (msg._action == KEYBIND_SELECT) {
|
||||||
|
close();
|
||||||
|
Game::Rest::check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rest::tooDangerous() {
|
||||||
|
_mode = TOO_DANGEROUS;
|
||||||
|
closeYesNo();
|
||||||
|
delaySeconds(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rest::confirmRest() {
|
||||||
|
_mode = CONFIRM;
|
||||||
|
openYesNo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rest::timeout() {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ViewsEnh
|
||||||
|
} // namespace MM1
|
||||||
|
} // namespace MM
|
53
engines/mm/mm1/views_enh/rest.h
Normal file
53
engines/mm/mm1/views_enh/rest.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/* ScummVM - Graphic Adventure Engine
|
||||||
|
*
|
||||||
|
* ScummVM is the legal property of its developers, whose names
|
||||||
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
|
* file distributed with this source distribution.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MM1_VIEWS_ENH_REST_H
|
||||||
|
#define MM1_VIEWS_ENH_REST_H
|
||||||
|
|
||||||
|
#include "mm/mm1/views_enh/yes_no.h"
|
||||||
|
|
||||||
|
namespace MM {
|
||||||
|
namespace MM1 {
|
||||||
|
namespace ViewsEnh {
|
||||||
|
|
||||||
|
class Rest : public YesNo {
|
||||||
|
private:
|
||||||
|
enum Mode { CONFIRM, TOO_DANGEROUS };
|
||||||
|
Mode _mode = CONFIRM;
|
||||||
|
|
||||||
|
void tooDangerous();
|
||||||
|
void confirmRest();
|
||||||
|
public:
|
||||||
|
Rest();
|
||||||
|
virtual ~Rest() {}
|
||||||
|
|
||||||
|
bool msgFocus(const FocusMessage &msg) override;
|
||||||
|
void draw() override;
|
||||||
|
bool msgKeypress(const KeypressMessage &msg) override;
|
||||||
|
bool msgAction(const ActionMessage &msg) override;
|
||||||
|
void timeout() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ViewsEnh
|
||||||
|
} // namespace MM1
|
||||||
|
} // namespace MM
|
||||||
|
|
||||||
|
#endif
|
67
engines/mm/mm1/views_enh/yes_no.cpp
Normal file
67
engines/mm/mm1/views_enh/yes_no.cpp
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/* ScummVM - Graphic Adventure Engine
|
||||||
|
*
|
||||||
|
* ScummVM is the legal property of its developers, whose names
|
||||||
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
|
* file distributed with this source distribution.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mm/mm1/views_enh/yes_no.h"
|
||||||
|
#include "mm/mm1/globals.h"
|
||||||
|
#include "mm/mm1/sound.h"
|
||||||
|
|
||||||
|
namespace MM {
|
||||||
|
namespace MM1 {
|
||||||
|
namespace ViewsEnh {
|
||||||
|
|
||||||
|
void YesNo::draw() {
|
||||||
|
if (_subviewVisible)
|
||||||
|
_subview.draw();
|
||||||
|
|
||||||
|
ScrollView::draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool YesNo::msgMouseDown(const MouseDownMessage &msg) {
|
||||||
|
if (_subview.msgMouseDown(msg))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return ScrollView::msgMouseDown(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool YesNo::msgMouseUp(const MouseUpMessage &msg) {
|
||||||
|
if (_subview.msgMouseUp(msg))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return ScrollView::msgMouseUp(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
YesNoSubview::YesNoSubview() : ScrollView("YesNoSubview") {
|
||||||
|
_bounds = Common::Rect(234, 144, 320, 200);
|
||||||
|
|
||||||
|
addButton(&g_globals->_confirmIcons, Common::Point(0, 0), 0, Common::KEYCODE_y);
|
||||||
|
addButton(&g_globals->_confirmIcons, Common::Point(25, 0), 2, Common::KEYCODE_n);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool YesNoSubview::msgKeypress(const KeypressMessage &msg) {
|
||||||
|
assert(g_events->focusedView() != this);
|
||||||
|
return g_events->focusedView()->send(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ViewsEnh
|
||||||
|
} // namespace MM1
|
||||||
|
} // namespace MM
|
75
engines/mm/mm1/views_enh/yes_no.h
Normal file
75
engines/mm/mm1/views_enh/yes_no.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/* ScummVM - Graphic Adventure Engine
|
||||||
|
*
|
||||||
|
* ScummVM is the legal property of its developers, whose names
|
||||||
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
|
* file distributed with this source distribution.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MM1_VIEWS_ENH_YES_NO_H
|
||||||
|
#define MM1_VIEWS_ENH_YES_NO_H
|
||||||
|
|
||||||
|
#include "mm/mm1/views_enh/scroll_view.h"
|
||||||
|
#include "mm/shared/xeen/sprites.h"
|
||||||
|
|
||||||
|
namespace MM {
|
||||||
|
namespace MM1 {
|
||||||
|
namespace ViewsEnh {
|
||||||
|
|
||||||
|
class YesNoSubview : public ScrollView {
|
||||||
|
public:
|
||||||
|
YesNoSubview();
|
||||||
|
virtual ~YesNoSubview() {}
|
||||||
|
|
||||||
|
bool msgKeypress(const KeypressMessage &msg) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class YesNo : public ScrollView {
|
||||||
|
private:
|
||||||
|
YesNoSubview _subview;
|
||||||
|
bool _subviewVisible = false;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Start displaying the yes/no subview
|
||||||
|
*/
|
||||||
|
void openYesNo() {
|
||||||
|
_subviewVisible = true;
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop displaying the subview
|
||||||
|
*/
|
||||||
|
void closeYesNo() {
|
||||||
|
_subviewVisible = false;
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
YesNo(const Common::String &name) : ScrollView(name) {}
|
||||||
|
virtual ~YesNo() {}
|
||||||
|
|
||||||
|
void draw() override;
|
||||||
|
bool msgMouseDown(const MouseDownMessage &msg) override;
|
||||||
|
bool msgMouseUp(const MouseUpMessage &msg) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ViewsEnh
|
||||||
|
} // namespace MM1
|
||||||
|
} // namespace MM
|
||||||
|
|
||||||
|
#endif
|
@ -144,6 +144,7 @@ MODULE_OBJS += \
|
|||||||
mm1/views_enh/map_popup.o \
|
mm1/views_enh/map_popup.o \
|
||||||
mm1/views_enh/party_view.o \
|
mm1/views_enh/party_view.o \
|
||||||
mm1/views_enh/protect.o \
|
mm1/views_enh/protect.o \
|
||||||
|
mm1/views_enh/rest.o \
|
||||||
mm1/views_enh/quick_ref.o \
|
mm1/views_enh/quick_ref.o \
|
||||||
mm1/views_enh/scroll_popup.o \
|
mm1/views_enh/scroll_popup.o \
|
||||||
mm1/views_enh/scroll_text.o \
|
mm1/views_enh/scroll_text.o \
|
||||||
@ -156,6 +157,7 @@ MODULE_OBJS += \
|
|||||||
mm1/views_enh/trap.o \
|
mm1/views_enh/trap.o \
|
||||||
mm1/views_enh/unlock.o \
|
mm1/views_enh/unlock.o \
|
||||||
mm1/views_enh/who_will_try.o \
|
mm1/views_enh/who_will_try.o \
|
||||||
|
mm1/views_enh/yes_no.o \
|
||||||
mm1/views_enh/interactions/interaction.o \
|
mm1/views_enh/interactions/interaction.o \
|
||||||
mm1/views_enh/interactions/statue.o \
|
mm1/views_enh/interactions/statue.o \
|
||||||
mm1/views_enh/locations/inn.o \
|
mm1/views_enh/locations/inn.o \
|
||||||
|
Loading…
Reference in New Issue
Block a user