MM: MM1: Added separate view for the druid Arenko

This commit is contained in:
Paul Gilbert 2023-04-09 17:35:18 -07:00
parent 8c814df757
commit 73e0229dec
11 changed files with 402 additions and 37 deletions

View File

@ -1394,6 +1394,12 @@ maps:
cursed: "Cursed"
keep_climbing: "Keep climbing."
sign: "Roadsign: Algary S.9"
emap28:
arenko_title: "Arenko"
well_done: "Well done! What is your pleasure?"
gold: "Gold"
gems: "Gems"
item: "Item"
map29:
algary: "Algary, enter (Y/N)?"

View File

@ -0,0 +1,50 @@
/* 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/game/arenko.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace Game {
void Arenko::giveGold() {
g_globals->_treasure.setGold((getRandomNumber(8) + 8) * 256);
g_maps->clearSpecial();
g_events->addAction(KEYBIND_SEARCH);
}
void Arenko::giveGems() {
g_globals->_treasure.setGems(getRandomNumber(50) + 200);
g_maps->clearSpecial();
g_events->addAction(KEYBIND_SEARCH);
}
void Arenko::giveItem() {
g_globals->_treasure._items[2] = getRandomNumber(22) + 196;
g_maps->clearSpecial();
g_events->addAction(KEYBIND_SEARCH);
}
} // namespace Game
} // namespace MM1
} // namespace MM

View File

@ -0,0 +1,42 @@
/* 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_GAME_ARENKO_H
#define MM1_GAME_ARENKO_H
#include "mm/mm1/game/game_logic.h"
namespace MM {
namespace MM1 {
namespace Game {
class Arenko : public GameLogic {
public:
void giveGold();
void giveGems();
void giveItem();
};
} // namespace Game
} // namespace MM1
} // namespace MM
#endif

View File

@ -135,43 +135,7 @@ void Map28::special() {
}
void Map28::special00() {
if (!_data[VAL1]) {
send(SoundMessage(STRING["maps.map28.arenko"]));
_data[VAL2] = 1;
} else if (_data[VAL1] < 19) {
send(SoundMessage(STRING["maps.map28.keep_climbing"]));
} else {
send(SoundMessage(
STRING["maps.map28.well_done"],
[](const Common::KeyState &ks) {
switch (ks.keycode) {
case Common::KEYCODE_a:
g_events->close();
g_globals->_treasure.setGold((g_events->getRandomNumber(8) + 8) * 256);
g_maps->clearSpecial();
g_events->addAction(KEYBIND_SEARCH);
break;
case Common::KEYCODE_b:
g_events->close();
g_globals->_treasure.setGems(g_events->getRandomNumber(50) + 200);
g_maps->clearSpecial();
g_events->addAction(KEYBIND_SEARCH);
break;
case Common::KEYCODE_c:
g_events->close();
g_globals->_treasure._items[2] = g_events->getRandomNumber(22) + 196;
g_maps->clearSpecial();
g_events->addAction(KEYBIND_SEARCH);
break;
default:
break;
}
}
));
}
g_events->addView("Arenko");
}
void Map28::special01() {

View File

@ -56,6 +56,7 @@
#include "mm/mm1/views/maps/access_code.h"
#include "mm/mm1/views/maps/alamar.h"
#include "mm/mm1/views/maps/alien.h"
#include "mm/mm1/views/maps/arenko.h"
#include "mm/mm1/views/maps/arrested.h"
#include "mm/mm1/views/maps/chess.h"
#include "mm/mm1/views/maps/dog_statue.h"
@ -123,6 +124,7 @@ private:
Views::Maps::AccessCode _accessCode;
Views::Maps::Alamar _alamar;
Views::Maps::Alien _alien;
Views::Maps::Arenko _arenko;
Views::Maps::Arrested _arrested;
Views::Maps::Chess _chess;
Views::Maps::ChildPrisoner _childPrisoner;

View File

@ -0,0 +1,98 @@
/* 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/maps/arenko.h"
#include "mm/mm1/maps/map28.h"
#include "mm/mm1/globals.h"
#define VAL1 63
#define VAL2 64
namespace MM {
namespace MM1 {
namespace Views {
namespace Maps {
Arenko::Arenko() : TextView("Arenko") {
_bounds = getLineBounds(20, 24);
}
bool Arenko::msgFocus(const FocusMessage &msg) {
MM1::Maps::Map28 &map = *static_cast<MM1::Maps::Map28 *>(g_maps->_currentMap);
if (!map[VAL1]) {
_line = STRING["maps.map28.arenko"];
map[VAL2] = 1;
} else if (map[VAL1] < 19) {
_line = STRING["maps.map28.keep_climbing"];
} else {
_line = STRING["maps.map28.well_done"];
}
return true;
}
void Arenko::draw() {
clearSurface();
writeString(0, 1, _line);
}
bool Arenko::msgKeypress(const KeypressMessage &msg) {
MM1::Maps::Map28 &map = *static_cast<MM1::Maps::Map28 *>(g_maps->_currentMap);
if (map[VAL1] == 19) {
switch (msg.keycode) {
case Common::KEYCODE_a:
close();
giveGold();
return true;
case Common::KEYCODE_b:
close();
giveGems();
return true;
case Common::KEYCODE_c:
close();
giveItem();
return true;
default:
break;
}
} else {
close();
}
return true;
}
bool Arenko::msgAction(const ActionMessage &msg) {
MM1::Maps::Map28 &map = *static_cast<MM1::Maps::Map28 *>(g_maps->_currentMap);
if (map[VAL1] != 19)
close();
return true;
}
} // namespace Maps
} // namespace Views
} // namespace MM1
} // namespace MM

View File

@ -0,0 +1,51 @@
/* 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_MAPS_ARENKO_H
#define MM1_VIEWS_MAPS_ARENKO_H
#include "mm/mm1/views/text_view.h"
#include "mm/mm1/game/arenko.h"
namespace MM {
namespace MM1 {
namespace Views {
namespace Maps {
class Arenko : public TextView, public MM1::Game::Arenko {
private:
Common::String _line;
public:
Arenko();
virtual ~Arenko() {}
bool msgFocus(const FocusMessage &msg) override;
void draw() override;
bool msgKeypress(const KeypressMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
};
} // namespace Maps
} // namespace Views
} // namespace MM1
} // namespace MM
#endif

View File

@ -54,6 +54,7 @@
#include "mm/mm1/views_enh/who_will_try.h"
#include "mm/mm1/views_enh/won_game.h"
#include "mm/mm1/views_enh/interactions/access_code.h"
#include "mm/mm1/views_enh/interactions/arenko.h"
#include "mm/mm1/views_enh/interactions/arrested.h"
#include "mm/mm1/views_enh/interactions/gypsy.h"
#include "mm/mm1/views_enh/interactions/ice_princess.h"
@ -79,6 +80,7 @@ namespace ViewsEnh {
struct Dialogs {
private:
ViewsEnh::Interactions::AccessCode _accessCode;
ViewsEnh::Interactions::Arenko _arenko;
ViewsEnh::Interactions::Arrested _arrested;
ViewsEnh::Interactions::Gypsy _gypsy;
ViewsEnh::Interactions::IcePrincess _icePrincess;

View File

@ -0,0 +1,97 @@
/* 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/interactions/arenko.h"
#include "mm/mm1/maps/map28.h"
#include "mm/mm1/globals.h"
#define VAL1 63
#define VAL2 64
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Arenko::Arenko() : Interaction("Arenko", 9) {
_title = STRING["maps.emap28.arenko_title"];
}
bool Arenko::msgFocus(const FocusMessage &msg) {
Maps::Map28 &map = *static_cast<Maps::Map28 *>(g_maps->_currentMap);
clearButtons();
if (!map[VAL1]) {
addText(STRING["maps.map28.arenko"]);
map[VAL2] = 1;
} else if (map[VAL1] < 19) {
addText(STRING["maps.map28.keep_climbing"]);
} else {
addText(STRING["maps.map28.well_done"]);
addButton(STRING["maps.emap28.gold"], 'A');
addButton(STRING["maps.emap28.gems"], 'B');
addButton(STRING["maps.emap28.item"], 'C');
}
return true;
}
void Arenko::viewAction() {
if (_buttons.empty()) {
close();
}
}
bool Arenko::msgKeypress(const KeypressMessage &msg) {
if (!_buttons.empty()) {
switch (msg.keycode) {
case Common::KEYCODE_a:
close();
giveGold();
return true;
case Common::KEYCODE_b:
close();
giveGems();
return true;
case Common::KEYCODE_c:
close();
giveItem();
return true;
default:
break;
}
}
return Interaction::msgKeypress(msg);
}
bool Arenko::msgAction(const ActionMessage &msg) {
if (_buttons.empty())
return Interaction::msgAction(msg);
return true;
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@ -0,0 +1,50 @@
/* 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_INTERACTIONS_ARENKO_H
#define MM1_VIEWS_ENH_INTERACTIONS_ARENKO_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/game/arenko.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Arenko : public Interaction, public MM1::Game::Arenko {
protected:
void viewAction() override;
public:
Arenko();
bool msgFocus(const FocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@ -36,6 +36,7 @@ MODULE_OBJS += \
mm1/data/text_parser.o \
mm1/data/trap.o \
mm1/data/treasure.o \
mm1/game/arenko.o \
mm1/game/arrested.o \
mm1/game/game_logic.o \
mm1/game/combat.o \
@ -71,6 +72,7 @@ MODULE_OBJS += \
mm1/views/maps/alamar.o \
mm1/views/maps/alien.o \
mm1/views/maps/answer_entry.o \
mm1/views/maps/arenko.o \
mm1/views/maps/arrested.o \
mm1/views/maps/chess.o \
mm1/views/maps/dog_statue.o \
@ -177,6 +179,7 @@ MODULE_OBJS += \
mm1/views_enh/won_game.o \
mm1/views_enh/yes_no.o \
mm1/views_enh/interactions/access_code.o \
mm1/views_enh/interactions/arenko.o \
mm1/views_enh/interactions/arrested.o \
mm1/views_enh/interactions/gypsy.o \
mm1/views_enh/interactions/ice_princess.o \