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

148
engines/mm/mm1/maps/map.cpp Normal file
View File

@@ -0,0 +1,148 @@
/* 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 "common/file.h"
#include "mm/mm1/maps/map.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/events.h"
namespace MM {
namespace MM1 {
namespace Maps {
Map::Map(uint index, const Common::String &name, uint16 id,
byte defaultSection, const char *desc) :
_mapIndex(index), _name(name), _id(id), _defaultSection(defaultSection) {
_description = desc ? Common::String(desc) : _name;
_description.setChar(toupper(_description[0]), 0);
if (_description.hasPrefix("Area")) {
_description.setChar(toupper(_description[4]), 4);
_description.insertChar(' ', 4);
}
Common::fill((byte *)&_walls[0], (byte *)&_walls[MAP_SIZE], 0);
Common::fill(&_states[0], (byte *)&_states[MAP_SIZE], 0);
Common::fill(&_visited[0], &_visited[MAP_SIZE], 0);
}
void Map::load() {
loadMazeData();
loadOverlay();
g_globals->_heardRumor = false;
}
void Map::loadMazeData() {
Common::File f;
if (!f.open("mazedata.dta"))
error("Could not open mazedata.dta");
f.seek(512 * _mapIndex);
f.read((byte *)_walls, MAP_SIZE);
f.read(_states, MAP_SIZE);
f.close();
}
void Map::loadOverlay() {
Common::File f;
if (!f.open(Common::Path(Common::String::format("%s.ovr", _name.c_str()))))
error("Could not open %s.ovr overlay", _name.c_str());
int magicId = f.readUint16LE();
int codePtr = f.readUint16LE();
int codeSize = f.readUint16LE();
f.readUint16LE(); // dataPtr
int dataSize = f.readUint16LE();
f.readUint16LE(); // extras size
f.readUint16LE(); // code entry-point
if (magicId != 0xF2 || (codePtr != 0xF48F && codePtr != 0xF47C))
error("Invalid map overlay header");
// Skip over code segment, since each map's
// code is going to be reimplemented in C++
f.skip(codeSize);
// Read in the data segment
_data.resize(dataSize);
f.read(&_data[0], dataSize);
}
bool Map::checkPartyDead() {
return g_globals->_party.checkPartyDead();
}
uint16 Map::dataWord(uint16 ofs) const {
return READ_LE_UINT16(&_data[ofs]);
}
void Map::dataWord(uint16 ofs, uint16 val) {
WRITE_LE_UINT16(&_data[ofs], val);
}
void Map::reduceHP() {
for (uint i = 0; i < g_globals->_party.size(); ++i)
g_globals->_party[i]._hpCurrent /= 2;
}
void Map::updateGame() {
g_events->send("Game", GameMessage("UPDATE"));
}
void Map::redrawGame() {
g_events->send("Game", GameMessage("REDRAW"));
}
void Map::encounter(const byte *id1, const byte *id2) {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
enc.clearMonsters();
for (int i = 0; i < 14 && *id1; ++i, ++id1, ++id2)
enc.addMonster(*id1, *id2);
enc._manual = true;
enc._levelIndex = 64;
enc.execute();
}
void Map::unlockDoor() {
g_maps->_currentState = _states[g_maps->_mapOffset] ^=
g_maps->_forwardMask & 0x55;
}
void Map::visitedSpecial() {
if (!_visited[g_maps->_mapOffset])
_visited[g_maps->_mapOffset] = VISITED_SPECIAL;
}
void Map::visitedExit() {
_visited[g_maps->_mapOffset] = VISITED_EXIT;
}
void Map::visitedBusiness() {
_visited[g_maps->_mapOffset] = VISITED_BUSINESS;
}
} // namespace Maps
} // namespace MM1
} // namespace MM

260
engines/mm/mm1/maps/map.h Normal file
View File

@@ -0,0 +1,260 @@
/* 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_MAPS_MAP_H
#define MM1_MAPS_MAP_H
#include "common/array.h"
#include "common/str.h"
#include "mm/mm1/events.h"
#include "mm/mm1/game/game_logic.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define MAP_W 16
#define MAP_H 16
#define MAP_SIZE (MAP_W * MAP_H)
class Maps;
enum DataOffset {
MAP_ID = 0,
MAP_1 = 1,
MAP_2 = 2,
MAP_4 = 4,
MAP_6 = 6,
MAP_NORTH_EXIT_ID = 8,
MAP_NORTH_EXIT_SECTION = 10,
MAP_EAST_EXIT_ID = 11,
MAP_EAST_EXIT_SECTION = 13,
MAP_SOUTH_EXIT_ID = 14,
MAP_SOUTH_EXIT_SECTION = 16,
MAP_WEST_EXIT_ID = 17,
MAP_WEST_EXIT_SECTION = 19,
MAP_20 = 20,
MAP_21 = 21,
MAP_FLEE_THRESHOLD = 22,
MAP_FLEE_X = 23,
MAP_FLEE_Y = 24,
MAP_SURRENDER_THRESHOLD = 25,
MAP_SURRENDER_X = 26,
MAP_SURRENDER_Y = 27,
MAP_BRIBE_THRESHOLD = 28,
MAP_29 = 29,
MAP_30 = 30,
MAP_31 = 31,
MAP_32 = 32,
MAP_33 = 33,
MAP_MAX_MONSTERS = 34,
MAP_SECTOR1 = 35,
MAP_SECTOR2 = 36,
MAP_TYPE = 37,
MAP_DISPEL_THRESHOLD = 38,
MAP_SURFACE_ID = 39,
MAP_SURFACE_SECTION = 41,
MAP_SURFACE_X = 42,
MAP_SURFACE_Y = 43,
MAP_44 = 44,
MAP_45 = 45,
MAP_FLAGS = 46,
MAP_47 = 47,
MAP_TRAP_THRESHOLD = 48,
MAP_49 = 49,
MAP_SPECIAL_COUNT = 50
};
enum WallType {
WALL_NONE = 0, WALL_NORMAL = 1, WALL_DOOR = 2,
WALL_TORCH = 3
};
enum CellState {
CELL_SPECIAL = 0x80, CELL_DARK = 0x20
};
class Maps;
class Map : public Game::GameLogic {
protected:
Common::String _name;
Common::String _description;
uint16 _id;
uint _mapIndex;
byte _defaultSection;
Common::Array<byte> _data;
private:
/**
* Loads the map's maze data
*/
void loadMazeData();
/**
* Load the map's overlay file
*/
void loadOverlay();
public:
/**
* Divides all the party's Hp in half
*/
static void reduceHP();
/**
* Many special methods return a 160 key, but it
* doesn't look like the game uses. My current
* assumption is that this is just a convenient
* 'do nothing' return value
*/
static void none160() {}
/**
* Generates an encounter based on the passed id arrays
*/
void encounter(const byte *id1, const byte *id2);
public:
byte _walls[MAP_SIZE];
byte _states[MAP_SIZE];
uint8 _visited[MAP_SIZE];
public:
Map(uint index, const Common::String &name, uint16 id,
byte defaultSection, const char *desc = nullptr);
virtual ~Map() {}
/**
* Loads the map
*/
virtual void load();
/**
* Handles all special stuff that happens on the map
*/
virtual void special() = 0;
/**
* Returns true if mapping is allowed in enhanced mode.
* This is to prevent places like the desert where the
* players shouldn't be able to see where they are
*/
virtual bool mappingAllowed() const {
return true;
}
/**
* Gets the map name
*/
Common::String getName() const { return _name; }
/**
* Gets the map description for the map display
*/
Common::String getDescription() const { return _description; }
/**
* Returns the map Id
*/
uint16 getId() const { return _id; }
/**
* Returns the map default section
*/
byte getDefaultSection() const {
return _defaultSection;
}
/**
* Accesses the map data
*/
const byte &operator[](uint ofs) const {
return _data[ofs];
}
byte &operator[](uint ofs) {
return _data[ofs];
}
byte dataByte(uint ofs) const {
return _data[ofs];
}
uint16 dataWord(uint16 ofs) const;
void dataWord(uint16 ofs, uint16 val);
/**
* Checks whether the party is dead or out of action,
* and if so, switches to the death screen
*/
bool checkPartyDead();
/**
* Send a message to a UI element
*/
template<class T>
bool send(const T &msg) {
return g_events->send(msg);
}
template<class T>
bool send(const Common::String &name, const T &msg) {
return g_events->send(name, msg);
}
/**
* Returns the map's index
*/
uint getMapIndex() const {
return _mapIndex;
}
/**
* Updates the game display
*/
static void updateGame();
/**
* Redraw the game display
*/
static void redrawGame();
/**
* Unlocks door
*/
void unlockDoor();
/**
* Visited a special cell
*/
void visitedSpecial();
/**
* Visited an exit cell
*/
void visitedExit();
/**
* Visited a business cell
*/
void visitedBusiness();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,235 @@
/* 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/maps/map00.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define STATUE_VAL 0x412
void Map00::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 24; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[75 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map00::special00() {
inn();
}
void Map00::special01() {
Common::String line2;
int x = 5;
switch (g_maps->_forwardMask) {
case DIRMASK_E:
line2 = STRING["maps.map00.market"];
x = 6;
break;
case DIRMASK_W:
line2 = STRING["maps.map00.blacksmith"];
break;
default:
line2 = STRING["maps.map00.inn"];
break;
}
send(SoundMessage(
2, 0, STRING["maps.sign"],
x, 1, line2
));
}
void Map00::special02() {
blacksmith();
}
void Map00::special03() {
market();
}
void Map00::special04() {
visitedExit();
send(SoundMessage(
STRING["maps.passage_outside1"],
[]() {
g_maps->_mapPos = Common::Point(10, 10);
g_maps->changeMap(0xa11, 2);
}
));
}
void Map00::special05() {
tavern();
}
void Map00::special06() {
temple();
}
void Map00::special07() {
training();
}
void Map00::special08() {
g_events->addView("Leprechaun");
}
void Map00::special09() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->changeMap(0xa11, 1);
}
));
}
void Map00::special10() {
Map &map = *g_maps->_currentMap;
map[STATUE_VAL] = 0;
searchStatue();
}
void Map00::special11() {
Map &map = *g_maps->_currentMap;
map[STATUE_VAL] = 1;
searchStatue();
}
void Map00::special12() {
Map &map = *g_maps->_currentMap;
map[STATUE_VAL] = 2;
searchStatue();
}
void Map00::special13() {
Map &map = *g_maps->_currentMap;
map[STATUE_VAL] = 3;
searchStatue();
}
void Map00::special14() {
Map &map = *g_maps->_currentMap;
map[STATUE_VAL] = 4;
searchStatue();
}
void Map00::special15() {
Map &map = *g_maps->_currentMap;
map[STATUE_VAL] = 5;
searchStatue();
}
void Map00::special16() {
Map &map = *g_maps->_currentMap;
map[STATUE_VAL] = 6;
searchStatue();
}
void Map00::special17() {
Map &map = *g_maps->_currentMap;
map[STATUE_VAL] = 7;
searchStatue();
}
void Map00::special18() {
send(SoundMessage(
2, 0, STRING["maps.sign"],
6, 1, STRING["maps.map00.temple"]
));
}
void Map00::special19() {
send(SoundMessage(
2, 0, STRING["maps.sign"],
6, 1, STRING["maps.map00.jail"]
));
}
void Map00::special20() {
send(SoundMessage(
2, 0, STRING["maps.sign"],
6, 1, STRING["maps.map00.tavern"]
));
}
void Map00::special21() {
send(SoundMessage(
2, 0, STRING["maps.sign"],
6, 1, STRING["maps.map00.training"]
));
}
void Map00::special22() {
Map &map = *g_maps->_currentMap;
map[MM1::Maps::MAP_47] = 3;
map[MM1::Maps::MAP_33] = 6;
g_maps->clearSpecial();
}
void Map00::special23() {
visitedExit();
Common::String msg = STRING["maps.map00.trapdoor"];
if (g_globals->_activeSpells._s.levitate)
msg += STRING["maps.map00.levitate"];
send(SoundMessage(msg,
[](const Common::KeyState &keyState) {
g_events->focusedView()->close();
if (!g_globals->_activeSpells._s.levitate)
g_maps->changeMap(0xa11, 1);
}
));
}
void Map00::searchStatue() {
send(SoundMessage(
STRING["maps.map00.statue"],
[]() {
Map &map = *g_maps->_currentMap;
g_events->send("Statue", GameMessage("STATUE", map[STATUE_VAL]));
}
));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

100
engines/mm/mm1/maps/map00.h Normal file
View File

@@ -0,0 +1,100 @@
/* 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_MAPS_MAP00_H
#define MM1_MAPS_MAP00_H
#include "mm/mm1/maps/map_town.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map00 : public MapTown {
typedef void (Map00:: *SpecialFn)();
private:
void searchStatue();
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special16();
void special17();
void special18();
void special19();
void special20();
void special21();
void special22();
void special23();
const SpecialFn SPECIAL_FN[24] = {
&Map00::special00,
&Map00::special01,
&Map00::special02,
&Map00::special03,
&Map00::special04,
&Map00::special05,
&Map00::special06,
&Map00::special07,
&Map00::special08,
&Map00::special09,
&Map00::special10,
&Map00::special11,
&Map00::special12,
&Map00::special13,
&Map00::special14,
&Map00::special15,
&Map00::special16,
&Map00::special17,
&Map00::special18,
&Map00::special19,
&Map00::special20,
&Map00::special21,
&Map00::special22,
&Map00::special23
};
public:
Map00() : MapTown(0, "sorpigal", 0x604, 1) {}
/**
* Handles all special stuff that happens on the map
*/
virtual void special();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,184 @@
/* 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/maps/map01.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map01::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 17; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[68 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map01::special00() {
inn();
}
void Map01::special01() {
Common::String line1 = STRING["maps.map01.zam1"];
Common::String line2 = STRING["maps.map01.zam3"];
bool hasCourier = false;
for (uint i = 0; i < g_globals->_party.size() && !hasCourier; ++i) {
hasCourier = (g_globals->_party[i]._flags[0] & CHARFLAG0_COURIER3) != 0;
}
if (hasCourier) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[0] |= CHARFLAG0_COURIER3 | CHARFLAG0_ZAM_CLUE;
}
line2 = STRING["maps.map01.zam2"];
}
send(InfoMessage(
0, 1, line1,
0, 3, line2
));
}
void Map01::special02() {
blacksmith();
}
void Map01::special03() {
market();
}
void Map01::special04() {
visitedExit();
send(SoundMessage(
STRING["maps.passage_outside2"],
[]() {
g_maps->_mapPos = Common::Point(3, 3);
g_maps->changeMap(0x101, 2);
}
));
}
void Map01::special05() {
tavern();
}
void Map01::special06() {
temple();
}
void Map01::special07() {
training();
}
void Map01::special08() {
// Paralyze all the men
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (c._sex == MALE && !(c._condition & BAD_CONDITION))
c._condition = PARALYZED;
}
redrawGame();
// Show the message and wait for a keypress
send(SoundMessage(
STRING["maps.map01.secret"],
[](const Common::KeyState &) {
g_events->close();
Game::Encounter &enc = g_globals->_encounters;
enc.clearMonsters();
uint count = g_events->getRandomNumber(4) + 4;
enc.addMonster(6, 12);
for (uint i = 0; i < count; ++i)
enc.addMonster(4, 9);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
));
}
void Map01::special09() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->_mapPos = Common::Point(8, 0);
g_maps->changeMap(0xc01, 1);
}
));
}
void Map01::special10() {
showSign(STRING["maps.map01.market"]);
}
void Map01::special11() {
showSign(STRING["maps.map01.blacksmith"]);
}
void Map01::special12() {
showSign(STRING["maps.map01.inn"]);
}
void Map01::special13() {
showSign(STRING["maps.map01.temple"]);
}
void Map01::special14() {
send(SoundMessage(
0, 1, STRING["maps.map01.zam0"]
));
}
void Map01::special15() {
showSign(STRING["maps.map01.tavern"]);
}
void Map01::special16() {
showSign(STRING["maps.map01.training"]);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP01_H
#define MM1_MAPS_MAP01_H
#include "mm/mm1/maps/map_town.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map01 : public MapTown {
typedef void (Map01:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special16();
const SpecialFn SPECIAL_FN[17] = {
&Map01::special00,
&Map01::special01,
&Map01::special02,
&Map01::special03,
&Map01::special04,
&Map01::special05,
&Map01::special06,
&Map01::special07,
&Map01::special08,
&Map01::special09,
&Map01::special10,
&Map01::special11,
&Map01::special12,
&Map01::special13,
&Map01::special14,
&Map01::special15,
&Map01::special16
};
public:
Map01() : MapTown(1, "portsmit", 0xc03, 1, "Portsmith") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,181 @@
/* 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/maps/map02.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
static const byte PORTAL_DEST_X[4] = { 8, 15, 0, 5 };
static const byte PORTAL_DEST_Y[4] = { 4, 0, 0, 14 };
static const uint16 PORTAL_DEST_ID[4] = { 0xc03, 0xa00, 0xf01, 0x604 };
static const byte PORTAL_DEST_SECTION[4] = { 3, 0, 1, 4 };
void Map02::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 22; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[73 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map02::special00() {
inn();
}
void Map02::special01() {
Common::String line1 = STRING["maps.map02.zom1"];
Common::String line2 = STRING["maps.map02.zom3"];
bool hasCourier = false;
for (uint i = 0; i < g_globals->_party.size() && !hasCourier; ++i) {
hasCourier = (g_globals->_party[i]._flags[0] & CHARFLAG0_COURIER3) != 0;
}
if (hasCourier) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[0] |= CHARFLAG0_COURIER3 | CHARFLAG0_ZOM_CLUE;
}
line2 = STRING["maps.map02.zom2"];
}
send(InfoMessage(
0, 1, line1,
0, 3, line2
));
}
void Map02::special02() {
blacksmith();
}
void Map02::special03() {
market();
}
void Map02::special04() {
visitedExit();
send(SoundMessage(
STRING["maps.passage_outside2"],
[]() {
g_maps->_mapPos = Common::Point(7, 7);
g_maps->changeMap(0x801, 2);
}
));
}
void Map02::special05() {
tavern();
}
void Map02::special06() {
temple();
}
void Map02::special07() {
training();
}
void Map02::special08() {
g_events->addView("Resistances");
}
void Map02::special09() {
showSign(STRING["maps.map02.docks"]);
}
void Map02::special10() {
showSign(STRING["maps.map02.market"]);
}
void Map02::special11() {
showSign(STRING["maps.map02.blacksmith"]);
}
void Map02::special12() {
showSign(STRING["maps.map02.inn"]);
}
void Map02::special13() {
send(SoundMessage(0, 1, STRING["maps.map02.zom0"]));
}
void Map02::special14() {
send(SoundMessage(
STRING["maps.map02.pit"],
[]() {
g_maps->_mapPos.x++;
g_globals->_encounters.execute();
}
));
}
void Map02::special15() {
visitedExit();
send(SoundMessage(
STRING["maps.map02.portal"],
[]() {
int index = g_maps->_mapPos.x - 9;
g_maps->_mapPos.x = PORTAL_DEST_X[index];
g_maps->_mapPos.y = PORTAL_DEST_Y[index];
uint16 id = PORTAL_DEST_ID[index];
byte section = PORTAL_DEST_SECTION[index];
g_maps->changeMap(id, section);
}
));
}
void Map02::special18() {
showSign(STRING["maps.map02.temple"]);
}
void Map02::special20() {
showSign(STRING["maps.map02.tavern"]);
}
void Map02::special21() {
showSign(STRING["maps.map02.training"]);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,91 @@
/* 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_MAPS_MAP02_H
#define MM1_MAPS_MAP02_H
#include "mm/mm1/maps/map_town.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map02 : public MapTown {
typedef void (Map02:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special18();
void special20();
void special21();
const SpecialFn SPECIAL_FN[22] = {
&Map02::special00,
&Map02::special01,
&Map02::special02,
&Map02::special03,
&Map02::special04,
&Map02::special05,
&Map02::special06,
&Map02::special07,
&Map02::special08,
&Map02::special09,
&Map02::special10,
&Map02::special11,
&Map02::special12,
&Map02::special13,
&Map02::special14,
&Map02::special15,
&Map02::special15,
&Map02::special15,
&Map02::special18,
&Map02::special15,
&Map02::special20,
&Map02::special21
};
public:
Map02() : MapTown(2, "algary", 0x203, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,228 @@
/* 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/maps/map03.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
static const byte MONSTER_ID1[8] = { 5, 10, 12, 2, 11, 16, 6, 12 };
static const byte MONSTER_ID2[8] = { 2, 7, 7, 7, 5, 4, 3, 8 };
void Map03::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 29; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[80 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map03::special00() {
inn();
}
void Map03::special01() {
bool hasCourier = false;
for (uint i = 0; i < g_globals->_party.size() && !hasCourier; ++i) {
hasCourier = (g_globals->_party[i]._flags[0] & CHARFLAG0_COURIER3) != 0;
}
bool hasScroll = false;
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (c.hasItem(VELLUM_SCROLL_ID)) {
hasScroll = true;
c._gold += 1500;
}
}
if (hasCourier && hasScroll) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
g_globals->_currCharacter = &c;
c._exp += 2500;
int idx = c._equipped.indexOf(VELLUM_SCROLL_ID);
if (idx != -1)
c._equipped.removeAt(idx);
idx = c._backpack.indexOf(VELLUM_SCROLL_ID);
if (idx != -1)
c._backpack.removeAt(idx);
}
InfoMessage info1(
0, 0, STRING["maps.map03.telgoran1"],
0, 1, STRING["maps.map03.telgoran2"],
[](const Common::KeyState &) {
InfoMessage info2(
0, 1, STRING["maps.map03.telgoran3"],
[](const Common::KeyState &) {
g_events->close();
}
);
info2._largeMessage = true;
g_events->send(info2);
}
);
info1._largeMessage = true;
g_events->send(info1);
} else {
send(InfoMessage(
0, 0, STRING["maps.map03.telgoran1"],
0, 1, STRING["maps.map03.telgoran4"]
));
}
none160();
}
void Map03::special02() {
blacksmith();
}
void Map03::special03() {
market();
}
void Map03::special04() {
visitedExit();
send(SoundMessage(
STRING["maps.passage_outside1"],
[]() {
g_maps->_mapPos = Common::Point(9, 11);
g_maps->changeMap(0x112, 2);
}
));
}
void Map03::special05() {
tavern();
}
void Map03::special06() {
temple();
}
void Map03::special07() {
training();
}
void Map03::special08() {
g_globals->_treasure._container = GOLD_CHEST;
g_globals->_treasure._items[2] = 200;
g_globals->_treasure.setGems(200);
g_events->addAction(KEYBIND_SEARCH);
}
void Map03::special09() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->_mapPos = Common::Point(14, 0);
g_maps->changeMap(5, 1);
}
));
}
void Map03::special10() {
showSign(STRING["maps.map03.market"]);
}
void Map03::special11() {
showSign(STRING["maps.map03.blacksmith"]);
}
void Map03::special12() {
showSign(STRING["maps.map03.inn"]);
}
void Map03::special13() {
_data[0x1d] = 80;
_data[0x2e] = 3;
_data[0x2f] = 3;
}
void Map03::special14() {
_data[0x1d] = 150;
_data[0x2e] = 2;
_data[0x2f] = 2;
}
void Map03::special15() {
assert(g_maps->_mapPos.x < 8);
g_maps->clearSpecial();
int monsterCount = (g_maps->_mapPos.x < 3) ? 1 :
getRandomNumber(8);
Game::Encounter &enc = g_globals->_encounters;
enc._levelIndex = 80;
enc._manual = true;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(MONSTER_ID1[i], MONSTER_ID2[i]);
enc.execute();
}
void Map03::special18() {
showSign(STRING["maps.map03.temple"]);
}
void Map03::special20() {
showSign(STRING["maps.map03.tavern"]);
}
void Map03::special21() {
showSign(STRING["maps.map03.training"]);
}
void Map03::special27() {
showSign(STRING["maps.map03.forbidden_crypt"]);
}
void Map03::special28() {
showSign(STRING["maps.map03.eternal_rest"]);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

100
engines/mm/mm1/maps/map03.h Normal file
View File

@@ -0,0 +1,100 @@
/* 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_MAPS_MAP03_H
#define MM1_MAPS_MAP03_H
#include "mm/mm1/maps/map_town.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map03 : public MapTown {
typedef void (Map03:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special18();
void special20();
void special21();
void special27();
void special28();
const SpecialFn SPECIAL_FN[29] = {
&Map03::special00,
&Map03::special01,
&Map03::special02,
&Map03::special03,
&Map03::special04,
&Map03::special05,
&Map03::special06,
&Map03::special07,
&Map03::special08,
&Map03::special09,
&Map03::special10,
&Map03::special11,
&Map03::special12,
&Map03::special13,
&Map03::special14,
&Map03::special15,
&Map03::special15,
&Map03::special15,
&Map03::special18,
&Map03::special15,
&Map03::special20,
&Map03::special21,
&Map03::special15,
&Map03::special15,
&Map03::special15,
&Map03::special15,
&Map03::special15,
&Map03::special27,
&Map03::special28
};
public:
Map03() : MapTown(3, "dusk", 0x802, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,200 @@
/* 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/maps/map04.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map04::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 22; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[73 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// Stealable treasure
send(SoundMessage(
STRING["maps.map04.treasure"],
[]() {
g_maps->clearSpecial();
if ((*g_maps->_currentMap)[MAP04_TREASURE_STOLEN] < 255)
(*g_maps->_currentMap)[MAP04_TREASURE_STOLEN]++;
g_globals->_treasure.setGold(600);
g_globals->_treasure.setGems(10);
g_events->addAction(KEYBIND_SEARCH);
}
));
}
void Map04::special00() {
inn();
}
void Map04::special01() {
bool hasCourier = false;
for (uint i = 0; i < g_globals->_party.size() && !hasCourier; ++i) {
hasCourier = (g_globals->_party[i]._flags[0] & CHARFLAG0_COURIER1) != 0;
}
bool hasScroll = g_globals->_party.hasItem(VELLUM_SCROLL_ID);
auto callback = [](const Common::KeyState &) {
g_events->close();
g_maps->_mapPos.y = 6;
g_maps->_currentMap->updateGame();
};
if (hasCourier && hasScroll) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
g_globals->_currCharacter = &c;
c._exp += 1000;
c._flags[0] &= (c._flags[0] & CHARFLAG0_COURIER1) | CHARFLAG0_COURIER2;
}
send(InfoMessage(
0, 0, STRING["maps.map04.agar1"],
0, 1, STRING["maps.map04.agar2"],
callback
));
} else {
send(InfoMessage(
0, 0, STRING["maps.map04.agar1"],
0, 1, STRING["maps.map04.agar3"],
callback
));
}
}
void Map04::special02() {
blacksmith();
}
void Map04::special03() {
market();
}
void Map04::special04() {
visitedExit();
if (_data[MAP04_PASSAGE_OVERRIDE] || _data[MAP04_TREASURE_STOLEN] == 0) {
send(SoundMessage(
STRING["maps.passage_outside2"],
[]() {
g_maps->_mapPos.x = 13;
g_maps->_mapPos.y = 1;
g_maps->changeMap(0xa00, 2);
}
));
} else {
// Sucks to be you
_data[MAP04_PASSAGE_OVERRIDE]++;
g_events->addView("Arrested");
}
}
void Map04::special05() {
tavern();
}
void Map04::special06() {
temple();
}
void Map04::special07() {
training();
}
void Map04::special08() {
g_maps->_mapPos.x = getRandomNumber(15);
g_maps->_mapPos.y = getRandomNumber(15);
redrawGame();
send(InfoMessage(0, 1, STRING["maps.poof"]));
}
void Map04::special09() {
visitedExit();
if (_data[MAP04_STAIRS_OVERRIDE] || _data[MAP04_TREASURE_STOLEN] == 0) {
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->_mapPos.x = 0;
g_maps->_mapPos.y = 7;
g_maps->changeMap(0x202, 1);
}
));
} else {
// Sucks to be you
_data[MAP04_STAIRS_OVERRIDE]++;
g_events->addView("Arrested");
}
}
void Map04::special10() {
showSign(STRING["maps.map04.market"]);
}
void Map04::special11() {
showSign(STRING["maps.map04.blacksmith"]);
}
void Map04::special12() {
showSign(STRING["maps.map04.inn"]);
}
void Map04::special13() {
if (_data[MAP04_TREASURE_STOLEN]) {
g_maps->clearSpecial();
g_events->addView("Arrested");
} else {
none160();
}
}
void Map04::special18() {
showSign(STRING["maps.map04.temple"]);
}
void Map04::special20() {
showSign(STRING["maps.map04.tavern"]);
}
void Map04::special21() {
showSign(STRING["maps.map04.training"]);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,94 @@
/* 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_MAPS_MAP04_H
#define MM1_MAPS_MAP04_H
#include "mm/mm1/maps/map_town.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define MAP04_PASSAGE_OVERRIDE 169
#define MAP04_STAIRS_OVERRIDE 196
#define MAP04_TREASURE_STOLEN 971
class Map04 : public MapTown {
typedef void (Map04:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special09();
void special10();
void special11();
void special12();
void special13();
void special18();
void special20();
void special21();
const SpecialFn SPECIAL_FN[22] = {
&Map04::special00,
&Map04::special01,
&Map04::special02,
&Map04::special03,
&Map04::special04,
&Map04::special05,
&Map04::special06,
&Map04::special07,
&Map04::special08,
&Map04::special09,
&Map04::special10,
&Map04::special11,
&Map04::special12,
&Map04::special13,
&Map04::special13,
&Map04::special13,
&Map04::special13,
&Map04::special13,
&Map04::special18,
&Map04::special13,
&Map04::special20,
&Map04::special21
};
public:
Map04() : MapTown(4, "erliquin", 0xb1a, 3) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
void special08();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,225 @@
/* 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/maps/map05.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define MONSTER_ID 169
#define VAL1 574
#define VAL2 575
void Map05::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 21; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[72 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map05::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->changeMap(0x604, 1);
}
));
}
void Map05::special01() {
encounter(1);
}
void Map05::special02() {
encounter(9);
}
void Map05::special03() {
encounter(14);
}
void Map05::special04() {
encounter(20);
}
void Map05::special05() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
enc.clearMonsters();
for (int i = 0; i < 10; ++i)
enc.addMonster(14, 1);
enc._levelIndex = 80;
enc._manual = true;
enc.execute();
}
void Map05::special06() {
if (!g_globals->_party.hasItem(VELLUM_SCROLL_ID)) {
send(SoundMessage(
0, 1, STRING[!hasFlag() ? "maps.map05.man1" : "maps.map05.man2"],
[]() {
Map05 &map = *static_cast<Map05 *>(g_maps->_currentMap);
if (map.addScroll()) {
map.addFlag();
g_events->send(InfoMessage(0, 1, STRING["maps.map05.man3"]));
}
}
));
}
}
void Map05::special07() {
visitedExit();
send(SoundMessage(
STRING["maps.map05.portal"],
[]() {
g_maps->_mapPos.x = 8;
g_maps->_mapPos.y = 8;
g_maps->changeMap(1, 1);
}
));
}
void Map05::special08() {
send(SoundMessage(
2, 1, STRING["maps.sign"],
10, 2, STRING["maps.map05.arena"]
));
}
void Map05::special09() {
send(SoundMessage(
0, 1, STRING["maps.map05.arena_inside"],
[]() {
Map05 &map = *static_cast<Map05 *>(g_maps->_currentMap);
map[MAP_47] = 2;
map[MAP_33] = 6;
map[MAP_MAX_MONSTERS] = 15;
g_globals->_encounters._encounterType = Game::FORCE_SURPRISED;
g_globals->_encounters.execute();
},
[]() {
Map05 &map = *static_cast<Map05 *>(g_maps->_currentMap);
map[MAP_47] = 1;
map[MAP_33] = 4;
map[MAP_MAX_MONSTERS] = 10;
g_globals->_treasure.clear();
}
));
}
void Map05::special10() {
showMessage(STRING["maps.map05.message2"]);
}
void Map05::special11() {
if (g_maps->_forwardMask == DIRMASK_S) {
g_maps->clearSpecial();
g_globals->_encounters.execute();
} else {
showMessage(STRING["maps.map05.message3"]);
}
}
void Map05::special14() {
g_maps->clearSpecial();
if (getRandomNumber(2) == 2)
g_globals->_encounters.execute();
}
void Map05::encounter(int monsterId) {
Game::Encounter &enc = g_globals->_encounters;
_data[MONSTER_ID] = monsterId;
g_maps->clearSpecial();
int monsterCount = getRandomNumber(5);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(monsterId, 1);
enc._levelIndex = 80;
enc._manual = true;
enc.execute();
}
void Map05::showMessage(const Common::String &msg) {
send(SoundMessage(
0, 1, STRING["maps.map05.message1"],
0, 2, msg
));
}
bool Map05::addScroll() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!c._backpack.full()) {
// Add item
c._backpack.add(VELLUM_SCROLL_ID, 0);
g_globals->_items.getItem(VELLUM_SCROLL_ID);
return true;
}
}
g_events->send(SoundMessage(8, 2, STRING["maps.map05.backpacks_full"]));
return false;
}
bool Map05::hasFlag() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
const Character &c = g_globals->_party[i];
if (c._flags[0] & CHARFLAG0_COURIER1)
return true;
}
return false;
}
void Map05::addFlag() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[0] |= CHARFLAG0_COURIER1;
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,89 @@
/* 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_MAPS_MAP05_H
#define MM1_MAPS_MAP05_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map05 : public Map {
typedef void (Map05:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special14();
void encounter(int monsterId);
void showMessage(const Common::String &msg);
static bool addScroll();
static bool hasFlag();
static void addFlag();
const SpecialFn SPECIAL_FN[21] = {
&Map05::special00,
&Map05::special01,
&Map05::special02,
&Map05::special03,
&Map05::special04,
&Map05::special05,
&Map05::special06,
&Map05::special07,
&Map05::special08,
&Map05::special09,
&Map05::special10,
&Map05::special11,
&Map05::special11,
&Map05::special11,
&Map05::special14,
&Map05::special14,
&Map05::special14,
&Map05::special14,
&Map05::special14,
&Map05::special14,
&Map05::special08
};
public:
Map05() : Map(5, "cave1", 0xa11, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,220 @@
/* 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/maps/map06.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 446
#define VAL2 447
#define VAL3 329
static const byte MONSTER_ID1[13] = {
2, 1, 8, 9, 5, 9, 2, 7, 15, 4, 11, 1, 5
};
static const byte MONSTER_ID2[13] = {
3, 4, 3, 4, 4, 3, 4, 3, 3, 4, 4, 3, 3
};
void Map06::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 27; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[78 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_data[VAL1]) {
_data[VAL2]++;
Common::Point &pos = g_maps->_mapPos;
if (pos.y == 9) {
if (pos.x == 13 || pos.x == 14)
pos.x++;
else
pos.y++;
} else if (pos.x < 6) {
if (pos.y == 0) {
if (pos.x == 0)
pos.y++;
else
pos.x--;
} else if (pos.y != 10 || pos.x == 3) {
pos.y++;
} else {
pos.x++;
}
} else if (pos.x == 6) {
if (pos.y == 0)
pos.x--;
else
pos.y--;
} else {
pos.y++;
}
updateGame();
} else {
checkPartyDead();
}
}
void Map06::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.passage_outside2"],
[]() {
g_maps->_mapPos = Common::Point(15, 11);
g_maps->changeMap(0xa11, 2);
}
));
}
void Map06::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map06.portal"],
[]() {
g_maps->_mapPos = Common::Point(7, 0);
g_maps->changeMap(0xc01, 1);
}
));
}
void Map06::special02() {
if (_data[VAL1]) {
g_maps->_mapPos.x--;
slide();
} else {
checkPartyDead();
}
}
void Map06::special03() {
if (_data[VAL1]) {
g_maps->_mapPos.y++;
slide();
} else {
checkPartyDead();
}
}
void Map06::special04() {
if (_data[VAL2]) {
_data[VAL2] = 0;
send(SoundMessage(0, 1, STRING["maps.map06.acid"]));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._hpCurrent = MAX((int)c._hpCurrent - 15, 0);
if (!c._hpCurrent) {
if (!(c._condition & BAD_CONDITION))
c._condition = UNCONSCIOUS;
}
}
}
}
void Map06::special06() {
send(SoundMessage(
STRING["maps.map06.button"],
[]() {
Map06 &map = *static_cast<Map06 *>(g_maps->_currentMap);
byte &val1 = map[VAL1];
val1 = val1 ? 0 : 1;
g_events->addKeypress(Common::KEYCODE_SPACE);
}
));
}
void Map06::special07() {
g_maps->_mapPos.x = 10;
g_maps->_mapPos.y = 11;
updateGame();
send(SoundMessage(17, 1, STRING["maps.poof"]));
}
void Map06::special09() {
send(SoundMessage(0, 1, STRING["maps.map06.banner"]));
}
void Map06::special10() {
g_maps->_mapPos.x++;
g_globals->_encounters.execute();
}
void Map06::special13() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
_data[VAL3]++;
int monsterCount = getRandomNumber(5);
enc._levelIndex = 20;
int id1 = MONSTER_ID1[g_maps->_mapPos.y];
int id2 = MONSTER_ID2[g_maps->_mapPos.y];
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, id2);
enc.execute();
}
void Map06::special26() {
if (_data[VAL3]) {
send(SoundMessage(STRING["maps.map06.wizard"]));
} else {
g_globals->_treasure.setGold(12000);
g_globals->_treasure._items[1] = BRONZE_KEY_ID;
g_globals->_treasure._items[2] = getRandomNumber(12) + 182;
g_events->addAction(KEYBIND_SEARCH);
}
}
void Map06::slide() {
_data[VAL2]++;
SoundMessage msg(16, 1, STRING["maps.map06.slide"]);
msg._delaySeconds = 2;
msg._callback = []() {
g_maps->_currentMap->updateGame();
};
send(msg);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,89 @@
/* 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_MAPS_MAP06_H
#define MM1_MAPS_MAP06_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map06 : public Map {
typedef void (Map06:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special06();
void special07();
void special09();
void special10();
void special13();
void special26();
void slide();
const SpecialFn SPECIAL_FN[27] = {
&Map06::special00,
&Map06::special01,
&Map06::special02,
&Map06::special03,
&Map06::special04,
&Map06::special04,
&Map06::special06,
&Map06::special07,
&Map06::special07,
&Map06::special09,
&Map06::special10,
&Map06::special10,
&Map06::special10,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special13,
&Map06::special26
};
public:
Map06() : Map(6, "cave2", 0x1, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,230 @@
/* 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/maps/map07.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
static const byte MONSTER_IDS1[5] = { 2, 4, 1, 6, 4 };
static const byte MONSTER_IDS2[5] = { 2, 5, 2, 3, 3 };
static const byte MONSTER_IDS3[6] = { 2, 3, 3, 8, 8, 8 };
static const byte MONSTER_IDS4[6] = { 10, 9, 9, 7, 7, 7 };
void Map07::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 18; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[69 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_maps->clearSpecial();
int idx = getRandomNumber(5) - 1;
setMonsters(MONSTER_IDS1[idx], MONSTER_IDS2[idx]);
g_globals->_encounters.execute();
}
void Map07::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->_mapPos = Common::Point(0, 15);
g_maps->changeMap(0xc03, 1);
}
));
}
void Map07::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map07.portal"],
[]() {
g_maps->_mapPos = Common::Point(2, 7);
g_maps->changeMap(0x202, 1);
}
));
}
void Map07::special02() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
const Character &c = g_globals->_party[i];
for (byte itemId = BRONZE_KEY_ID;
itemId <= DIAMOND_KEY_ID; ++itemId) {
if (c.hasItem(itemId)) {
// Someone has a key
none160();
return;
}
}
}
g_maps->_mapPos.y--;
updateGame();
send(SoundMessage(0, 1, STRING["maps.map07.gate"]));
}
void Map07::special03() {
send(SoundMessage(0, 1, STRING["maps.map07.do_not_disturb"]));
}
void Map07::special04() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
enc.clearMonsters();
for (int i = 0; i < 6; ++i)
enc.addMonster(MONSTER_IDS3[i], MONSTER_IDS4[i]);
for (int i = 6; i < 13; ++i)
enc.addMonster(1, 2);
enc.execute();
}
void Map07::special05() {
g_maps->clearSpecial();
setMonsters();
g_globals->_encounters.addMonster(9, 2);
g_globals->_encounters.execute();
}
void Map07::special07() {
g_maps->clearSpecial();
setMonsters();
g_globals->_encounters.addMonster(10, 4);
g_globals->_encounters.execute();
}
void Map07::special09() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
setMonsters();
for (int i = 6; i < 10; ++i)
enc.addMonster(9, 2);
for (int i = 10; i < 13; ++i)
enc.addMonster(10, 4);
enc.addMonster(11, 4);
enc.execute();
}
void Map07::special11() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
setMonsters();
for (int i = 6; i < 12; ++i)
enc.addMonster(11, 4);
enc.addMonster(9, 5);
enc.execute();
}
void Map07::special13() {
poolYN(
[]() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._sex = (c._sex == MALE) ? FEMALE : MALE;
c.loadFaceSprites();
}
g_events->send(SoundMessage(0, 1, STRING["maps.map07.reversal"]));
Sound::sound(SOUND_3);
}
);
}
void Map07::special14() {
applyCondition(POISONED);
}
void Map07::special15() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._flags[11] & CHARFLAG11_GOT_MIGHT)) {
c._flags[11] |= CHARFLAG11_GOT_MIGHT;
c._might._base = MIN((int)c._might._base + 4, 255);
}
}
g_events->send(SoundMessage(0, 1, STRING["maps.map07.might"]));
Sound::sound(SOUND_3);
}
void Map07::special16() {
applyCondition(DISEASED);
}
void Map07::special17() {
poolYN([]() {
g_globals->_treasure._items[2] = g_events->getRandomNumber(12) + 24;
g_globals->_treasure.setGems(20);
g_events->addAction(KEYBIND_SEARCH);
});
}
void Map07::setMonsters(int id1, int id2) {
Game::Encounter &enc = g_globals->_encounters;
enc.clearMonsters();
for (int i = 0; i < 6; ++i)
enc.addMonster(id1, id2);
enc._manual = true;
enc._levelIndex = 48;
}
void Map07::poolYN(YNCallback callback) {
send(SoundMessage(STRING["maps.map07.pool"], callback));
}
void Map07::applyCondition(Condition cond) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._condition & BAD_CONDITION))
c._condition = cond;
}
Sound::sound(SOUND_3);
send(InfoMessage(0, 1, STRING["maps.map07.toxic"]));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,86 @@
/* 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_MAPS_MAP07_H
#define MM1_MAPS_MAP07_H
#include "mm/mm1/maps/map.h"
#include "mm/mm1/data/character.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map07 : public Map {
typedef void (Map07:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special07();
void special09();
void special11();
void special13();
void special14();
void special15();
void special16();
void special17();
void setMonsters(int id1 = 10, int id2 = 1);
void poolYN(YNCallback callback);
void applyCondition(Condition cond);
const SpecialFn SPECIAL_FN[18] = {
&Map07::special00,
&Map07::special01,
&Map07::special02,
&Map07::special03,
&Map07::special04,
&Map07::special05,
&Map07::special05,
&Map07::special07,
&Map07::special07,
&Map07::special09,
&Map07::special09,
&Map07::special11,
&Map07::special11,
&Map07::special13,
&Map07::special14,
&Map07::special15,
&Map07::special16,
&Map07::special17
};
public:
Map07() : Map(7, "cave3", 0xC01, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,198 @@
/* 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/maps/map08.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define MAX_CODE_LENGTH 10
#define ANSWER_OFFSET 147
#define CODE_ARMED 163
#define CODE_FAILURES 408
static const byte OFFSETS1[8] = { 146, 98, 150, 102, 153, 105, 157, 109 };
static const byte OFFSETS2[8] = { 130, 82, 134, 86, 137, 89, 141, 93 };
void Map08::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 24; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[75 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_maps->clearSpecial();
if (g_maps->_mapPos.x == 0 || g_maps->_mapPos.x == 15) {
g_globals->_encounters.execute();
} else {
addTreasure();
}
}
void Map08::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->_mapPos = Common::Point(15, 7);
g_maps->changeMap(0xb1a, 1);
}
));
}
void Map08::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->_mapPos = Common::Point(14, 1);
g_maps->changeMap(0xa00, 2);
}
));
}
void Map08::special02() {
if (_data[CODE_ARMED]) {
g_events->addView("AccessCode");
} else {
checkPartyDead();
}
}
void Map08::special04() {
g_maps->_mapPos = Common::Point(15, 9);
updateGame();
}
void Map08::special05() {
g_maps->_mapPos = Common::Point(0, 9);
updateGame();
}
void Map08::special06() {
if (_data[CODE_ARMED]) {
reduceHP();
send(InfoMessage(18, 2, STRING["maps.map08.zap"]));
Sound::sound(SOUND_3);
} else {
checkPartyDead();
}
}
void Map08::special08() {
if (_data[CODE_ARMED]) {
send(InfoMessage(0, 1, STRING["maps.map08.dancing_lights"]));
Sound::sound(SOUND_3);
} else {
checkPartyDead();
}
}
void Map08::special20() {
g_maps->clearSpecial();
g_globals->_treasure._items[2] = getRandomNumber(48);
g_globals->_treasure._trapType = 1;
g_globals->_treasure._container = SILVER_BOX;
addTreasure();
}
void Map08::addTreasure() {
g_globals->_treasure.setGold(getRandomNumber(150) + 100);
g_globals->_treasure.setGems(getRandomNumber(4));
g_events->addAction(KEYBIND_SEARCH);
}
void Map08::codeEntered(const Common::String &code) {
MM1::Maps::Map &map = *g_maps->_currentMap;
Common::String properCode;
for (int i = 0; i < 10 && map[ANSWER_OFFSET + i]; ++i)
properCode += map[ANSWER_OFFSET + i] + 0x1f;
if (code.equalsIgnoreCase(properCode))
correctCode();
else
incorrectCode();
}
void Map08::correctCode() {
_data[CODE_ARMED] = 0;
for (int i = 0; i < 8; ++i)
_states[OFFSETS1[i]] ^= 4;
for (int i = 0; i < 8; ++i)
_states[OFFSETS2[i]] ^= 0x40;
_states[119] ^= 0x10;
_states[120] ^= 1;
send(SoundMessage(STRING["maps.map08.good_code"]));
}
void Map08::incorrectCode() {
SoundMessage msg(
STRING["maps.map08.bad_code"],
[]() {
MM1::Maps::Map &map = *g_maps->_currentMap;
map[CODE_FAILURES]++;
if (map[CODE_FAILURES] != 2 && map[CODE_FAILURES] < 20) {
g_maps->_mapPos.y--;
map.updateGame();
return;
} else if (map[CODE_FAILURES] != 2) {
map[MM1::Maps::MAP_31] = 10;
}
InfoMessage msg2(
0, 1, STRING["maps.map08.bad_code"],
17, 2, STRING["maps.map08.alarm"],
[]() {
g_globals->_encounters.execute();
}
);
msg2._delaySeconds = 2;
g_events->send(msg2);
Sound::sound(SOUND_3);
}
);
msg._delaySeconds = 2;
send(msg);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,99 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MM1_MAPS_MAP08_H
#define MM1_MAPS_MAP08_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map08 : public Map {
typedef void (Map08:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special04();
void special05();
void special06();
void special08();
void special20();
void addTreasure();
const SpecialFn SPECIAL_FN[24] = {
&Map08::special00,
&Map08::special01,
&Map08::special02,
&Map08::special02,
&Map08::special04,
&Map08::special05,
&Map08::special06,
&Map08::special06,
&Map08::special08,
&Map08::special08,
&Map08::special08,
&Map08::special08,
&Map08::special06,
&Map08::special06,
&Map08::special06,
&Map08::special06,
&Map08::special06,
&Map08::special06,
&Map08::special06,
&Map08::special06,
&Map08::special20,
&Map08::special20,
&Map08::special20,
&Map08::special20
};
/**
* Correct code entered
*/
void correctCode();
/**
* Incorrect code entered
*/
void incorrectCode();
public:
Map08() : Map(8, "cave4", 0x202, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Access code entered
*/
void codeEntered(const Common::String &code);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,243 @@
/* 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/maps/map09.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
static const byte MAP_DEST_X[4] = { 8, 15, 15, 7 };
static const byte MAP_DEST_Y[4] = { 5, 1, 0, 0 };
static const uint16 MAP_DEST_ID[4] = { 0x604, 0x51b, 0x601, 0xa00 };
void Map09::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 28; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[79 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map09::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->changeMap(0x802, 1);
}
));
}
void Map09::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map09.passage_outside"],
[]() {
g_maps->_mapPos = Common::Point(0, 0);
g_maps->changeMap(0xf05, 3);
}
));
}
void Map09::special02() {
portal(0);
}
void Map09::special03() {
portal(1);
}
void Map09::special04() {
portal(2);
}
void Map09::special05() {
portal(3);
}
void Map09::special06() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._flags[11] & CHARFLAG11_GOT_ACCURACY)) {
c._flags[11] |= CHARFLAG11_GOT_ACCURACY;
c._might._base = MIN((int)c._accuracy._base + 4, 255);
}
}
g_events->send(SoundMessage(0, 1, STRING["maps.map09.accuracy"]));
}
void Map09::special07() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._flags[11] & CHARFLAG11_GOT_SPEED)) {
c._flags[11] |= CHARFLAG11_GOT_SPEED;
c._might._base = MIN((int)c._speed._base + 4, 255);
}
}
g_events->send(SoundMessage(0, 1, STRING["maps.map09.agility"]));
}
void Map09::special08() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[5] |= CHARFLAG5_8;
}
send(SoundMessage(
0, 1, STRING["maps.map09.shrine1"],
[]() {
const Character &leader = g_globals->_party[0];
if (leader._alignment == leader._alignmentInitial) {
SoundMessage msg(
STRING["maps.map09.shrine2"],
[]() {
g_globals->_treasure._items[2] = g_events->getRandomNumber(26) + 120;
g_globals->_treasure.setGold(120);
g_events->addAction(KEYBIND_SEARCH);
}
);
msg._delaySeconds = 2;
g_events->send(msg);
} else {
SoundMessage msg(
STRING["maps.map09.shrine3"],
[]() {
// TODO: Check this is right. Original set y twice
g_maps->_mapPos = Common::Point(5, 13);
g_maps->changeMap(0x201, 3);
}
);
msg._delaySeconds = 2;
g_events->send(msg);
}
}
));
}
void Map09::special09() {
send(SoundMessage(0, 1, STRING["maps.map09.stalactites"]));
reduceHP();
}
void Map09::special14() {
g_maps->clearSpecial();
if (g_globals->_activeSpells._s.levitate) {
send(SoundMessage(
0, 1, STRING["maps.map09.pit"],
0, 2, STRING["maps.map09.levitation"]
));
} else {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!g_globals->_activeSpells._s.poison &&
!(c._condition & BAD_CONDITION))
c._condition = POISONED;
c._hpCurrent /= 2;
}
SoundMessage msg(
STRING["maps.map09.pit"],
[]() {
g_globals->_encounters.execute();
}
);
msg._delaySeconds = 2;
send(msg);
}
}
void Map09::special18() {
if (g_globals->_activeSpells._s.psychic_protection) {
send(SoundMessage(
0, 1, STRING["maps.map09.psychic_blast"],
0, 2, STRING["maps.map09.protection"]
));
} else {
g_globals->_currCharacter = &g_globals->_party[
getRandomNumber(g_globals->_party.size()) - 1
];
if (!(g_globals->_currCharacter->_condition & BAD_CONDITION)) {
// Chosen character is okay, so blast them
g_globals->_currCharacter->_condition = BAD_CONDITION | DEAD;
} else {
// Chosen character is disabled, so instead
// remove the SP from all members of the party
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_party[i]._sp._current = 0;
}
}
g_globals->_encounters.execute();
}
}
void Map09::special25() {
send(SoundMessage(0, 1, STRING["maps.map09.scrawl"]));
}
void Map09::special26() {
send(SoundMessage(0, 1, STRING["maps.map09.corak_was_here"]));
}
void Map09::special27() {
send(SoundMessage(0, 1, STRING["maps.map09.message"]));
}
void Map09::portal(int index) {
visitedExit();
_portalIndex = index;
send(SoundMessage(
STRING["maps.map09.portal"],
[]() {
int idx = static_cast<Map09 *>(g_maps->_currentMap)->_portalIndex;
g_maps->_mapPos = Common::Point(MAP_DEST_X[idx], MAP_DEST_Y[idx]);
g_maps->changeMap(MAP_DEST_ID[idx], 1);
}
));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,96 @@
/* 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_MAPS_MAP09_H
#define MM1_MAPS_MAP09_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map09 : public Map {
typedef void (Map09:: *SpecialFn)();
private:
int _portalIndex = 0;
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special14();
void special18();
void special25();
void special26();
void special27();
void portal(int index);
const SpecialFn SPECIAL_FN[28] = {
&Map09::special00,
&Map09::special01,
&Map09::special02,
&Map09::special03,
&Map09::special04,
&Map09::special05,
&Map09::special06,
&Map09::special07,
&Map09::special08,
&Map09::special09,
&Map09::special09,
&Map09::special09,
&Map09::special09,
&Map09::special09,
&Map09::special14,
&Map09::special14,
&Map09::special14,
&Map09::special14,
&Map09::special18,
&Map09::special18,
&Map09::special18,
&Map09::special18,
&Map09::special18,
&Map09::special18,
&Map09::special18,
&Map09::special25,
&Map09::special26,
&Map09::special27
};
public:
Map09() : Map(9, "cave5", 0x5, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,201 @@
/* 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/maps/map10.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
static const byte MAP_DEST_X[15] = {
7, 7, 3, 3, 7, 13, 1, 7, 9, 13, 12, 1, 8, 12, 4
};
static const byte MAP_DEST_Y[15] = {
3, 14, 7, 7, 12, 8, 13, 3, 0, 7, 2, 14, 13, 7, 7
};
static const uint16 MAP_DEST_ID[15] = {
0x706, 0x107, 0xb07, 0x508, 0xf08, 0xa11, 0xa11, 1,
0xc01, 0x202, 0x604, 0xc03, 0x203, 0x802, 0xb1a
};
static const byte MAP_DEST_SECTION[15] = {
3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
void Map10::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 34; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[85 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map10::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.passage_outside1"],
[]() {
g_maps->_mapPos = Common::Point(0, 7);
g_maps->changeMap(0x101, 2);
}
));
}
void Map10::special01() {
send(SoundMessage(
STRING["maps.map10.ranalou1"],
[]() {
g_events->send(InfoMessage(STRING["maps.map10.ranalou2"]));
Sound::sound(SOUND_3);
for (uint i = 0; i < g_globals->_party.size(); ++i)
g_globals->_party[i]._flags[1] |= CHARFLAG1_1;
g_maps->clearSpecial();
},
[]() {
g_events->send(SoundMessage(STRING["maps.map10.ranalou3"]));
g_maps->_mapPos = Common::Point(15, 0);
g_maps->_currentMap->updateGame();
}
));
}
void Map10::special02() {
int idx = g_maps->_mapPos.x;
g_maps->_mapPos = Common::Point(MAP_DEST_X[idx], MAP_DEST_Y[idx]);
g_maps->changeMap(MAP_DEST_ID[idx], MAP_DEST_SECTION[idx]);
send(SoundMessage(STRING["maps.map10.poof"]));
}
void Map10::special17() {
g_maps->_mapPos.y++;
updateGame();
}
void Map10::special18() {
g_maps->_mapPos.x++;
updateGame();
}
void Map10::special19() {
g_maps->_mapPos.x--;
updateGame();
}
void Map10::special20() {
g_maps->clearSpecial();
g_globals->_treasure._items[2] = 252;
g_globals->_treasure.setGems(20);
g_globals->_treasure._container = SILVER_CHEST;
g_events->addAction(KEYBIND_SEARCH);
}
void Map10::special23() {
g_maps->clearSpecial();
if (g_globals->_activeSpells._s.levitate) {
Common::String msg = Common::String::format("%s %s",
STRING["maps.map10.pit"].c_str(),
STRING["maps.map10.levitation"].c_str());
send(SoundMessage(msg));
Sound::sound(SOUND_3);
} else {
reduceHP();
if (getRandomNumber(4) == 4) {
SoundMessage msg(
0, 1, STRING["maps.map10.pit"],
[]() {
g_globals->_encounters.execute();
}
);
msg._delaySeconds = 2;
send(msg);
Sound::sound(SOUND_3);
} else {
send(SoundMessage(STRING["maps.map10.pit"]));
Sound::sound(SOUND_3);
}
}
}
void Map10::special29() {
send(SoundMessage(STRING["maps.map10.sign1"]));
}
void Map10::special30() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = getRandomNumber(4) + 3;
g_globals->_treasure._items[2] = THUNDRANIUM_ID;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(9, 9);
enc._levelIndex = 64;
enc._manual = true;
enc.execute();
}
void Map10::special31() {
send(SoundMessage(STRING["maps.map10.sign2"]));
}
void Map10::special32() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = getRandomNumber(4) + 3;
g_globals->_treasure._items[2] = LASER_BLASTER_ID;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(8, 12);
enc._levelIndex = 64;
enc._manual = true;
enc.execute();
}
void Map10::special33() {
g_maps->_mapPos.x = 15;
updateGame();
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP10_H
#define MM1_MAPS_MAP10_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map10 : public Map {
typedef void (Map10:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special17();
void special18();
void special19();
void special20();
void special23();
void special29();
void special30();
void special31();
void special32();
void special33();
const SpecialFn SPECIAL_FN[34] = {
&Map10::special00,
&Map10::special01,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special02,
&Map10::special17,
&Map10::special18,
&Map10::special19,
&Map10::special20,
&Map10::special20,
&Map10::special20,
&Map10::special23,
&Map10::special23,
&Map10::special23,
&Map10::special23,
&Map10::special23,
&Map10::special23,
&Map10::special29,
&Map10::special30,
&Map10::special31,
&Map10::special32,
&Map10::special33
};
public:
Map10() : Map(10, "cave6", 0x51b, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,196 @@
/* 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/maps/map11.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define MAX_ANSWER_LENGTH 8
#define ANSWER_OFFSET 636
#define VAL1 641
#define VAL2 642
#define VAL3 643
void Map11::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 14; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[65 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_globals->_treasure._items[2] = 0;
if (getRandomNumber(50) == 10) {
pit();
} else {
if (_data[VAL1] == 66 && _data[VAL2] == 74) {
g_maps->_mapPos = Common::Point(7, 11);
} else {
g_maps->_mapPos.x = getRandomNumber(15);
g_maps->_mapPos.y = getRandomNumber(15);
}
updateGame();
send(SoundMessage(STRING["maps.map11.poof"]));
}
}
void Map11::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.map11.ladder"],
[]() {
g_maps->_mapPos = Common::Point(7, 2);
g_maps->changeMap(0xf04, 2);
}
));
}
void Map11::special01() {
if (_data[VAL1]) {
// Teleport to outside the Inn of Sorpigal
g_maps->_mapPos = Common::Point(8, 5);
g_maps->changeMap(0x604, 1);
} else {
g_events->addView("VolcanoGod");
}
}
void Map11::special02() {
g_maps->clearSpecial();
pit();
}
void Map11::special03() {
send(SoundMessage(STRING["maps.map11.sign"]));
}
void Map11::special04() {
g_maps->clearSpecial();
g_events->addView("VirginPrisoner");
}
void Map11::special05() {
send(SoundMessage(STRING["maps.map11.tip2"]));
}
void Map11::special06() {
selectDial(0);
}
void Map11::special07() {
selectDial(1);
}
void Map11::special08() {
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map11::pit() {
if (g_globals->_activeSpells._s.levitate) {
Common::String msg = Common::String::format("%s %s",
STRING["maps.map10.pit"].c_str(),
STRING["maps.map10.levitation"].c_str());
send(SoundMessage(msg));
Sound::sound(SOUND_3);
} else {
reduceHP();
reduceHP();
send(SoundMessage(STRING["maps.map10.pit"]));
Sound::sound(SOUND_3);
}
}
void Map11::selectDial(int dialIndex) {
_dialIndex = dialIndex;
Common::String msg = Common::String::format(
STRING["maps.map11.dial"].c_str(), '1' + dialIndex);
send(SoundMessage(msg,
[](const Common::KeyState &ks) {
if (ks.keycode >= Common::KEYCODE_a &&
ks.keycode <= Common::KEYCODE_z) {
Map11 &map = *static_cast<Map11 *>(g_maps->_currentMap);
g_events->close();
map.setDialChar(ks.ascii);
map.none160();
}
}
));
}
void Map11::challenge() {
Game::Encounter &enc = g_globals->_encounters;
enc.clearMonsters();
enc.addMonster(10, 12);
for (int i = 1; i < 10; ++i)
enc.addMonster(7, 8);
enc._levelIndex = 96;
enc._manual = true;
enc.execute();
}
void Map11::setDialChar(char c) {
_data[VAL2 + _dialIndex] = c;
}
void Map11::clue() {
g_maps->_mapPos = Common::Point(0, 5);
updateGame();
}
void Map11::riddleAnswer(const Common::String &answer) {
Common::String properAnswer;
for (int i = 0; i < 8 && _data[ANSWER_OFFSET + i]; ++i)
properAnswer += _data[ANSWER_OFFSET + i] + 30;
if (answer.equalsIgnoreCase(properAnswer)) {
_data[VAL1]++;
g_globals->_treasure._items[2] = KEY_CARD_ID;
g_events->addAction(KEYBIND_SEARCH);
} else {
g_maps->_mapPos = Common::Point(7, 2);
g_maps->changeMap(0xf04, 2);
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP11_H
#define MM1_MAPS_MAP11_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map11 : public Map {
typedef void (Map11:: *SpecialFn)();
private:
int _dialIndex = 0;
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void pit();
void selectDial(int dialIndex);
const SpecialFn SPECIAL_FN[14] = {
&Map11::special00,
&Map11::special01,
&Map11::special02,
&Map11::special03,
&Map11::special04,
&Map11::special05,
&Map11::special06,
&Map11::special07,
&Map11::special08,
&Map11::special08,
&Map11::special08,
&Map11::special02,
&Map11::special02,
&Map11::special02
};
public:
Map11() : Map(11, "cave7", 0x212, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Creates a challenge encounter
*/
void challenge();
/**
* Set the alphabetic character for the current dial
*/
void setDialChar(char c);
/**
* Volcano god's clue
*/
void clue();
/**
* Volcano god's riddle answer
*/
void riddleAnswer(const Common::String &answer);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,220 @@
/* 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/maps/map12.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define CORRECT 464
#define SELECTIONS 473
void Map12::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 18; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[69 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map12::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.map12.ladder_up"],
[]() {
g_maps->_mapPos = Common::Point(7, 13);
g_maps->changeMap(0x106, 2);
}
));
}
void Map12::special01() {
Common::String line1 = STRING["maps.map12.lever"];
Common::String line2;
for (int i = 0; i < 9; ++i) {
if (!_data[SELECTIONS + i]) {
line2 = STRING["maps.map12.wont_budge"];
break;
}
}
if (!line2.empty()) {
send(SoundMessage(0, 1, line1, 0, 2, line2));
} else {
line2 = STRING["maps.map12.pull_it"];
send(SoundMessage(
0, 1, line1,
0, 2, line2,
[]() {
Map12 &map = *static_cast<Map12 *>(g_maps->_currentMap);
int i;
for (i = 0; i < 9; ++i) {
if (map[SELECTIONS + i] != map[CORRECT + i])
break;
}
if (i < 9) {
g_events->send(SoundMessage(STRING["maps.map12.incorrect"]));
} else {
// Reward the party
for (i = 0; i < (int)g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (c._intelligence._base < 25) {
c._intelligence._current = c._intelligence._base =
c._intelligence._base + 2;
}
c._gems = MIN((int)c._gems + 20, 0xffff);
c._gold += 200;
c._exp += 2000;
}
g_events->send(SoundMessage(STRING["maps.map12.correct"]));
}
}
));
}
}
void Map12::special02() {
polyhedron('1', 0x80 + '6');
}
void Map12::special03() {
polyhedron('1', 0x80 + '3');
}
void Map12::special04() {
polyhedron('1', 0x80 + '0');
}
void Map12::special05() {
polyhedron('1', '1');
}
void Map12::special06() {
polyhedron('1', 0x80 + '2');
}
void Map12::special07() {
polyhedron('1', 0x80 + '5');
}
void Map12::special08() {
polyhedron('1', 0x80 + '4');
}
void Map12::special09() {
setPolyhedron(0);
}
void Map12::special10() {
setPolyhedron(1);
}
void Map12::special11() {
setPolyhedron(2);
}
void Map12::special12() {
setPolyhedron(3);
}
void Map12::special13() {
setPolyhedron(4);
}
void Map12::special14() {
setPolyhedron(5);
}
void Map12::special15() {
setPolyhedron(6);
}
void Map12::special16() {
setPolyhedron(7);
}
void Map12::special17() {
setPolyhedron(8);
}
void Map12::polyhedron(unsigned char side1, unsigned char side2) {
Common::String msg = Common::String::format(
STRING["maps.map12.polyhedron3"].c_str(), side1, side2);
send(SoundMessage(msg));
}
void Map12::keyCallbackSpinPolyhedronTwo() {
static_cast<Map12 *>(g_maps->_currentMap)->spinPolyhedron(0);
g_maps->_currentMap->updateGame();
}
void Map12::keyCallbackSpinPolyhedronOne(const Common::KeyState &ks) {
if (ks.keycode >= Common::KEYCODE_0 && ks.keycode <= Common::KEYCODE_9) {
g_events->close();
Map12 &map = *static_cast<Map12 *>(g_maps->_currentMap);
map.spinPolyhedron(ks.ascii | 0x80);
map.none160();
}
}
void Map12::setPolyhedron(int polyIndex) {
_polyIndex = polyIndex;
if (_data[SELECTIONS + polyIndex]) {
Common::String msg = Common::String::format(
STRING["maps.map12.polyhedron2"].c_str(),
_data[SELECTIONS + polyIndex]);
send(SoundMessage(msg, keyCallbackSpinPolyhedronTwo));
} else {
send(SoundMessage(STRING["maps.map12.polyhedron1"], keyCallbackSpinPolyhedronOne));
}
}
void Map12::spinPolyhedron(byte newSide) {
_data[SELECTIONS + _polyIndex] = newSide;
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP12_H
#define MM1_MAPS_MAP12_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map12 : public Map {
typedef void (Map12:: *SpecialFn)();
private:
int _polyIndex = 0;
static void keyCallbackSpinPolyhedronTwo();
static void keyCallbackSpinPolyhedronOne(const Common::KeyState &ks);
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special16();
void special17();
void polyhedron(unsigned char side1, unsigned char side2);
void setPolyhedron(int polyIndex);
const SpecialFn SPECIAL_FN[18] = {
&Map12::special00,
&Map12::special01,
&Map12::special02,
&Map12::special03,
&Map12::special04,
&Map12::special05,
&Map12::special06,
&Map12::special07,
&Map12::special08,
&Map12::special09,
&Map12::special10,
&Map12::special11,
&Map12::special12,
&Map12::special13,
&Map12::special14,
&Map12::special15,
&Map12::special16,
&Map12::special17
};
public:
Map12() : Map(12, "cave8", 0x601, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Spins a polyhedron
*/
void spinPolyhedron(byte newSide);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,181 @@
/* 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/maps/map13.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 143
#define MONSTER_ID1 389
#define MONSTER_ID2 445
void Map13::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 23; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[74 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_maps->clearSpecial();
int index;
if (g_maps->_mapPos.y < 5) {
index = 0;
} else if (g_maps->_mapPos.y < 9) {
index = 14;
} else if (g_maps->_mapPos.x < 9) {
index = 28;
} else {
index = 42;
}
int monsterCount = getRandomNumber(7) + 5;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(_data[MONSTER_ID1 + index + i],
_data[MONSTER_ID2 + index + i]);
enc._manual = true;
enc._levelIndex = 48;
enc.execute();
}
void Map13::special00() {
visitedExit();
_data[VAL1] = 0;
send(SoundMessage(
STRING["maps.map13.passage_outside"],
[]() {
g_maps->_mapPos = Common::Point(8, 4);
g_maps->changeMap(0x703, 2);
}
));
}
void Map13::special01() {
if (_data[VAL1]) {
g_maps->clearSpecial();
g_globals->_treasure._items[2] = MEDUSA_HEAD_ID;
g_events->addAction(KEYBIND_SEARCH);
} else {
_data[VAL1]++;
encounter(getRandomNumber(6) + 3, 9, 6);
}
}
void Map13::special02() {
g_maps->clearSpecial();
if (g_globals->_activeSpells._s.levitate) {
send(SoundMessage(
0, 1, STRING["maps.map13.spike_pit"],
0, 2, STRING["maps.map13.levitation1"]
));
} else if (!g_globals->_activeSpells._s.poison) {
reduceHP();
reduceHP();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._condition & BAD_CONDITION))
c._condition = POISONED;
}
send(SoundMessage(STRING["maps.map13.snake_pit"]));
}
}
void Map13::special06() {
send(SoundMessage(STRING["maps.map13.remains"]));
}
void Map13::special10() {
g_maps->clearSpecial();
Sound::sound(SOUND_2);
Sound::sound(SOUND_3);
if (g_globals->_activeSpells._s.levitate) {
send(InfoMessage(
0, 1, STRING["maps.map13.snake_pit"],
0, 2, STRING["maps.map13.levitation2"]
));
Sound::sound(SOUND_3);
} else if (!g_globals->_activeSpells._s.poison) {
reduceHP();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._condition & BAD_CONDITION))
c._condition = POISONED;
}
InfoMessage msg(
0, 1, STRING["maps.map13.snake_pit"],
[]() {
static_cast<Map13 *>(g_maps->_currentMap)->encounter(
g_events->getRandomNumber(3) + 10, 14, 1);
}
);
msg._delaySeconds = 2;
send(msg);
}
}
void Map13::special18() {
encounter(getRandomNumber(4) + 2, 2, 5);
}
void Map13::special22() {
encounter(getRandomNumber(3) + 3, 9, 6);
}
void Map13::encounter(size_t count, byte id1, byte id2) {
Game::Encounter &enc = g_globals->_encounters;
enc.clearMonsters();
for (size_t i = 0; i < count; ++i)
enc.addMonster(id1, id2);
enc._manual = true;
enc._levelIndex = 64;
enc.execute();
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,85 @@
/* 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_MAPS_MAP13_H
#define MM1_MAPS_MAP13_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map13 : public Map {
typedef void (Map13:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special06();
void special10();
void special18();
void special22();
const SpecialFn SPECIAL_FN[23] = {
&Map13::special00,
&Map13::special01,
&Map13::special02,
&Map13::special02,
&Map13::special02,
&Map13::special02,
&Map13::special06,
&Map13::special06,
&Map13::special06,
&Map13::special06,
&Map13::special10,
&Map13::special10,
&Map13::special10,
&Map13::special10,
&Map13::special10,
&Map13::special10,
&Map13::special10,
&Map13::special10,
&Map13::special18,
&Map13::special18,
&Map13::special18,
&Map13::special18,
&Map13::special22
};
public:
Map13() : Map(13, "cave9", 0xa00, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Start an encounter
*/
void encounter(size_t count, byte id1, byte id2);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,183 @@
/* 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/maps/map14.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 75
#define VAL2 148
#define VAL3 395
void Map14::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 6; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[57 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_maps->clearSpecial();
int monsterCount = getRandomNumber(3);
int id1 = getRandomNumber(16);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, 7);
enc._levelIndex = 5;
enc._manual = true;
enc.execute();
}
void Map14::special00() {
if (_data[VAL1]) {
g_maps->clearSpecial();
for (uint i = 0; i < g_globals->_party.size(); ++i)
g_globals->_party[i]._flags[2] |= CHARFLAG2_8;
none160();
} else {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
if (g_globals->_party[i]._flags[2] & CHARFLAG2_8) {
g_maps->clearSpecial();
none160();
return;
}
}
send(SoundMessage(STRING["maps.map14.surrounded"],
[]() {
Map14 &map = *static_cast<Map14 *>(g_maps->_currentMap);
map.encounter();
},
[]() {
if (g_events->getRandomNumber(3) == 3) {
g_maps->_mapPos = Common::Point(15, 10);
g_maps->_currentMap->updateGame();
} else {
Map14 &map = *static_cast<Map14 *>(g_maps->_currentMap);
map.encounter();
}
}
));
}
}
void Map14::encounter() {
Game::Encounter &enc = g_globals->_encounters;
_data[VAL1]++;
enc.clearMonsters();
enc.addMonster(2, 12);
for (int i = 1; i < 12; ++i)
enc.addMonster(13, 8);
enc._levelIndex = 80;
enc._manual = true;
enc.execute();
}
void Map14::special01() {
_data[VAL1] = 0;
_data[VAL2]++;
none160();
}
void Map14::special02() {
if (_data[VAL3] & 0x80) {
g_maps->_mapPos = Common::Point(7, 0);
g_maps->changeMap(0x706, 3);
} else if (_data[VAL3]) {
_data[VAL3] = 0;
} else {
send("View", DrawGraphicMessage(65 + 6));
send(SoundMessage(
STRING["maps.map14.castle"],
[]() {
Map14 &map = *static_cast<Map14 *>(g_maps->_currentMap);
map[VAL3] = 0xff;
map.updateGame();
},
[]() {
Map14 &map = *static_cast<Map14 *>(g_maps->_currentMap);
map[VAL3]++;
map.updateGame();
}
));
}
}
void Map14::special03() {
send(SoundMessage(STRING["maps.map14.words"]));
}
void Map14::special04() {
visitedExit();
if (_data[VAL2]) {
send(SoundMessage(
STRING["maps.map14.passage"],
[]() {
g_maps->_mapPos = Common::Point(4, 4);
g_maps->changeMap(0x706, 3);
}
));
} else {
none160();
}
}
void Map14::special05() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._flags[11] & CHARFLAG11_GOT_ENDURANCE)) {
c._flags[11] |= CHARFLAG11_GOT_ENDURANCE;
int endurance = c._endurance._base + 4;
if (endurance < 30) {
c._endurance._base = c._endurance._current = endurance;
}
}
}
send(SoundMessage(STRING["maps.map14.pool"]));
}
} // namespace Maps
} // 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_MAPS_MAP14_H
#define MM1_MAPS_MAP14_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map14 : public Map {
typedef void (Map14:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
const SpecialFn SPECIAL_FN[6] = {
&Map14::special00,
&Map14::special01,
&Map14::special02,
&Map14::special03,
&Map14::special04,
&Map14::special05
};
void encounter();
public:
Map14() : Map(14, "areaa1", 0xf01, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,218 @@
/* 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/maps/map15.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 350
#define VAL2 118
#define ITEM_ID 361
#define GEMS 362
void Map15::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 9; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[60 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (g_maps->_mapPos.y >= 3) {
g_globals->_treasure.clear();
if (getRandomNumber(20) == 20) {
if (_data[VAL1] > 14)
_data[VAL1] = 14;
g_globals->_activeSpells._s.fire = 0;
enc.clearMonsters();
for (uint i = 0; i < _data[VAL1]; ++i)
enc.addMonster(7, 8);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
} else {
send(SoundMessage(16, 1, STRING["maps.map15.its_hot"]));
if (!g_globals->_activeSpells._s.fire) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._hpCurrent = MAX((int)c._hpCurrent - 15, 0);
}
}
}
} else if (getRandomNumber(100) != 100) {
none160();
} else {
Character &c = g_globals->_party[0];
g_globals->_currCharacter = &c;
int id1 = getRandomNumber(2 + ((c._level < 12) ? c._level : 14));
int monsterCount = getRandomNumber((id1 < 15) ? 13 : 4);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, 11);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
}
void Map15::special00() {
send(SoundMessage(STRING["maps.map15.lava"]));
}
void Map15::special01() {
Game::Encounter &enc = g_globals->_encounters;
if (_data[VAL2]) {
SoundMessage msg(
STRING["maps.map15.body"],
[]() {
g_globals->_treasure._items[2] = DRAGONS_TOOTH_ID;
g_events->addAction(KEYBIND_SEARCH);
}
);
msg._delaySeconds = 5;
send(msg);
} else {
_data[VAL2]++;
enc.clearMonsters();
enc.addMonster(15, 9);
enc._levelIndex = 5;
enc._manual = true;
enc.execute();
}
}
void Map15::special02() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
_data[VAL2]++;
int monsterCount = getRandomNumber(4) + 1;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(15, 9);
enc._levelIndex = 48;
enc._manual = true;
enc.execute();
}
void Map15::special03() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
_data[VAL2]++;
enc.clearMonsters();
for (int i = 0; i < 10; ++i)
enc.addMonster(15, 9);
enc._levelIndex = 48;
enc._manual = true;
}
void Map15::special04() {
_data[ITEM_ID] = PIRATES_MAP_A_ID;
_data[GEMS] = 100;
cove();
}
void Map15::special05() {
_data[ITEM_ID] = PIRATES_MAP_B_ID;
_data[GEMS] = 200;
cove();
}
void Map15::special06() {
g_maps->clearSpecial();
send(SoundMessage(STRING["maps.map15.percella1"],
[]() {
g_globals->_treasure._items[2] = KINGS_PASS_ID;
g_events->addAction(KEYBIND_SEARCH);
},
[]() {
SoundMessage msg(
STRING["maps.map15.percella2"],
[]() {
g_maps->_mapPos = Common::Point(14, 2);
g_maps->_currentMap->updateGame();
}
);
msg._delaySeconds = 5;
g_events->send(msg);
}
));
}
void Map15::special08() {
_data[VAL2] = 0;
none160();
}
void Map15::cove() {
send(SoundMessage(STRING["maps.map15.cove"],
[]() {
Map15 &map = *static_cast<Map15 *>(g_maps->_currentMap);
g_maps->clearSpecial();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
int idx = c._backpack.indexOf(map[ITEM_ID]);
if (idx != -1) {
c._backpack.removeAt(idx);
g_globals->_treasure.setGold(2000);
g_globals->_treasure.setGems(map[GEMS]);
break;
}
}
g_events->addAction(KEYBIND_SEARCH);
}
));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP15_H
#define MM1_MAPS_MAP15_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map15 : public Map {
typedef void (Map15:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special08();
void cove();
const SpecialFn SPECIAL_FN[9] = {
&Map15::special00,
&Map15::special01,
&Map15::special02,
&Map15::special03,
&Map15::special04,
&Map15::special05,
&Map15::special06,
&Map15::special00,
&Map15::special08
};
public:
Map15() : Map(15, "areaa2", 0x502, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,136 @@
/* 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/maps/map16.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 83
void Map16::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 8; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[59 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (getRandomNumber(100) == 100) {
Character &c = g_globals->_party[0];
g_globals->_currCharacter = &c;
int id1 = getRandomNumber(c._level >= 12 ? 14 : c._level) + 2;
int monsterCount = getRandomNumber(id1 < 15 ? 13 : 4);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, 11);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
} else {
none160();
}
}
void Map16::special00() {
if (_data[VAL1]) {
g_maps->clearSpecial();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
g_globals->_currCharacter = &c;
c._flags[2] |= CHARFLAG2_1;
}
none160();
} else {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
g_globals->_currCharacter = &c;
if (c._flags[2] & CHARFLAG2_1) {
g_maps->clearSpecial();
g_events->addAction(KEYBIND_SEARCH);
return;
}
}
_data[VAL1]++;
SoundMessage msg(STRING["maps.map16.water"],
[]() {
Game::Encounter &enc = g_globals->_encounters;
enc.clearMonsters();
enc.addMonster(4, 12);
for (int i = 1; i < 12; ++i)
enc.addMonster(12, 11);
enc._levelIndex = 80;
enc._manual = true;
enc.execute();
}
);
msg._delaySeconds = 5;
send(msg);
}
}
void Map16::special01() {
send(SoundMessage(STRING["maps.map16.wheel"],
[]() {
for (int i = 0; i < 20; ++i)
Sound::sound(SOUND_1);
g_events->addView("WheelSpin");
}
));
}
void Map16::special02() {
_data[VAL1] = 0;
none160();
}
void Map16::special03() {
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP16_H
#define MM1_MAPS_MAP16_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map16 : public Map {
typedef void (Map16:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
const SpecialFn SPECIAL_FN[8] = {
&Map16::special00,
&Map16::special01,
&Map16::special02,
&Map16::special03,
&Map16::special03,
&Map16::special03,
&Map16::special03,
&Map16::special03
};
public:
Map16() : Map(16, "areaa3", 0xb02, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,168 @@
/* 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/maps/map17.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 509
#define CORRECT_ANSWERS 511
void Map17::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 9; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[60 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (getRandomNumber(100) == 100) {
Character &c = g_globals->_party[0];
g_globals->_currCharacter = &c;
int id1 = getRandomNumber(c._level >= 12 ? 14 : c._level) + 2;
int monsterCount = getRandomNumber(id1 < 15 ? 13 : 4);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, 11);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
} else if (getRandomNumber(30) == 10) {
g_maps->_mapPos = Common::Point(15, 15);
updateGame();
send(SoundMessage(STRING["maps.map17.wave"]));
} else {
none160();
}
}
void Map17::special00() {
send(SoundMessage(STRING["maps.map17.islands"]));
}
void Map17::special01() {
SoundMessage msg(STRING["maps.map17.bridge"],
[]() {
g_events->addView("ColorQuestions");
}
);
msg._largeMessage = true;
send(msg);
}
void Map17::special02() {
if (_data[CORRECT_ANSWERS]) {
g_globals->_treasure._items[2] = CORAL_KEY_ID;
g_events->addAction(KEYBIND_SEARCH);
} else {
none160();
}
}
void Map17::special03() {
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
/*
void Map17::askQuestion(uint partyIndex) {
if (partyIndex >= g_globals->_party.size()) {
// Entire party has answered the question
if (_data[CORRECT_ANSWERS]) {
g_maps->_mapPos.y = 2;
updateGame();
} else {
none160();
}
return;
}
_data[VAL1] = partyIndex;
g_globals->_currCharacter = &g_globals->_party[partyIndex];
if (!(g_globals->_currCharacter->_condition & BAD_CONDITION)) {
InfoMessage msg(
0, 0, STRING["maps.map17.color"],
0, 2, STRING["maps.map17.options"],
[](const Common::KeyState &ks) {
Map17 &map = *static_cast<Map17 *>(g_maps->_currentMap);
if (ks.keycode >= Common::KEYCODE_1 &&
ks.keycode <= Common::KEYCODE_9) {
map[COLOR] = ks.ascii - '1';
Common::String line;
Character &c = *g_globals->_currCharacter;
int color = c._flags[2] & 0xf;
// If a color hasn't been designated yet from talking to Gypsy,
// or it has but the wrong color is selected, eradicate them
if (!color || (color & 7) != map[COLOR]) {
c._condition = ERADICATED;
line = STRING["maps.map17.wrong"];
} else {
map[CORRECT_ANSWERS]++;
c._flags[4] |= CHARFLAG4_80;
line = STRING["maps.map17.correct"];
}
Sound::sound(SOUND_3);
InfoMessage msg2;
msg2._largeMessage = true;
msg2._delaySeconds = 1;
msg2._lines.push_back(Line(0, 0, STRING["maps.map17.color"]));
msg2._lines.push_back(Line(0, 2, STRING["maps.map17.options"]));
msg2._lines.push_back(Line(16, 6, line));
msg2._callback = []() {
Map17 &map17 = *static_cast<Map17 *>(g_maps->_currentMap);
map17.askQuestion(map17[VAL1] + 1);
};
g_events->send(msg2);
}
}
);
msg._largeMessage = true;
send(msg);
}
}
*/
} // namespace Maps
} // 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_MAPS_MAP17_H
#define MM1_MAPS_MAP17_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map17 : public Map {
typedef void (Map17:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
const SpecialFn SPECIAL_FN[9] = {
&Map17::special00,
&Map17::special01,
&Map17::special02,
&Map17::special03,
&Map17::special03,
&Map17::special03,
&Map17::special03,
&Map17::special03,
&Map17::special03
};
public:
Map17() : Map(17, "areaa4", 0x103, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,177 @@
/* 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/maps/map18.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 235
#define VAL2 196
void Map18::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 10; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[61 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map18::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.map18.passage"],
[]() {
g_maps->_mapPos = Common::Point(0, 7);
g_maps->changeMap(0xb1a, 1);
}
));
}
void Map18::special01() {
visitedExit();
if (_data[VAL1] & 0x80) {
g_maps->_mapPos = Common::Point(0, 7);
g_maps->changeMap(0x508, 3);
} else if (_data[VAL1] != 0) {
_data[VAL1] = 0;
} else {
send("View", DrawGraphicMessage(65 + 6));
send(SoundMessage(
STRING["maps.map18.castle_south"],
[]() {
Map18 &map = *static_cast<Map18 *>(g_maps->_currentMap);
map[VAL1] = 0xff;
map.updateGame();
},
[]() {
Map18 &map = *static_cast<Map18 *>(g_maps->_currentMap);
map[VAL1]++;
map.updateGame();
}
));
}
}
void Map18::special02() {
visitedExit();
if (_data[VAL2] & 0x80) {
g_maps->_mapPos = Common::Point(7, 15);
g_maps->changeMap(0xf08, 3);
} else if (_data[VAL2] != 0) {
_data[VAL2] = 0;
} else {
send("View", DrawGraphicMessage(65 + 6));
send(SoundMessage(
STRING["maps.map18.castle_north"],
[]() {
Map18 &map = *static_cast<Map18 *>(g_maps->_currentMap);
map[VAL2] = 0xff;
map.updateGame();
},
[]() {
Map18 &map = *static_cast<Map18 *>(g_maps->_currentMap);
map[VAL2]++;
map.updateGame();
}
));
}
}
void Map18::special03() {
visitedExit();
send(SoundMessage(STRING["maps.map18.ruins"],
[]() {
g_maps->_mapPos = Common::Point(2, 2);
g_maps->changeMap(0xf03, 3);
}
));
}
void Map18::special04() {
send(SoundMessage(STRING["maps.map18.sign1"]));
}
void Map18::special05() {
send(SoundMessage(STRING["maps.map18.sign2"]));
}
void Map18::special06() {
send(SoundMessage(STRING["maps.map18.sign3"]));
}
void Map18::special07() {
bool hasWonGame = false;
for (uint i = 0; i < g_globals->_party.size(); ++i) {
const Character &c = g_globals->_party[i];
hasWonGame |= (c._flags[13] & CHARFLAG13_80) != 0;
}
if (hasWonGame)
g_events->addView("WonGame");
else
send(SoundMessage(STRING["maps.map18.gates"]));
}
void Map18::special08() {
visitedExit();
send(SoundMessage(
STRING["maps.map18.cave"],
[]() {
g_maps->_mapPos = Common::Point(15, 7);
g_maps->changeMap(0x202, 1);
}
));
}
void Map18::special09() {
g_maps->clearSpecial();
g_globals->_treasure._items[2] = SILVER_KEY_ID;
g_globals->_treasure._trapType = 4;
g_globals->_treasure._container = IRON_BOX;
g_globals->_treasure.setGold(2400);
g_events->addAction(KEYBIND_SEARCH);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,70 @@
/* 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_MAPS_MAP18_H
#define MM1_MAPS_MAP18_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map18 : public Map {
typedef void (Map18:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
const SpecialFn SPECIAL_FN[10] = {
&Map18::special00,
&Map18::special01,
&Map18::special02,
&Map18::special03,
&Map18::special04,
&Map18::special05,
&Map18::special06,
&Map18::special07,
&Map18::special08,
&Map18::special09
};
public:
Map18() : Map(18, "areab1", 0xa00, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,167 @@
/* 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/maps/map19.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 123
#define VAL2 161
#define VAL3 162
#define VAL4 163
#define VAL5 164
#define VAL6 165
#define VAL7 166
#define ANSWER_OFFSET 167
void Map19::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 6; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[57 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map19::special00() {
g_events->addView("IcePrincess");
}
void Map19::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map19.cave"],
[]() {
g_maps->_mapPos = Common::Point(8, 0);
g_maps->changeMap(0xa00, 1);
}
));
}
void Map19::special02() {
visitedExit();
send(SoundMessage(
STRING["maps.map19.stairs_down"],
[]() {
g_maps->_mapPos = Common::Point(7, 1);
g_maps->changeMap(0xf02, 3);
}
));
}
void Map19::special03() {
send(SoundMessage(STRING["maps.map19.carving"]));
}
void Map19::special04() {
if (_data[VAL2])
g_maps->clearSpecial();
_data[VAL2]++;
_data[VAL4] = 10;
_data[VAL5] = 10;
_data[VAL7] = 10;
_data[VAL6] = 7;
encounter();
}
void Map19::special05() {
if (_data[VAL3])
g_maps->clearSpecial();
_data[VAL3]++;
_data[VAL4] = 10;
_data[VAL6] = 7;
_data[VAL5] = 1;
_data[VAL7] = 1;
encounter();
}
void Map19::encounter() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = getRandomNumber(5) + 3;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(_data[VAL7], _data[VAL6]);
enc.addMonster(_data[VAL5], _data[VAL4]);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
void Map19::riddleAnswer(const Common::String &answer) {
Common::String properAnswer;
_data[VAL1] = answer.size();
for (int i = 0; i < 4; ++i)
properAnswer += (_data[ANSWER_OFFSET + i] & 0x7f) + 64;
if (answer.equalsIgnoreCase(properAnswer)) {
InfoMessage msg(
16, 2, STRING["maps.map19.correct"],
[]() {
g_maps->clearSpecial();
if (g_globals->_party.hasItem(DIAMOND_KEY_ID)) {
g_globals->_treasure._items[2] = BRONZE_KEY_ID;
g_events->addAction(KEYBIND_SEARCH);
return;
}
g_globals->_treasure._items[2] = DIAMOND_KEY_ID;
g_events->addAction(KEYBIND_SEARCH);
}
);
msg._delaySeconds = 2;
send(msg);
Sound::sound(SOUND_3);
Sound::sound(SOUND_3);
} else {
g_maps->_mapPos.x = 15;
updateGame();
send(SoundMessage(STRING["maps.map19.incorrect"]));
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP19_H
#define MM1_MAPS_MAP19_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map19 : public Map {
typedef void (Map19:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void encounter();
const SpecialFn SPECIAL_FN[6] = {
&Map19::special00,
&Map19::special01,
&Map19::special02,
&Map19::special03,
&Map19::special04,
&Map19::special05
};
public:
Map19() : Map(19, "areab2", 0x703, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Ice Princess riddle answer
*/
void riddleAnswer(const Common::String &answer);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,206 @@
/* 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/maps/map20.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define CASTLE_STATE 177
void Map20::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 9; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[60 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_walls[g_maps->_mapOffset] != 0xff) {
g_maps->clearSpecial();
enc.execute();
} else if (getRandomNumber(100) != 100) {
none160();
} else {
int id1 = getRandomNumber(5);
int monsterCount = getRandomNumber(13);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, 11);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
}
void Map20::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.map20.stairs_down"],
[]() {
g_maps->_mapPos = Common::Point(1, 15);
g_maps->changeMap(0xc03, 1);
}
));
}
void Map20::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map20.cave"],
[]() {
g_maps->_mapPos = Common::Point(15, 0);
g_maps->changeMap(0x51b, 1);
}
));
}
void Map20::special02() {
visitedExit();
if (_data[CASTLE_STATE] & 0x80) {
goToCastle();
} else if (_data[CASTLE_STATE]) {
_data[CASTLE_STATE] = 0;
} else {
send("View", DrawGraphicMessage(6 + 65));
send(SoundMessage(
STRING["maps.map20.castle"],
[]() {
Map20 &map = *static_cast<Map20 *>(g_maps->_currentMap);
map[CASTLE_STATE] = 0xff;
map.goToCastle();
},
[]() {
Map20 &map = *static_cast<Map20 *>(g_maps->_currentMap);
map[CASTLE_STATE]++;
map.updateGame();
}
));
}
}
void Map20::special03() {
bool hasWhistle = g_globals->_party.hasItem(RUBY_WHISTLE_ID);
if (!hasWhistle) {
send(SoundMessage(STRING["maps.map20.temple"],
[](const Common::KeyState &) {
g_events->focusedView()->close();
}
));
return;
}
send(
SoundMessage(STRING["maps.map20.temple"],
[](const Common::KeyState &) {
g_events->focusedView()->close();
g_events->send(SoundMessage(
STRING["maps.map20.whistle"],
[](const Common::KeyState &ks) {
if (ks.keycode == Common::KEYCODE_0) {
g_events->focusedView()->close();
g_maps->_currentMap->none160();
} else if (ks.keycode == Common::KEYCODE_2) {
g_events->focusedView()->close();
g_events->send(SoundMessage(
STRING["maps.map20.stairs_down"],
[]() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_currCharacter = &g_globals->_party[i];
g_globals->_currCharacter->_flags[0] |= CHARFLAG0_FOUND_CHEST | CHARFLAG0_40;
}
g_maps->_mapPos = Common::Point(8, 8);
g_maps->changeMap(0xf04, 3);
}
));
} else if (ks.keycode >= Common::KEYCODE_1 &&
ks.keycode <= Common::KEYCODE_9) {
g_events->focusedView()->close();
g_maps->_mapPos = Common::Point(8, 5);
g_maps->changeMap(0x604, 1);
}
}
));
}
));
}
void Map20::special04() {
send(SoundMessage(STRING["maps.map20.sign1"]));
}
void Map20::special05() {
send(SoundMessage(STRING["maps.map20.sign2"]));
}
void Map20::special06() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_currCharacter = &g_globals->_party[i];
g_globals->_currCharacter->_flags[5] |= CHARFLAG5_2;
}
SoundMessage info(0, 0, STRING["maps.map20.peak"]);
info._largeMessage = true;
send(info);
}
void Map20::special07() {
g_maps->_mapPos.y = 6;
updateGame();
}
void Map20::special08() {
g_maps->_mapPos.x = 9;
updateGame();
}
void Map20::goToCastle() {
g_maps->_mapPos = Common::Point(15, 8);
g_maps->changeMap(0xa11, 3);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,73 @@
/* 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_MAPS_MAP20_H
#define MM1_MAPS_MAP20_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map20 : public Map {
typedef void (Map20:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
const SpecialFn SPECIAL_FN[9] = {
&Map20::special00,
&Map20::special01,
&Map20::special02,
&Map20::special03,
&Map20::special04,
&Map20::special05,
&Map20::special06,
&Map20::special07,
&Map20::special08
};
public:
Map20() : Map(20, "areab3", 0x101, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Go to the castle
*/
void goToCastle();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,165 @@
/* 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/maps/map21.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define QUESTION_NUM 159
#define TRIVIA_ENABLED 160
#define TRIVIA_COST 500
void Map21::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 8; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[59 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_walls[g_maps->_mapOffset] != 0xff) {
g_maps->clearSpecial();
enc.execute();
} else if (getRandomNumber(100) != 100) {
if (getRandomNumber(200) != 192)
none160();
return;
} else {
int id1 = getRandomNumber(14);
int monsterCount = getRandomNumber(13);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, 11);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
}
void Map21::special00() {
g_maps->clearSpecial();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[7] |= CHARFLAG7_20;
}
SoundMessage msg(
STRING["maps.map21.ghostship"],
[]() {
Game::Encounter &enc = g_globals->_encounters;
enc.clearMonsters();
for (int i = 0; i < 8; ++i)
enc.addMonster(12, 12);
enc.addMonster(13, 12);
for (int i = 9; i < 13; ++i)
enc.addMonster(3, 8);
enc._levelIndex = 80;
enc._encounterType = Game::FORCE_SURPRISED;
enc._manual = true;
enc.execute();
}
);
msg._delaySeconds = 2;
send(msg);
}
void Map21::special01() {
send(SoundMessage(
STRING["maps.map21.free_trivia"],
[]() {
Map21 &map = *static_cast<Map21 *>(g_maps->_currentMap);
map[TRIVIA_ENABLED]++;
}
));
}
void Map21::special02() {
if (_data[TRIVIA_ENABLED])
return;
send(SoundMessage(
STRING["maps.map21.trivia_island"],
[]() {
MM1::Maps::Map &map = *g_maps->_currentMap;
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
g_globals->_currCharacter = &c;
if (g_globals->_currCharacter->_gold >= TRIVIA_COST) {
c._gold -= 500;
g_maps->clearSpecial();
map[TRIVIA_ENABLED]++;
return;
}
}
g_maps->_mapPos.y++;
g_maps->_currentMap->updateGame();
g_events->send(SoundMessage(STRING["maps.map21.not_enough_gold"]));
},
[]() {
g_maps->_mapPos.y++;
g_maps->_currentMap->updateGame();
}
));
}
void Map21::special03() {
askTrivia(0);
}
void Map21::special04() {
askTrivia(g_maps->_mapPos.x - 5);
}
void Map21::askTrivia(int questionNum) {
_data[QUESTION_NUM] = questionNum;
if (_data[TRIVIA_ENABLED]) {
g_maps->clearSpecial();
send("Trivia", GameMessage("TRIVIA", questionNum));
}
}
} // namespace Maps
} // 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_MAPS_MAP21_H
#define MM1_MAPS_MAP21_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map21 : public Map {
typedef void (Map21:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
const SpecialFn SPECIAL_FN[8] = {
&Map21::special00,
&Map21::special01,
&Map21::special02,
&Map21::special03,
&Map21::special04,
&Map21::special04,
&Map21::special04,
&Map21::special04
};
void askTrivia(int questionNum);
public:
Map21() : Map(21, "areab4", 0xd03, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,183 @@
/* 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/maps/map22.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define WHISTLE_GIVEN 107
static const byte MONSTER_ID1[5] = { 13, 12, 13, 12, 11 };
static const byte MONSTER_ID2[5] = { 6, 6, 5, 5, 4 };
void Map22::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 14; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[65 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map22::special00() {
bool hasFlags = false;
for (uint i = 0; i < g_globals->_party.size() && !hasFlags; ++i) {
g_globals->_currCharacter = &g_globals->_party[i];
hasFlags = ((g_globals->_currCharacter->_flags[0] &
(CHARFLAG0_ZAM_CLUE | CHARFLAG0_ZOM_CLUE)) ==
(CHARFLAG0_ZAM_CLUE | CHARFLAG0_ZOM_CLUE));
}
if (!hasFlags) {
none160();
return;
}
Sound::sound(SOUND_3);
InfoMessage msg(STRING["maps.map22.chest"]);
msg._largeMessage = true;
send(msg);
for (uint i = 0; i < g_globals->_party.size() && !hasFlags; ++i) {
Character &c = g_globals->_party[i];
g_globals->_currCharacter = &c;
// Remove the clue flags
c._flags[0] = (c._flags[0] & ~(CHARFLAG0_ZAM_CLUE | CHARFLAG0_ZOM_CLUE)) |
CHARFLAG0_FOUND_CHEST;
// Add amulet to player
if (!c._backpack.full()) {
_data[WHISTLE_GIVEN]++;
c._backpack.add(RUBY_WHISTLE_ID, 200);
break;
}
}
if (!_data[WHISTLE_GIVEN]) {
// Entire party's inventory full. So screw it, replace
// the last item in the last character's backpack
g_globals->_currCharacter->_backpack.removeAt(INVENTORY_COUNT - 1);
g_globals->_currCharacter->_backpack.add(RUBY_WHISTLE_ID, 192);
}
g_globals->_currCharacter->_gold += 5000;
}
void Map22::special01() {
send(SoundMessage(STRING["maps.map22.roadsign"]));
}
void Map22::special02() {
send(SoundMessage(
STRING["maps.map22.wagons"],
[]() {
g_maps->clearSpecial();
if (g_maps->_mapPos.x == 5) {
g_globals->_treasure._items[2] = MERCHANTS_PASS_ID;
g_events->addAction(KEYBIND_SEARCH);
} else {
InfoMessage msg1(
16, 2, STRING["maps.map22.ambush"],
[]() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = g_events->getRandomNumber(3);
int idx = g_events->getRandomNumber(5) - 1;
const int id1 = MONSTER_ID1[idx];
const int id2 = MONSTER_ID2[idx];
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, id2);
enc._levelIndex = 32;
enc._manual = true;
enc._encounterType = Game::FORCE_SURPRISED;
enc.execute();
}
);
msg1._delaySeconds = 2;
g_events->send(msg1);
}
}
));
}
void Map22::special08() {
send(SoundMessage(
STRING["maps.map22.fountain"],
[]() {
switch (g_maps->_mapPos.x) {
case 8:
// Add might
for (uint i = 0; i < g_globals->_party.size(); ++i)
g_globals->_party[i]._might._current += 50;
Sound::sound(SOUND_3);
g_events->send(SoundMessage(STRING["maps.map22.today_might"]));
break;
case 9:
// Add spell levels
for (uint i = 0; i < g_globals->_party.size(); ++i)
g_globals->_party[i]._spellLevel._current += 7;
Sound::sound(SOUND_3);
g_events->send(SoundMessage(STRING["maps.map22.today_spells"]));
break;
default:
// Poison
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._condition & BAD_CONDITION))
c._condition |= POISONED;
}
Sound::sound(SOUND_3);
g_events->send(SoundMessage(STRING["maps.map22.poison"]));
break;
}
}
));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP22_H
#define MM1_MAPS_MAP22_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map22 : public Map {
typedef void (Map22:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special08();
const SpecialFn SPECIAL_FN[14] = {
&Map22::special00,
&Map22::special01,
&Map22::special02,
&Map22::special02,
&Map22::special02,
&Map22::special02,
&Map22::special02,
&Map22::special02,
&Map22::special08,
&Map22::special08,
&Map22::special08,
&Map22::special08,
&Map22::special08,
&Map22::special08
};
public:
Map22() : Map(22, "areac1", 0x304, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,212 @@
/* 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/maps/map23.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 107
#define VAL2 108
void Map23::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 14; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[65 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_maps->clearSpecial();
InfoMessage msg(
14, 2, STRING["maps.map23.look_out"],
[]() {
g_globals->_encounters.execute();
}
);
msg._delaySeconds = 2;
send(msg);
}
void Map23::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.map23.passage"],
[]() {
g_maps->_mapPos = Common::Point(12, 0);
g_maps->changeMap(0x604, 1);
}
));
}
void Map23::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map23.cave"],
[]() {
g_maps->_mapPos = Common::Point(7, 0);
g_maps->changeMap(1, 1);
}
));
}
void Map23::special02() {
g_events->addView("Gypsy");
}
void Map23::special03() {
if (g_globals->_activeSpells._s.levitate) {
Common::String line1 = Common::String::format("%s %s",
STRING["maps.map23.pit"].c_str(),
STRING["maps.map23.levitation"].c_str()
);
send(SoundMessage(line1));
} else {
reduceHP();
Common::String line1 = Common::String::format("%s %s",
STRING["maps.map23.pit"].c_str(),
STRING["maps.map23.ambush"].c_str()
);
SoundMessage msg(line1,
[]() {
g_globals->_encounters.execute();
}
);
msg._delaySeconds = 2;
send(msg);
}
}
void Map23::special08() {
send(SoundMessage(
STRING["maps.map23.column"],
[]() {
g_maps->_mapPos = Common::Point(
g_events->getRandomNumber(15),
g_events->getRandomNumber(15));
g_maps->_currentMap->updateGame();
}
));
}
void Map23::special09() {
send(SoundMessage(
STRING["maps.map23.statues"],
[]() {
Map23 &map = *static_cast<Map23 *>(g_maps->_currentMap);
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
map._states[32]--;
g_maps->_currentState = map._states[32];
enc.clearMonsters();
for (int i = 0; i < 6; ++i)
enc.addMonster(2, 4);
enc._levelIndex = 80;
enc._manual = true;
enc.execute();
}
));
}
void Map23::special10() {
if (_data[VAL1]) {
if (g_maps->_forwardMask != DIRMASK_E) {
g_maps->clearSpecial();
return;
}
} else {
_data[VAL1] = 1;
}
fountain();
}
void Map23::special11() {
if (_data[VAL2]) {
if (g_maps->_forwardMask != DIRMASK_E) {
g_maps->clearSpecial();
return;
}
} else {
_data[VAL2] = 1;
}
fountain();
}
void Map23::special12() {
send(SoundMessage(14, 2, STRING["maps.map23.avalanche"]));
g_maps->_currentState = 209;
_states[g_maps->_mapOffset] = 0xff;
_walls[g_maps->_mapOffset] = 162;
if (g_events->isKeypressPending()) {
send(InfoMessage());
g_maps->clearSpecial();
}
}
void Map23::special13() {
g_maps->clearSpecial();
g_globals->_treasure._container = IRON_BOX;
g_globals->_treasure._items[0] = 171;
g_globals->_treasure._items[1] = 183;
g_globals->_treasure._items[2] = 191;
g_globals->_treasure.setGold(12);
g_events->addAction(KEYBIND_SEARCH);
}
void Map23::fountain() {
send(SoundMessage(
STRING["maps.map23.fountain"],
[]() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
int attrNum = g_events->getRandomNumber(8) - 1;
c.getAttribute(attrNum)._current = 30;
}
g_events->send(InfoMessage(16, 2, STRING["maps.map23.cheers"]));
}
));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,75 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MM1_MAPS_MAP23_H
#define MM1_MAPS_MAP23_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map23 : public Map {
typedef void (Map23:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void fountain();
const SpecialFn SPECIAL_FN[14] = {
&Map23::special00,
&Map23::special01,
&Map23::special02,
&Map23::special03,
&Map23::special03,
&Map23::special03,
&Map23::special03,
&Map23::special03,
&Map23::special08,
&Map23::special09,
&Map23::special10,
&Map23::special11,
&Map23::special12,
&Map23::special13
};
public:
Map23() : Map(23, "areac2", 0xa11, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,171 @@
/* 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/maps/map24.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 91
void Map24::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 10; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[61 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map24::special00() {
send(SoundMessage(STRING["maps.map24.roadsign"]));
}
void Map24::special01() {
SoundMessage msg(
STRING["maps.map24.kilburn"],
[]() {
Map24 &map = *static_cast<Map24 *>(g_maps->_currentMap);
if (!map.addItem(MAP_OF_DESERT_ID)) {
g_maps->clearSpecial();
map.none160();
}
}
);
msg._largeMessage = true;
send(msg);
}
void Map24::special02() {
if (_data[VAL1]) {
send(SoundMessage(
STRING["maps.map24.wyvern_eye"],
[]() {
Map24 &map = *static_cast<Map24 *>(g_maps->_currentMap);
map.addItem(WYVERN_EYE_ID);
}
));
} else {
send(SoundMessage(
STRING["maps.map24.lair"],
[]() {
Map24 &map = *static_cast<Map24 *>(g_maps->_currentMap);
Game::Encounter &enc = g_globals->_encounters;
map[VAL1]++;
int monsterCount = g_events->getRandomNumber(4) + 3;
enc.clearMonsters();
enc.addMonster(6, 8);
for (int i = 1; i < monsterCount; ++i)
enc.addMonster(14, 7);
enc._manual = true;
enc._encounterType = Game::FORCE_SURPRISED;
enc._levelIndex = 40;
enc.execute();
}
));
}
}
void Map24::special03() {
g_maps->clearSpecial();
SoundMessage msg(
STRING["maps.map24.wyverns"],
[]() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = g_events->getRandomNumber(4) + 3;
enc.clearMonsters();
for (int i = 1; i < monsterCount; ++i)
enc.addMonster(14, 7);
enc._manual = true;
enc._encounterType = Game::FORCE_SURPRISED;
enc._levelIndex = 40;
enc.execute();
}
);
msg._delaySeconds = 3;
send(msg);
}
void Map24::special08() {
send(SoundMessage(STRING["maps.map24.sign"]));
}
void Map24::special09() {
send(SoundMessage(
STRING["maps.map24.hermit"],
[]() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._backpack.clear();
for (int j = 0; j < INVENTORY_COUNT; ++j)
c._backpack.add(USELESS_ITEM_ID, 0);
}
Character &c = g_globals->_party[0];
g_globals->_currCharacter = &c;
c._backpack[0]._id = PIRATES_MAP_A_ID;
c._backpack[1]._id = PIRATES_MAP_B_ID;
g_maps->clearSpecial();
g_maps->_currentMap->none160();
}
));
}
bool Map24::addItem(byte itemId) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
g_globals->_currCharacter = &c;
if (!c._backpack.full()) {
c._backpack.add(itemId, 20);
return false;
}
}
g_events->send(SoundMessage(STRING["maps.map24.backpacks_full"]));
Sound::sound(SOUND_3);
return true;
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,71 @@
/* 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_MAPS_MAP24_H
#define MM1_MAPS_MAP24_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map24 : public Map {
typedef void (Map24:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special08();
void special09();
const SpecialFn SPECIAL_FN[10] = {
&Map24::special00,
&Map24::special01,
&Map24::special02,
&Map24::special03,
&Map24::special03,
&Map24::special03,
&Map24::special03,
&Map24::special03,
&Map24::special08,
&Map24::special09
};
public:
Map24() : Map(24, "areac3", 0x904, 1) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Adds an item to the party
*/
static bool addItem(byte itemId);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,194 @@
/* 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/maps/map25.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map25::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 3; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[54 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
switch (_walls[g_maps->_mapOffset]) {
case 0:
if (getRandomNumber(100) == 100) {
Game::Encounter &enc = g_globals->_encounters;
Character &c = g_globals->_party[0];
g_globals->_currCharacter = &c;
int val = getRandomNumber((c._level >= 12 ? 14 : c._level) + 2);
int monsterCount = getRandomNumber((val < 15) ? 13 : 4);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(val, 11);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
} else {
switch (getRandomNumber(100)) {
case 99:
send(SoundMessage(STRING["maps.map25.volcano"]));
reduceHP();
Sound::sound(SOUND_3);
break;
case 100: {
SoundMessage msg(
STRING["maps.map25.pirates"],
[]() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = g_events->getRandomNumber(8) + 4;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(12, 12);
enc._levelIndex = 64;
enc._manual = true;
enc.execute();
}
);
msg._delaySeconds = 3;
send(msg);
break;
}
default:
none160();
break;
}
}
break;
case 0x55:
if (g_maps->_mapPos.y < 9) {
nativesAttack();
} else {
if (g_maps->_mapPos.x >= 10) {
SoundMessage msg(STRING["maps.map25.weeping"]);
if (getRandomNumber(100) >= 99) {
msg._delaySeconds = 3;
msg._callback = []() {
g_globals->_encounters.execute();
};
}
send(msg);
} else if (getRandomNumber(100) >= 99) {
g_globals->_encounters.execute();
}
}
break;
default:
send(SoundMessage(
STRING["maps.map25.ship"],
[]() {
g_maps->clearSpecial();
if (g_maps->_mapOffset == 216) {
g_events->send(SoundMessage(STRING["maps.map25.jolly_raven"]));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_currCharacter = &g_globals->_party[i];
g_globals->_currCharacter->_flags[7] |= CHARFLAG7_10;
}
g_globals->_treasure.setGems(20);
} else {
g_globals->_activeSpells._s.cursed = 10;
g_globals->_encounters.execute();
}
}
));
break;
}
}
void Map25::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.map25.portal"],
[]() {
g_maps->_mapPos = Common::Point(12, 4);
g_maps->changeMap(0x201, 3);
}
));
}
void Map25::special01() {
visitedExit();
if (g_globals->_party.hasItem(CORAL_KEY_ID)) {
send(InfoMessage(
STRING["maps.map25.key"],
[]() {
g_maps->_mapPos = Common::Point(7, 5);
g_maps->changeMap(0x212, 1);
}
));
}
}
void Map25::special02() {
nativesAttack();
}
void Map25::nativesAttack() {
SoundMessage msg(
STRING["maps.map25.natives"],
[]() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = g_events->getRandomNumber(6) + 7;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(9, 12);
g_maps->clearSpecial();
enc._levelIndex = 64;
enc._manual = true;
enc.execute();
}
);
msg._delaySeconds = 3;
send(msg);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP25_H
#define MM1_MAPS_MAP25_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map25 : public Map {
typedef void (Map25:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void nativesAttack();
const SpecialFn SPECIAL_FN[3] = {
&Map25::special00,
&Map25::special01,
&Map25::special02
};
public:
Map25() : Map(25, "areac4", 0xf04, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,122 @@
/* 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/maps/map26.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 67
void Map26::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 4; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[55 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
desert();
}
void Map26::special00() {
if (_data[VAL1]) {
addFlag();
} else {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
if (g_globals->_party[i]._flags[2] & CHARFLAG2_2) {
g_maps->clearSpecial();
none160();
return;
}
}
SoundMessage msg(
STRING["maps.map26.scorpion"],
[]() {
Map26 &map = *static_cast<Map26 *>(g_maps->_currentMap);
Game::Encounter &enc = g_globals->_encounters;
map[VAL1]++;
enc.clearMonsters();
enc.addMonster(1, 12);
for (int i = 1; i < 14; ++i)
enc.addMonster(5, 5);
enc._levelIndex = 80;
enc._manual = true;
enc._encounterType = Game::FORCE_SURPRISED;
enc.execute();
}
);
msg._delaySeconds = 4;
send(msg);
}
}
void Map26::special01() {
_data[VAL1] = 0;
none160();
}
void Map26::special02() {
send(SoundMessage(
STRING["maps.map26.trading_post"],
[]() {
Character &c = g_globals->_party[0];
if (c._backpack.empty()) {
g_events->send(SoundMessage(STRING["maps.map26.nothing_to_trade"]));
} else {
c._backpack[0]._id = CACTUS_NECTAR_ID;
c._backpack[0]._charges = 10;
}
}
));
}
void Map26::special03() {
send(SoundMessage(STRING["maps.map26.kilburn"]));
}
void Map26::addFlag() {
for (uint i = 0; i < g_globals->_party.size(); ++i)
g_globals->_party[i]._flags[2] |= CHARFLAG2_2;
g_maps->clearSpecial();
none160();
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,59 @@
/* 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_MAPS_MAP26_H
#define MM1_MAPS_MAP26_H
#include "mm/mm1/maps/map_desert.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map26 : public MapDesert {
typedef void (Map26:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void addFlag();
const SpecialFn SPECIAL_FN[4] = {
&Map26::special00,
&Map26::special01,
&Map26::special02,
&Map26::special03
};
public:
Map26() : MapDesert(26, "aread1", 0x505, 2, 247, MapDesert::RND_FULL) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,137 @@
/* 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/maps/map27.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map27::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 6; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[57 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_walls[g_maps->_mapOffset] == 0xff) {
desert();
} else {
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
}
void Map27::special00() {
send(SoundMessage(STRING["maps.map27.pool"]));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._flags[11] & CHARFLAG11_PERSONALITY)) {
c._flags[11] |= CHARFLAG11_PERSONALITY;
if (c._personality._base < 30) {
c._personality._current = c._personality._base =
c._personality._base + 4;
}
}
}
}
void Map27::special01() {
send(SoundMessage(STRING["maps.map27.retreat"]));
}
void Map27::special02() {
send(SoundMessage(
0, 1, clerics('N'),
0, 2, STRING["maps.map27.cured"]
));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (c._condition != ERADICATED) {
c._condition = 0;
c._hpCurrent = c._hpMax = c._hp;
}
}
g_maps->clearSpecial();
}
void Map27::special03() {
send(SoundMessage(
0, 1, clerics('E'),
0, 2, STRING["maps.map27.alignment"]
));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._alignment = c._alignmentInitial;
}
}
void Map27::special04() {
send(SoundMessage(
0, 1, clerics('W'),
0, 2, STRING["maps.map27.curses"]
));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
for (int invNum = 0; invNum < 2; ++invNum) {
Inventory &inv = (invNum == 0) ? c._equipped : c._backpack;
for (int itemNum = (int)inv.size() - 1; itemNum >= 0; --itemNum) {
Item *item = g_globals->_items.getItem(c._equipped[itemNum]._id);
if (item->_constBonus_id == EQUIP_CURSED)
inv.removeAt(itemNum);
}
}
}
g_globals->_activeSpells._s.cursed = 0;
}
void Map27::special05() {
send(SoundMessage(STRING["maps.map27.sign"]));
}
Common::String Map27::clerics(char name) {
return Common::String::format("%s %c.",
STRING["maps.map27.clerics"].c_str(), name);
}
} // namespace Maps
} // 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_MAPS_MAP27_H
#define MM1_MAPS_MAP27_H
#include "mm/mm1/maps/map_desert.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map27 : public MapDesert {
typedef void (Map27:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
Common::String clerics(char name);
const SpecialFn SPECIAL_FN[6] = {
&Map27::special00,
&Map27::special01,
&Map27::special02,
&Map27::special03,
&Map27::special04,
&Map27::special05
};
public:
Map27() : MapDesert(27, "aread2", 0xb05, 2, 66, MapDesert::RND_BASIC) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,174 @@
/* 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/maps/map28.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/data/locations.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 63
#define VAL2 64
void Map28::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 3; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[54 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (g_maps->_mapPos.x >= 7) {
g_maps->clearSpecial();
g_globals->_encounters.execute();
} else {
send(SoundMessage(
STRING["maps.map28.tree"],
[]() {
Map28 &map = *static_cast<Map28 *>(g_maps->_currentMap);
if (!map[VAL2]) {
g_events->send(SoundMessage(STRING["maps.map28.nothing"]));
} else {
g_maps->clearSpecial();
map[VAL1]++;
int val = g_events->getRandomNumber(10);
switch (val) {
case 1:
g_events->send(SoundMessage(STRING["maps.map28.nothing"]));
break;
case 2:
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._food = MIN((int)c._food + 5, MAX_FOOD);
}
g_events->send(SoundMessage(STRING["maps.map28.food"]));
break;
case 3:
map.setCondition(POISONED);
map.reduceHpBase();
g_events->send(SoundMessage(STRING["maps.map28.thorns"]));
break;
case 4:
if (g_globals->_activeSpells._s.levitate) {
g_events->send(SoundMessage(STRING["maps.map28.nothing"]));
} else {
map.reduceHpBase();
map.reduceHpBase();
g_events->send(SoundMessage(STRING["maps.map28.you_fell"]));
}
break;
case 5:
g_events->send(SoundMessage(STRING["maps.map28.lightning"]));
break;
case 6:
map.setCondition(DISEASED);
map.reduceHpBase();
g_events->send(SoundMessage(STRING["maps.map28.lightning"]));
break;
case 7:
if (!g_globals->_activeSpells._s.psychic_protection) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._sp._current = 0;
}
}
g_events->send(SoundMessage(STRING["maps.map28.flash"]));
break;
case 8:
g_events->send(SoundMessage(STRING["maps.map28.poof"]));
g_maps->_mapPos = Common::Point(
g_events->getRandomNumber(15),
g_events->getRandomNumber(15));
map.updateGame();
break;
default:
g_globals->_activeSpells._s.cursed = val;
break;
}
}
}
));
}
}
void Map28::special00() {
g_events->addView("Arenko");
}
void Map28::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map28.cave"],
[]() {
g_maps->_mapPos = Common::Point(8, 8);
g_maps->changeMap(0x601, 1);
}
));
}
void Map28::special02() {
send(SoundMessage(STRING["maps.map28.sign"]));
}
void Map28::setCondition(byte condition) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (getRandomNumber(3) == 2 && !(c._condition & BAD_CONDITION))
c._condition = condition;
}
}
void Map28::reduceHpBase() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._hpCurrent /= 2;
}
}
} // namespace Maps
} // 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_MAPS_MAP28_H
#define MM1_MAPS_MAP28_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map28 : public Map {
typedef void (Map28:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void setCondition(byte condition);
void reduceHpBase();
const SpecialFn SPECIAL_FN[3] = {
&Map28::special00,
&Map28::special01,
&Map28::special02
};
public:
Map28() : Map(28, "aread3", 0x106, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,218 @@
/* 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/maps/map29.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define ANSWER_OFFSET 67
#define BEAST_FLAG 110
void Map29::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 4; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[55 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
switch (_walls[g_maps->_mapOffset]) {
case 0:
if (getRandomNumber(50) == 50) {
int id1 = getRandomNumber(16);
int monsterCount = getRandomNumber(id1 < 15 ? 13 : 4);
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, 11);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
} else {
none160();
}
break;
case 0xaa:
if (g_maps->_forwardMask == DIRMASK_W)
checkPartyDead();
else
// TODO: This key doesn't seem to be used by game
g_events->addKeypress((Common::KeyCode)149);
break;
default:
g_maps->clearSpecial();
enc.execute();
break;
}
}
void Map29::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.map29.algary"],
[]() {
g_maps->_mapPos = Common::Point(8, 15);
g_maps->changeMap(0x203, 1);
}
));
}
void Map29::special01() {
if (_data[BEAST_FLAG]) {
g_maps->clearSpecial();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[2] |= CHARFLAG2_4;
}
} else {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (c._flags[2] & CHARFLAG2_4)
return;
}
send(SoundMessage(
STRING["maps.map29.beast"],
[]() {
g_maps->_mapPos = Common::Point(12, 12);
g_maps->_currentMap->updateGame();
},
[]() {
Game::Encounter &enc = g_globals->_encounters;
Map29 &map = *static_cast<Map29 *>(g_maps->_currentMap);
g_events->close();
map[BEAST_FLAG]++;
enc.clearMonsters();
enc.addMonster(3, 12);
for (int i = 1; i < 13; ++i)
enc.addMonster(3, 5);
enc._manual = true;
enc._encounterType = Game::FORCE_SURPRISED;
enc._levelIndex = 80;
enc.execute();
}
));
}
}
void Map29::special02() {
if (!g_globals->_party.hasItem(B_QUEEN_IDOL_ID) ||
!g_globals->_party.hasItem(W_QUEEN_IDOL_ID)) {
begone();
} else {
g_events->addView("Chess");
}
}
void Map29::special03() {
SoundMessage msg(
STRING["maps.map29.attack"],
[]() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = g_events->getRandomNumber(5) + 6;
g_maps->clearSpecial();
enc.clearMonsters();
enc.addMonster(11, 12);
for (int i = 1; i < monsterCount; ++i)
enc.addMonster(1, 7);
enc._manual = true;
enc._encounterType = Game::FORCE_SURPRISED;
enc._levelIndex = 80;
enc.execute();
}
);
msg._delaySeconds = 4;
send(msg);
}
void Map29::chessAnswer(const Common::String &answer) {
Common::String properAnswer;
for (int i = 0; i < 22; ++i)
properAnswer += _data[ANSWER_OFFSET + i] - 48;
if (answer.equalsIgnoreCase(properAnswer)) {
redrawGame();
InfoMessage msg(
16, 2, STRING["maps.map19.correct"],
[]() {
MM1::Maps::Map29 &map29 = *static_cast<MM1::Maps::Map29 *>(g_maps->_currentMap);
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._exp += 25000;
}
g_maps->_mapPos.y = 7;
map29.updateGame();
}
);
msg._delaySeconds = 2;
send(msg);
Sound::sound(SOUND_3);
Sound::sound(SOUND_3);
} else {
begone();
}
}
void Map29::begone() {
g_maps->_mapPos.y = 7;
SoundMessage msg(STRING["maps.map29.begone"],
[]() {
g_maps->_currentMap->updateGame();
}
);
msg._delaySeconds = 2;
send(msg);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,66 @@
/* 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_MAPS_MAP29_H
#define MM1_MAPS_MAP29_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map29 : public Map {
typedef void (Map29:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
const SpecialFn SPECIAL_FN[4] = {
&Map29::special00,
&Map29::special01,
&Map29::special02,
&Map29::special03
};
void begone();
public:
Map29() : Map(29, "aread4", 0x801, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Chess answer handler
*/
void chessAnswer(const Common::String &answer);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,155 @@
/* 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/maps/map30.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
static const byte MONSTER_ID1[8] = { 2, 3, 8, 10, 14, 16, 17, 7 };
static const byte MONSTER_ID2[8] = { 5, 6, 3, 8, 10, 12, 12, 12 };
void Map30::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 4; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[55 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_walls[g_maps->_mapOffset] != 0xff) {
g_maps->clearSpecial();
int monsterCount = getRandomNumber(8) + 6;
int idx = getRandomNumber(8) - 1;
byte id1 = MONSTER_ID1[idx];
byte id2 = MONSTER_ID2[idx];
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, id2);
enc._manual = true;
enc._levelIndex = 96;
enc.execute();
return;
}
desert();
}
void Map30::special00() {
visitedExit();
send(SoundMessage(
STRING["maps.map30.passage"],
[]() {
g_maps->_mapPos = Common::Point(15, 7);
g_maps->changeMap(0x802, 1);
}
));
}
void Map30::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map30.ruins"],
[]() {
g_maps->_mapPos = Common::Point(7, 15);
g_maps->changeMap(0x107, 3);
}
));
}
void Map30::special02() {
g_events->addView("Giant");
}
void Map30::special03() {
send(SoundMessage(
STRING["maps.map30.hourglass"],
[]() {
g_maps->clearSpecial();
Sound::sound(SOUND_3);
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._age = MAX((int)c._age - 20, 18);
}
g_maps->_currentMap->none160();
}
));
}
Common::String Map30::worthiness() {
Character &c = *g_globals->_currCharacter;
if ((c._flags[1] & ~CHARFLAG1_WORTHY) == ~CHARFLAG1_WORTHY)
return worthy();
else
return unworthy();
}
Common::String Map30::worthy() {
Character &c = *g_globals->_currCharacter;
int val = ((c._worthiness + 1) / 2) * 256;
c._exp += val;
Common::String line = Common::String::format(
STRING["maps.map30.worthy"].c_str(), '0' + (c._worthiness / 5));
line = Common::String::format("%s%d %s",
line.c_str(), val, STRING["maps.map30.experience"].c_str());
if (c._worthiness & 0x80) {
int attrNum = getRandomNumber(7) - 1;
line += Common::String::format(", +3 %s",
STRING[Common::String::format("maps.map30.attributes.%d", attrNum)].c_str());
AttributePair &attrib = c.getAttribute(attrNum);
if (attrib._base < 43)
attrib._current = attrib._base = attrib._base + 3;
}
c._worthiness = 0;
return line;
}
Common::String Map30::unworthy() {
return STRING["maps.map30.unworthy"];
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,66 @@
/* 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_MAPS_MAP30_H
#define MM1_MAPS_MAP30_H
#include "mm/mm1/maps/map_desert.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map30 : public MapDesert {
typedef void (Map30:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
const SpecialFn SPECIAL_FN[4] = {
&Map30::special00,
&Map30::special01,
&Map30::special02,
&Map30::special03
};
Common::String worthy();
Common::String unworthy();
public:
Map30() : MapDesert(30, "areae1", 0x112, 2, 137, MapDesert::RND_FULL) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Handles worthiness, returning resulting message
*/
Common::String worthiness();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,139 @@
/* 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/maps/map31.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 79
void Map31::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 7; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[58 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_walls[g_maps->_mapOffset] != 0xff) {
if (getRandomNumber(100) < 25) {
g_maps->clearSpecial();
g_globals->_encounters.execute();
} else {
send(SoundMessage(STRING["maps.map31.poof"]));
g_maps->_mapPos = Common::Point(
getRandomNumber(15), getRandomNumber(15));
updateGame();
}
return;
}
desert();
}
void Map31::special00() {
send(SoundMessage(STRING["maps.map31.device"]));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._flags[11] & CHARFLAG11_GOT_INTELLIGENCE)) {
c._flags[11] |= CHARFLAG11_GOT_INTELLIGENCE;
c._intelligence._current = c._intelligence._base =
MIN(c._intelligence._base + 4, 30);
}
}
}
void Map31::special01() {
g_events->addView("Alien");
}
void Map31::special02() {
if (_data[VAL1]) {
none160();
} else {
encounter();
}
}
void Map31::special06() {
if (_data[VAL1]) {
g_globals->_treasure._items[2] = LASER_BLASTER_ID;
g_events->addAction(KEYBIND_SEARCH);
} else {
none160();
}
}
void Map31::encounter() {
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = getRandomNumber(7) + 5;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(8, 12);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
void Map31::hostile() {
SoundMessage msg(
STRING["maps.map31.flash"],
[]() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_party[i]._condition = ERADICATED;
}
}
);
msg._delaySeconds = 2;
send(msg);
}
void Map31::neutral() {
_data[VAL1]--;
encounter();
}
void Map31::friendly() {
send(SoundMessage(STRING["maps.map31.varnlings"]));
g_maps->clearSpecial();
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,81 @@
/* 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_MAPS_MAP31_H
#define MM1_MAPS_MAP31_H
#include "mm/mm1/maps/map_desert.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map31 : public MapDesert {
typedef void (Map31:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special06();
const SpecialFn SPECIAL_FN[7] = {
&Map31::special00,
&Map31::special01,
&Map31::special02,
&Map31::special02,
&Map31::special02,
&Map31::special02,
&Map31::special06
};
public:
Map31() : MapDesert(31, "areae2", 0x706, 2, 80, MapDesert::RND_BASIC) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Starts an encounter
*/
void encounter();
/**
* Called if you attack the alien
*/
void hostile();
/**
* Called if you specify neutral for alien
*/
void neutral();
/**
* Called if you select to act friendly to the alien
*/
void friendly();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,148 @@
/* 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/maps/map32.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 75
#define VAL2 111
#define PASSWORD_INDEX 393
void Map32::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 6; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[57 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_walls[g_maps->_mapOffset] == 0x55 && g_maps->_mapPos.x < 13) {
send(SoundMessage(STRING["maps.map32.music"]));
} else {
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
}
void Map32::special00() {
visitedExit();
if (!g_globals->_party.hasItem(DIAMOND_KEY_ID)) {
send(SoundMessage(STRING["maps.map32.door"]));
} else {
send(SoundMessage(
0, 1, STRING["maps.map32.door"],
0, 2, STRING["maps.map32.key"],
[]() {
g_maps->_mapPos = Common::Point(7, 0);
g_maps->changeMap(0xb1a, 3);
}
));
}
}
void Map32::special01() {
g_events->addView("Lion");
}
void Map32::special02() {
visitedExit();
if (_data[VAL2] & 0x80) {
g_maps->_mapPos = Common::Point(0, 7);
g_maps->changeMap(0xb07, 3);
} else if (_data[VAL2] != 0) {
_data[VAL2] = 0;
} else {
send("View", DrawGraphicMessage(65 + 6));
send(SoundMessage(
STRING["maps.map32.castle"],
[]() {
Map32 &map = *static_cast<Map32 *>(g_maps->_currentMap);
map[VAL2] = 0xff;
map.updateGame();
},
[]() {
Map32 &map = *static_cast<Map32 *>(g_maps->_currentMap);
map[VAL2]++;
map.updateGame();
}
));
}
}
void Map32::special04() {
if (_data[PASSWORD_INDEX] & 0x80) {
_data[PASSWORD_INDEX] = getRandomNumber(7) - 1;
}
Common::String line2 = Common::String::format("\"%s %s",
STRING[Common::String::format("maps.map32.passwords.%d",
_data[PASSWORD_INDEX])].c_str(),
STRING["maps.map32.password"].c_str()
);
send(SoundMessage(
0, 1, STRING["maps.map32.heratio"],
0, 2, line2
));
}
void Map32::special05() {
if (!_data[VAL1]) {
g_maps->_mapPos.x--;
updateGame();
}
}
void Map32::passwordEntered(const Common::String &password) {
if ((_data[PASSWORD_INDEX] & 0x80) ||
!password.equalsIgnoreCase(STRING[Common::String::format("maps.map32.passwords.%d",
_data[PASSWORD_INDEX])])) {
g_maps->_mapPos.x--;
updateGame();
} else {
g_events->send(SoundMessage(STRING["maps.map32.correct"]));
_data[VAL1]++;
g_maps->clearSpecial();
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,66 @@
/* 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_MAPS_MAP32_H
#define MM1_MAPS_MAP32_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map32 : public Map {
typedef void (Map32:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special04();
void special05();
const SpecialFn SPECIAL_FN[6] = {
&Map32::special00,
&Map32::special01,
&Map32::special02,
&Map32::special01,
&Map32::special04,
&Map32::special05
};
public:
Map32() : Map(32, "areae3", 0xb1a, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Password given to lion
*/
void passwordEntered(const Common::String &password);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,214 @@
/* 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/maps/map33.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 71
#define VAL2 72
static const byte MONSTER_IDS11[10] = {
15, 16, 15, 16, 14, 15, 4, 5, 3, 2
};
static const byte MONSTER_IDS12[10] = {
7, 7, 8, 8, 9, 9, 10, 10, 10, 10
};
static const byte MONSTER_IDS21[12] = {
2, 12, 7, 5, 5, 1, 2, 3, 1, 4, 5, 2
};
static const byte MONSTER_IDS22[12] = {
5, 18, 10, 10, 11, 11, 11, 14, 13, 16, 15, 16
};
void Map33::special() {
Game::Encounter &enc = g_globals->_encounters;
// Scan for special actions on the map cell
for (uint i = 0; i < 5; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[56 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_walls[g_maps->_mapOffset] == 0xff) {
if (g_maps->_mapPos.x >= 6 || g_maps->_mapPos.y < 5 ||
g_maps->_mapPos.y >= 8) {
if (g_maps->_mapPos.y < 5 && g_maps->_forwardMask != DIRMASK_N) {
g_events->addKeypress((Common::KeyCode)149);
} else {
InfoMessage msg(0, 1, STRING["maps.map33.slime"]);
Sound::sound(SOUND_2);
switch (getRandomNumber(200)) {
case 198: {
Character &c = g_globals->_party[
getRandomNumber(g_globals->_party.size() - 1)
];
if (!(c._condition & BAD_CONDITION)) {
c._condition |= SILENCED | PARALYZED | UNCONSCIOUS;
c._hpCurrent = 0;
msg._lines.push_back(Line(0, 2, STRING["maps.map33.quicksand"]));
Sound::sound(SOUND_3);
}
break;
}
case 199:
case 200: {
int monsterCount = getRandomNumber(10) + 3;
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i) {
int idx = getRandomNumber(12) - 1;
enc.addMonster(MONSTER_IDS21[idx], MONSTER_IDS22[idx]);
}
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
break;
}
default:
break;
}
}
} else {
send(SoundMessage(STRING["maps.map33.tombstones"]));
}
} else {
if (g_maps->_mapPos.y < 5) {
int monsterCount = getRandomNumber(6) + 2;
int idx = getRandomNumber(6) - 1;
int id1 = MONSTER_IDS11[idx];
int id2 = MONSTER_IDS12[idx];
enc.clearMonsters();
for (int i = 0; i < monsterCount; ++i)
enc.addMonster(id1, id2);
enc._manual = true;
enc._levelIndex = 64;
}
g_maps->clearSpecial();
enc.execute();
}
}
void Map33::special00() {
send(SoundMessage(
STRING["maps.map33.meeting"],
[]() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
enc.clearMonsters();
for (int i = 0; i < 10; ++i)
enc.addMonster(MONSTER_IDS11[i], MONSTER_IDS12[i]);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
));
}
void Map33::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map33.building"],
[]() {
g_maps->_mapPos = Common::Point(0, 0);
g_maps->changeMap(0xf01, 3);
}
));
}
void Map33::special02() {
_data[VAL1] = 12;
_data[VAL2] = 8;
search(STRING["maps.map33.coffin"]);
}
void Map33::special03() {
_data[VAL1] = 10;
_data[VAL2] = 10;
search(STRING["maps.map33.crypt"]);
}
void Map33::special04() {
g_maps->clearSpecial();
send(SoundMessage(
STRING["maps.map33.corpse"],
[]() {
SoundMessage msg(
STRING["maps.map33.thanks"],
[](const Common::KeyState &) {
g_events->close();
g_globals->_treasure.setGems(50);
g_events->addAction(KEYBIND_SEARCH);
}
);
g_events->send(msg);
}
));
}
void Map33::search(const Common::String &msg) {
send(SoundMessage(
msg,
[]() {
Map33 &map = *static_cast<Map33 *>(g_maps->_currentMap);
Game::Encounter &enc = g_globals->_encounters;
int monsterCount = g_events->getRandomNumber(6) + 7;
enc.clearMonsters();
enc.addMonster(map[VAL1], map[VAL2]);
for (int i = 1; i < monsterCount; ++i)
enc.addMonster(10, 7);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
));
}
} // namespace Maps
} // 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_MAPS_MAP33_H
#define MM1_MAPS_MAP33_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map33 : public Map {
typedef void (Map33:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void search(const Common::String &msg);
const SpecialFn SPECIAL_FN[5] = {
&Map33::special00,
&Map33::special01,
&Map33::special02,
&Map33::special03,
&Map33::special04
};
public:
Map33() : Map(33, "areae4", 0x11b, 2) {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,176 @@
/* 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/maps/map34.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 1238
void Map34::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 23; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[74 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map34::special00() {
g_events->addView("ChildPrisoner");
}
void Map34::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.passage_outside1"],
[]() {
g_maps->_mapPos = Common::Point(7, 15);
g_maps->changeMap(0xf01, 2);
}
));
}
void Map34::special02() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if ((c._flags[13] & CHARFLAG13_ALAMAR) || c.hasItem(EYE_OF_GOROS_ID)) {
g_maps->clearSpecial();
g_globals->_encounters.execute();
return;
}
}
Sound::sound2(SOUND_2);
InfoMessage msg(0, 0, STRING["maps.map34.alamar"]);
msg._largeMessage = true;
msg._keyCallback = [](const Common::KeyState &) {
g_events->close();
g_globals->_treasure._items[2] = EYE_OF_GOROS_ID;
g_events->addAction(KEYBIND_SEARCH);
};
send(msg);
}
void Map34::special03() {
send(SoundMessage(STRING["maps.map34.message3"]));
}
void Map34::special04() {
send(SoundMessage(STRING["maps.map34.message4"]));
}
void Map34::special05() {
send(SoundMessage(STRING["maps.map34.message5"]));
}
void Map34::special06() {
send(SoundMessage(STRING["maps.map34.message6"]));
}
void Map34::special07() {
if (g_globals->_party.hasItem(GOLD_KEY_ID)) {
checkPartyDead();
} else {
send(SoundMessage(STRING["maps.map34.door"]));
g_maps->_mapPos.y--;
updateGame();
}
}
void Map34::special08() {
send(SoundMessage(STRING["maps.map34.statue"]));
}
void Map34::special09() {
send(SoundMessage(STRING["maps.map34.banner"]));
}
void Map34::special10() {
g_maps->_mapPos.x++;
g_maps->_mapPos.y--;
updateGame();
}
void Map34::special12() {
g_maps->_mapPos.x--;
g_maps->_mapPos.y++;
updateGame();
}
void Map34::special13() {
send(SoundMessage(STRING["maps.map34.sign"]));
}
void Map34::special16() {
send(SoundMessage(STRING["maps.map34.machine"]));
}
void Map34::special17() {
send(SoundMessage(STRING["maps.map34.box"]));
_data[MAP_47] = 9;
_data[VAL1] = 9;
}
void Map34::special18() {
send(SoundMessage(STRING["maps.map34.message1"]));
}
void Map34::special19() {
send(SoundMessage(STRING["maps.map34.message2"]));
}
void Map34::special20() {
if (_data[VAL1]) {
g_maps->clearSpecial();
g_globals->_encounters.execute();
} else {
none160();
}
}
void Map34::special21() {
send(SoundMessage(STRING["maps.map34.message7"]));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,92 @@
/* 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_MAPS_MAP34_H
#define MM1_MAPS_MAP34_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map34 : public Map {
typedef void (Map34:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special12();
void special13();
void special16();
void special17();
void special18();
void special19();
void special20();
void special21();
const SpecialFn SPECIAL_FN[23] = {
&Map34::special00,
&Map34::special01,
&Map34::special02,
&Map34::special03,
&Map34::special04,
&Map34::special05,
&Map34::special06,
&Map34::special07,
&Map34::special08,
&Map34::special09,
&Map34::special10,
&Map34::special10,
&Map34::special12,
&Map34::special13,
&Map34::special13,
&Map34::special13,
&Map34::special16,
&Map34::special17,
&Map34::special18,
&Map34::special19,
&Map34::special20,
&Map34::special21,
&Map34::special01
};
public:
Map34() : Map(34, "doom", 0x706, 3, "Castle Doom") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,199 @@
/* 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/maps/map35.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 29
#define VAL2 47
static const byte MATCH_ITEMS[7] = {
0, 0,241, 0, 0, 0, 0
};
static const byte MATCH_FLAGS[8] = {
1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80
};
static const uint16 QUEST_EXPERIENCE[7] = {
1000, 2000, 3000, 4000, 6000, 8000, 10000
};
void Map35::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 11; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[62 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map35::special00() {
g_events->addView("ManPrisoner");
}
void Map35::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map35.exit"],
[]() {
g_maps->_mapPos = Common::Point(14, 10);
g_maps->changeMap(0xa00, 2);
}
));
}
void Map35::special02() {
visitedExit();
g_maps->_mapPos = Common::Point(14, 9);
g_maps->changeMap(0xa00, 2);
send(SoundMessage(STRING["maps.map35.slide"]));
}
void Map35::special03() {
send(SoundMessage(STRING["maps.map35.message"]));
}
void Map35::special04() {
if (!g_globals->_party.hasItem(MERCHANTS_PASS_ID)) {
g_maps->_mapPos.y++;
updateGame();
send(SoundMessage(STRING["maps.map35.merchant_pass"]));
}
}
void Map35::special05() {
updateFlags();
send("View", DrawGraphicMessage(7 + 65));
send("Inspectron", GameMessage("DISPLAY"));
}
void Map35::special06() {
g_maps->clearSpecial();
g_globals->_treasure.setGems(30);
g_events->addAction(KEYBIND_SEARCH);
}
void Map35::special07() {
send(SoundMessage(STRING["maps.map35.vault"]));
_data[VAL1] = 30;
_data[VAL2] = 7;
}
void Map35::special09() {
g_maps->clearSpecial();
g_globals->_treasure.setGems(50);
special07();
}
void Map35::updateFlags() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
int counte = c._equipped.size();
int count = counte + c._backpack.size();
for (int itemIdx = 0; itemIdx < count; ++itemIdx) {
byte itemId = (itemIdx < counte) ?
c._equipped[itemIdx]._id : c._backpack[itemIdx - counte]._id;
// Scan list of items to match against
for (int arrIdx = 0; arrIdx < 7; ++arrIdx) {
if (itemId == MATCH_ITEMS[arrIdx]) {
c._flags[5] |= MATCH_FLAGS[arrIdx];
break;
}
}
}
}
}
void Map35::acceptQuest() {
Character &leader = g_globals->_party[0];
byte flags = leader._flags[8];
// Find quest that hasn't been done yet
int questNum;
for (questNum = 8; flags && questNum < 15; ++questNum, flags >>= 1) {
if (!(flags & 1))
break;
}
if (questNum == 15) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[8] = CHARFLAG8_80;
c._flags[5] = CHARFLAG5_80;
}
}
// Assign the quest to all party characters
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._quest = questNum;
}
// Draw the scene
g_maps->_mapPos.y++;
redrawGame();
}
Common::String Map35::checkQuestComplete() {
Character &leader = g_globals->_party[0];
int qIndex = leader._quest - 8;
if (leader._flags[5] & MATCH_FLAGS[qIndex] & 0x7f) {
// The quest was complete
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._quest = 0;
c._flags[8] |= MATCH_FLAGS[qIndex];
c._exp += QUEST_EXPERIENCE[qIndex];
}
return Common::String::format(
STRING["maps.map35.inspectron5"].c_str(),
QUEST_EXPERIENCE[qIndex]);
} else {
// The quest isn't yet complete
return STRING["maps.map35.inspectron3"];
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP35_H
#define MM1_MAPS_MAP35_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map35 : public Map {
typedef void (Map35:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special09();
void updateFlags();
const SpecialFn SPECIAL_FN[11] = {
&Map35::special00,
&Map35::special01,
&Map35::special02,
&Map35::special03,
&Map35::special04,
&Map35::special05,
&Map35::special06,
&Map35::special07,
&Map35::special07,
&Map35::special09,
&Map35::special09
};
public:
Map35() : Map(35, "blackrn", 0xf08, 3, "Castle Blackridge North") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Accepts a quest from Inspectron
*/
void acceptQuest();
/**
* Does a check for whether Inspectron's current quest
* is complete or not
*/
Common::String checkQuestComplete();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,225 @@
/* 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/maps/map36.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
static const byte MATCH_ITEMS[7] = {
GARLIC_ID, WOLFSBANE_ID, BELLADONNA_ID, MEDUSA_HEAD_ID,
WYVERN_EYE_ID, DRAGONS_TOOTH_ID, RING_OF_OKRIM_ID
};
static const byte MATCH_FLAGS[8] = {
1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80
};
static const uint16 QUEST_EXPERIENCE[7] = {
1000, 2000, 3000, 4000, 6000, 8000, 10000
};
void Map36::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 15; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[66 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map36::special00() {
g_events->addView("CloakedPrisoner");
}
void Map36::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map36.exit"],
[]() {
g_maps->_mapPos = Common::Point(11, 2);
g_maps->changeMap(0xa00, 2);
}
));
}
void Map36::special02() {
visitedExit();
g_maps->_mapPos = Common::Point(12, 2);
g_maps->changeMap(0xa00, 2);
send(SoundMessage(STRING["maps.map36.slide"]));
}
void Map36::special03() {
send(SoundMessage(STRING["maps.map36.message"]));
}
void Map36::special04() {
if (!g_globals->_party.hasItem(MERCHANTS_PASS_ID)) {
g_maps->_mapPos.x--;
updateGame();
send(SoundMessage(STRING["maps.map36.begone"]));
}
}
void Map36::special05() {
updateFlags();
send("View", DrawGraphicMessage(7 + 65));
send("Hacker", GameMessage("DISPLAY"));
}
void Map36::special06() {
visitedExit();
g_maps->_mapPos = Common::Point(7, 4);
g_maps->changeMap(0x705, 3);
send(SoundMessage(STRING["maps.map36.pit"]));
}
void Map36::special07() {
send(SoundMessage(STRING["maps.map36.vault"]));
_data[MAP_47] = 7;
_data[MAP_29] = 30;
for (int i = 0; i < 3; ++i)
Sound::sound(SOUND_2);
}
void Map36::special11() {
g_globals->_treasure.setGems(30);
special07();
}
void Map36::updateFlags() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
int counte = c._equipped.size();
int count = counte + c._backpack.size();
for (int itemIdx = 0; itemIdx < count; ++itemIdx) {
byte itemId = (itemIdx < counte) ?
c._equipped[itemIdx]._id : c._backpack[itemIdx - counte]._id;
// Scan list of items to match against
for (int arrIdx = 0; arrIdx < 7; ++arrIdx) {
if (itemId == MATCH_ITEMS[arrIdx]) {
c._flags[6] |= MATCH_FLAGS[arrIdx];
break;
}
}
}
}
}
void Map36::acceptQuest() {
Character &leader = g_globals->_party[0];
byte flags = leader._flags[9];
// Find quest that hasn't been done yet
int questNum;
for (questNum = 15; flags && questNum < 22; ++questNum, flags >>= 1) {
if (!(flags & 1))
break;
}
if (questNum == 22) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[9] = CHARFLAG9_80;
c._flags[6] = CHARFLAG6_80;
c._backpack.empty();
}
send(SoundMessage(
STRING["maps.map36.hacker7"],
[](const Common::KeyState &) {
g_maps->_mapPos = Common::Point(11, 15);
g_maps->_currentMap->updateGame();
}
));
} else {
// Assign the quest to all party characters
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._quest = questNum;
}
// Draw the scene
g_maps->_mapPos.y++;
redrawGame();
}
}
Common::String Map36::checkQuestComplete() {
Character &leader = g_globals->_party[0];
int qIndex = leader._quest - 15;
if (leader._flags[6] & MATCH_FLAGS[qIndex] & 0x7f) {
// The quest was complete
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._quest = 0;
c._flags[9] |= MATCH_FLAGS[qIndex];
c._exp += QUEST_EXPERIENCE[qIndex];
}
return Common::String::format(
STRING["maps.map36.inspectron6"].c_str(),
QUEST_EXPERIENCE[qIndex]);
} else {
// The quest isn't yet complete
return STRING["maps.map36.hacker5"];
}
}
void Map36::brewComplete() {
// Nuke the entire party's backpack contents
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[9] = CHARFLAG9_80;
c._flags[6] = CHARFLAG6_80;
c._backpack.clear();
}
send(SoundMessage(STRING["maps.map36.hacker6"]));
g_maps->_mapPos = Common::Point(12, 5);
g_maps->_mapPos.x--;
redrawGame();
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,87 @@
/* 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_MAPS_MAP36_H
#define MM1_MAPS_MAP36_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map36 : public Map {
typedef void (Map36:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special11();
void updateFlags();
void brewComplete();
const SpecialFn SPECIAL_FN[15] = {
&Map36::special00,
&Map36::special01,
&Map36::special02,
&Map36::special03,
&Map36::special04,
&Map36::special05,
&Map36::special06,
&Map36::special07,
&Map36::special07,
&Map36::special07,
&Map36::special07,
&Map36::special11,
&Map36::special11,
&Map36::special11,
&Map36::special11
};
public:
Map36() : Map(36, "blackrs", 0x508, 3, "Castle Blackridge South") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Accepts a quest from Inspectron
*/
void acceptQuest();
/**
* Does a check for whether Inspectron's current quest
* is complete or not
*/
Common::String checkQuestComplete();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,182 @@
/* 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/maps/map37.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 232
void Map37::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 20; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[71 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// Randomly spin the party
int count = getRandomNumber(4) - 1;
for (int i = 0; i < count; ++i)
g_maps->turnLeft();
send(SoundMessage(STRING["maps.map37.spins"]));
}
void Map37::special00() {
SoundMessage msg(STRING["maps.map37.message1"]);
msg._fontReduced = true;
send(msg);
}
void Map37::special01() {
if (_data[VAL1]) {
none160();
} else {
visitedExit();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_party[i]._flags[5] |= CHARFLAG5_1;
}
send(SoundMessage(
STRING["maps.map37.opening"],
[]() {
g_maps->_mapPos = Common::Point(13, 5);
g_maps->changeMap(0xa00, 2);
}
));
}
}
void Map37::special02() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->_mapPos.x = 15;
g_maps->changeMap(0x703, 3);
}
));
}
void Map37::special03() {
special02();
}
void Map37::special04() {
Game::Encounter &enc = g_globals->_encounters;
g_maps->clearSpecial();
if (_data[VAL1]) {
g_events->addView("Ghost");
} else {
_data[VAL1]++;
enc.clearMonsters();
enc.addMonster(19, 12);
for (int i = 1; i < 4; ++i)
enc.addMonster(14, 8);
enc.addMonster(16, 12);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
}
void Map37::special05() {
encounter(&_data[553], &_data[562]);
}
void Map37::special06() {
encounter(&_data[571], &_data[586]);
}
void Map37::special07() {
encounter(&_data[601], &_data[615]);
}
void Map37::special08() {
encounter(&_data[629], &_data[641]);
}
void Map37::special09() {
encounter(&_data[653], &_data[662]);
}
void Map37::special10() {
encounter(&_data[671], &_data[681]);
}
void Map37::special11() {
encounter(&_data[691], &_data[699]);
}
void Map37::special12() {
encounter(&_data[707], &_data[714]);
}
void Map37::special13() {
encounter(&_data[721], &_data[730]);
}
void Map37::special14() {
encounter(&_data[739], &_data[752]);
}
void Map37::special15() {
send(SoundMessage(STRING["maps.wall_painted"]));
if (!g_globals->_party.hasItem(B_QUEEN_IDOL_ID)) {
g_globals->_treasure._items[2] = B_QUEEN_IDOL_ID;
}
}
void Map37::special16() {
g_maps->clearSpecial();
g_globals->_treasure._container = GOLD_BOX;
g_globals->_treasure.setGems(100);
g_events->addAction(KEYBIND_SEARCH);
}
void Map37::special19() {
send(SoundMessage(STRING["maps.map37.archway"]));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP37_H
#define MM1_MAPS_MAP37_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map37 : public Map {
typedef void (Map37:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special16();
void special19();
const SpecialFn SPECIAL_FN[20] = {
&Map37::special00,
&Map37::special01,
&Map37::special02,
&Map37::special03,
&Map37::special04,
&Map37::special05,
&Map37::special06,
&Map37::special07,
&Map37::special08,
&Map37::special09,
&Map37::special10,
&Map37::special11,
&Map37::special12,
&Map37::special13,
&Map37::special14,
&Map37::special15,
&Map37::special16,
&Map37::special16,
&Map37::special16,
&Map37::special19
};
public:
Map37() : Map(37, "qvl1", 0xf03, 3, "Wizard's Lair 1") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,138 @@
/* 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/maps/map38.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map38::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 19; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[70 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_maps->_mapPos = Common::Point(getRandomNumber(16) - 1,
getRandomNumber(16) - 1);
send(SoundMessage(STRING["maps.map38.ringing"]));
}
void Map38::special00() {
send(SoundMessage(STRING["maps.map38.message4"]));
}
void Map38::special01() {
send(SoundMessage(STRING["maps.wall_painted"]));
}
void Map38::special02() {
special03();
}
void Map38::special03() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->_mapPos.x = 0;
g_maps->changeMap(0xf03, 3);
}
));
}
void Map38::special04() {
send(SoundMessage(STRING["maps.map38.banner"]));
}
void Map38::special05() {
encounter(&_data[669], &_data[682]);
}
void Map38::special06() {
encounter(&_data[690], &_data[705]);
}
void Map38::special07() {
encounter(&_data[715], &_data[724]);
}
void Map38::special08() {
encounter(&_data[733], &_data[743]);
}
void Map38::special09() {
encounter(&_data[753], &_data[764]);
}
void Map38::special10() {
encounter(&_data[775], &_data[788]);
}
void Map38::special11() {
encounter(&_data[801], &_data[816]);
}
void Map38::special12() {
encounter(&_data[831], &_data[840]);
}
void Map38::special13() {
encounter(&_data[849], &_data[862]);
}
void Map38::special14() {
encounter(&_data[875], &_data[890]);
}
void Map38::special15() {
send(SoundMessage(STRING["maps.map38.face1"]));
}
void Map38::special16() {
send(SoundMessage(STRING["maps.map38.face2"]));
}
void Map38::special17() {
send(SoundMessage(STRING["maps.map38.face3"]));
}
void Map38::special18() {
send(SoundMessage(STRING["maps.map38.face4"]));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP38_H
#define MM1_MAPS_MAP38_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map38 : public Map {
typedef void (Map38:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special16();
void special17();
void special18();
const SpecialFn SPECIAL_FN[19] = {
&Map38::special00,
&Map38::special01,
&Map38::special02,
&Map38::special03,
&Map38::special04,
&Map38::special05,
&Map38::special06,
&Map38::special07,
&Map38::special08,
&Map38::special09,
&Map38::special10,
&Map38::special11,
&Map38::special12,
&Map38::special13,
&Map38::special14,
&Map38::special15,
&Map38::special16,
&Map38::special17,
&Map38::special18
};
public:
Map38() : Map(38, "qvl2", 0x703, 3, "Wizard's Lair 2") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,172 @@
/* 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/maps/map39.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define ANSWER_OFFSET 477
void Map39::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 19; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[70 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map39::special00() {
send(SoundMessage(STRING["maps.map39.message6"]));
}
void Map39::special01() {
visitedExit();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_party[i]._flags[7] |= CHARFLAG7_1;
}
send(SoundMessage(
STRING["maps.map39.stairs_up"],
[]() {
g_maps->_mapPos = Common::Point(9, 9);
g_maps->changeMap(0x703, 2);
}
));
}
void Map39::special02() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->changeMap(0x702, 3);
}
));
}
void Map39::special03() {
g_events->addView("Ruby");
}
void Map39::special04() {
if (g_globals->_party.hasItem(SILVER_KEY_ID)) {
send(SoundMessage(STRING["maps.map39.door_glows"]));
} else {
g_maps->_mapPos.y++;
updateGame();
send(SoundMessage(STRING["maps.map39.door_repels"]));
}
}
void Map39::special05() {
encounter(&_data[615], &_data[622]);
}
void Map39::special06() {
encounter(&_data[629], &_data[637]);
}
void Map39::special07() {
encounter(&_data[645], &_data[656]);
}
void Map39::special08() {
encounter(&_data[667], &_data[676]);
}
void Map39::special09() {
encounter(&_data[685], &_data[696]);
}
void Map39::special10() {
encounter(&_data[707], &_data[718]);
}
void Map39::special11() {
encounter(&_data[729], &_data[742]);
}
void Map39::special12() {
encounter(&_data[755], &_data[762]);
}
void Map39::special13() {
encounter(&_data[769], &_data[782]);
}
void Map39::special14() {
encounter(&_data[795], &_data[807]);
}
void Map39::special18() {
send(SoundMessage(STRING["maps.wall_painted"]));
}
void Map39::riddleAnswered(const Common::String &answer) {
Common::String properAnswer;
for (int i = 0; i < 12 && _data[ANSWER_OFFSET + i]; ++i)
properAnswer += _data[ANSWER_OFFSET + i] - 64;
if (answer.equalsIgnoreCase(properAnswer)) {
g_maps->clearSpecial();
Sound::sound(SOUND_3);
redrawGame();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_party[i]._flags[5] |= CHARFLAG5_20;
}
g_globals->_treasure._items[2] = CRYSTAL_KEY_ID;
g_events->addAction(KEYBIND_SEARCH);
} else {
g_maps->_mapPos.x = 9;
updateGame();
send(InfoMessage(STRING["maps.map39.ruby2"]));
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,87 @@
/* 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_MAPS_MAP39_H
#define MM1_MAPS_MAP39_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map39 : public Map {
typedef void (Map39:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special18();
const SpecialFn SPECIAL_FN[19] = {
&Map39::special00,
&Map39::special01,
&Map39::special02,
&Map39::special03,
&Map39::special04,
&Map39::special05,
&Map39::special06,
&Map39::special07,
&Map39::special08,
&Map39::special09,
&Map39::special10,
&Map39::special11,
&Map39::special12,
&Map39::special13,
&Map39::special14,
&Map39::special05,
&Map39::special05,
&Map39::special05,
&Map39::special18
};
public:
Map39() : Map(39, "rwl1", 0xf02, 3, "Warrior's Stronghold 1") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
void riddleAnswered(const Common::String &answer);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,208 @@
/* 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/maps/map40.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define VAL1 363
#define VAL2 831
#define GOLD 832
void Map40::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 23; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[74 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (_data[VAL1]) {
checkPartyDead();
} else {
_data[VAL2]++;
g_maps->_mapPos.y++;
updateGame();
send(SoundMessage(STRING["maps.map40.conveyor_belt"]));
}
}
void Map40::special00() {
send(SoundMessage(STRING["maps.map40.message2"]));
}
void Map40::special01() {
g_maps->clearSpecial();
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_party[i]._flags[7] |= CHARFLAG7_40;
}
g_events->addView("LordArcher");
}
void Map40::special02() {
reduceHP();
send(SoundMessage(STRING["maps.map40.giants"]));
}
void Map40::special03() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->changeMap(0xf02, 3);
}
));
}
void Map40::special04() {
send(SoundMessage(
STRING["maps.map40.button"],
[]() {
Map40 &map = *static_cast<Map40 *>(g_maps->_currentMap);
map[VAL1]++;
}
));
}
void Map40::special05() {
encounter(&_data[588], &_data[601]);
}
void Map40::special06() {
encounter(&_data[614], &_data[621]);
}
void Map40::special07() {
encounter(&_data[628], &_data[640]);
}
void Map40::special08() {
encounter(&_data[652], &_data[658]);
}
void Map40::special09() {
encounter(&_data[664], &_data[675]);
}
void Map40::special10() {
encounter(&_data[686], &_data[700]);
}
void Map40::special11() {
encounter(&_data[714], &_data[726]);
}
void Map40::special12() {
encounter(&_data[738], &_data[750]);
}
void Map40::special13() {
encounter(&_data[762], &_data[776]);
}
void Map40::special14() {
encounter(&_data[790], &_data[802]);
}
void Map40::special15() {
if (_data[VAL2]) {
_data[VAL2] = 0;
reduceHP();
reduceHP();
send(SoundMessage(STRING["maps.map40.squish"]));
} else {
none160();
}
}
void Map40::special16() {
send(SoundMessage(STRING["maps.map40.boulder"]));
}
void Map40::special17() {
send(SoundMessage(STRING["maps.map40.test1"]));
}
void Map40::special18() {
send(SoundMessage(STRING["maps.map40.test2"]));
}
void Map40::special19() {
send(SoundMessage(STRING["maps.map40.test3"]));
}
void Map40::special20() {
send(SoundMessage(STRING["maps.map40.test4"]));
}
void Map40::archerResist() {
Game::Encounter &enc = g_globals->_encounters;
enc.clearMonsters();
for (int i = 0; i < 6; ++i)
enc.addMonster(12, 10);
enc.addMonster(15, 12);
enc._manual = true;
enc._levelIndex = 112;
enc.execute();
}
void Map40::archerSubmit() {
// As long as even one character has gold, Archer will take
// all of the party's gold. However, if the party is penniless,
// then Archer will actually give each character 5000 gold
for (uint i = 0; i < g_globals->_party.size(); ++i) {
if (g_globals->_party[i]._gold) {
WRITE_LE_UINT16(&_data[GOLD], 0);
break;
}
}
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_party[i]._gold = READ_LE_UINT16(&_data[GOLD]);
}
g_maps->_mapPos = Common::Point(8, 5);
g_maps->changeMap(0x604, 1);
}
} // namespace Maps
} // namespace MM1
} // namespace MM

104
engines/mm/mm1/maps/map40.h Normal file
View File

@@ -0,0 +1,104 @@
/* 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_MAPS_MAP40_H
#define MM1_MAPS_MAP40_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map40 : public Map {
typedef void (Map40:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special16();
void special17();
void special18();
void special19();
void special20();
const SpecialFn SPECIAL_FN[23] = {
&Map40::special00,
&Map40::special01,
&Map40::special02,
&Map40::special03,
&Map40::special04,
&Map40::special05,
&Map40::special06,
&Map40::special07,
&Map40::special08,
&Map40::special09,
&Map40::special10,
&Map40::special11,
&Map40::special12,
&Map40::special13,
&Map40::special14,
&Map40::special15,
&Map40::special16,
&Map40::special17,
&Map40::special18,
&Map40::special19,
&Map40::special20,
&Map40::special02,
&Map40::special02
};
public:
Map40() : Map(40, "rwl2", 0x702, 3, "Warrior's Stronghold 2") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Called when party chooses to resist Lord Archer
*/
void archerResist();
/**
* Called when party chooses to submit to Lord Archer
*/
void archerSubmit();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,166 @@
/* 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/maps/map41.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map41::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 25; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[76 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
checkPartyDead();
}
void Map41::special00() {
send(SoundMessage(STRING["maps.map41.message3"]));
}
void Map41::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map41.stairs_up"],
[]() {
g_maps->_mapPos = Common::Point(14, 2);
g_maps->changeMap(0x101, 2);
}
));
}
void Map41::special02() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->changeMap(0x704, 3);
}
));
}
void Map41::special03() {
special02();
}
void Map41::special04() {
send(SoundMessage(STRING["maps.map41.dung"]));
}
void Map41::special05() {
encounter(&_data[509], &_data[519]);
}
void Map41::special06() {
encounter(&_data[529], &_data[542]);
}
void Map41::special07() {
encounter(&_data[555], &_data[563]);
}
void Map41::special08() {
encounter(&_data[571], &_data[586]);
}
void Map41::special09() {
encounter(&_data[601], &_data[613]);
}
void Map41::special10() {
encounter(&_data[625], &_data[633]);
}
void Map41::special11() {
encounter(&_data[641], &_data[650]);
}
void Map41::special12() {
encounter(&_data[659], &_data[670]);
}
void Map41::special13() {
encounter(&_data[683], &_data[691]);
}
void Map41::special14() {
encounter(&_data[699], &_data[710]);
}
void Map41::special16() {
showSign(STRING["maps.map41.sign1"]);
}
void Map41::special17() {
showSign(STRING["maps.map41.sign2"]);
}
void Map41::special18() {
showSign(STRING["maps.map41.sign3"]);
}
void Map41::special19() {
showSign(STRING["maps.map41.sign4"]);
}
void Map41::special20() {
showSign(STRING["maps.map41.sign5"]);
}
void Map41::special21() {
send(SoundMessage(STRING["maps.wall_painted"]));
}
void Map41::special22() {
send(SoundMessage(STRING["maps.map41.tapestry1"]));
}
void Map41::special23() {
send(SoundMessage(STRING["maps.map41.tapestry2"]));
}
void Map41::showSign(const Common::String &line) {
send(SoundMessage(
0, 1, STRING["maps.sign"],
0, 2, line
));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,99 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MM1_MAPS_MAP41_H
#define MM1_MAPS_MAP41_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map41 : public Map {
typedef void (Map41:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special16();
void special17();
void special18();
void special19();
void special20();
void special21();
void special22();
void special23();
void showSign(const Common::String &line);
const SpecialFn SPECIAL_FN[25] = {
&Map41::special00,
&Map41::special01,
&Map41::special02,
&Map41::special03,
&Map41::special04,
&Map41::special05,
&Map41::special06,
&Map41::special07,
&Map41::special08,
&Map41::special09,
&Map41::special10,
&Map41::special11,
&Map41::special12,
&Map41::special13,
&Map41::special14,
&Map41::special14,
&Map41::special16,
&Map41::special17,
&Map41::special18,
&Map41::special19,
&Map41::special20,
&Map41::special21,
&Map41::special22,
&Map41::special23,
&Map41::special04
};
public:
Map41() : Map(41, "enf1", 0xf04, 3, "Minotaur Stronghold 1") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,185 @@
/* 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/maps/map42.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define MONSTER_COUNT 151
#define VAL1 259
void Map42::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 25; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[76 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
g_maps->_mapPos.y = 4;
updateGame();
}
void Map42::special00() {
g_events->addView("DogStatue");
}
void Map42::special01() {
send(SoundMessage(STRING["maps.map42.message9"]));
}
void Map42::special02() {
Game::Encounter &enc = g_globals->_encounters;
if (_data[VAL1]) {
send(SoundMessage(STRING["maps.map42.defeated"]));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
g_globals->_party[i]._flags[5] |= CHARFLAG5_40;
}
} else {
_data[VAL1]++;
enc.clearMonsters();
enc.addMonster(14, 12);
for (int i = 1; i < 13; ++i)
enc.addMonster(8, 5);
enc._manual = true;
enc._levelIndex = 64;
enc.execute();
}
}
void Map42::special03() {
send(SoundMessage(STRING["maps.map42.sign1"]));
}
void Map42::special04() {
Sound::sound(SOUND_2);
g_maps->_mapPos.x = getRandomNumber(5) + 5;
redrawGame();
}
void Map42::special05() {
encounter(&_data[611], &_data[624]);
}
void Map42::special06() {
encounter(&_data[637], &_data[648]);
}
void Map42::special07() {
encounter(&_data[659], &_data[668]);
}
void Map42::special08() {
encounter(&_data[677], &_data[686]);
}
void Map42::special09() {
encounter(&_data[695], &_data[704]);
}
void Map42::special10() {
encounter(&_data[713], &_data[724]);
}
void Map42::special11() {
encounter(&_data[735], &_data[743]);
}
void Map42::special12() {
encounter(&_data[751], &_data[759]);
}
void Map42::special13() {
encounter(&_data[767], &_data[777]);
}
void Map42::special14() {
encounter(&_data[787], &_data[796]);
}
void Map42::special15() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->changeMap(0xf04, 3);
}
));
}
void Map42::special17() {
g_globals->_treasure.setGold(7500);
g_globals->_treasure._container = GOLD_BOX;
g_events->addAction(KEYBIND_SEARCH);
}
void Map42::dogSuccess() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[0] = CHARFLAG0_DOG_STATUE;
c._exp += 10000;
}
g_globals->_treasure._items[2] = GOLD_KEY_ID;
g_globals->_treasure._trapType = 2;
none160();
}
void Map42::dogDesecrate() {
Game::Encounter &enc = g_globals->_encounters;
redrawGame();
byte &count = _data[MONSTER_COUNT];
count *= 2;
if (count >= 16)
count = 13;
enc.clearMonsters();
for (int i = 0; i < (int)count; ++i)
enc.addMonster(4, 10);
enc._manual = true;
enc._levelIndex = 20;
enc.execute();
}
} // namespace Maps
} // namespace MM1
} // namespace MM

102
engines/mm/mm1/maps/map42.h Normal file
View File

@@ -0,0 +1,102 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MM1_MAPS_MAP42_H
#define MM1_MAPS_MAP42_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map42 : public Map {
typedef void (Map42:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special17();
const SpecialFn SPECIAL_FN[25] = {
&Map42::special00,
&Map42::special01,
&Map42::special02,
&Map42::special03,
&Map42::special04,
&Map42::special05,
&Map42::special06,
&Map42::special07,
&Map42::special08,
&Map42::special09,
&Map42::special10,
&Map42::special11,
&Map42::special12,
&Map42::special13,
&Map42::special14,
&Map42::special15,
&Map42::special15,
&Map42::special17,
&Map42::special17,
&Map42::special03,
&Map42::special03,
&Map42::special03,
&Map42::special04,
&Map42::special04,
&Map42::special04
};
public:
Map42() : Map(42, "enf2", 0x704, 3, "Minotaur Stronghold 1") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Succeeded in the necessary quests
*/
void dogSuccess();
/**
* Desecrating the dog statue
*/
void dogDesecrate();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,223 @@
/* 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/maps/map43.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define TREASURE_STATE 142
static const byte MATCH_ITEMS[7] = {
0, 0, MAP_OF_DESERT_ID, 0, 0, 0, 0
};
static const byte MATCH_FLAGS[8] = {
1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80
};
static const uint16 QUEST_EXPERIENCE[7] = {
1000, 2000, 3000, 4000, 6000, 8000, 10000
};
void Map43::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 9; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[60 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map43::special00() {
g_events->addView("DemonPrisoner");
}
void Map43::special01() {
_data[TREASURE_STATE] = 0;
if (g_maps->_forwardMask == DIRMASK_E) {
visitedExit();
send(SoundMessage(
STRING["maps.map43.exit"],
[]() {
g_maps->_mapPos = Common::Point(9, 13);
g_maps->changeMap(0x101, 2);
}
));
} else {
none160();
}
}
void Map43::special02() {
send(SoundMessage(
STRING["maps.map43.button"],
[]() {
Map43 &map = *static_cast<Map43 *>(g_maps->_currentMap);
map._states[101] = 17;
map.none160();
}
));
}
void Map43::special03() {
send(SoundMessage(STRING["maps.map43.message_b"]));
}
void Map43::special04() {
if (!g_globals->_party.hasItem(MERCHANTS_PASS_ID)) {
send(SoundMessage(
STRING["maps.map43.guards"],
[](const Common::KeyState &) {
g_events->focusedView()->close();
g_maps->_mapPos = Common::Point(9, 13);
g_maps->changeMap(0x101, 2);
}
));
}
}
void Map43::special05() {
updateFlags();
send("View", DrawGraphicMessage(7 + 65));
g_events->addView("LordIronfist");
}
void Map43::special06() {
if (_data[TREASURE_STATE]) {
g_globals->_treasure.setGold(18000);
g_maps->clearSpecial();
g_events->addAction(KEYBIND_SEARCH);
} else {
Game::Encounter &enc = g_globals->_encounters;
_data[TREASURE_STATE]++;
enc.clearMonsters();
for (int i = 0; i < 8; ++i)
enc.addMonster(13, 7);
enc._manual = true;
enc._levelIndex = 80;
enc.execute();
}
}
void Map43::special07() {
send(SoundMessage(STRING["maps.map43.tower"]));
}
void Map43::special08() {
send(SoundMessage(STRING["maps.map43.throne_room"]));
}
void Map43::updateFlags() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
int counte = c._equipped.size();
int count = counte + c._backpack.size();
for (int itemIdx = 0; itemIdx < count; ++itemIdx) {
byte itemId = (itemIdx < counte) ?
c._equipped[itemIdx]._id : c._backpack[itemIdx - counte]._id;
// Scan list of items to match against
for (int arrIdx = 0; arrIdx < 7; ++arrIdx) {
if (itemId == MATCH_ITEMS[arrIdx]) {
c._flags[7] |= MATCH_FLAGS[arrIdx];
break;
}
}
}
}
}
void Map43::acceptQuest() {
Character &leader = g_globals->_party[0];
byte flags = leader._flags[10];
// Find quest that hasn't been done yet
int questNum = 1;
if (flags) {
for (questNum = 1; flags && questNum < 8; ++questNum, flags >>= 1) {
if (!(flags & 1))
break;
}
if (questNum == 8) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[10] = CHARFLAG8_80;
c._flags[7] = CHARFLAG5_80;
}
questNum = 1;
}
}
// Assign the quest to all party characters
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._quest = questNum;
}
// Draw the scene
g_maps->_mapPos.x++;
updateGame();
}
Common::String Map43::checkQuestComplete() {
Character &leader = g_globals->_party[0];
int qIndex = leader._quest - 1;
if (leader._flags[7] & MATCH_FLAGS[qIndex] & 0x7f) {
// The quest was complete
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._quest = 0;
c._flags[10] |= MATCH_FLAGS[qIndex];
c._exp += QUEST_EXPERIENCE[qIndex];
}
return Common::String::format(
STRING["maps.map43.ironfist5"].c_str(),
QUEST_EXPERIENCE[qIndex]);
} else {
// The quest isn't yet complete
return STRING["maps.map43.ironfist3"];
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,80 @@
/* 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_MAPS_MAP43_H
#define MM1_MAPS_MAP43_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map43 : public Map {
typedef void (Map43:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void updateFlags();
const SpecialFn SPECIAL_FN[9] = {
&Map43::special00,
&Map43::special01,
&Map43::special02,
&Map43::special03,
&Map43::special04,
&Map43::special05,
&Map43::special06,
&Map43::special07,
&Map43::special08
};
public:
Map43() : Map(43, "whitew", 0xa11, 3, "Castle White Wolf") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Accepts a quest from Inspectron
*/
void acceptQuest();
/**
* Does a check for whether Inspectron's current quest
* is complete or not
*/
Common::String checkQuestComplete();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,127 @@
/* 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/maps/map44.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map44::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 11; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[62 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map44::special00() {
g_events->addView("MutatedPrisoner");
}
void Map44::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.passage_outside1"],
[]() {
g_maps->_mapPos = Common::Point(12, 12);
g_maps->changeMap(0x112, 2);
}
));
}
void Map44::special02() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->changeMap(0xf05, 3);
}
));
}
void Map44::special03() {
send(SoundMessage(STRING["maps.map44.message_f"]));
}
void Map44::special04() {
send(SoundMessage(STRING["maps.map44.clover"]));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
if (!(c._flags[11] & CHARFLAG11_GOT_LUCK)) {
c._flags[11] |= CHARFLAG11_GOT_LUCK;
c._luck._current = c._luck._base = c._luck._base + 4;
}
}
}
void Map44::special05() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[5] |= CHARFLAG5_10;
}
send(SoundMessage(
STRING["maps.map44.fountain"],
[]() {
Map44 &map = *static_cast<Map44 *>(g_maps->_currentMap);
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._exp += c._gold;
c._gold = 0;
}
map.none160();
}
));
}
void Map44::special06() {
send(SoundMessage(STRING["maps.map44.message"]));
}
void Map44::special07() {
send(SoundMessage(STRING["maps.map44.bones"]));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,69 @@
/* 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_MAPS_MAP44_H
#define MM1_MAPS_MAP44_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map44 : public Map {
typedef void (Map44:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
const SpecialFn SPECIAL_FN[11] = {
&Map44::special00,
&Map44::special01,
&Map44::special02,
&Map44::special03,
&Map44::special04,
&Map44::special05,
&Map44::special06,
&Map44::special07,
&Map44::special07,
&Map44::special07,
&Map44::special07
};
public:
Map44() : Map(44, "dragad", 0x107, 3, "Dragadune Ruins 1") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,167 @@
/* 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/maps/map45.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map45::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 22; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[73 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map45::special00() {
send(SoundMessage(STRING["maps.map45.message8"]));
}
void Map45::special01() {
visitedExit();
send(SoundMessage(
STRING["maps.map45.passage"],
[]() {
g_maps->_mapPos = Common::Point(15, 12);
g_maps->changeMap(5, 1);
}
));
}
void Map45::special02() {
special04();
}
void Map45::special03() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->changeMap(0x107, 1);
}
));
}
void Map45::special04() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->changeMap(0xa00, 3);
}
));
}
void Map45::special05() {
encounter(&_data[600], &_data[611]);
}
void Map45::special06() {
encounter(&_data[622], &_data[633]);
}
void Map45::special07() {
encounter(&_data[644], &_data[657]);
}
void Map45::special08() {
encounter(&_data[670], &_data[683]);
}
void Map45::special09() {
encounter(&_data[696], &_data[710]);
}
void Map45::special10() {
encounter(&_data[724], &_data[737]);
}
void Map45::special11() {
encounter(&_data[750], &_data[761]);
}
void Map45::special12() {
encounter(&_data[772], &_data[786]);
}
void Map45::special13() {
encounter(&_data[800], &_data[814]);
}
void Map45::special14() {
encounter(&_data[828], &_data[837]);
}
void Map45::special15() {
send(SoundMessage(STRING["maps.map45.sign1"]));
}
void Map45::special16() {
showSign(STRING["maps.map45.sign2"]);
}
void Map45::special18() {
showSign(STRING["maps.map45.sign3"]);
}
void Map45::special19() {
send(SoundMessage(STRING["maps.map45.walls"]));
}
void Map45::special20() {
send(SoundMessage(STRING["maps.map45.message"]));
}
void Map45::special21() {
send(SoundMessage(STRING["maps.wall_painted"]));
}
void Map45::showSign(const Common::String &line) {
send(SoundMessage(
0, 1, STRING["maps.sign"],
0, 2, line
));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,94 @@
/* 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_MAPS_MAP45_H
#define MM1_MAPS_MAP45_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map45 : public Map {
typedef void (Map45:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special16();
void special18();
void special19();
void special20();
void special21();
void showSign(const Common::String &line);
const SpecialFn SPECIAL_FN[22] = {
&Map45::special00,
&Map45::special01,
&Map45::special02,
&Map45::special03,
&Map45::special04,
&Map45::special05,
&Map45::special06,
&Map45::special07,
&Map45::special08,
&Map45::special09,
&Map45::special10,
&Map45::special11,
&Map45::special12,
&Map45::special13,
&Map45::special14,
&Map45::special15,
&Map45::special16,
&Map45::special16,
&Map45::special18,
&Map45::special19,
&Map45::special20,
&Map45::special21
};
public:
Map45() : Map(45, "udrag1", 0xf05, 3, "Dragadune Ruins 2") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // 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/maps/map46.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
void Map46::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 7; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[58 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
// All other cells on the map are encounters
g_maps->clearSpecial();
g_globals->_encounters.execute();
}
void Map46::special00() {
send(SoundMessage(STRING["maps.wall_painted"]));
}
void Map46::special01() {
send(SoundMessage(STRING["maps.map46.shakes"]));
}
void Map46::special02() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_down"],
[]() {
g_maps->changeMap(0x705, 3);
}
));
}
void Map46::special03() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->changeMap(0xf05, 3);
}
));
}
void Map46::special04() {
special03();
}
void Map46::special05() {
g_maps->_mapPos.x++;
updateGame();
}
void Map46::special06() {
send(SoundMessage(STRING["maps.map46.clerics"]));
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,64 @@
/* 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_MAPS_MAP46_H
#define MM1_MAPS_MAP46_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map46 : public Map {
typedef void (Map46:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
const SpecialFn SPECIAL_FN[7] = {
&Map46::special00,
&Map46::special01,
&Map46::special02,
&Map46::special03,
&Map46::special04,
&Map46::special05,
&Map46::special06
};
public:
Map46() : Map(46, "udrag2", 0xa00, 3, "Dragadune Ruins 3") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

View File

@@ -0,0 +1,180 @@
/* 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/maps/map47.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define ARRAY1 250
void Map47::special() {
// Scan for special actions on the map cell
for (uint i = 0; i < 26; ++i) {
if (g_maps->_mapOffset == _data[51 + i]) {
// Found a specially handled cell, but it
// only triggers in designated direction(s)
if (g_maps->_forwardMask & _data[77 + i]) {
(this->*SPECIAL_FN[i])();
} else {
checkPartyDead();
}
return;
}
}
if (getRandomNumber(100) < 10) {
g_globals->_encounters.execute();
} else {
g_maps->_mapPos = Common::Point(
getRandomNumber(16) - 1, getRandomNumber(16) - 1);
updateGame();
send(SoundMessage(STRING["maps.map47.poof"]));
}
}
void Map47::special00() {
send(SoundMessage(STRING["maps.map47.message5"]));
}
void Map47::special01() {
send(SoundMessage(
STRING["maps.map47.gong"],
[]() {
Map47 &map = *static_cast<Map47 *>(g_maps->_currentMap);
int toneNum = g_events->getRandomNumber(6);
if (toneNum < 4) {
g_events->send(SoundMessage(STRING[
Common::String::format("maps.map47.tones.%d", toneNum)]));
} else {
map.poof();
}
}
));
}
void Map47::special02() {
if (_data[ARRAY1] && _data[ARRAY1 + 1] && _data[ARRAY1 + 2]) {
send(SoundMessage(STRING["maps.map47.clerics3"]));
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[11] = CHARFLAG11_CLERICS;
}
}
}
void Map47::special03() {
visitedExit();
send(SoundMessage(
STRING["maps.stairs_up"],
[]() {
g_maps->changeMap(0xa00, 3);
}
));
}
void Map47::special04() {
send(SoundMessage(STRING["maps.map47.painting"]));
}
void Map47::special05() {
encounter(&_data[587], &_data[594]);
}
void Map47::special06() {
encounter(&_data[601], &_data[608]);
}
void Map47::special07() {
encounter(&_data[615], &_data[624]);
}
void Map47::special08() {
encounter(&_data[633], &_data[644]);
}
void Map47::special09() {
encounter(&_data[655], &_data[665]);
}
void Map47::special10() {
encounter(&_data[675], &_data[684]);
}
void Map47::special11() {
encounter(&_data[693], &_data[700]);
}
void Map47::special12() {
encounter(&_data[707], &_data[718]);
}
void Map47::special13() {
encounter(&_data[729], &_data[740]);
}
void Map47::special14() {
encounter(&_data[751], &_data[762]);
}
void Map47::special15() {
encounter(&_data[773], &_data[782]);
}
void Map47::special16() {
encounter(&_data[791], &_data[801]);
}
void Map47::special17() {
encounter(&_data[811], &_data[821]);
}
void Map47::special23() {
Common::String line = Common::String::format(
STRING["maps.map47.door_number"].c_str(),
'0' + (g_maps->_mapPos.x - 5)
);
send(SoundMessage(line));
}
void Map47::poof() {
if (getRandomNumber(100) < 10) {
g_globals->_encounters.execute();
} else {
g_maps->_mapPos = Common::Point(
getRandomNumber(16) - 1, getRandomNumber(16) - 1);
updateGame();
send(SoundMessage(STRING["maps.map47.poof"]));
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

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/>.
*
*/
#ifndef MM1_MAPS_MAP47_H
#define MM1_MAPS_MAP47_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map47 : public Map {
typedef void (Map47:: *SpecialFn)();
private:
void special00();
void special01();
void special02();
void special03();
void special04();
void special05();
void special06();
void special07();
void special08();
void special09();
void special10();
void special11();
void special12();
void special13();
void special14();
void special15();
void special16();
void special17();
void special23();
const SpecialFn SPECIAL_FN[26] = {
&Map47::special00,
&Map47::special01,
&Map47::special02,
&Map47::special03,
&Map47::special04,
&Map47::special05,
&Map47::special06,
&Map47::special07,
&Map47::special08,
&Map47::special09,
&Map47::special10,
&Map47::special11,
&Map47::special12,
&Map47::special13,
&Map47::special14,
&Map47::special15,
&Map47::special16,
&Map47::special17,
&Map47::special01,
&Map47::special01,
&Map47::special01,
&Map47::special01,
&Map47::special01,
&Map47::special23,
&Map47::special23,
&Map47::special23
};
public:
Map47() : Map(47, "udrag3", 0x705, 3, "Dragadune Ruins 4") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
void poof();
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

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/>.
*
*/
#include "mm/mm1/maps/map48.h"
#include "mm/mm1/maps/maps.h"
#include "mm/mm1/events.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/sound.h"
namespace MM {
namespace MM1 {
namespace Maps {
#define ANSWER_OFFSET 274
void Map48::special() {
g_events->addView("Orango");
}
void Map48::orangoAnswer(const Common::String &answer) {
Common::String properAnswer;
for (int i = 0; i < 15 && _data[ANSWER_OFFSET + i]; ++i)
properAnswer += (_data[ANSWER_OFFSET + i] & 0x7f) + 29;
if (answer.equalsIgnoreCase(properAnswer)) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
c._flags[13] |= CHARFLAG13_ALAMAR;
}
g_maps->_mapPos = Common::Point(8, 5);
g_maps->changeMap(0x604, 1);
SoundMessage msg(STRING["maps.map48.orango3"]);
msg._largeMessage = true;
send(msg);
} else {
g_maps->_mapPos.x++;
updateGame();
send(SoundMessage(13, 2, STRING["maps.map48.orango2"]));
}
}
} // namespace Maps
} // namespace MM1
} // namespace MM

View File

@@ -0,0 +1,51 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MM1_MAPS_MAP48_H
#define MM1_MAPS_MAP48_H
#include "mm/mm1/maps/map.h"
namespace MM {
namespace MM1 {
namespace Maps {
class Map48 : public Map {
typedef void (Map48:: *SpecialFn)();
public:
Map48() : Map(48, "demon", 0x412, 3, "Soul Maze") {}
/**
* Handles all special stuff that happens on the map
*/
void special() override;
/**
* Handles Orango answer
*/
void orangoAnswer(const Common::String &answer);
};
} // namespace Maps
} // namespace MM1
} // namespace MM
#endif

Some files were not shown because too many files have changed in this diff Show More