Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

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/>.
*
*/
#include "mm/mm1/views_enh/interactions/access_code.h"
#include "mm/mm1/maps/map08.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
AccessCode::AccessCode() : InteractionQuery("AccessCode", 8) {
_title = STRING["maps.emap08.access_code"];
addText(STRING["maps.map08.enter_code"]);
}
void AccessCode::answerEntered() {
MM1::Maps::Map08 &map = *static_cast<MM1::Maps::Map08 *>(g_maps->_currentMap);
map.codeEntered(_answer);
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,48 @@
/* 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_ACCESS_CODE_H
#define MM1_VIEWS_ENH_INTERACTIONS_ACCESS_CODE_H
#include "mm/mm1/views_enh/interactions/interaction_query.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class AccessCode : public InteractionQuery {
protected:
/**
* Answer entered
*/
void answerEntered() override;
public:
AccessCode();
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

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_enh/interactions/alamar.h"
#include "mm/mm1/maps/map49.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
#define VAL1 952
#define HAS_EYE 154
Alamar::Alamar() : Interaction("Alamar", 22) {
}
bool Alamar::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
clearButtons();
MM1::Maps::Map49 &map = *static_cast<MM1::Maps::Map49 *>(g_maps->_currentMap);
_succeeded = false;
for (uint i = 0; i < g_globals->_party.size() && !_succeeded; ++i)
_succeeded = (g_globals->_party[i]._flags[13] & CHARFLAG13_ALAMAR) != 0;
map[HAS_EYE] = g_globals->_party.hasItem(EYE_OF_GOROS_ID) ? 1 : 0;
if (!_succeeded && !map[HAS_EYE]) {
for (uint i = 0; i < g_globals->_party.size() && !_succeeded; ++i)
g_globals->_party[i]._quest = 255;
}
_title = STRING["maps.emap49.king_alamar"];
if (_succeeded) {
addText(Common::String::format("%s%s",
STRING["maps.map49.alamar1"].c_str(),
STRING["maps.map49.alamar3"].c_str()
));
} else if (map[HAS_EYE]) {
_title = STRING["maps.emap49.sheltem"];
addText(Common::String::format("%s%s",
STRING["maps.map49.alamar1"].c_str(),
STRING["maps.map49.alamar4"].c_str()
));
for (int i = 0; i < 6; ++i)
Sound::sound(SOUND_2);
} else {
addText(Common::String::format("%s%s",
STRING["maps.map49.alamar1"].c_str(),
STRING["maps.map49.alamar2"].c_str()
));
}
return true;
}
void Alamar::viewAction() {
MM1::Maps::Map49 &map = *static_cast<MM1::Maps::Map49 *>(g_maps->_currentMap);
close();
if (map[HAS_EYE]) {
map[VAL1]++;
map.updateGame();
} else {
g_maps->_mapPos.x = 8;
map.updateGame();
}
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,52 @@
/* 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_ALAMAR_H
#define MM1_VIEWS_ENH_INTERACTIONS_ALAMAR_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Alamar : public Interaction {
private:
bool _succeeded = false;
protected:
void viewAction() override;
public:
Alamar();
virtual ~Alamar() {}
bool msgFocus(const FocusMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View 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/interactions/alien.h"
#include "mm/mm1/maps/map31.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Alien::Alien() : Interaction("Alien", 37) {
_title = STRING["maps.emap31.alien_title"];
addText(STRING["maps.emap31.alien"]);
addButton(STRING["maps.emap31.option_a"], 'A');
addButton(STRING["maps.emap31.option_b"], 'B');
addButton(STRING["maps.emap31.option_c"], 'C');
}
bool Alien::msgKeypress(const KeypressMessage &msg) {
MM1::Maps::Map31 &map = *static_cast<MM1::Maps::Map31 *>(
g_maps->_currentMap);
switch (msg.keycode) {
case Common::KEYCODE_a:
close();
map.hostile();
break;
case Common::KEYCODE_b:
close();
map.neutral();
break;
case Common::KEYCODE_c:
close();
map.friendly();
break;
default:
break;
}
return true;
}
} // namespace Interactions
} // 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_INTERACTIONS_ALIEN_H
#define MM1_VIEWS_ENH_INTERACTIONS_ALIEN_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Alien : public Interaction {
public:
Alien();
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

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

@@ -0,0 +1,82 @@
/* 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/arrested.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Arrested::Arrested() : Interaction("Arrested", 26), Game::Arrested() {
_title = STRING["maps.emap04.town_guards"];
}
bool Arrested::msgFocus(const FocusMessage &msg) {
addText(STRING["maps.emap04.guards"]);
clearButtons();
addButton(STRING["maps.emap04.attack"], 'A');
addButton(STRING["maps.emap04.bribe"], 'B');
addButton(STRING["maps.emap04.run"], 'R');
addButton(STRING["maps.emap04.surrender"], 'S');
return true;
}
bool Arrested::msgKeypress(const KeypressMessage &msg) {
switch (msg.keycode) {
case Common::KEYCODE_a:
attack();
break;
case Common::KEYCODE_b:
bribe();
break;
case Common::KEYCODE_r:
run();
break;
case Common::KEYCODE_s:
surrender();
break;
default:
return Interaction::msgKeypress(msg);
}
return true;
}
void Arrested::surrender(int numYears) {
Game::Arrested::surrender(numYears);
// Display sentence
Common::String str = Common::String::format(
STRING["maps.emap04.sentence"].c_str(), numYears);
SoundMessage msg(str);
msg._delaySeconds = 3;
send(msg);
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View 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_INTERACTIONS_ARRESTED_H
#define MM1_VIEWS_ENH_INTERACTIONS_ARRESTED_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/game/arrested.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Arrested : public Interaction, public MM1::Game::Arrested {
protected:
void surrender(int numYears = 2);
public:
Arrested();
/**
* Handles focus
*/
bool msgFocus(const FocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

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/>.
*
*/
#include "mm/mm1/views_enh/interactions/chess.h"
#include "mm/mm1/maps/map29.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Chess::Chess() : InteractionQuery("Chess", 23, 13) {
_title = STRING["maps.emap29.og_title"];
addText(STRING["maps.map29.og"]);
}
void Chess::answerEntered() {
MM1::Maps::Map29 &map = *static_cast<MM1::Maps::Map29 *>(g_maps->_currentMap);
map.chessAnswer(_answer);
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,49 @@
/* 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_CHESS_H
#define MM1_VIEWS_ENH_INTERACTIONS_CHESS_H
#include "mm/mm1/views_enh/interactions/interaction_query.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Chess : public InteractionQuery {
protected:
/**
* Answer entered
*/
void answerEntered() override;
public:
Chess();
virtual ~Chess() {}
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

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/dog_statue.h"
#include "mm/mm1/maps/map42.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
DogStatue::DogStatue() : Interaction("DogStatue") {
_title = STRING["maps.emap42.title"];
}
bool DogStatue::msgFocus(const FocusMessage &msg) {
Sound::sound(SOUND_2);
_completedQuests = false;
for (uint i = 0; i < g_globals->_party.size(); ++i) {
if ((g_globals->_party[i]._flags[0] &
(CHARFLAG0_COURIER3 | CHARFLAG0_FOUND_CHEST | CHARFLAG0_40)) ==
(CHARFLAG0_COURIER3 | CHARFLAG0_FOUND_CHEST | CHARFLAG0_40)) {
_completedQuests = true;
break;
}
}
clearButtons();
if (_completedQuests) {
addText(Common::String::format("%s%s",
STRING["maps.map42.statue1"].c_str(),
STRING["maps.map42.statue2"].c_str()
));
} else {
addText(Common::String::format("%s%s",
STRING["maps.map42.statue1"].c_str(),
STRING["maps.map42.statue3"].c_str()
));
addButton(STRING["maps.yes"], 'Y');
addButton(STRING["maps.no"], 'N');
}
return TextView::msgFocus(msg);
}
bool DogStatue::msgKeypress(const KeypressMessage &msg) {
MM1::Maps::Map42 &map = *static_cast<MM1::Maps::Map42 *>(g_maps->_currentMap);
if (_completedQuests) {
close();
map.dogSuccess();
} else if (msg.keycode == Common::KEYCODE_y || msg.keycode == Common::KEYCODE_n) {
close();
if (msg.keycode == Common::KEYCODE_y)
map.dogDesecrate();
}
return true;
}
void DogStatue::viewAction() {
MM1::Maps::Map42 &map = *static_cast<MM1::Maps::Map42 *>(g_maps->_currentMap);
close();
if (_completedQuests)
map.dogSuccess();
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,54 @@
/* 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_DOG_STATUE_H
#define MM1_VIEWS_ENH_INTERACTIONS_DOG_STATUE_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class DogStatue : public Interaction {
private:
bool _completedQuests = false;
protected:
/**
* Handles any action/press
*/
void viewAction() override;
public:
DogStatue();
virtual ~DogStatue() {}
bool msgFocus(const FocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,78 @@
/* 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/ghost.h"
#include "mm/mm1/maps/map37.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Ghost::Ghost() : Interaction("Ghost", 33) {
_title = STRING["maps.emap37.okrim"];
}
bool Ghost::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
addText(STRING["maps.map37.okrim1"]);
clearButtons();
addButton(STRING["maps.accept"], 'Y');
addButton(STRING["maps.decline"], 'N');
return true;
}
bool Ghost::msgKeypress(const KeypressMessage &msg) {
if (!_buttons.empty()) {
MM1::Maps::Map37 &map = *static_cast<MM1::Maps::Map37 *>(g_maps->_currentMap);
if (msg.keycode == Common::KEYCODE_y) {
g_globals->_party[0]._condition = ERADICATED;
close();
return true;
} else if (msg.keycode == Common::KEYCODE_n) {
map[MM1::Maps::MAP_29] = 32;
map[MM1::Maps::MAP_47] = 8;
addText(STRING["maps.map37.okrim2"]);
clearButtons();
return true;
}
}
return true;
}
void Ghost::viewAction() {
if (_buttons.empty()) {
close();
}
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,58 @@
/* 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_GHOST_H
#define MM1_VIEWS_ENH_INTERACTIONS_GHOST_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Ghost : public Interaction {
protected:
/**
* Handles any action/press
*/
void viewAction() override;
public:
Ghost();
/**
* Handles focus
*/
bool msgFocus(const FocusMessage &msg) override;
/**
* Handle keypresses
*/
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,68 @@
/* 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/giant.h"
#include "mm/mm1/maps/map30.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Giant::Giant() : Interaction("Giant", 8) {
_title = STRING["maps.emap30.giant_title"];
_animated = false;
}
bool Giant::msgFocus(const FocusMessage &msg) {
PartyView::msgFocus(msg);
_charSelected = false;
addText(STRING["maps.map30.giant"]);
return true;
}
void Giant::charSwitched(Character *priorChar) {
Interaction::charSwitched(priorChar);
if (_charSelected)
return;
_charSelected = true;
MM1::Maps::Map30 &map = *static_cast<MM1::Maps::Map30 *>(g_maps->_currentMap);
Common::String line = map.worthiness();
addText(line);
Sound::sound(SOUND_2);
delaySeconds(5);
redraw();
}
void Giant::timeout() {
close();
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,65 @@
/* 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_GIANT_H
#define MM1_VIEWS_ENH_INTERACTIONS_GIANT_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Giant : public Interaction {
private:
bool _charSelected = false;
protected:
/**
* Called when the selected character has been switched
*/
void charSwitched(Character *priorChar) override;
/**
* Only allow a character to be selected once
*/
bool canSwitchToChar(Character *dst) override {
return !_charSelected;
}
public:
Giant();
/**
* Handles focus
*/
bool msgFocus(const FocusMessage &msg) override;
void timeout() override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,72 @@
/* 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/gypsy.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Gypsy::Gypsy() : Interaction("Gypsy", 9) {
_title = STRING["maps.emap23.gypsy_title"];
}
bool Gypsy::msgFocus(const FocusMessage &msg) {
PartyView::msgFocus(msg);
_charSelected = false;
addText(STRING["maps.map23.gypsy"]);
return true;
}
void Gypsy::viewAction() {
// When already showing Gypsy, any click/key will close view
if (_charSelected)
close();
}
void Gypsy::charSwitched(Character *priorChar) {
Interaction::charSwitched(priorChar);
Character &c = *g_globals->_currCharacter;
if (!(c._flags[4] & CHARFLAG4_ASSIGNED)) {
c._flags[4] = CHARFLAG4_ASSIGNED |
(getRandomNumber(8) - 1);
}
Common::String line = Common::String::format(
STRING["maps.map23.your_sign_is"].c_str(),
STRING[Common::String::format("colors.%d",
c._flags[4] & CHARFLAG4_SIGN)].c_str()
);
addText(line);
_charSelected = true;
redraw();
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,61 @@
/* 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_GYPSY_H
#define MM1_VIEWS_ENH_INTERACTIONS_GYPSY_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Gypsy : public Interaction {
private:
bool _charSelected = false;
protected:
/**
* Handles any action/press
*/
void viewAction() override;
/**
* Called when the selected character has been switched
*/
void charSwitched(Character *priorChar) override;
public:
Gypsy();
/**
* Handles focus
*/
bool msgFocus(const FocusMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,110 @@
/* 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/hacker.h"
#include "mm/mm1/maps/map36.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Hacker::Hacker() : Interaction("Hacker", 35) {
_title = STRING["maps.emap36.hacker_title"];
}
bool Hacker::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
return true;
}
bool Hacker::msgGame(const GameMessage &msg) {
if (msg._name != "DISPLAY")
return false;
g_globals->_currCharacter = &g_globals->_party[0];
_mode = g_globals->_currCharacter->_quest ? ACTIVE_QUEST : CAN_ACCEPT;
if (_mode == CAN_ACCEPT)
Sound::sound(SOUND_2);
addView();
clearButtons();
if (_mode == CAN_ACCEPT) {
addText(STRING["maps.map36.hacker2"]);
addButton(STRING["maps.accept"], 'Y');
addButton(STRING["maps.decline"], 'N');
} else {
// There's an active quest, so check for completion
MM1::Maps::Map36 &map = *static_cast<MM1::Maps::Map36 *>(g_maps->_currentMap);
int questNum = g_globals->_party[0]._quest;
Common::String line;
if (questNum >= 8 && questNum <= 14)
line = map.checkQuestComplete();
else
line = STRING["maps.map36.hacker4"];
g_maps->_mapPos.y++;
map.redrawGame();
addText(line);
}
return true;
}
bool Hacker::msgKeypress(const KeypressMessage &msg) {
MM1::Maps::Map36 &map = *static_cast<MM1::Maps::Map36 *>(g_maps->_currentMap);
if (_mode == CAN_ACCEPT) {
if (msg.keycode == Common::KEYCODE_y) {
map.acceptQuest();
_mode = ACCEPTED_QUEST;
clearButtons();
Common::String line = Common::String::format("%s %s",
STRING["maps.map36.hacker3"].c_str(),
STRING[Common::String::format(
"maps.map36.ingredients.%d",
g_globals->_party[0]._quest - 15)].c_str()
);
addText(line);
redraw();
return true;
} else if (msg.keycode == Common::KEYCODE_n) {
close();
return true;
}
}
return false;
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,52 @@
/* 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_HACKER_H
#define MM1_VIEWS_ENH_INTERACTIONS_HACKER_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Hacker : public Interaction {
private:
enum Mode { CAN_ACCEPT, ACTIVE_QUEST, ACCEPTED_QUEST };
Mode _mode = CAN_ACCEPT;
public:
Hacker();
virtual ~Hacker() {}
bool msgGame(const GameMessage &msg) override;
bool msgFocus(const FocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

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/>.
*
*/
#include "mm/mm1/views_enh/interactions/ice_princess.h"
#include "mm/mm1/maps/map19.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
IcePrincess::IcePrincess() : InteractionQuery("IcePrincess", 10, 19) {
_title = STRING["maps.emap19.title"];
addText(STRING["maps.emap19.ice_princess"]);
}
void IcePrincess::answerEntered() {
MM1::Maps::Map19 &map = *static_cast<MM1::Maps::Map19 *>(g_maps->_currentMap);
map.riddleAnswer(_answer);
}
} // 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_ICE_PRINCESS_H
#define MM1_VIEWS_ENH_INTERACTIONS_ICE_PRINCESS_H
#include "mm/mm1/views_enh/interactions/interaction_query.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class IcePrincess : public InteractionQuery {
protected:
/**
* Answer entered
*/
void answerEntered() override;
public:
IcePrincess();
virtual ~IcePrincess() {}
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,107 @@
/* 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/inspectron.h"
#include "mm/mm1/maps/map35.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Inspectron::Inspectron() : Interaction("Inspectron", 18) {
_title = STRING["maps.emap35.inspectron_title"];
}
bool Inspectron::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
return true;
}
bool Inspectron::msgGame(const GameMessage &msg) {
if (msg._name != "DISPLAY")
return false;
g_globals->_currCharacter = &g_globals->_party[0];
_mode = g_globals->_currCharacter->_quest ? ACTIVE_QUEST : CAN_ACCEPT;
if (_mode == CAN_ACCEPT)
Sound::sound(SOUND_2);
addView();
clearButtons();
if (_mode == CAN_ACCEPT) {
addText(STRING["maps.map35.inspectron2"]);
addButton(STRING["maps.accept"], 'Y');
addButton(STRING["maps.decline"], 'N');
} else {
// There's an active quest, so check for completion
MM1::Maps::Map35 &map = *static_cast<MM1::Maps::Map35 *>(g_maps->_currentMap);
int questNum = g_globals->_party[0]._quest;
Common::String line;
if (questNum >= 8 && questNum <= 14)
line = map.checkQuestComplete();
else
line = STRING["maps.map35.inspectron4"];
g_maps->_mapPos.y++;
map.redrawGame();
addText(line);
}
return true;
}
bool Inspectron::msgKeypress(const KeypressMessage &msg) {
MM1::Maps::Map35 &map = *static_cast<MM1::Maps::Map35 *>(g_maps->_currentMap);
if (_mode == CAN_ACCEPT) {
if (msg.keycode == Common::KEYCODE_y) {
map.acceptQuest();
_mode = ACCEPTED_QUEST;
clearButtons();
addText(STRING[Common::String::format(
"maps.map35.quests.%d",
g_globals->_party[0]._quest - 8
)]);
redraw();
return true;
} else if (msg.keycode == Common::KEYCODE_n) {
close();
return true;
}
}
return false;
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,52 @@
/* 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_INSPECTRON_H
#define MM1_VIEWS_ENH_INTERACTIONS_INSPECTRON_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Inspectron : public Interaction {
private:
enum Mode { CAN_ACCEPT, ACTIVE_QUEST, ACCEPTED_QUEST };
Mode _mode = CAN_ACCEPT;
public:
Inspectron();
virtual ~Inspectron() {}
bool msgGame(const GameMessage &msg) override;
bool msgFocus(const FocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,179 @@
/* 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/interaction.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/mm1.h"
#include "mm/mm1/sound.h"
#include "mm/shared/utils/strings.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
#define BTN_SIZE 10
Interaction::Interaction(const Common::String &name, int portrait) : PartyView(name) {
_bounds = Common::Rect(8, 8, 224, 140);
if (portrait != -1) {
_frame.load("frame.fac");
_portrait.load(Common::Path(Common::String::format("face%02d.fac", portrait)));
}
}
void Interaction::addText(const Common::String &str) {
setReduced(false);
_lines = splitLines(searchAndReplace(str, "\n", " "));
}
bool Interaction::msgGame(const GameMessage &msg) {
if (msg._name == "DISPLAY") {
addView(this);
return true;
}
return PartyView::msgGame(msg);
}
bool Interaction::msgUnfocus(const UnfocusMessage &msg) {
PartyView::msgUnfocus(msg);
return true;
}
void Interaction::draw() {
PartyView::draw();
Graphics::ManagedSurface s = getSurface();
if (!_frame.empty()) {
_frame.draw(&s, 0, Common::Point(8, 8));
_portrait.draw(&s, _portraitFrameNum, Common::Point(15, 14));
}
setReduced(false);
if (!_title.empty()) {
size_t strWidth = getStringWidth(_title);
writeString(125 - strWidth / 2, 20, _title);
}
// Write any text lines
for (uint i = 0; i < _lines.size(); ++i) {
writeString(0, (6 + i) * 9 - 5, _lines[i], ALIGN_MIDDLE);
}
// Write out any buttons
if (!_buttons.empty()) {
_textPos = Common::Point(0, (6 + _lines.size()) * 9);
setReduced(true);
// Create a blank button
Graphics::ManagedSurface btnSmall(BTN_SIZE, BTN_SIZE);
btnSmall.blitFrom(g_globals->_blankButton, Common::Rect(0, 0, 20, 20),
Common::Rect(0, 0, BTN_SIZE, BTN_SIZE));
for (uint i = 0; i < _buttons.size(); ++i, _textPos.x += 10) {
InteractionButton &btn = _buttons[i];
int itemWidth = BTN_SIZE + 5 + getStringWidth(_buttons[i]._text);
if ((_textPos.x + itemWidth) > _innerBounds.width()) {
_textPos.x = 0;
_textPos.y += BTN_SIZE + 2;
}
Common::Point pt = _textPos;
// Display button and write character in the middle
s.blitFrom(btnSmall, Common::Point(pt.x + _bounds.borderSize(),
pt.y + _bounds.borderSize()));
writeString(pt.x + (BTN_SIZE / 2) + 1, pt.y,
Common::String::format("%c", _buttons[i]._c), ALIGN_MIDDLE);
// Write text to the right of the button
writeString(pt.x + BTN_SIZE + 5, pt.y, _buttons[i]._text);
// Set up bounds for the area covered by the button & text
btn._bounds = Common::Rect(pt.x, pt.y,
pt.x + BTN_SIZE + 5 + itemWidth, pt.y + BTN_SIZE);
btn._bounds.translate(_innerBounds.left, _innerBounds.top);
}
}
}
bool Interaction::tick() {
if (_animated && ++_tickCtr >= 10) {
_tickCtr = 0;
_portraitFrameNum = g_engine->getRandomNumber(0, 2);
redraw();
}
return PartyView::tick();
}
void Interaction::leave() {
if (g_events->focusedView() == this)
close();
g_maps->turnAround();
g_events->redraw();
}
bool Interaction::msgKeypress(const KeypressMessage &msg) {
viewAction();
return true;
}
bool Interaction::msgAction(const ActionMessage &msg) {
if (msg._action == KEYBIND_ESCAPE) {
leave();
} else if (!PartyView::msgAction(msg)) {
viewAction();
}
return true;
}
bool Interaction::msgMouseDown(const MouseDownMessage &msg) {
if (!PartyView::msgMouseDown(msg)) {
// Check if a button was pressed
for (uint i = 0; i < _buttons.size(); ++i) {
const auto &btn = _buttons[i];
if (_buttons[i]._bounds.contains(msg._pos)) {
msgKeypress(KeypressMessage(Common::KeyState(
(Common::KeyCode)(Common::KEYCODE_a + btn._c - 'A'), btn._c
)));
return true;
}
}
// Fall back on treating click as a standard acknowledgement
viewAction();
}
return true;
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,149 @@
/* 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_INTERACTION_H
#define MM1_VIEWS_ENH_INTERACTIONS_INTERACTION_H
#include "mm/mm1/views_enh/party_view.h"
#include "mm/shared/xeen/sprites.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Interaction : public PartyView {
struct InteractionButton {
Common::String _text;
char _c = '\0';
Common::Rect _bounds;
InteractionButton() {}
InteractionButton(const Common::String &text, char c) :
_text(text), _c(toupper(c)) {}
};
private:
Shared::Xeen::SpriteResource _frame;
Shared::Xeen::SpriteResource _portrait;
int _tickCtr = 0;
int _portraitFrameNum = 0;
protected:
Common::String _title;
Common::StringArray _lines;
Common::Array<InteractionButton> _buttons;
bool _animated = true;
int _portraitNum = 0;
protected:
bool selectCharByDefault() const override {
return false;
}
/**
* Handles any action/press
*/
virtual void viewAction() {}
/**
* Adds text for display
*/
void addText(const Common::String &str);
/**
* Clear the buttons
*/
void clearButtons() {
_buttons.clear();
}
/**
* Adds a button
*/
void addButton(const Common::String &str, char c) {
_buttons.push_back(InteractionButton(str, c));
}
/**
* Write out a line
*/
void writeLine(int lineNum, const Common::String &str,
TextAlign align = ALIGN_LEFT, int xp = 0) {
PartyView::writeLine(6 + lineNum, str, align, xp);
}
/**
* Write out a line
*/
void writeLine(int lineNum, int value,
TextAlign align = ALIGN_LEFT, int xp = 0) {
PartyView::writeLine(6 + lineNum,
Common::String::format("%d", value), align, xp);
}
public:
Interaction(const Common::String &name, int portrait = -1);
/**
* Handles game messages
*/
bool msgGame(const GameMessage &msg) override;
/**
* Unfocuses the view
*/
bool msgUnfocus(const UnfocusMessage &msg) override;
/**
* Draw the location
*/
void draw() override;
/**
* Tick handler
*/
bool tick() override;
/**
* Leave the location, turning around
*/
void leave();
/**
* Keypress handler
*/
bool msgKeypress(const KeypressMessage &msg) override;
/**
* Action handler
*/
bool msgAction(const ActionMessage &msg) override;
/**
* Mouse click handler
*/
bool msgMouseDown(const MouseDownMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,74 @@
/* 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/interaction_query.h"
#include "mm/mm1/views_enh/text_entry.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
InteractionQuery::InteractionQuery(const Common::String &name,
int maxChars, int portrait) : Interaction(name, portrait),
_maxChars(maxChars) {
}
void InteractionQuery::abortFunc() {
auto *view = static_cast<InteractionQuery *>(g_events->focusedView());
view->answerEntry("");
}
void InteractionQuery::enterFunc(const Common::String &answer) {
auto *view = static_cast<InteractionQuery *>(g_events->focusedView());
view->answerEntry(answer);
}
bool InteractionQuery::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
_showEntry = dynamic_cast<TextEntry *>(msg._priorView) == nullptr;
return true;
}
void InteractionQuery::draw() {
Interaction::draw();
if (!_showEntry)
return;
assert(_buttons.empty());
int xp = 30; // (_innerBounds.width() / 2) - (_maxChars * 8 / 2);
int yp = (8 + _lines.size()) * 9 - 5;
_textEntry.display(xp, yp, _maxChars, false, abortFunc, enterFunc);
}
void InteractionQuery::answerEntry(const Common::String &answer) {
close();
_answer = answer;
answerEntered();
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View 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/>.
*
*/
#ifndef MM1_VIEWS_ENH_INTERACTIONS_INTERACTION_QUERY_H
#define MM1_VIEWS_ENH_INTERACTIONS_INTERACTION_QUERY_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/views_enh/text_entry.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class InteractionQuery : public Interaction {
private:
TextEntry _textEntry;
static void abortFunc();
static void enterFunc(const Common::String &answer);
int _maxChars = 0;
protected:
bool _showEntry = false;
Common::String _answer;
/**
* Answer entered
*/
virtual void answerEntered() = 0;
public:
InteractionQuery(const Common::String &name,
int maxChars, int portrait = -1);
bool msgFocus(const FocusMessage &msg) override;
void draw() override;
/**
* Passed the entered text
*/
void answerEntry(const Common::String &answer);
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,88 @@
/* 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/keeper.h"
#include "mm/mm1/maps/map54.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Keeper::Keeper() : Interaction("Keeper", 10) {
_title = STRING["maps.emap54.keeper"];
_animated = false;
}
bool Keeper::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
_pageNum = 0;
addText(STRING["maps.map54.keeper1"]);
return true;
}
void Keeper::viewAction() {
MM1::Maps::Map54 &map = *static_cast<MM1::Maps::Map54 *>(g_maps->_currentMap);
switch (++_pageNum) {
case 1:
addText(STRING["maps.emap54.keeper2"]);
redraw();
break;
case 2: {
uint32 perfTotal;
_isWorthy = map.isWorthy(perfTotal);
addText(Common::String::format(
STRING["maps.emap54.keeper3"].c_str(), perfTotal));
redraw();
break;
}
case 3:
addText(STRING[_isWorthy ? "maps.emap54.keeper5" :
"maps.emap54.keeper4"].c_str());
redraw();
break;
case 4:
if (!_isWorthy) {
leave();
} else {
addText(STRING["maps.map54.keeper6"]);
redraw();
}
break;
default:
leave();
break;
}
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,56 @@
/* 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_KEEPER_H
#define MM1_VIEWS_ENH_INTERACTIONS_KEEPER_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Keeper : public Interaction {
private:
int _pageNum = 0;
bool _isWorthy = false;
protected:
/**
* Handles any action/press
*/
void viewAction() override;
public:
Keeper();
/**
* Handles focus
*/
bool msgFocus(const FocusMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,62 @@
/* 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/leprechaun.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Leprechaun::Leprechaun() : Interaction("Leprechaun", 15) {
_title = STRING["maps.emap00.leprechaun_title"];
addText(STRING["maps.emap00.leprechaun"]);
addButton(STRING["stats.towns.1"], '1');
addButton(STRING["stats.towns.2"], '2');
addButton(STRING["stats.towns.3"], '3');
addButton(STRING["stats.towns.4"], '4');
addButton(STRING["stats.towns.5"], '5');
}
bool Leprechaun::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
return true;
}
bool Leprechaun::msgKeypress(const KeypressMessage &msg) {
if (msg.keycode >= Common::KEYCODE_1 && msg.keycode <= Common::KEYCODE_5) {
teleportToTown(msg.ascii);
return true;
} else if (msg.keycode == Common::KEYCODE_6) {
g_maps->turnRight();
g_maps->_mapPos = Common::Point(8, 3);
g_maps->changeMap(0x4242, 1);
}
return false;
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,46 @@
/* 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_LEPRECHAUN_H
#define MM1_VIEWS_ENH_INTERACTIONS_LEPRECHAUN_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/game/leprechaun.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Leprechaun : public Interaction, MM1::Game::Leprechaun {
public:
Leprechaun();
virtual ~Leprechaun() {}
bool msgFocus(const FocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

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/>.
*
*/
#include "mm/mm1/views_enh/interactions/lion.h"
#include "mm/mm1/maps/map32.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Lion::Lion() : InteractionQuery("Lion", 10) {
_title = STRING["maps.emap32.statue_title"];
addText(STRING["maps.emap32.statue"]);
}
void Lion::answerEntered() {
MM1::Maps::Map32 &map = *static_cast<MM1::Maps::Map32 *>(g_maps->_currentMap);
map.passwordEntered(_answer);
}
} // 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_LION_H
#define MM1_VIEWS_ENH_INTERACTIONS_LION_H
#include "mm/mm1/views_enh/interactions/interaction_query.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Lion : public InteractionQuery {
protected:
/**
* Answer entered
*/
void answerEntered() override;
public:
Lion();
virtual ~Lion() {}
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,57 @@
/* 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/lord_archer.h"
#include "mm/mm1/maps/map40.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
LordArcher::LordArcher() : Interaction("LordArcher", 33) {
_title = STRING["maps.emap40.title"];
addText(STRING["maps.emap40.archer"]);
addButton(STRING["maps.yes"], 'Y');
addButton(STRING["maps.no"], 'N');
}
bool LordArcher::msgKeypress(const KeypressMessage &msg) {
if (msg.keycode == Common::KEYCODE_y || msg.keycode == Common::KEYCODE_n) {
MM1::Maps::Map40 &map = *static_cast<MM1::Maps::Map40 *>(g_maps->_currentMap);
close();
if (msg.keycode == Common::KEYCODE_y) {
map.archerSubmit();
} else {
map.archerResist();
}
}
return true;
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,45 @@
/* 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_LORD_ARCHER_H
#define MM1_VIEWS_ENH_INTERACTIONS_LORD_ARCHER_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class LordArcher : public Interaction {
public:
LordArcher();
virtual ~LordArcher() {}
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,118 @@
/* 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/lord_ironfist.h"
#include "mm/mm1/maps/map43.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
LordIronfist::LordIronfist() : Interaction("LordIronfist", 18) {
_title = STRING["maps.emap43.title"];
}
bool LordIronfist::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
clearButtons();
if (_mode == ACCEPTING) {
_mode = ACCEPTED_QUEST;
addText(STRING[Common::String::format(
"maps.map43.quests.%d",
g_globals->_party[0]._quest
)]);
} else {
const Character &c = g_globals->_party[0];
_mode = c._quest ? ACTIVE_QUEST : CAN_ACCEPT;
if (_mode == CAN_ACCEPT) {
Sound::sound(SOUND_2);
addText(Common::String::format("%s%s",
STRING["maps.map43.ironfist1"].c_str(),
STRING["maps.map43.ironfist2"].c_str()
));
addButton(STRING["maps.accept"], 'Y');
addButton(STRING["maps.decline"], 'N');
} else {
// There's an active quest, so check for completion
MM1::Maps::Map43 &map = *static_cast<MM1::Maps::Map43 *>(g_maps->_currentMap);
int questNum = g_globals->_party[0]._quest;
Common::String line;
if (questNum < 8)
line = map.checkQuestComplete();
else
line = STRING["maps.map43.ironfist4"];
g_maps->_mapPos.x++;
addText(Common::String::format("%s%s",
STRING["maps.map43.ironfist1"].c_str(),
line.c_str()
));
}
}
return true;
}
bool LordIronfist::msgKeypress(const KeypressMessage &msg) {
MM1::Maps::Map43 &map = *static_cast<MM1::Maps::Map43 *>(g_maps->_currentMap);
if (_mode == CAN_ACCEPT) {
if (msg.keycode == Common::KEYCODE_y) {
// Accept the quest
close();
map.acceptQuest();
// Reshow the view to display what the quest is
_mode = ACCEPTING;
addView();
} else if (msg.keycode == Common::KEYCODE_n) {
close();
}
} else {
close();
}
return true;
}
void LordIronfist::viewAction() {
if (_mode != CAN_ACCEPT)
close();
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,54 @@
/* 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_LORD_IRONFIST_H
#define MM1_VIEWS_ENH_INTERACTIONS_LORD_IRONFIST_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class LordIronfist : public Interaction {
private:
enum Mode { CAN_ACCEPT, ACCEPTING, ACTIVE_QUEST, ACCEPTED_QUEST };
Mode _mode = CAN_ACCEPT;
protected:
void viewAction() override;
public:
LordIronfist();
virtual ~LordIronfist() {}
bool msgFocus(const FocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,45 @@
/* 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/orango.h"
#include "mm/mm1/maps/map48.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Orango::Orango() : InteractionQuery("Orango", 15, 13) {
_title = STRING["maps.emap48.title"];
addText(STRING["maps.emap48.orango1"]);
}
void Orango::answerEntered() {
MM1::Maps::Map48 &map = *static_cast<MM1::Maps::Map48 *>(g_maps->_currentMap);
map.orangoAnswer(_answer);
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,48 @@
/* 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_ORANGO_H
#define MM1_VIEWS_ENH_INTERACTIONS_ORANGO_H
#include "mm/mm1/views_enh/interactions/interaction_query.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Orango : public InteractionQuery {
protected:
/**
* Answer entered
*/
void answerEntered() override;
public:
Orango();
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,188 @@
/* 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/prisoners.h"
#include "mm/mm1/maps/map11.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Prisoner::Prisoner(const Common::String &name, int portrait, const Common::String &line1,
byte flag, Alignment freeAlignment, Alignment leaveAlignment) :
Interaction(name, portrait), _line(line1), _flag(flag),
_freeAlignment(freeAlignment), _leaveAlignment(leaveAlignment) {
_title = STRING["maps.eprisoners.title"];
}
bool Prisoner::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
addText(_line);
clearButtons();
addButton(STRING["maps.eprisoners.options1"], '1');
addButton(STRING["maps.eprisoners.options2"], '2');
addButton(STRING["maps.eprisoners.options3"], '3');
// Since the prisoner options are 1 to 3, disable party bindings
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
return true;
}
bool Prisoner::msgKeypress(const KeypressMessage &msg) {
if (endDelay())
return true;
if (msg.keycode < Common::KEYCODE_1 || msg.keycode > Common::KEYCODE_3)
return true;
Common::String line;
int align;
switch (msg.keycode) {
case Common::KEYCODE_1:
line = STRING["maps.prisoners.flees"];
align = _freeAlignment;
g_maps->clearSpecial();
flee();
break;
case Common::KEYCODE_2:
line = STRING["maps.prisoners.cowers"];
align = _leaveAlignment;
break;
default:
align = NEUTRAL;
break;
}
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._flags[1] & _flag)) {
c._flags[1] |= _flag;
if (align == c._alignment)
c._worthiness += 32;
}
}
if (align != NEUTRAL) {
clearButtons();
addText(line);
redraw();
delaySeconds(3);
Sound::sound(SOUND_2);
} else {
close();
}
return true;
}
void Prisoner::timeout() {
close();
}
/*------------------------------------------------------------------------*/
ChildPrisoner::ChildPrisoner() :
Prisoner("ChildPrisoner", 34, STRING["maps.prisoners.child"],
CHARFLAG1_4, GOOD, EVIL) {
}
ManPrisoner::ManPrisoner() :
Prisoner("ManPrisoner", 23, STRING["maps.prisoners.man"],
CHARFLAG1_20, EVIL, GOOD) {
}
CloakedPrisoner::CloakedPrisoner() :
Prisoner("CloakedPrisoner", 16, STRING["maps.prisoners.cloaked"],
CHARFLAG1_40, EVIL, GOOD) {
_animated = false;
}
DemonPrisoner::DemonPrisoner() :
Prisoner("DemonPrisoner", 41, STRING["maps.prisoners.demon"],
CHARFLAG1_10, EVIL, GOOD) {
}
MutatedPrisoner::MutatedPrisoner() :
Prisoner("MutatedPrisoner", 1, STRING["maps.prisoners.mutated"],
CHARFLAG1_2, GOOD, EVIL) {
}
MaidenPrisoner::MaidenPrisoner() :
Prisoner("MaidenPrisoner", 2, STRING["maps.prisoners.maiden"],
CHARFLAG1_8, GOOD, EVIL) {
}
void MaidenPrisoner::flee() {
MM1::Maps::Map &map = *g_maps->_currentMap;
map._walls[48] &= 0x7f;
}
/*------------------------------------------------------------------------*/
VirginPrisoner::VirginPrisoner() : Interaction("VirginPrisoner", 2) {
addText(STRING["maps.emap11.virgin"]);
addButton(STRING["maps.emap11.virgin_a"], 'A');
addButton(STRING["maps.emap11.virgin_b"], 'B');
addButton(STRING["maps.emap11.virgin_c"], 'C');
}
bool VirginPrisoner::msgKeypress(const KeypressMessage &msg) {
switch (msg.keycode) {
case Common::KEYCODE_a:
g_events->close();
g_events->send(SoundMessage(STRING["maps.map11.tip1"]));
break;
case Common::KEYCODE_b:
g_events->close();
static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap)->challenge();
break;
case Common::KEYCODE_c:
g_events->close();
break;
default:
return Interaction::msgKeypress(msg);
}
return true;
}
bool VirginPrisoner::msgAction(const ActionMessage &msg) {
if (msg._action == KEYBIND_ESCAPE) {
g_events->close();
return true;
} else {
return Interaction::msgAction(msg);
}
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,115 @@
/* 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_PRISONERS_H
#define MM1_VIEWS_ENH_INTERACTIONS_PRISONERS_H
#include "mm/mm1/views_enh/interactions/interaction.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Prisoner : public Interaction {
private:
Common::String _line;
byte _flag;
Alignment _freeAlignment;
Alignment _leaveAlignment;
protected:
virtual void flee() {}
/**
* Return true if the selected character can be switched
*/
bool canSwitchChar() override {
return false;
}
public:
Prisoner(const Common::String &name, int portrait, const Common::String &line1,
byte flag, Alignment freeAlignment, Alignment leaveAlignment);
virtual ~Prisoner() {}
bool msgFocus(const FocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
void timeout() override;
};
class ChildPrisoner : public Prisoner {
public:
ChildPrisoner();
virtual ~ChildPrisoner() {}
};
class ManPrisoner : public Prisoner {
public:
ManPrisoner();
virtual ~ManPrisoner() {}
};
class CloakedPrisoner : public Prisoner {
public:
CloakedPrisoner();
virtual ~CloakedPrisoner() {
}
};
class DemonPrisoner : public Prisoner {
public:
DemonPrisoner();
virtual ~DemonPrisoner() {
}
};
class MutatedPrisoner : public Prisoner {
public:
MutatedPrisoner();
virtual ~MutatedPrisoner() {
}
};
class MaidenPrisoner : public Prisoner {
protected:
void flee() override;
public:
MaidenPrisoner();
virtual ~MaidenPrisoner() {
}
};
class VirginPrisoner : public Interaction {
public:
VirginPrisoner();
virtual ~VirginPrisoner() {
}
bool msgKeypress(const KeypressMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,84 @@
/* 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/resistances.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Resistances::Resistances() : Interaction("Resistances", 4) {
_title = STRING["maps.emap02.resistances"];
}
bool Resistances::msgFocus(const FocusMessage &msg) {
PartyView::msgFocus(msg);
addText(STRING["maps.map02.morango"]);
return true;
}
void Resistances::draw() {
Interaction::draw();
if (_lines.empty()) {
const Character &c = *g_globals->_currCharacter;
setReduced(true);
writeLine(0, STRING["maps.emap02.magic"], ALIGN_LEFT, 0);
writeLine(0, c._resistances._s._magic, ALIGN_RIGHT, 45);
writeLine(0, STRING["maps.emap02.fire"], ALIGN_LEFT, 50);
writeLine(0, c._resistances._s._fire, ALIGN_RIGHT, 90);
writeLine(0, STRING["maps.emap02.cold"], ALIGN_LEFT, 95);
writeLine(0, c._resistances._s._cold, ALIGN_RIGHT, 145);
writeLine(0, STRING["maps.emap02.electricity"], ALIGN_LEFT, 150);
writeLine(0, c._resistances._s._electricity, ALIGN_RIGHT, 195);
writeLine(1, STRING["maps.emap02.acid"], ALIGN_LEFT, 0);
writeLine(1, c._resistances._s._acid, ALIGN_RIGHT, 45);
writeLine(1, STRING["maps.emap02.fear"], ALIGN_LEFT, 50);
writeLine(1, c._resistances._s._fear, ALIGN_RIGHT, 90);
writeLine(1, STRING["maps.emap02.poison"], ALIGN_LEFT, 95);
writeLine(1, c._resistances._s._poison, ALIGN_RIGHT, 145);
writeLine(1, STRING["maps.emap02.sleep"], ALIGN_LEFT, 150);
writeLine(1, c._resistances._s._psychic, ALIGN_RIGHT, 195);
}
}
void Resistances::viewAction() {
// When already showing resistances, any click/key will close view
if (_lines.empty())
close();
}
void Resistances::charSwitched(Character *priorChar) {
Interaction::charSwitched(priorChar);
_lines.clear();
redraw();
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,63 @@
/* 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_RESISTANCES_H
#define MM1_VIEWS_ENH_INTERACTIONS_RESISTANCES_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Resistances : public Interaction {
protected:
/**
* Handles any action/press
*/
void viewAction() override;
/**
* Called when the selected character has been switched
*/
void charSwitched(Character *priorChar) override;
public:
Resistances();
/**
* Handles focus
*/
bool msgFocus(const FocusMessage &msg) override;
/**
* Draw the location
*/
void draw() override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

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/>.
*
*/
#include "mm/mm1/views_enh/interactions/ruby.h"
#include "mm/mm1/maps/map39.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Ruby::Ruby() : InteractionQuery("Ruby", 12) {
_title = STRING["maps.emap39.title"];
addText(STRING["maps.emap39.ruby1"]);
}
void Ruby::answerEntered() {
MM1::Maps::Map39 &map = *static_cast<MM1::Maps::Map39 *>(g_maps->_currentMap);
map.riddleAnswered(_answer);
}
} // 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_RUBY_H
#define MM1_VIEWS_ENH_INTERACTIONS_RUBY_H
#include "mm/mm1/views_enh/interactions/interaction_query.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Ruby : public InteractionQuery {
protected:
/**
* Answer entered
*/
void answerEntered() override;
public:
Ruby();
virtual ~Ruby() {}
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

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/views_enh/interactions/scummvm.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
ScummVM::ScummVM() : Interaction("ScummVM", 38) {
_title = STRING["maps.map55.title"];
addText(STRING["maps.map55.message"]);
}
void ScummVM::viewAction() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._gold += 10000;
c._gems = MIN((int)c._gems + 1000, 0xffff);
}
g_maps->_mapPos = Common::Point(8, 3);
g_maps->changeMap(0x604, 1);
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,48 @@
/* 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_SCUMMVM_H
#define MM1_VIEWS_ENH_INTERACTIONS_SCUMMVM_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class ScummVM : public Interaction {
protected:
/**
* Handles any action/press
*/
void viewAction() override;
public:
ScummVM();
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,76 @@
/* 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/statue.h"
#include "mm/mm1/globals.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Statue::Statue() : Interaction("Statue", 33) {
_title = STRING["dialogs.statues.statue"];
_animated = false;
}
bool Statue::msgGame(const GameMessage &msg) {
if (msg._name == "STATUE") {
_pageNum = 0;
_statueNum = msg._value;
addView(this);
return true;
}
return false;
}
bool Statue::msgFocus(const FocusMessage &msg) {
Common::String statueType = STRING[Common::String::format(
"dialogs.statues.names.%d", _statueNum)];
Common::String str = Common::String::format("%s%s. %s",
STRING["dialogs.statues.stone"].c_str(),
statueType.c_str(),
STRING["dialogs.statues.plaque"].c_str()
);
addText(str);
return true;
}
void Statue::viewAction() {
switch (++_pageNum) {
case 1:
addText(STRING[Common::String::format(
"dialogs.statues.messages.%d", _statueNum)]);
redraw();
break;
default:
leave();
break;
}
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,61 @@
/* 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_STATUE_H
#define MM1_VIEWS_ENH_INTERACTIONS_STATUE_H
#include "mm/mm1/views_enh/interactions/interaction.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Statue : public Interaction {
private:
int _statueNum = 0;
int _pageNum = 0;
protected:
/**
* Handles any action/press
*/
void viewAction() override;
public:
Statue();
/**
* Handles game message
*/
bool msgGame(const GameMessage &msg) override;
/**
* Handles focus
*/
bool msgFocus(const FocusMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View 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/interactions/trivia.h"
#include "mm/mm1/maps/map21.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
Trivia::Trivia() : InteractionQuery("Trivia", 14) {
_title = STRING["maps.emap21.title"];
}
bool Trivia::msgGame(const GameMessage &msg) {
if (msg._name == "TRIVIA") {
_question = STRING[Common::String::format(
"maps.map21.questions.%d", msg._value)];
_correctAnswer = STRING[Common::String::format(
"maps.map21.answers.%d", msg._value)];
addText(_question);
open();
return true;
}
return false;
}
void Trivia::answerEntered() {
if (_answer.equalsIgnoreCase(_correctAnswer)) {
send(InfoMessage(STRING["maps.map21.correct"]));
g_globals->_party[0]._gems += 50;
Sound::sound(SOUND_3);
} else {
g_maps->_mapPos.x = 15;
g_maps->_currentMap->updateGame();
send(InfoMessage(STRING["maps.map21.incorrect"]));
}
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,54 @@
/* 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_TRIVIA_H
#define MM1_VIEWS_ENH_INTERACTIONS_TRIVIA_H
#include "mm/mm1/views_enh/interactions/interaction_query.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class Trivia : public InteractionQuery {
private:
Common::String _question, _correctAnswer;
protected:
/**
* Answer entered
*/
void answerEntered() override;
public:
Trivia();
virtual ~Trivia() {}
bool msgGame(const GameMessage &msg) override;
};
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,117 @@
/* 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/volcano_god.h"
#include "mm/mm1/maps/map11.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
VolcanoGod::VolcanoGod() : InteractionQuery("VolcanoGod", 8, 10) {
_title = STRING["maps.emap11.volcano_god"];
}
bool VolcanoGod::msgFocus(const FocusMessage &msg) {
InteractionQuery::msgFocus(msg);
_showEntry = false;
setMode(CHOOSE_OPTION);
return true;
}
bool VolcanoGod::msgKeypress(const KeypressMessage &msg) {
switch (msg.keycode) {
case Common::KEYCODE_a:
challenge();
break;
case Common::KEYCODE_b:
riddle();
break;
case Common::KEYCODE_c:
clue();
break;
default:
return InteractionQuery::msgKeypress(msg);
}
return true;
}
bool VolcanoGod::msgAction(const ActionMessage &msg) {
if (msg._action == KEYBIND_ESCAPE) {
g_events->close();
return true;
} else {
return InteractionQuery::msgAction(msg);
}
}
void VolcanoGod::setMode(Mode newMode) {
clearButtons();
_mode = newMode;
switch (_mode) {
case CHOOSE_OPTION:
addText(STRING["maps.emap11.god_text"]);
addButton(STRING["maps.emap11.god_a"], 'A');
addButton(STRING["maps.emap11.god_b"], 'B');
addButton(STRING["maps.emap11.god_c"], 'C');
break;
case ENTER_RESPONSE:
addText(STRING["maps.emap11.question"]);
_showEntry = true;
break;
}
redraw();
}
void VolcanoGod::challenge() {
MM1::Maps::Map11 &map = *static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap);
close();
map.challenge();
}
void VolcanoGod::riddle() {
Sound::sound(SOUND_2);
setMode(ENTER_RESPONSE);
redraw();
}
void VolcanoGod::clue() {
MM1::Maps::Map11 &map = *static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap);
close();
map.clue();
}
void VolcanoGod::answerEntered() {
MM1::Maps::Map11 &map = *static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap);
map.riddleAnswer(_answer);
}
} // namespace Interactions
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,65 @@
/* 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_VOLCANO_GOD_H
#define MM1_VIEWS_ENH_INTERACTIONS_VOLCANO_GOD_H
#include "mm/mm1/views_enh/interactions/interaction_query.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
class VolcanoGod : public InteractionQuery {
private:
enum Mode {
CHOOSE_OPTION, ENTER_RESPONSE
};
Mode _mode = CHOOSE_OPTION;
void setMode(Mode newMode);
void challenge();
void riddle();
void clue();
protected:
/**
* Answer entered
*/
void answerEntered() override;
public:
VolcanoGod();
virtual ~VolcanoGod() {
}
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