MM: MM1: Added Protect screen

This commit is contained in:
Paul Gilbert 2023-03-14 22:03:00 -07:00
parent c8078ba3f1
commit 2e513c33f4
6 changed files with 168 additions and 25 deletions

View File

@ -117,8 +117,8 @@ dialogs:
title: " re-order party new 1 2 3 4 5 6"
old: "old"
protect:
title: "protect: spells currently active"
protection: "protection from"
title: "Protect: Spells currently active"
protection: "Protection from"
to_attacks: "to attacks"
1: "fear"
2: "cold"
@ -127,17 +127,17 @@ dialogs:
5: "acid"
6: "elec"
7: "magic"
8: "light ("
9: "leather skin"
10: "levitate"
11: "walk on water"
12: "guard dog"
13: "psychic protection"
14: "bless"
15: "invisibility"
16: "shield"
17: "power shield"
18: "*** cursed -"
8: "Light ("
9: "Leather skin"
10: "Levitate"
11: "Walk on water"
12: "Guard dog"
13: "Psychic protection"
14: "Bless"
15: "Invisibility"
16: "Shield"
17: "Power shield"
18: "*** Cursed -"
quick_ref:
title: "# name hit pts spell pts ac"
food: "food= "

View File

@ -74,8 +74,7 @@ void Protect::draw() {
}
void Protect::printProtectionFrom() {
if (_textPos.y == 2)
writeString(STRING["dialogs.protect.protection"]);
writeString(STRING["dialogs.protect.protection"]);
_textPos.x = 17;
}

View File

@ -25,7 +25,6 @@
#include "mm/mm1/events.h"
#include "mm/mm1/views_enh/create_characters.h"
#include "mm/mm1/views/locations/inn.h"
#include "mm/mm1/views/protect.h"
#include "mm/mm1/views/title.h"
#include "mm/mm1/views_enh/character_info.h"
#include "mm/mm1/views_enh/character_select.h"
@ -35,6 +34,7 @@
#include "mm/mm1/views_enh/game_messages.h"
#include "mm/mm1/views_enh/main_menu.h"
#include "mm/mm1/views_enh/map_popup.h"
#include "mm/mm1/views_enh/protect.h"
#include "mm/mm1/views_enh/quick_ref.h"
#include "mm/mm1/views_enh/search.h"
#include "mm/mm1/views_enh/title.h"
@ -64,22 +64,22 @@ private:
ViewsEnh::Locations::Training _training;
ViewsEnh::Spells::CastSpell _castSpell;
ViewsEnh::Spells::Spellbook _spellbook;
ViewsEnh::CreateCharacters _createCharacters;
ViewsEnh::Exchange _exchange;
Views::Protect _protect;
ViewsEnh::Title _title;
ViewsEnh::Characters _characters;
ViewsEnh::Search _search;
ViewsEnh::Trap _trap;
ViewsEnh::Unlock _unlock;
ViewsEnh::WhoWillTry _whoWillTry;
ViewsEnh::CharacterInfo _characterInfo;
ViewsEnh::CharacterSelect _characterSelect;
ViewsEnh::Characters _characters;
ViewsEnh::CreateCharacters _createCharacters;
ViewsEnh::Exchange _exchange;
ViewsEnh::Game _game;
ViewsEnh::GameMessages _gameMessages;
ViewsEnh::MainMenu _mainMenu;
ViewsEnh::MapPopup _mapPopup;
ViewsEnh::Protect _protect;
ViewsEnh::QuickRef _quickRef;
ViewsEnh::Search _search;
ViewsEnh::Title _title;
ViewsEnh::Trap _trap;
ViewsEnh::Unlock _unlock;
ViewsEnh::WhoWillTry _whoWillTry;
public:
Dialogs() {}
};

View File

@ -0,0 +1,99 @@
/* 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/protect.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
Protect::Protect() : ScrollView("Protect") {
setBounds(Common::Rect(0, 0, 320, 200));
addButton(&g_globals->_escSprites, Common::Point(120, 166), 0, KEYBIND_ESCAPE);
}
void Protect::draw() {
ScrollView::draw();
setReduced(false);
writeLine(0, STRING["dialogs.protect.title"], ALIGN_MIDDLE);
writeString(152, 172, STRING["enhdialogs.misc.go_back"]);
setReduced(true);
int yp = 4;
// Protection spells
for (int i = 0; i < 7; ++i) {
g_globals->_activeSpells._arr[i] = 3;
if (g_globals->_activeSpells._arr[i]) {
Common::String line = Common::String::format("%s %s + %d%%",
STRING["dialogs.protect.protection"].c_str(),
STRING[Common::String::format("dialogs.protect.%d", i + 1)].c_str(),
g_globals->_activeSpells._arr[i]);
writeString(0, yp += 8, line, ALIGN_MIDDLE);
}
}
// Light spell
g_globals->_activeSpells._arr[7] = 5;
if (g_globals->_activeSpells._arr[7]) {
writeString(0, yp += 8, Common::String::format("%s%d)",
STRING["dialogs.protect.8"].c_str(),
g_globals->_activeSpells._arr[7]), ALIGN_MIDDLE);
}
// The rest
for (int i = 8; i < 18; ++i) {
g_globals->_activeSpells._arr[i] = 3;
if (i == 13)
yp += 8;
if (g_globals->_activeSpells._arr[i]) {
Common::String line = STRING[Common::String::format(
"dialogs.protect.%d", i + 1)];
if (i == 17) {
line += Common::String::format(" %d %s",
g_globals->_activeSpells._arr[17],
STRING["dialogs.protect.to_attacks"].c_str()
);
}
writeString(0, yp += 8, line, ALIGN_MIDDLE);
}
}
}
bool Protect::msgAction(const ActionMessage &msg) {
switch (msg._action) {
case KEYBIND_ESCAPE:
close();
return true;
default:
break;
}
return false;
}
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@ -0,0 +1,44 @@
/* 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_PROTECT_H
#define MM1_VIEWS_ENH_PROTECT_H
#include "mm/mm1/views_enh/scroll_view.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
class Protect : public ScrollView {
public:
Protect();
virtual ~Protect() {}
void draw() override;
bool msgAction(const ActionMessage &msg) override;
};
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@ -143,6 +143,7 @@ MODULE_OBJS += \
mm1/views_enh/map.o \
mm1/views_enh/map_popup.o \
mm1/views_enh/party_view.o \
mm1/views_enh/protect.o \
mm1/views_enh/quick_ref.o \
mm1/views_enh/scroll_popup.o \
mm1/views_enh/scroll_text.o \