Initial commit
This commit is contained in:
46
engines/mm/mm1/views/are_you_ready.cpp
Normal file
46
engines/mm/mm1/views/are_you_ready.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/are_you_ready.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
void AreYouReady::draw() {
|
||||
drawTextBorder();
|
||||
writeString(11, 11, STRING["dialogs.ready.1"]);
|
||||
writeString(11, 13, STRING["dialogs.ready.2"]);
|
||||
}
|
||||
|
||||
bool AreYouReady::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_SELECT) {
|
||||
replaceView("MainMenu");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
44
engines/mm/mm1/views/are_you_ready.h
Normal file
44
engines/mm/mm1/views/are_you_ready.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_ARE_YOU_READY_H
|
||||
#define MM1_VIEWS_ARE_YOU_READY_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class AreYouReady : public TextView {
|
||||
public:
|
||||
AreYouReady() : TextView("AreYouReady") {}
|
||||
virtual ~AreYouReady() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
89
engines/mm/mm1/views/bash.cpp
Normal file
89
engines/mm/mm1/views/bash.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/bash.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
Bash::Bash() : TextView("Bash") {
|
||||
}
|
||||
|
||||
bool Bash::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "SHOW") {
|
||||
bashDoor();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Bash::bashDoor() {
|
||||
byte walls = g_maps->_currentWalls & g_maps->_forwardMask;
|
||||
if (!(g_maps->_currentState & 0x55 & g_maps->_forwardMask) || !walls) {
|
||||
forwards();
|
||||
return;
|
||||
}
|
||||
|
||||
int val;
|
||||
if (!(walls & 0x55))
|
||||
val = 1;
|
||||
else if (!(g_maps->_currentWalls & g_maps->_currentWalls & 0xaa))
|
||||
val = 0;
|
||||
else
|
||||
val = 2;
|
||||
|
||||
if (g_maps->_currentMap->dataByte(Maps::MAP_30 + val) != 1) {
|
||||
forwards();
|
||||
return;
|
||||
}
|
||||
|
||||
Sound::sound(SOUND_1);
|
||||
int might = getRandomNumber(100);
|
||||
|
||||
for (uint i = 0; i < g_globals->_party.size(); ++i) {
|
||||
Character &c = g_globals->_party[i];
|
||||
might += c._might;
|
||||
}
|
||||
|
||||
int threshold = g_maps->_currentMap->dataByte(Maps::MAP_45);
|
||||
|
||||
if (threshold && might >= threshold) {
|
||||
g_maps->_currentMap->unlockDoor();
|
||||
}
|
||||
|
||||
if (getRandomNumber(100) >= g_maps->_currentMap->dataByte(Maps::MAP_TRAP_THRESHOLD)) {
|
||||
send("Trap", GameMessage("TRIGGER"));
|
||||
} else {
|
||||
forwards();
|
||||
}
|
||||
}
|
||||
|
||||
void Bash::forwards() {
|
||||
g_events->addAction(KEYBIND_FORWARDS);
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
63
engines/mm/mm1/views/bash.h
Normal file
63
engines/mm/mm1/views/bash.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_BASH_H
|
||||
#define MM1_VIEWS_BASH_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class Bash : public TextView {
|
||||
private:
|
||||
/**
|
||||
* Handle bashing the door
|
||||
*/
|
||||
void bashDoor();
|
||||
|
||||
/**
|
||||
* When there's no door to bash, the bash action
|
||||
* is transformed into a simple forwards movement
|
||||
*/
|
||||
void forwards();
|
||||
public:
|
||||
Bash();
|
||||
virtual ~Bash() {}
|
||||
|
||||
/**
|
||||
* Handles game messages
|
||||
*/
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
|
||||
/**
|
||||
* The view doesn't actually have any rendering,
|
||||
* so the draw method has no implementation
|
||||
*/
|
||||
void draw() override {}
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
185
engines/mm/mm1/views/character_base.cpp
Normal file
185
engines/mm/mm1/views/character_base.cpp
Normal 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/views/character_base.h"
|
||||
#include "mm/mm1/utils/strings.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
void CharacterBase::printStats() {
|
||||
Character &re = *g_globals->_currCharacter;
|
||||
printSummary();
|
||||
|
||||
writeString(0, 2, STRING["stats.attributes.int"]);
|
||||
writeNumber(re._intelligence);
|
||||
_textPos.x = 8;
|
||||
writeString(STRING["stats.attributes.level"]);
|
||||
writeNumber(re._level);
|
||||
_textPos.x = 18;
|
||||
writeString(STRING["stats.attributes.age"]);
|
||||
writeNumber(re._level);
|
||||
_textPos.x = 27;
|
||||
writeString(STRING["stats.attributes.exp"]);
|
||||
writeNumber(re._exp);
|
||||
|
||||
newLine();
|
||||
writeString(STRING["stats.attributes.mgt"]);
|
||||
writeNumber(re._might);
|
||||
|
||||
newLine();
|
||||
writeString(STRING["stats.attributes.per"]);
|
||||
writeNumber(re._personality);
|
||||
_textPos.x = 8;
|
||||
writeString(STRING["stats.attributes.sp"]);
|
||||
writeNumber(re._sp._current);
|
||||
_textPos.x = 16;
|
||||
writeChar('/');
|
||||
writeNumber(re._sp._base);
|
||||
_textPos.x = 22;
|
||||
writeChar('(');
|
||||
writeNumber(re._spellLevel._current);
|
||||
writeChar(')');
|
||||
_textPos.x = 26;
|
||||
writeString(STRING["stats.attributes.gems"]);
|
||||
writeNumber(re._gems);
|
||||
|
||||
newLine();
|
||||
writeString(STRING["stats.attributes.end"]);
|
||||
writeNumber(re._endurance);
|
||||
|
||||
newLine();
|
||||
writeString(STRING["stats.attributes.spd"]);
|
||||
writeNumber(re._speed);
|
||||
_textPos.x = 8;
|
||||
writeString(STRING["stats.attributes.hp"]);
|
||||
writeNumber(re._hpCurrent);
|
||||
_textPos.x = 16;
|
||||
writeChar('/');
|
||||
writeNumber(re._hpMax);
|
||||
_textPos.x = 26;
|
||||
writeString(STRING["stats.attributes.gold"]);
|
||||
writeNumber(re._gold);
|
||||
|
||||
newLine();
|
||||
writeString(STRING["stats.attributes.acy"]);
|
||||
writeNumber(re._accuracy);
|
||||
|
||||
newLine();
|
||||
writeString(STRING["stats.attributes.luc"]);
|
||||
writeNumber(re._luck);
|
||||
_textPos.x = 8;
|
||||
writeString(STRING["stats.attributes.ac"]);
|
||||
writeNumber(re._ac);
|
||||
_textPos.x = 26;
|
||||
writeString(STRING["stats.attributes.food"]);
|
||||
writeNumber(re._food);
|
||||
|
||||
newLine();
|
||||
newLine();
|
||||
printCondition();
|
||||
printInventory();
|
||||
}
|
||||
|
||||
void CharacterBase::printSummary() {
|
||||
Character &re = *g_globals->_currCharacter;
|
||||
writeString(1, 0, re._name);
|
||||
|
||||
_textPos.x = 17;
|
||||
writeString(": ");
|
||||
|
||||
writeChar((re._sex == MALE) ? 'M' : (re._sex == FEMALE ? 'F' : 'O'));
|
||||
|
||||
_textPos.x++;
|
||||
writeString((re._alignment >= GOOD && re._alignment <= EVIL) ?
|
||||
STRING[Common::String::format("stats.alignments.%d", re._alignment)] :
|
||||
STRING["stats.none"]
|
||||
);
|
||||
|
||||
if (re._race >= HUMAN && re._race <= HALF_ORC)
|
||||
writeString(26, 0, STRING[Common::String::format("stats.races.%d", re._race)]);
|
||||
else
|
||||
writeString(26, 0, STRING["stats.none"]);
|
||||
|
||||
if (re._class >= KNIGHT && re._class <= ROBBER)
|
||||
writeString(32, 0, STRING[Common::String::format("stats.classes.%d", re._class)]);
|
||||
else
|
||||
writeString(32, 0, STRING["stats.none"]);
|
||||
}
|
||||
|
||||
void CharacterBase::printCondition() {
|
||||
Character &c = *g_globals->_currCharacter;
|
||||
writeString(STRING["stats.attributes.cond"]);
|
||||
_textPos.x++;
|
||||
|
||||
writeString(c.getConditionString());
|
||||
}
|
||||
|
||||
void CharacterBase::printInventory() {
|
||||
Character &re = *g_globals->_currCharacter;
|
||||
writeString(0, 12, STRING["stats.inventory"]);
|
||||
|
||||
// Print the equipped and backpack items
|
||||
for (uint i = 0; i < INVENTORY_COUNT; ++i) {
|
||||
// Equippied item
|
||||
writeChar(0, 13 + i, '1' + i);
|
||||
writeChar(')');
|
||||
_textPos.x++;
|
||||
|
||||
if (i < re._equipped.size()) {
|
||||
g_globals->_items.getItem(re._equipped[i]._id);
|
||||
const Item &item = g_globals->_currItem;
|
||||
writeString(item._name);
|
||||
}
|
||||
|
||||
// Backpack item
|
||||
writeChar(20, 13 + i, 'A' + i);
|
||||
writeChar(')');
|
||||
_textPos.x++;
|
||||
|
||||
if (i < re._backpack.size()) {
|
||||
g_globals->_items.getItem(re._backpack[i]._id);
|
||||
const Item &item = g_globals->_currItem;
|
||||
writeString(item._name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterBase::draw() {
|
||||
assert(g_globals->_currCharacter);
|
||||
clearSurface();
|
||||
printStats();
|
||||
}
|
||||
|
||||
bool CharacterBase::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
59
engines/mm/mm1/views/character_base.h
Normal file
59
engines/mm/mm1/views/character_base.h
Normal 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_VIEWS_CHARACTER_BASE_H
|
||||
#define MM1_VIEWS_CHARACTER_BASE_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
/**
|
||||
* Base class for showing character information.
|
||||
* MM1 has three character dialogs:
|
||||
* 1) Character management from Create Characters
|
||||
* 2) Inn that allows simply viewing characters
|
||||
* 3) In-game character display
|
||||
*/
|
||||
class CharacterBase : public TextView {
|
||||
private:
|
||||
void printStats();
|
||||
void printSummary();
|
||||
void printInventory();
|
||||
protected:
|
||||
void printCondition();
|
||||
|
||||
public:
|
||||
CharacterBase(const Common::String &name) : TextView(name) {}
|
||||
~CharacterBase() {}
|
||||
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
444
engines/mm/mm1/views/character_info.cpp
Normal file
444
engines/mm/mm1/views/character_info.cpp
Normal file
@@ -0,0 +1,444 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/character_info.h"
|
||||
#include "mm/mm1/views/combat.h"
|
||||
#include "mm/mm1/utils/strings.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
void CharacterInfo::draw() {
|
||||
assert(g_globals->_currCharacter);
|
||||
CharacterBase::draw();
|
||||
|
||||
MetaEngine::setKeybindingMode(
|
||||
_state == DISPLAY || _state == TRADE_WITH ?
|
||||
KeybindingMode::KBMODE_PARTY_MENUS :
|
||||
KeybindingMode::KBMODE_MENUS
|
||||
);
|
||||
|
||||
switch (_state) {
|
||||
case DISPLAY:
|
||||
writeString(0, 21, STRING["dialogs.character.legend1"]);
|
||||
writeString(0, 22, STRING["dialogs.character.legend2"]);
|
||||
writeString(0, 23, STRING["dialogs.character.legend3"]);
|
||||
writeString(0, 24, STRING["dialogs.character.legend4"]);
|
||||
break;
|
||||
|
||||
case DISCARD:
|
||||
writeString(0, 20, STRING["dialogs.character.discard"]);
|
||||
escToGoBack(0);
|
||||
break;
|
||||
|
||||
case EQUIP:
|
||||
writeString(0, 20, STRING["dialogs.character.equip"]);
|
||||
escToGoBack(0);
|
||||
break;
|
||||
|
||||
case REMOVE:
|
||||
writeString(0, 20, STRING["dialogs.character.remove"]);
|
||||
escToGoBack(0);
|
||||
break;
|
||||
|
||||
case SHARE:
|
||||
writeString(8, 20, STRING["dialogs.character.share_all"]);
|
||||
drawGemsGoldFood();
|
||||
break;
|
||||
|
||||
case TRADE_WITH:
|
||||
// Print party
|
||||
clearLines(13, 24);
|
||||
for (uint i = 0; i < g_globals->_party.size(); ++i) {
|
||||
const Character &c = g_globals->_party[i];
|
||||
_textPos.x = (i % 2) == 0 ? 1 : 22;
|
||||
_textPos.y = 15 + (i / 2);
|
||||
writeChar(c._condition ? '*' : ' ');
|
||||
writeChar('1' + i);
|
||||
writeString(") ");
|
||||
writeString(c._name);
|
||||
}
|
||||
|
||||
writeString(10, 20, Common::String::format(
|
||||
STRING["dialogs.character.trade_with"].c_str(),
|
||||
(int)g_globals->_party.size()
|
||||
));
|
||||
break;
|
||||
|
||||
case TRADE_KIND:
|
||||
writeString(6, 20, STRING["dialogs.character.trade_which"]);
|
||||
drawGemsGoldFood();
|
||||
writeString(20, 23, STRING["dialogs.character.item"]);
|
||||
escToGoBack(0);
|
||||
break;
|
||||
|
||||
case TRADE_ITEM:
|
||||
writeString(10, 20, STRING["dialogs.character.which"]);
|
||||
escToGoBack(0);
|
||||
break;
|
||||
|
||||
case USE:
|
||||
g_globals->_combatEffectCtr = 0;
|
||||
g_globals->_nonCombatEffectCtr = 0;
|
||||
writeString(7, 20, STRING["dialogs.character.use_what"]);
|
||||
escToGoBack(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterInfo::timeout() {
|
||||
switch (_state) {
|
||||
case USE:
|
||||
if (g_events->isInCombat()) {
|
||||
close();
|
||||
} else {
|
||||
_state = DISPLAY;
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return CharacterBase::timeout();
|
||||
}
|
||||
}
|
||||
|
||||
bool CharacterInfo::msgFocus(const FocusMessage &msg) {
|
||||
CharacterBase::msgFocus(msg);
|
||||
_state = DISPLAY;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
|
||||
switch (_state) {
|
||||
case DISPLAY:
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_c:
|
||||
send("CastSpell", GameMessage("SPELL", 0));
|
||||
break;
|
||||
case Common::KEYCODE_d:
|
||||
if (!g_globals->_currCharacter->_backpack.empty())
|
||||
_state = DISCARD;
|
||||
redraw();
|
||||
break;
|
||||
case Common::KEYCODE_e:
|
||||
if (!g_globals->_currCharacter->_backpack.empty())
|
||||
_state = EQUIP;
|
||||
redraw();
|
||||
break;
|
||||
case Common::KEYCODE_g:
|
||||
g_globals->_currCharacter->gatherGold();
|
||||
redraw();
|
||||
break;
|
||||
case Common::KEYCODE_q:
|
||||
replaceView("QuickRef");
|
||||
break;
|
||||
case Common::KEYCODE_r:
|
||||
if (!g_globals->_currCharacter->_equipped.empty())
|
||||
_state = REMOVE;
|
||||
redraw();
|
||||
break;
|
||||
case Common::KEYCODE_s:
|
||||
_state = SHARE;
|
||||
redraw();
|
||||
break;
|
||||
case Common::KEYCODE_t:
|
||||
_state = TRADE_WITH;
|
||||
redraw();
|
||||
break;
|
||||
case Common::KEYCODE_u:
|
||||
_state = USE;
|
||||
redraw();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DISCARD:
|
||||
if (msg.keycode >= Common::KEYCODE_a &&
|
||||
msg.keycode <= Common::KEYCODE_f)
|
||||
discardItem(msg.keycode - Common::KEYCODE_a);
|
||||
redraw();
|
||||
break;
|
||||
|
||||
case EQUIP:
|
||||
if (msg.keycode >= Common::KEYCODE_a &&
|
||||
msg.keycode <= Common::KEYCODE_f)
|
||||
equipItem(msg.keycode - Common::KEYCODE_a);
|
||||
redraw();
|
||||
break;
|
||||
|
||||
case REMOVE:
|
||||
if (msg.keycode >= Common::KEYCODE_1 &&
|
||||
msg.keycode <= Common::KEYCODE_6)
|
||||
removeItem(msg.keycode - Common::KEYCODE_1);
|
||||
redraw();
|
||||
break;
|
||||
|
||||
case SHARE:
|
||||
if (msg.keycode >= Common::KEYCODE_1 &&
|
||||
msg.keycode <= Common::KEYCODE_3) {
|
||||
Party::share((TransferKind)(msg.keycode - Common::KEYCODE_0));
|
||||
_state = DISPLAY;
|
||||
redraw();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case TRADE_KIND:
|
||||
if (msg.keycode >= Common::KEYCODE_1 &&
|
||||
msg.keycode <= Common::KEYCODE_3) {
|
||||
_tradeKind = (TransferKind)(msg.keycode - Common::KEYCODE_0);
|
||||
tradeHowMuch();
|
||||
|
||||
} else if (msg.keycode == Common::KEYCODE_4) {
|
||||
if (g_globals->_party[_tradeWith]._backpack.full()) {
|
||||
writeString(14, 21, STRING["dialogs.character.full"]);
|
||||
Sound::sound(SOUND_2);
|
||||
_state = DISPLAY;
|
||||
delaySeconds(3);
|
||||
} else {
|
||||
_state = TRADE_ITEM;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TRADE_ITEM:
|
||||
if (msg.keycode >= Common::KEYCODE_a &&
|
||||
msg.keycode <= Common::KEYCODE_f) {
|
||||
switch (g_globals->_currCharacter->trade(_tradeWith,
|
||||
msg.keycode - Common::KEYCODE_a)) {
|
||||
case Character::TRADE_FULL:
|
||||
writeString(14, 21, STRING["dialogs.character.full"]);
|
||||
_state = DISPLAY;
|
||||
delaySeconds(3);
|
||||
break;
|
||||
case Character::TRADE_SUCCESS:
|
||||
_state = DISPLAY;
|
||||
redraw();
|
||||
break;
|
||||
default:
|
||||
// Do nothing, no item at selected index
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case USE: {
|
||||
Character &c = *g_globals->_currCharacter;
|
||||
Inventory *inv;
|
||||
Inventory::Entry *invEntry;
|
||||
if (msg.keycode >= Common::KEYCODE_1 && msg.keycode <= Common::KEYCODE_6 &&
|
||||
(msg.keycode - Common::KEYCODE_1) < (int)c._equipped.size()) {
|
||||
inv = &c._equipped;
|
||||
invEntry = &c._equipped[msg.keycode - Common::KEYCODE_1];
|
||||
} else if (msg.keycode >= Common::KEYCODE_a && msg.keycode <= Common::KEYCODE_f &&
|
||||
(msg.keycode - Common::KEYCODE_a) < (int)c._backpack.size()) {
|
||||
inv = &c._backpack;
|
||||
invEntry = &c._backpack[msg.keycode - Common::KEYCODE_a];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_events->isInCombat())
|
||||
combatUseItem(*inv, *invEntry, msg.keycode >= Common::KEYCODE_a);
|
||||
else
|
||||
nonCombatUseItem(*inv, *invEntry, msg.keycode >= Common::KEYCODE_a);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterInfo::msgAction(const ActionMessage &msg) {
|
||||
switch (msg._action) {
|
||||
case KEYBIND_ESCAPE:
|
||||
if (_state != DISPLAY) {
|
||||
redraw();
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
|
||||
_state = DISPLAY;
|
||||
return true;
|
||||
case KEYBIND_VIEW_PARTY1:
|
||||
case KEYBIND_VIEW_PARTY2:
|
||||
case KEYBIND_VIEW_PARTY3:
|
||||
case KEYBIND_VIEW_PARTY4:
|
||||
case KEYBIND_VIEW_PARTY5:
|
||||
case KEYBIND_VIEW_PARTY6:
|
||||
if (_state == DISPLAY) {
|
||||
g_globals->_currCharacter = &g_globals->_party[
|
||||
msg._action - KEYBIND_VIEW_PARTY1];
|
||||
redraw();
|
||||
} else if (_state == TRADE_WITH) {
|
||||
_state = TRADE_KIND;
|
||||
_tradeWith = msg._action - KEYBIND_VIEW_PARTY1;
|
||||
redraw();
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CharacterInfo::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "USE") {
|
||||
addView();
|
||||
_state = USE;
|
||||
redraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CharacterInfo::discardItem(uint index) {
|
||||
Inventory &inv = g_globals->_currCharacter->_backpack;
|
||||
if (index < inv.size())
|
||||
inv.removeAt(index);
|
||||
_state = DISPLAY;
|
||||
}
|
||||
|
||||
void CharacterInfo::equipItem(uint index) {
|
||||
Common::String errMsg;
|
||||
_state = DISPLAY;
|
||||
|
||||
if (!EquipRemove::equipItem(index, _textPos, errMsg)) {
|
||||
clearLines(20, 24);
|
||||
_textPos.y = 21;
|
||||
writeString(errMsg);
|
||||
|
||||
Sound::sound(SOUND_2);
|
||||
delaySeconds(3);
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterInfo::removeItem(uint index) {
|
||||
Common::String errMsg;
|
||||
_state = DISPLAY;
|
||||
|
||||
if (!EquipRemove::removeItem(index, _textPos, errMsg)) {
|
||||
clearLines(20, 24);
|
||||
_textPos.y = 21;
|
||||
writeString(errMsg);
|
||||
|
||||
Sound::sound(SOUND_2);
|
||||
delaySeconds(3);
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterInfo::drawGemsGoldFood() {
|
||||
writeString(20, 20, STRING["dialogs.character.gems"]);
|
||||
writeString(20, 21, STRING["dialogs.character.gold"]);
|
||||
writeString(20, 22, STRING["dialogs.character.food"]);
|
||||
}
|
||||
|
||||
void CharacterInfo::howMuchAborted() {
|
||||
_state = TRADE_WITH;
|
||||
redraw();
|
||||
}
|
||||
|
||||
void CharacterInfo::howMuchEntered(uint amount) {
|
||||
Character &src = *g_globals->_currCharacter;
|
||||
Character &dest = g_globals->_party[_tradeWith];
|
||||
|
||||
switch (_tradeKind) {
|
||||
case TK_GEMS:
|
||||
if (amount > src._gems || ((int)dest._gems + amount) > 0xffff) {
|
||||
Sound::sound(SOUND_2);
|
||||
} else {
|
||||
src._gems -= amount;
|
||||
dest._gems += amount;
|
||||
}
|
||||
break;
|
||||
case TK_GOLD:
|
||||
if (amount > src._gold || (dest._gold + amount) > 0xffffff) {
|
||||
Sound::sound(SOUND_2);
|
||||
} else {
|
||||
src._gold -= amount;
|
||||
dest._gold += amount;
|
||||
}
|
||||
break;
|
||||
case TK_FOOD:
|
||||
if (amount > src._food || (dest._food + amount) > 40) {
|
||||
Sound::sound(SOUND_2);
|
||||
} else {
|
||||
src._food -= amount;
|
||||
dest._food += amount;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_state = DISPLAY;
|
||||
redraw();
|
||||
}
|
||||
|
||||
void CharacterInfo::abortFunc() {
|
||||
CharacterInfo *view = (CharacterInfo *)g_events->focusedView();
|
||||
view->howMuchAborted();
|
||||
}
|
||||
|
||||
void CharacterInfo::enterFunc(const Common::String &text) {
|
||||
CharacterInfo *view = (CharacterInfo *)g_events->focusedView();
|
||||
view->howMuchEntered(atoi(text.c_str()));
|
||||
}
|
||||
|
||||
void CharacterInfo::tradeHowMuch() {
|
||||
clearLines(20, 24);
|
||||
escToGoBack(0);
|
||||
writeString(10, 20, STRING["dialogs.character.how_much"]);
|
||||
|
||||
_textEntry.display(20, 20, 5, true, abortFunc, enterFunc);
|
||||
}
|
||||
|
||||
void CharacterInfo::combatUseItem(Inventory &inv, Inventory::Entry &invEntry, bool isEquipped) {
|
||||
Common::String msg = Game::UseItem::combatUseItem(inv, invEntry, isEquipped);
|
||||
clearLines(20, 24);
|
||||
writeString(8, 21, msg);
|
||||
delaySeconds(3);
|
||||
}
|
||||
|
||||
void CharacterInfo::nonCombatUseItem(Inventory &inv, Inventory::Entry &invEntry, bool isEquipped) {
|
||||
Common::String msg = Game::UseItem::nonCombatUseItem(inv, invEntry, isEquipped);
|
||||
|
||||
clearLines(20, 24);
|
||||
writeString(8, 21, msg);
|
||||
delaySeconds(3);
|
||||
}
|
||||
|
||||
} // namespace ViewsEnh
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
115
engines/mm/mm1/views/character_info.h
Normal file
115
engines/mm/mm1/views/character_info.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_CHARACTER_INFO_H
|
||||
#define MM1_VIEWS_CHARACTER_INFO_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "mm/mm1/views/character_base.h"
|
||||
#include "mm/mm1/data/character.h"
|
||||
#include "mm/mm1/data/items.h"
|
||||
#include "mm/mm1/game/equip_remove.h"
|
||||
#include "mm/mm1/game/use_item.h"
|
||||
#include "mm/mm1/views/text_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
/**
|
||||
* In-game character dialog
|
||||
*/
|
||||
class CharacterInfo : public CharacterBase, MM1::Game::EquipRemove,
|
||||
public MM1::Game::UseItem {
|
||||
private:
|
||||
enum ViewState {
|
||||
DISPLAY, DISCARD, EQUIP, GATHER, REMOVE, SHARE,
|
||||
TRADE_WITH, TRADE_KIND, TRADE_ITEM, USE };
|
||||
ViewState _state = DISPLAY;
|
||||
Common::String _newName;
|
||||
private:
|
||||
int _tradeWith = -1;
|
||||
TransferKind _tradeKind = TK_GEMS;
|
||||
TextEntry _textEntry;
|
||||
static void abortFunc();
|
||||
static void enterFunc(const Common::String &text);
|
||||
private:
|
||||
/**
|
||||
* Discards the item at the given index
|
||||
*/
|
||||
void discardItem(uint index);
|
||||
|
||||
/**
|
||||
* Equips the item at the given index
|
||||
*/
|
||||
void equipItem(uint index);
|
||||
|
||||
/**
|
||||
* Removes the equipped item at the given index
|
||||
*/
|
||||
void removeItem(uint index);
|
||||
|
||||
/**
|
||||
* Draw options for gems, gold, and food
|
||||
*/
|
||||
void drawGemsGoldFood();
|
||||
|
||||
/**
|
||||
* Selects how much for gems/gold/food trades
|
||||
*/
|
||||
void tradeHowMuch();
|
||||
|
||||
/**
|
||||
* Using an item during combat
|
||||
*/
|
||||
void combatUseItem(Inventory &inv, Inventory::Entry &invEntry, bool isEquipped);
|
||||
|
||||
/**
|
||||
* Using an item outside of combat
|
||||
*/
|
||||
void nonCombatUseItem(Inventory &inv, Inventory::Entry &invEntry, bool isEquipped);
|
||||
public:
|
||||
CharacterInfo() : CharacterBase("CharacterInfo") {}
|
||||
virtual ~CharacterInfo() {}
|
||||
|
||||
void draw() override;
|
||||
void timeout() override;
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
|
||||
/**
|
||||
* How much entry aborted
|
||||
*/
|
||||
void howMuchAborted();
|
||||
|
||||
/**
|
||||
* How much entered for a trade
|
||||
*/
|
||||
void howMuchEntered(uint amount);
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
123
engines/mm/mm1/views/character_manage.cpp
Normal file
123
engines/mm/mm1/views/character_manage.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/character_manage.h"
|
||||
#include "mm/mm1/utils/strings.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
void CharacterManage::draw() {
|
||||
assert(g_globals->_currCharacter);
|
||||
CharacterBase::draw();
|
||||
|
||||
switch (_state) {
|
||||
case DISPLAY:
|
||||
writeString(6, 21, STRING["dialogs.view_character.rename"]);
|
||||
writeString(6, 22, STRING["dialogs.view_character.delete"]);
|
||||
escToGoBack();
|
||||
break;
|
||||
|
||||
case RENAME:
|
||||
writeString(6, 21, STRING["dialogs.view_character.name"]);
|
||||
writeString(_newName);
|
||||
writeChar('_');
|
||||
break;
|
||||
|
||||
case DELETE:
|
||||
writeString(6, 21, STRING["dialogs.view_character.are_you_sure"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool CharacterManage::msgKeypress(const KeypressMessage &msg) {
|
||||
switch (_state) {
|
||||
case DISPLAY:
|
||||
if ((msg.flags & Common::KBD_CTRL) && msg.keycode == Common::KEYCODE_n) {
|
||||
_state = RENAME;
|
||||
_newName = "";
|
||||
redraw();
|
||||
} else if ((msg.flags & Common::KBD_CTRL) && msg.keycode == Common::KEYCODE_d) {
|
||||
_state = DELETE;
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case RENAME:
|
||||
if (msg.ascii >= 32 && msg.ascii <= 127) {
|
||||
_newName += toupper(msg.ascii);
|
||||
redraw();
|
||||
}
|
||||
if (msg.keycode == Common::KEYCODE_RETURN || _newName.size() == 15) {
|
||||
strncpy(g_globals->_currCharacter->_name, _newName.c_str(), 16);
|
||||
_state = DISPLAY;
|
||||
redraw();
|
||||
} else if (msg.keycode == Common::KEYCODE_BACKSPACE &&
|
||||
!_newName.empty()) {
|
||||
_newName.deleteLastChar();
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case DELETE:
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
// Removes the character and returns to View All Characters
|
||||
g_globals->_roster.remove(g_globals->_currCharacter);
|
||||
close();
|
||||
} else {
|
||||
// Any other keypress returns to display mode
|
||||
redraw();
|
||||
}
|
||||
|
||||
_state = DISPLAY;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharacterManage::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
if (_state != DISPLAY) {
|
||||
redraw();
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
|
||||
_state = DISPLAY;
|
||||
return true;
|
||||
} else if (msg._action >= KEYBIND_VIEW_PARTY1 &&
|
||||
msg._action <= KEYBIND_VIEW_PARTY6 &&
|
||||
_state == DISPLAY) {
|
||||
g_globals->_currCharacter = &g_globals->_party[
|
||||
msg._action - KEYBIND_VIEW_PARTY1];
|
||||
addView();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
53
engines/mm/mm1/views/character_manage.h
Normal file
53
engines/mm/mm1/views/character_manage.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_CHARACTER_MANAGE_H
|
||||
#define MM1_VIEWS_CHARACTER_MANAGE_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "mm/mm1/views/character_base.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
/**
|
||||
* Character management dialog
|
||||
*/
|
||||
class CharacterManage : public CharacterBase {
|
||||
enum ViewState { DISPLAY = 0, RENAME = 1, DELETE = 2 };
|
||||
ViewState _state = DISPLAY;
|
||||
Common::String _newName;
|
||||
public:
|
||||
CharacterManage() : CharacterBase("CharacterManage") {}
|
||||
virtual ~CharacterManage() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
50
engines/mm/mm1/views/character_view.h
Normal file
50
engines/mm/mm1/views/character_view.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_CHARACTER_VIEW_H
|
||||
#define MM1_VIEWS_CHARACTER_VIEW_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "mm/mm1/views/character_base.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
/**
|
||||
* Character view from the inn screen
|
||||
*/
|
||||
class CharacterView : public CharacterBase {
|
||||
public:
|
||||
CharacterView() : CharacterBase("CharacterView") {}
|
||||
virtual ~CharacterView() {}
|
||||
|
||||
void draw() override {
|
||||
CharacterBase::draw();
|
||||
escToGoBack();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
65
engines/mm/mm1/views/character_view_combat.cpp
Normal file
65
engines/mm/mm1/views/character_view_combat.cpp
Normal 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/views/character_view_combat.h"
|
||||
#include "mm/mm1/utils/strings.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
bool CharacterViewCombat::msgFocus(const FocusMessage &msg) {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
|
||||
return CharacterBase::msgFocus(msg);
|
||||
}
|
||||
|
||||
bool CharacterViewCombat::msgUnfocus(const UnfocusMessage &msg) {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
return CharacterBase::msgUnfocus(msg);
|
||||
}
|
||||
|
||||
void CharacterViewCombat::draw() {
|
||||
CharacterBase::draw();
|
||||
|
||||
writeString(12, 22, Common::String::format("'1'-'%c' %s",
|
||||
'0' + g_globals->_combatParty.size(), STRING["dialogs.quick_ref.to_view"].c_str()));
|
||||
escToGoBack();
|
||||
}
|
||||
|
||||
bool CharacterViewCombat::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action >= KEYBIND_VIEW_PARTY1 &&
|
||||
msg._action <= KEYBIND_VIEW_PARTY6) {
|
||||
uint charNum = msg._action - KEYBIND_VIEW_PARTY1;
|
||||
if (charNum < g_globals->_combatParty.size()) {
|
||||
g_globals->_currCharacter = g_globals->_combatParty[charNum];
|
||||
redraw();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
52
engines/mm/mm1/views/character_view_combat.h
Normal file
52
engines/mm/mm1/views/character_view_combat.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_CHARACTER_VIEW_COMBAT_H
|
||||
#define MM1_VIEWS_CHARACTER_VIEW_COMBAT_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "mm/mm1/data/character.h"
|
||||
#include "mm/mm1/views/character_base.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
/**
|
||||
* Character info view within combat, that allows
|
||||
* switching between characters
|
||||
*/
|
||||
class CharacterViewCombat : public CharacterBase {
|
||||
public:
|
||||
CharacterViewCombat() : CharacterBase("CharacterViewCombat") {}
|
||||
virtual ~CharacterViewCombat() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
98
engines/mm/mm1/views/characters.cpp
Normal file
98
engines/mm/mm1/views/characters.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/characters.h"
|
||||
#include "mm/mm1/utils/strings.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
void Characters::draw() {
|
||||
drawTextBorder();
|
||||
|
||||
Roster &roster = g_globals->_roster;
|
||||
writeString(11, 0, STRING["dialogs.view_characters.title"]);
|
||||
int lineNum = 0;
|
||||
_charIndexes.clear();
|
||||
|
||||
if (g_globals->_roster.empty()) {
|
||||
writeString(8, 5, STRING["dialogs.misc.no_characters"]);
|
||||
escToGoBack();
|
||||
return;
|
||||
}
|
||||
|
||||
// Loop to print characters
|
||||
for (int charNum = 0; charNum < ROSTER_COUNT; ++charNum) {
|
||||
if (roster._towns[charNum]) {
|
||||
const Character &re = roster[charNum];
|
||||
Common::String charName = re._name;
|
||||
pad_string(charName, 16, '.');
|
||||
|
||||
Common::String level = Common::String::format("(%d)L%d",
|
||||
roster._towns[charNum], re._level._current);
|
||||
pad_string(level, 7);
|
||||
|
||||
Common::String className = (re._class >= KNIGHT && re._class <= ROBBER) ?
|
||||
STRING[Common::String::format("stats.classes.%d", (int)re._class)] :
|
||||
STRING["stats.none"];
|
||||
|
||||
// Form line like: A) charName...(1)L1 Knight
|
||||
Common::String line = Common::String::format("(%c) %s%s%s",
|
||||
'A' + lineNum, charName.c_str(), level.c_str(), className.c_str());
|
||||
writeString(3, 3 + lineNum++, line);
|
||||
|
||||
_charIndexes.push_back(charNum);
|
||||
}
|
||||
}
|
||||
|
||||
// Print legend at the bottom
|
||||
writeString(6, 22, Common::String::format(
|
||||
STRING["dialogs.view_characters.legend1"].c_str(),
|
||||
'A' + (int)_charIndexes.size() - 1));
|
||||
writeString(12, 24, STRING["dialogs.misc.go_back"]);
|
||||
}
|
||||
|
||||
bool Characters::msgKeypress(const KeypressMessage &msg) {
|
||||
if (msg.keycode >= Common::KEYCODE_a &&
|
||||
msg.keycode <= (Common::KEYCODE_a + (int)_charIndexes.size() - 1)) {
|
||||
// Character selected
|
||||
uint charIndex = _charIndexes[msg.keycode - Common::KEYCODE_a];
|
||||
g_globals->_currCharacter = &g_globals->_roster[charIndex];
|
||||
_characterView.addView();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Characters::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
53
engines/mm/mm1/views/characters.h
Normal file
53
engines/mm/mm1/views/characters.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_CHARACTERS_H
|
||||
#define MM1_VIEWS_CHARACTERS_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
#include "mm/mm1/views/character_manage.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
/**
|
||||
* Dialog for View All Characters
|
||||
*/
|
||||
class Characters : public TextView {
|
||||
private:
|
||||
Common::Array<uint> _charIndexes;
|
||||
CharacterManage _characterView;
|
||||
public:
|
||||
Characters() : TextView("Characters") {}
|
||||
virtual ~Characters() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
130
engines/mm/mm1/views/color_questions.cpp
Normal file
130
engines/mm/mm1/views/color_questions.cpp
Normal file
@@ -0,0 +1,130 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/color_questions.h"
|
||||
#include "mm/mm1/maps/map17.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
#define COLOR 510
|
||||
#define CORRECT_ANSWERS 511
|
||||
|
||||
ColorQuestions::ColorQuestions() : TextView("ColorQuestions") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool ColorQuestions::msgFocus(const FocusMessage &msg) {
|
||||
TextView::msgFocus(msg);
|
||||
_showingResponse = false;
|
||||
|
||||
// Find first non-incapacitated party member
|
||||
_charIndex = -1;
|
||||
moveToNextChar();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorQuestions::draw() {
|
||||
clearSurface();
|
||||
|
||||
if (!_showingResponse) {
|
||||
writeString(0, 0, STRING["maps.map17.color"]);
|
||||
writeString(0, 2, STRING["maps.map17.options"]);
|
||||
|
||||
} else {
|
||||
const Character &c = g_globals->_party[_charIndex];
|
||||
|
||||
Common::String result = STRING[c.hasBadCondition() ?
|
||||
"maps.map17.wrong" : "maps.map17.correct"];
|
||||
writeString(16, 2, result);
|
||||
}
|
||||
}
|
||||
|
||||
bool ColorQuestions::msgKeypress(const KeypressMessage &msg) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
if (!_showingResponse && msg.keycode >= Common::KEYCODE_1 && msg.keycode <= Common::KEYCODE_9) {
|
||||
Maps::Map17 &map = *static_cast<Maps::Map17 *>(g_maps->_currentMap);
|
||||
map[COLOR] = msg.ascii - '1';
|
||||
|
||||
Character &c = g_globals->_party[_charIndex];
|
||||
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;
|
||||
} else {
|
||||
map[CORRECT_ANSWERS]++;
|
||||
c._flags[4] |= CHARFLAG4_80;
|
||||
}
|
||||
|
||||
// Show the response
|
||||
_showingResponse = true;
|
||||
redraw();
|
||||
delaySeconds(2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ColorQuestions::msgAction(const ActionMessage &msg) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ColorQuestions::timeout() {
|
||||
// Move to next non-incapacitated character
|
||||
_showingResponse = false;
|
||||
moveToNextChar();
|
||||
|
||||
if (_charIndex >= (int)g_globals->_party.size()) {
|
||||
// All of party questioned
|
||||
close();
|
||||
g_maps->_mapPos.y = 2;
|
||||
g_maps->_currentMap->updateGame();
|
||||
|
||||
g_globals->_party.checkPartyDead();
|
||||
|
||||
} else {
|
||||
// Prompt response for next party member
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void ColorQuestions::moveToNextChar() {
|
||||
do {
|
||||
++_charIndex;
|
||||
} while (_charIndex < (int)g_globals->_party.size() &&
|
||||
g_globals->_party[_charIndex].hasBadCondition());
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
52
engines/mm/mm1/views/color_questions.h
Normal file
52
engines/mm/mm1/views/color_questions.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_COLOR_QUESTIONS_H
|
||||
#define MM1_VIEWS_COLOR_QUESTIONS_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class ColorQuestions : public TextView {
|
||||
private:
|
||||
int _charIndex = 0;
|
||||
bool _showingResponse = false;
|
||||
|
||||
void moveToNextChar();
|
||||
public:
|
||||
ColorQuestions();
|
||||
virtual ~ColorQuestions() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
void timeout() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
867
engines/mm/mm1/views/combat.cpp
Normal file
867
engines/mm/mm1/views/combat.cpp
Normal file
@@ -0,0 +1,867 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/combat.h"
|
||||
#include "mm/mm1/views/character_view_combat.h"
|
||||
#include "mm/mm1/game/encounter.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
Combat::Combat() : TextView("Combat") {
|
||||
}
|
||||
|
||||
void Combat::setMode(Mode newMode) {
|
||||
_mode = newMode;
|
||||
|
||||
if (newMode == SELECT_OPTION) {
|
||||
_option = OPTION_NONE;
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_COMBAT);
|
||||
} else {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
}
|
||||
|
||||
if (_mode == MONSTER_SPELL)
|
||||
// Make a copy of monster spell
|
||||
_monsterSpellLines = getMonsterSpellMessage();
|
||||
|
||||
if (_mode != MONSTER_ADVANCES && _mode != MONSTER_ATTACK &&
|
||||
_mode != MONSTER_SPELL)
|
||||
_activeMonsterNum = -1;
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void Combat::disableAttacks() {
|
||||
_allowFight = false;
|
||||
_allowShoot = false;
|
||||
_allowCast = false;
|
||||
_allowAttack = false;
|
||||
}
|
||||
|
||||
bool Combat::msgFocus(const FocusMessage &msg) {
|
||||
g_globals->_currCharacter = g_globals->_combatParty[_currentChar];
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_COMBAT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Combat::msgUnfocus(const UnfocusMessage &msg) {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
return TextView::msgUnfocus(msg);
|
||||
}
|
||||
|
||||
bool Combat::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "COMBAT") {
|
||||
// Clear combat data
|
||||
clear();
|
||||
|
||||
loadMonsters();
|
||||
setupCanAttacks();
|
||||
setupHandicap();
|
||||
|
||||
addView();
|
||||
combatLoop();
|
||||
return true;
|
||||
|
||||
} else if (msg._name == "SPELL_RESULT") {
|
||||
assert(msg._value >= 0 && msg._value < 40);
|
||||
_spellResult._lines.clear();
|
||||
_spellResult._lines.push_back(Line(msg._value, 1, msg._stringValue));
|
||||
_spellResult._delaySeconds = 3;
|
||||
|
||||
setMode(SPELL_RESULT);
|
||||
return true;
|
||||
|
||||
} else if (msg._name == "DISABLE_ATTACKS") {
|
||||
disableAttacks();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Combat::draw() {
|
||||
switch (_mode) {
|
||||
case NEXT_ROUND:
|
||||
writeMonsters();
|
||||
resetBottom();
|
||||
highlightNextRound();
|
||||
delaySeconds(1);
|
||||
return;
|
||||
case MONSTER_ADVANCES:
|
||||
writeString(0, 20, _monsterName);
|
||||
writeString(STRING["dialogs.combat.advances"]);
|
||||
writeSpaces(30);
|
||||
writeRound();
|
||||
writeMonsters();
|
||||
delaySeconds(2);
|
||||
return;
|
||||
case MONSTERS_AFFECTED:
|
||||
writeMonsterEffects();
|
||||
delaySeconds(2);
|
||||
return;
|
||||
case MONSTER_SPELL:
|
||||
writeMonsterSpell();
|
||||
delaySeconds(2);
|
||||
return;
|
||||
case INFILTRATION:
|
||||
writeInfiltration();
|
||||
delaySeconds(3);
|
||||
return;
|
||||
case WAITS_FOR_OPENING:
|
||||
writeWaitsForOpening();
|
||||
delaySeconds(2);
|
||||
return;
|
||||
case CHAR_ATTACKS:
|
||||
writeMonsters();
|
||||
writeCharAttackDamage();
|
||||
delaySeconds(3);
|
||||
return;
|
||||
case NO_EFFECT:
|
||||
writeCharAttackNoEffect();
|
||||
delaySeconds(3);
|
||||
return;
|
||||
case DEFEATED_MONSTERS:
|
||||
writeDefeat();
|
||||
Sound::sound2(SOUND_3);
|
||||
delaySeconds(3);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
clearSurface();
|
||||
writeStaticContent();
|
||||
writeHandicap();
|
||||
writeRound();
|
||||
writePartyNumbers();
|
||||
writeMonsters();
|
||||
writeParty();
|
||||
|
||||
switch (_mode) {
|
||||
case SELECT_OPTION:
|
||||
writeOptions();
|
||||
break;
|
||||
|
||||
case SPELL_RESULT:
|
||||
writeSpellResult();
|
||||
if (_spellResult._delaySeconds)
|
||||
delaySeconds(_spellResult._delaySeconds);
|
||||
break;
|
||||
|
||||
case MONSTER_ATTACK:
|
||||
writeMonsterAttack();
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
case MONSTER_FLEES:
|
||||
case MONSTER_WANDERS:
|
||||
writeMonsterAction(_mode == MONSTER_FLEES);
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::timeout() {
|
||||
switch (_mode) {
|
||||
case NEXT_ROUND:
|
||||
nextRound2();
|
||||
break;
|
||||
case MONSTER_ADVANCES:
|
||||
nextRound3();
|
||||
break;
|
||||
case MONSTERS_AFFECTED:
|
||||
case CHAR_ATTACKS:
|
||||
case NO_EFFECT:
|
||||
case MONSTER_FLEES:
|
||||
removeDeadMonsters();
|
||||
combatLoop();
|
||||
break;
|
||||
case MONSTER_WANDERS:
|
||||
case INFILTRATION:
|
||||
case MONSTER_ATTACK:
|
||||
writeParty();
|
||||
writeMonsters();
|
||||
checkParty();
|
||||
break;
|
||||
case MONSTER_SPELL:
|
||||
checkMonsterSpellDone();
|
||||
break;
|
||||
case WAITS_FOR_OPENING:
|
||||
combatLoop(true);
|
||||
break;
|
||||
case DEFEATED_MONSTERS:
|
||||
combatDone();
|
||||
break;
|
||||
case SPELL_RESULT:
|
||||
if (_spellResult._callback)
|
||||
_spellResult._callback();
|
||||
else
|
||||
// Character is done
|
||||
block();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool Combat::msgKeypress(const KeypressMessage &msg) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
if (_mode == SELECT_OPTION && _option != OPTION_NONE) {
|
||||
switch (_option) {
|
||||
case OPTION_FIGHT:
|
||||
case OPTION_SHOOT:
|
||||
if (msg.keycode >= Common::KEYCODE_a &&
|
||||
msg.keycode < (int)(Common::KEYCODE_a + _attackableCount)) {
|
||||
if (_option == OPTION_FIGHT)
|
||||
fightMonster(msg.keycode - Common::KEYCODE_a);
|
||||
else
|
||||
shootMonster(msg.keycode - Common::KEYCODE_a);
|
||||
}
|
||||
break;
|
||||
|
||||
case OPTION_DELAY:
|
||||
if (msg.keycode >= Common::KEYCODE_0 &&
|
||||
msg.keycode <= Common::KEYCODE_9) {
|
||||
g_globals->_delay = msg.keycode - Common::KEYCODE_0;
|
||||
combatLoop();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (_mode == SPELL_RESULT && !isDelayActive()) {
|
||||
// Displaying a spell result that required waiting for keypress
|
||||
assert(_spellResult._callback);
|
||||
_spellResult._callback();
|
||||
|
||||
} else if (isDelayActive()) {
|
||||
// In all other modes, if a delay is active, any keypress
|
||||
// will cause the delay to end immediately
|
||||
endDelay();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Combat::msgAction(const ActionMessage &msg) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
if (_mode == SELECT_OPTION && _option != OPTION_NONE &&
|
||||
msg._action == KEYBIND_ESCAPE) {
|
||||
_option = OPTION_NONE;
|
||||
combatLoop();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_mode != SELECT_OPTION || (_option != OPTION_NONE &&
|
||||
_option != OPTION_EXCHANGE))
|
||||
return false;
|
||||
|
||||
switch (msg._action) {
|
||||
case KEYBIND_VIEW_PARTY1:
|
||||
case KEYBIND_VIEW_PARTY2:
|
||||
case KEYBIND_VIEW_PARTY3:
|
||||
case KEYBIND_VIEW_PARTY4:
|
||||
case KEYBIND_VIEW_PARTY5:
|
||||
case KEYBIND_VIEW_PARTY6: {
|
||||
uint charNum = msg._action - KEYBIND_VIEW_PARTY1;
|
||||
if (charNum < g_globals->_combatParty.size()) {
|
||||
if (_option == OPTION_EXCHANGE) {
|
||||
if (g_globals->_combatParty[charNum] != g_globals->_currCharacter)
|
||||
exchangeWith(charNum);
|
||||
} else {
|
||||
g_globals->_currCharacter = g_globals->_combatParty[charNum];
|
||||
addView("CharacterViewCombat");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case KEYBIND_COMBAT_ATTACK:
|
||||
attack();
|
||||
break;
|
||||
case KEYBIND_COMBAT_BLOCK:
|
||||
block();
|
||||
break;
|
||||
case KEYBIND_COMBAT_CAST:
|
||||
cast();
|
||||
break;
|
||||
case KEYBIND_DELAY:
|
||||
delay();
|
||||
break;
|
||||
case KEYBIND_COMBAT_EXCHANGE:
|
||||
exchange();
|
||||
break;
|
||||
case KEYBIND_COMBAT_FIGHT:
|
||||
fight();
|
||||
break;
|
||||
case KEYBIND_PROTECT:
|
||||
addView("Protect");
|
||||
break;
|
||||
case KEYBIND_QUICKREF:
|
||||
addView("QuickRef");
|
||||
break;
|
||||
case KEYBIND_COMBAT_RETREAT:
|
||||
retreat();
|
||||
break;
|
||||
case KEYBIND_COMBAT_SHOOT:
|
||||
shoot();
|
||||
break;
|
||||
case KEYBIND_COMBAT_USE:
|
||||
use();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Combat::writeOptions() {
|
||||
resetBottom();
|
||||
|
||||
switch (_option) {
|
||||
case OPTION_NONE:
|
||||
writeAllOptions();
|
||||
break;
|
||||
case OPTION_DELAY:
|
||||
writeDelaySelect();
|
||||
break;
|
||||
case OPTION_EXCHANGE:
|
||||
writeExchangeSelect();
|
||||
break;
|
||||
case OPTION_FIGHT:
|
||||
writeFightSelect();
|
||||
break;
|
||||
case OPTION_SHOOT:
|
||||
writeShootSelect();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::writeAllOptions() {
|
||||
assert(g_globals->_currCharacter &&
|
||||
g_globals->_currCharacter == g_globals->_combatParty[_currentChar]);
|
||||
const Character &c = *g_globals->_currCharacter;
|
||||
writeString(0, 20, STRING["dialogs.combat.options_for"]);
|
||||
writeString(0, 22, c._name);
|
||||
|
||||
// Highlight the currently active character
|
||||
writeChar(3 + 4 * (_currentChar % 2), 3 + (_currentChar / 2),
|
||||
(unsigned char)'1' + _currentChar + 0x80);
|
||||
|
||||
bool testShoot;
|
||||
if (c._canAttack) {
|
||||
writeAttackOptions();
|
||||
_allowAttack = true;
|
||||
_allowFight = true;
|
||||
|
||||
// Archers can always attack
|
||||
testShoot = c._class == ARCHER;
|
||||
} else {
|
||||
testShoot = true;
|
||||
}
|
||||
if (testShoot && c._missileAttr._base) {
|
||||
_allowShoot = true;
|
||||
writeShootOption();
|
||||
}
|
||||
|
||||
if (c._sp._current) {
|
||||
writeCastOption();
|
||||
_allowCast = true;
|
||||
}
|
||||
|
||||
writeString(16, 22, STRING["dialogs.combat.exchange_use"]);
|
||||
writeString(16, 23, STRING["dialogs.combat.retreat_block"]);
|
||||
}
|
||||
|
||||
void Combat::writeDelaySelect() {
|
||||
resetBottom();
|
||||
writeString(0, 20, STRING["dialogs.combat.set_delay"]);
|
||||
writeString(0, 23, Common::String::format(
|
||||
STRING["dialogs.combat.delay_currently"].c_str(),
|
||||
g_globals->_delay));
|
||||
escToGoBack(0, 23);
|
||||
}
|
||||
|
||||
void Combat::writeExchangeSelect() {
|
||||
resetBottom();
|
||||
writeString(7, 20, Common::String::format(
|
||||
STRING["dialogs.combat.exchange_places"].c_str(),
|
||||
'0' + g_globals->_combatParty.size()));
|
||||
escToGoBack(12, 23);
|
||||
}
|
||||
|
||||
void Combat::writeFightSelect() {
|
||||
_attackableCount = MIN(_attackersCount, (int)_remainingMonsters.size());
|
||||
|
||||
writeString(10, 20, Common::String::format(
|
||||
STRING["dialogs.combat.fight_which"].c_str(), 'A' + _attackableCount - 1));
|
||||
escToGoBack(12, 23);
|
||||
}
|
||||
|
||||
void Combat::writeShootSelect() {
|
||||
_attackableCount = MIN(_attackersCount, (int)_remainingMonsters.size());
|
||||
|
||||
writeString(10, 20, Common::String::format(
|
||||
STRING["dialogs.combat.shoot_which"].c_str(), 'A' + _attackableCount - 1));
|
||||
escToGoBack(12, 23);
|
||||
}
|
||||
|
||||
void Combat::writeAttackOptions() {
|
||||
writeString(16, 20, STRING["dialogs.combat.attack"]);
|
||||
writeString(16, 21, STRING["dialogs.combat.fight"]);
|
||||
}
|
||||
|
||||
void Combat::writeCastOption() {
|
||||
writeString(30, 21, STRING["dialogs.combat.cast"]);
|
||||
}
|
||||
|
||||
void Combat::writeShootOption() {
|
||||
writeString(30, 20, STRING["dialogs.combat.shoot"]);
|
||||
}
|
||||
|
||||
void Combat::resetBottom() {
|
||||
clearLines(20, 24);
|
||||
_allowFight = _allowShoot = false;
|
||||
_allowCast = _allowAttack = false;
|
||||
}
|
||||
|
||||
void Combat::writeStaticContent() {
|
||||
writeString(0, 0, STRING["dialogs.combat.combat"]);
|
||||
writeString(0, 1, STRING["dialogs.combat.round"]);
|
||||
writeString(0, 7, STRING["dialogs.combat.delay"]);
|
||||
writeString(0, 8, STRING["dialogs.combat.protect"]);
|
||||
writeString(0, 9, STRING["dialogs.combat.quickref"]);
|
||||
writeString(0, 10, STRING["dialogs.combat.view_char"]);
|
||||
writeString(0, 12, STRING["dialogs.combat.handicap"]);
|
||||
|
||||
_textPos = Common::Point(0, 15);
|
||||
for (int i = 0; i < 40; ++i)
|
||||
writeChar('-');
|
||||
}
|
||||
|
||||
void Combat::writeHandicap() {
|
||||
writeString(0, 13, " ");
|
||||
_textPos.x = 0;
|
||||
|
||||
switch (_handicap) {
|
||||
case HANDICAP_EVEN:
|
||||
writeString(STRING["dialogs.combat.even"]);
|
||||
break;
|
||||
case HANDICAP_PARTY:
|
||||
writeString(STRING["dialogs.combat.party_plus"]);
|
||||
writeNumber(_handicapDelta);
|
||||
break;
|
||||
case HANDICAP_MONSTER:
|
||||
writeString(STRING["dialogs.combat.monster_plus"]);
|
||||
writeNumber(_handicapDelta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::writeRound() {
|
||||
writeNumber(7, 1, _roundNum);
|
||||
}
|
||||
|
||||
void Combat::writePartyNumbers() {
|
||||
for (uint i = 0; i < g_globals->_combatParty.size(); ++i) {
|
||||
writeChar(2 + 4 * (i % 2), 3 + (i / 2),
|
||||
g_globals->_combatParty[i]->_canAttack ? '+' : ' ');
|
||||
writeChar('1' + i);
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::writeMonsters() {
|
||||
if (_remainingMonsters.empty()) {
|
||||
_textPos = Common::Point(10, 0);
|
||||
writeSpaces(30);
|
||||
} else {
|
||||
for (int i = 0; i < (int)_remainingMonsters.size(); ++i) {
|
||||
_textPos = Common::Point(11, i);
|
||||
writeChar(i < _attackersCount ? '+' : ' ');
|
||||
unsigned char c = 'A' + i;
|
||||
if ((i == _activeMonsterNum) && (_mode == MONSTER_ADVANCES ||
|
||||
_mode == MONSTER_ATTACK || _mode == MONSTER_SPELL))
|
||||
c |= 0x80;
|
||||
|
||||
writeChar(c);
|
||||
writeString(") ");
|
||||
writeString(_remainingMonsters[i]->_name);
|
||||
writeMonsterStatus(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (; _textPos.y < 15; _textPos.y++) {
|
||||
_textPos.x = 10;
|
||||
writeSpaces(30);
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::writeMonsterStatus(int monsterNum) {
|
||||
auto *currMonster = _monsterP;
|
||||
_monsterP = _remainingMonsters[monsterNum];
|
||||
monsterIndexOf();
|
||||
byte statusBits = _remainingMonsters[monsterNum]->_status;
|
||||
|
||||
if (statusBits) {
|
||||
writeDots();
|
||||
|
||||
int status;
|
||||
if (statusBits == MONFLAG_DEAD) {
|
||||
status = MON_DEAD;
|
||||
} else {
|
||||
for (status = MON_PARALYZED; !(statusBits & 0x80);
|
||||
++status, statusBits <<= 1) {
|
||||
}
|
||||
}
|
||||
|
||||
writeString(STRING[Common::String::format("dialogs.combat.status.%d",
|
||||
status)]);
|
||||
} else if (_monsterP->_hp != _monsterP->_defaultHP) {
|
||||
writeDots();
|
||||
writeString(STRING["dialogs.combat.status.wounded"]);
|
||||
} else {
|
||||
writeSpaces(40 - _textPos.x);
|
||||
}
|
||||
|
||||
_monsterP = currMonster;
|
||||
}
|
||||
|
||||
void Combat::writeDots() {
|
||||
while (_textPos.x < 30)
|
||||
writeChar('.');
|
||||
}
|
||||
|
||||
void Combat::writeParty() {
|
||||
clearPartyArea();
|
||||
|
||||
for (uint i = 0; i < g_globals->_combatParty.size(); ++i) {
|
||||
const Character &c = *g_globals->_combatParty[i];
|
||||
writeString(21 * (i % 2), 16 + (i / 2),
|
||||
Common::String::format("%c%c) %s",
|
||||
(c._condition == 0) ? ' ' : '*',
|
||||
'1' + i,
|
||||
c._name
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::clearPartyArea() {
|
||||
clearLines(16, 18);
|
||||
}
|
||||
|
||||
void Combat::writeDefeat() {
|
||||
writeString(10, 0, "+----------------------------+");
|
||||
for (int y = 1; y < 8; ++y)
|
||||
writeString(10, y, "! !");
|
||||
writeString(10, 8, "+----------------------------+");
|
||||
|
||||
writeString(10, 2, STRING["dialogs.combat.defeating1"]);
|
||||
writeString(10, 4, STRING["dialogs.combat.defeating2"]);
|
||||
writeNumber(14, 6, _totalExperience);
|
||||
_textPos.x++;
|
||||
writeString(STRING["dialogs.combat.xp"]);
|
||||
}
|
||||
|
||||
void Combat::highlightNextRound() {
|
||||
Common::String s = Common::String::format("%s%d",
|
||||
STRING["dialogs.combat.round"].c_str(),
|
||||
_roundNum);
|
||||
|
||||
for (uint i = 0; i < s.size(); ++i)
|
||||
s.setChar(s[i] | 0x80, i);
|
||||
|
||||
writeString(0, 1, s);
|
||||
}
|
||||
|
||||
void Combat::writeMonsterEffects() {
|
||||
if (_monstersRegenerate)
|
||||
writeString(0, 21, STRING["dialogs.combat.regenerate"]);
|
||||
|
||||
if (_monstersResistSpells) {
|
||||
if (_textPos.y != 21)
|
||||
_textPos.y = 20;
|
||||
|
||||
writeString(0, _textPos.y + 1, STRING["dialogs.combat.overcome"]);
|
||||
}
|
||||
|
||||
writeMonsters();
|
||||
}
|
||||
|
||||
void Combat::writeMonsterAction(bool flees) {
|
||||
resetBottom();
|
||||
writeString(0, 20, _monsterName);
|
||||
writeChar(' ');
|
||||
writeString(STRING[flees ?
|
||||
"dialogs.combat.monster_flees" : "dialogs.combat.monster_wanders"
|
||||
]);
|
||||
}
|
||||
|
||||
void Combat::writeMonsterSpell() {
|
||||
resetBottom();
|
||||
|
||||
for (int i = 0, y = 0; i < (int)_monsterSpellLines.size() &&
|
||||
_monsterSpellLines[i].y > y;
|
||||
y = _monsterSpellLines[i].y, ++i) {
|
||||
Common::String text = _monsterSpellLines[i]._text;
|
||||
size_t idx;
|
||||
while ((idx = text.findFirstOf(' ')) != Common::String::npos)
|
||||
text.deleteChar(idx);
|
||||
|
||||
writeString(0, _monsterSpellLines[i].y, text);
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::writeMonsterAttack() {
|
||||
Common::String monsterName = _monsterP->_name;
|
||||
Common::String attackStyle = STRING[Common::String::format(
|
||||
"dialogs.combat.attack_types.%d", _monsterAttackStyle)];
|
||||
Character &c = *g_globals->_currCharacter;
|
||||
|
||||
Common::String line = Common::String::format("%s %s %s",
|
||||
monsterName.c_str(),
|
||||
attackStyle.c_str(),
|
||||
c._name
|
||||
);
|
||||
writeString(0, 20, line);
|
||||
writeString(0, 21, getAttackString());
|
||||
|
||||
if (_damage) {
|
||||
// Attacks wake up sleeping characters
|
||||
if (!(c._condition & BAD_CONDITION))
|
||||
c._condition &= ~ASLEEP;
|
||||
|
||||
// Also check for secondary monster touch action here
|
||||
// This returns a text line to display, and can also
|
||||
// adjust the damage amount. Another reason why we
|
||||
// can't actually apply damage until here
|
||||
int yp = 22;
|
||||
if (monsterTouch(line))
|
||||
writeString(0, yp++, line);
|
||||
|
||||
Common::String damageStr = subtractDamageFromChar();
|
||||
if (!damageStr.empty())
|
||||
writeString(0, yp, damageStr);
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::writeInfiltration() {
|
||||
Common::String line = Common::String::format("%s %s",
|
||||
_monsterP->getDisplayName().c_str(),
|
||||
STRING["dialogs.combat.infiltration"].c_str());
|
||||
|
||||
resetBottom();
|
||||
writeString(0, 20, line);
|
||||
Sound::sound(SOUND_2);
|
||||
Sound::sound(SOUND_2);
|
||||
}
|
||||
|
||||
void Combat::writeWaitsForOpening() {
|
||||
Common::String line = Common::String::format("%s %s",
|
||||
_monsterP->getDisplayName().c_str(),
|
||||
STRING["dialogs.combat.infiltration"].c_str()
|
||||
);
|
||||
|
||||
resetBottom();
|
||||
writeString(0, 20, line);
|
||||
}
|
||||
|
||||
void Combat::writeSpellResult() {
|
||||
for (uint i = 0; i < _spellResult._lines.size(); ++i) {
|
||||
const Line &l = _spellResult._lines[i];
|
||||
writeString(l.x, l.y + 20, l._text);
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::checkMonsterSpellDone() {
|
||||
for (uint i = 0; i < _monsterSpellLines.size(); ++i) {
|
||||
if (i > 0 && _monsterSpellLines[i].y ==
|
||||
_monsterSpellLines[i - 1].y) {
|
||||
// Remove the message line just displayed, and redraw
|
||||
// so the next one can be shown
|
||||
_monsterSpellLines.remove_at(i - 1);
|
||||
redraw();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
checkParty();
|
||||
}
|
||||
|
||||
void Combat::delay() {
|
||||
setOption(OPTION_DELAY);
|
||||
}
|
||||
|
||||
void Combat::exchange() {
|
||||
if (g_globals->_combatParty.size() > 1)
|
||||
setOption(OPTION_EXCHANGE);
|
||||
}
|
||||
|
||||
void Combat::fight() {
|
||||
if (_allowFight) {
|
||||
if (_remainingMonsters.size() < 2) {
|
||||
attackMonsterPhysical();
|
||||
} else {
|
||||
setOption(OPTION_FIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::shoot() {
|
||||
if (_allowShoot) {
|
||||
if (_remainingMonsters.size() < 2) {
|
||||
attackMonsterPhysical();
|
||||
} else {
|
||||
setOption(OPTION_SHOOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::writeMessage() {
|
||||
resetBottom();
|
||||
for (const auto &line : _message)
|
||||
writeString(line.x, line.y, line._text);
|
||||
}
|
||||
|
||||
void Combat::writeCharAttackDamage() {
|
||||
resetBottom();
|
||||
|
||||
writeString(0, 20, Common::String::format("%s %s %s",
|
||||
g_globals->_currCharacter->_name,
|
||||
STRING[_isShooting ? "dialogs.combat.shoots" :
|
||||
"dialogs.combat.attacks"].c_str(),
|
||||
_monsterP->_name.c_str()
|
||||
));
|
||||
_isShooting = false;
|
||||
|
||||
writeString(0, 21, getAttackString());
|
||||
|
||||
if (_monsterP->_status == MONFLAG_DEAD) {
|
||||
writeString(0, 22, Common::String::format("%s %s",
|
||||
_monsterP->_name.c_str(),
|
||||
STRING["dialogs.combat.goes_down"].c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::writeCharAttackNoEffect() {
|
||||
resetBottom();
|
||||
|
||||
writeString(0, 20, Common::String::format("%s %s %s",
|
||||
g_globals->_currCharacter->_name,
|
||||
STRING[_isShooting ? "dialogs.combat.shoots" :
|
||||
"dialogs.combat.attacks"].c_str(),
|
||||
_monsterP->_name.c_str()
|
||||
));
|
||||
_isShooting = false;
|
||||
|
||||
writeString(0, 21, STRING["dialogs.combat.weapon_no_effect"]);
|
||||
}
|
||||
|
||||
Common::String Combat::getAttackString() {
|
||||
Common::String line1;
|
||||
if (_numberOfTimes == 1) {
|
||||
line1 = STRING["dialogs.combat.once"];
|
||||
} else {
|
||||
line1 = Common::String::format("%d %s", _numberOfTimes,
|
||||
STRING["dialogs.combat.times"].c_str());
|
||||
}
|
||||
|
||||
line1 += Common::String::format(" %s ", STRING["dialogs.combat.and"].c_str());
|
||||
|
||||
if (_displayedDamage == 0) {
|
||||
line1 += STRING["dialogs.combat.misses"];
|
||||
} else {
|
||||
line1 += STRING["dialogs.combat.hit"];
|
||||
|
||||
if (_numberOfTimes > 1) {
|
||||
line1 += ' ';
|
||||
|
||||
if (_timesHit == 1) {
|
||||
line1 += STRING["dialogs.combat.once"];
|
||||
} else {
|
||||
line1 += Common::String::format("%d %s", _timesHit,
|
||||
STRING["dialogs.combat.times"].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
line1 += Common::String::format(" %s %d %s",
|
||||
STRING["dialogs.combat.for"].c_str(), _displayedDamage,
|
||||
STRING[_damage == 1 ? "dialogs.combat.point" : "dialogs.combat.points"].c_str());
|
||||
|
||||
if (line1.size() < 30) {
|
||||
line1 += ' ';
|
||||
line1 += STRING["dialogs.combat.of_damage"];
|
||||
} else {
|
||||
line1 += '!';
|
||||
}
|
||||
}
|
||||
|
||||
return line1;
|
||||
}
|
||||
|
||||
void Combat::setOption(SelectedOption option) {
|
||||
MetaEngine::setKeybindingMode((option == OPTION_EXCHANGE) ?
|
||||
KeybindingMode::KBMODE_PARTY_MENUS :
|
||||
KeybindingMode::KBMODE_MENUS);
|
||||
_option = option;
|
||||
redraw();
|
||||
}
|
||||
|
||||
void Combat::displaySpellResult(const InfoMessage &msg) {
|
||||
if (msg._delaySeconds) {
|
||||
_spellResult = msg;
|
||||
} else {
|
||||
InfoMessage tmp = msg;
|
||||
tmp._delaySeconds = 3;
|
||||
_spellResult = tmp;
|
||||
}
|
||||
|
||||
setMode(SPELL_RESULT);
|
||||
}
|
||||
|
||||
void Combat::combatDone() {
|
||||
Game::Combat::combatDone();
|
||||
|
||||
close();
|
||||
g_events->send("Game", GameMessage("UPDATE"));
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
276
engines/mm/mm1/views/combat.h
Normal file
276
engines/mm/mm1/views/combat.h
Normal file
@@ -0,0 +1,276 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_COMBAT_H
|
||||
#define MM1_VIEWS_COMBAT_H
|
||||
|
||||
#include "mm/mm1/game/combat.h"
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class Combat : public TextView, public Game::Combat {
|
||||
private:
|
||||
LineArray _monsterSpellLines;
|
||||
uint _attackableCount = 0;
|
||||
InfoMessage _spellResult;
|
||||
// Combat options that have sub-option selection
|
||||
enum SelectedOption {
|
||||
OPTION_NONE, OPTION_DELAY, OPTION_EXCHANGE,
|
||||
OPTION_FIGHT, OPTION_SHOOT
|
||||
};
|
||||
SelectedOption _option = OPTION_NONE;
|
||||
|
||||
/**
|
||||
* Selects a combat option that requires a selection
|
||||
*/
|
||||
void setOption(SelectedOption option);
|
||||
|
||||
void writeOptions();
|
||||
void writeAllOptions();
|
||||
void writeAttackOptions();
|
||||
void writeCastOption();
|
||||
void writeShootOption();
|
||||
void resetBottom();
|
||||
|
||||
/**
|
||||
* Write the encounter handicap
|
||||
*/
|
||||
void writeHandicap();
|
||||
|
||||
/**
|
||||
* Write out all the static content
|
||||
*/
|
||||
void writeStaticContent();
|
||||
|
||||
/**
|
||||
* Write out the round number
|
||||
*/
|
||||
void writeRound();
|
||||
|
||||
/**
|
||||
* Writes out the party member numbers,
|
||||
* with a plus next to each if they can attack
|
||||
*/
|
||||
void writePartyNumbers();
|
||||
|
||||
/**
|
||||
* Write the monsters list
|
||||
*/
|
||||
void writeMonsters();
|
||||
|
||||
/**
|
||||
* Write out a monster's status
|
||||
*/
|
||||
void writeMonsterStatus(int monsterNum);
|
||||
|
||||
/**
|
||||
* Write out a series of dots
|
||||
*/
|
||||
void writeDots();
|
||||
|
||||
/**
|
||||
* Writes out the party members
|
||||
*/
|
||||
void writeParty();
|
||||
|
||||
/**
|
||||
* Clears the party area
|
||||
*/
|
||||
void clearPartyArea();
|
||||
|
||||
/**
|
||||
* Writes the result of defeating all the monsters
|
||||
*/
|
||||
void writeDefeat();
|
||||
|
||||
/**
|
||||
* Highlight the round number indicator
|
||||
*/
|
||||
void highlightNextRound();
|
||||
|
||||
/**
|
||||
* Write monster changes
|
||||
*/
|
||||
void writeMonsterEffects();
|
||||
|
||||
/**
|
||||
* Handles a monster action
|
||||
*/
|
||||
void writeMonsterAction(bool flees);
|
||||
|
||||
/**
|
||||
* Write out message from a monster casting a spell
|
||||
*/
|
||||
void writeMonsterSpell();
|
||||
|
||||
/**
|
||||
* Write out monster's attack
|
||||
*/
|
||||
void writeMonsterAttack();
|
||||
|
||||
/**
|
||||
* Write message for monster infiltrating the party
|
||||
*/
|
||||
void writeInfiltration();
|
||||
|
||||
/**
|
||||
* Write message for monster waits for an opening
|
||||
*/
|
||||
void writeWaitsForOpening();
|
||||
|
||||
/**
|
||||
* Writes the result of a spell
|
||||
*/
|
||||
void writeSpellResult();
|
||||
|
||||
/**
|
||||
* Whether there's messages remaining
|
||||
*/
|
||||
void checkMonsterSpellDone();
|
||||
|
||||
/**
|
||||
* Delay option
|
||||
*/
|
||||
void delay();
|
||||
|
||||
/**
|
||||
* Exchange option
|
||||
*/
|
||||
void exchange();
|
||||
|
||||
/**
|
||||
* Fight option
|
||||
*/
|
||||
void fight();
|
||||
|
||||
/**
|
||||
* Shoot option
|
||||
*/
|
||||
void shoot();
|
||||
|
||||
/**
|
||||
* Write message for characters attacking monsters
|
||||
*/
|
||||
void writeCharAttackDamage();
|
||||
|
||||
/**
|
||||
* Write message for character attack having no effect
|
||||
*/
|
||||
void writeCharAttackNoEffect();
|
||||
|
||||
/**
|
||||
* Get attack damage string
|
||||
*/
|
||||
Common::String getAttackString();
|
||||
|
||||
/**
|
||||
* Writes out a message
|
||||
*/
|
||||
void writeMessage();
|
||||
|
||||
/**
|
||||
* Writes text for delay number selection
|
||||
*/
|
||||
void writeDelaySelect();
|
||||
|
||||
/**
|
||||
* Write text for exchange party member
|
||||
*/
|
||||
void writeExchangeSelect();
|
||||
|
||||
/**
|
||||
* Having selected to fight, selects monster to attack
|
||||
*/
|
||||
void writeFightSelect();
|
||||
|
||||
/**
|
||||
* Having selected to shoot, selects monster to attack
|
||||
*/
|
||||
void writeShootSelect();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Sets a new display mode
|
||||
*/
|
||||
void setMode(Mode newMode) override;
|
||||
|
||||
/**
|
||||
* Does final cleanup when combat is done
|
||||
*/
|
||||
void combatDone() override;
|
||||
|
||||
public:
|
||||
Combat();
|
||||
virtual ~Combat() {}
|
||||
|
||||
void displaySpellResult(const InfoMessage &msg) override;
|
||||
|
||||
/**
|
||||
* Disable the flags for allowing attacks for
|
||||
* the current character
|
||||
*/
|
||||
void disableAttacks();
|
||||
|
||||
/**
|
||||
* Called when the view is focused
|
||||
*/
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
|
||||
/**
|
||||
* Called when the view is unfocused
|
||||
*/
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
|
||||
/**
|
||||
* Called for game messages
|
||||
*/
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
|
||||
/**
|
||||
* Draw the Combat details overlayed on
|
||||
* the existing game screen
|
||||
*/
|
||||
void draw() override;
|
||||
|
||||
/**
|
||||
* Handles delay timeouts
|
||||
*/
|
||||
void timeout() override;
|
||||
|
||||
/**
|
||||
* Handles keypresses
|
||||
*/
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
|
||||
/**
|
||||
* Key binder actions
|
||||
*/
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
492
engines/mm/mm1/views/create_characters.cpp
Normal file
492
engines/mm/mm1/views/create_characters.cpp
Normal file
@@ -0,0 +1,492 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/create_characters.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
void CreateCharacters::NewCharacter::clear() {
|
||||
Common::fill(_attribs1, _attribs1 + 7, 0);
|
||||
Common::fill(_attribs2, _attribs2 + 7, 0);
|
||||
_class = KNIGHT;
|
||||
_race = HUMAN;
|
||||
_alignment = GOOD;
|
||||
_sex = MALE;
|
||||
_name = "";
|
||||
|
||||
Common::fill(_classesAllowed, _classesAllowed + 7, 0);
|
||||
}
|
||||
|
||||
void CreateCharacters::NewCharacter::reroll() {
|
||||
clear();
|
||||
|
||||
// Generate attributes
|
||||
for (int attrib = INTELLECT; attrib <= LUCK; ++attrib)
|
||||
_attribs1[attrib] = g_engine->getRandomNumber(4, 17);
|
||||
Common::copy(_attribs1, _attribs1 + 7, _attribs2);
|
||||
|
||||
// Select which classes are available
|
||||
_classesAllowed[KNIGHT] = _attribs1[MIGHT] >= 12;
|
||||
_classesAllowed[PALADIN] = _attribs1[MIGHT] >= 12 && _attribs1[PERSONALITY] >= 12 &&
|
||||
_attribs1[ENDURANCE] >= 12;
|
||||
_classesAllowed[ARCHER] = _attribs1[INTELLECT] >= 12 && _attribs1[ACCURACY] >= 12;
|
||||
_classesAllowed[CLERIC] = _attribs1[PERSONALITY] >= 12;
|
||||
_classesAllowed[SORCERER] = _attribs1[INTELLECT] >= 12;
|
||||
_classesAllowed[ROBBER] = true;
|
||||
}
|
||||
|
||||
void CreateCharacters::NewCharacter::save() {
|
||||
uint i = 0;
|
||||
while (i < ROSTER_COUNT && g_globals->_roster._towns[i])
|
||||
++i;
|
||||
|
||||
g_globals->_roster._towns[i] = Maps::SORPIGAL;
|
||||
g_globals->_currCharacter = &g_globals->_roster[i];
|
||||
Character &re = *g_globals->_currCharacter;
|
||||
re.clear();
|
||||
|
||||
Common::strcpy_s(re._name, _name.c_str());
|
||||
re._sex = _sex;
|
||||
re._alignment = re._alignmentInitial = _alignment;
|
||||
re._race = _race;
|
||||
re._class = _class;
|
||||
re._intelligence = _attribs1[INTELLECT];
|
||||
re._might = _attribs1[MIGHT];
|
||||
re._personality = _attribs1[PERSONALITY];
|
||||
re._endurance = _attribs1[ENDURANCE];
|
||||
re._speed = _attribs1[SPEED];
|
||||
re._accuracy = _attribs1[ACCURACY];
|
||||
re._luck = _attribs1[LUCK];
|
||||
|
||||
switch (_class) {
|
||||
case KNIGHT:
|
||||
setHP(12);
|
||||
break;
|
||||
case PALADIN:
|
||||
case ARCHER:
|
||||
setHP(10);
|
||||
break;
|
||||
case CLERIC:
|
||||
setHP(8);
|
||||
setSP(_attribs1[PERSONALITY]);
|
||||
break;
|
||||
case SORCERER:
|
||||
setHP(6);
|
||||
setSP(_attribs1[INTELLECT]);
|
||||
break;
|
||||
case ROBBER:
|
||||
setHP(8);
|
||||
re._trapCtr = 50;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (_race) {
|
||||
case HUMAN:
|
||||
re._resistances._s._fear = 70;
|
||||
re._resistances._s._psychic = 25;
|
||||
break;
|
||||
case ELF:
|
||||
re._resistances._s._fear = 70;
|
||||
break;
|
||||
case DWARF:
|
||||
re._resistances._s._poison = 25;
|
||||
break;
|
||||
case GNOME:
|
||||
re._resistances._s._magic = 20;
|
||||
break;
|
||||
case HALF_ORC:
|
||||
re._resistances._s._psychic = 50;
|
||||
break;
|
||||
}
|
||||
|
||||
re._food = 10;
|
||||
re._backpack[0]._id = 1;
|
||||
const int ALIGNMENT_VALS[3] = { 0, 0x10, 0x20 };
|
||||
re._alignmentCtr = ALIGNMENT_VALS[re._alignmentInitial];
|
||||
|
||||
g_globals->_roster.save();
|
||||
}
|
||||
|
||||
void CreateCharacters::NewCharacter::setHP(int hp) {
|
||||
Character &re = *g_globals->_currCharacter;
|
||||
|
||||
if (_attribs1[ENDURANCE] >= 19)
|
||||
hp += 4;
|
||||
else if (_attribs1[ENDURANCE] >= 17)
|
||||
hp += 3;
|
||||
else if (_attribs1[ENDURANCE] >= 15)
|
||||
hp += 2;
|
||||
else if (_attribs1[ENDURANCE] >= 13)
|
||||
hp += 1;
|
||||
else if (_attribs1[ENDURANCE] < 5)
|
||||
hp -= 2;
|
||||
else if (_attribs1[ENDURANCE] < 8)
|
||||
hp -= 1;
|
||||
|
||||
re._hpCurrent = re._hp = re._hpMax = hp;
|
||||
|
||||
int ac = 0;
|
||||
if (_attribs1[SPEED] >= 19)
|
||||
ac = 4;
|
||||
else if (_attribs1[SPEED] >= 17)
|
||||
ac = 3;
|
||||
else if (_attribs1[SPEED] >= 15)
|
||||
ac = 2;
|
||||
if (_attribs1[SPEED] >= 13)
|
||||
ac = 1;
|
||||
|
||||
re._ac = ac;
|
||||
}
|
||||
|
||||
void CreateCharacters::NewCharacter::setSP(int amount) {
|
||||
Character &re = *g_globals->_currCharacter;
|
||||
|
||||
int level = 0;
|
||||
if (amount >= 19)
|
||||
level = 4;
|
||||
else if (amount >= 17)
|
||||
level = 3;
|
||||
else if (amount >= 15)
|
||||
level = 2;
|
||||
else if (amount >= 13)
|
||||
level = 1;
|
||||
|
||||
re._sp = level + 3;
|
||||
re._spellLevel = 1;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void CreateCharacters::draw() {
|
||||
drawTextBorder();
|
||||
|
||||
writeString(10, 0, STRING["dialogs.create_characters.title"]);
|
||||
writeString(3, 5, STRING["dialogs.create_characters.intellect"]);
|
||||
writeString(3, 7, STRING["dialogs.create_characters.might"]);
|
||||
writeString(3, 9, STRING["dialogs.create_characters.personality"]);
|
||||
writeString(3, 11, STRING["dialogs.create_characters.endurance"]);
|
||||
writeString(3, 13, STRING["dialogs.create_characters.speed"]);
|
||||
writeString(3, 15, STRING["dialogs.create_characters.accuracy"]);
|
||||
writeString(3, 17, STRING["dialogs.create_characters.luck"]);
|
||||
printAttributes();
|
||||
|
||||
switch (_state) {
|
||||
case SELECT_CLASS:
|
||||
printClasses();
|
||||
if (g_globals->_roster.full())
|
||||
writeString(9, 21, STRING["dialogs.create_characters.full"]);
|
||||
escToGoBack();
|
||||
break;
|
||||
|
||||
case SELECT_RACE:
|
||||
printRaces();
|
||||
break;
|
||||
|
||||
case SELECT_ALIGNMENT:
|
||||
printAlignments();
|
||||
break;
|
||||
|
||||
case SELECT_SEX:
|
||||
printSexes();
|
||||
break;
|
||||
|
||||
case SELECT_NAME:
|
||||
printSummary(false);
|
||||
break;
|
||||
|
||||
case SAVE_PROMPT:
|
||||
printSummary(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateCharacters::printAttributes() {
|
||||
_textPos.y = 5;
|
||||
|
||||
for (int i = 0; i < 7; ++i, _textPos.y += 2) {
|
||||
_textPos.x = 17;
|
||||
if (_newChar._attribs1[i] < 10)
|
||||
writeChar(' ');
|
||||
writeNumber(_newChar._attribs1[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateCharacters::printClasses() {
|
||||
if (_newChar._classesAllowed[KNIGHT]) {
|
||||
writeString(23, 5, "1) ");
|
||||
writeString(STRING["stats.classes.1"]);
|
||||
}
|
||||
if (_newChar._classesAllowed[PALADIN]) {
|
||||
writeString(23, 6, "2) ");
|
||||
writeString(STRING["stats.classes.2"]);
|
||||
}
|
||||
if (_newChar._classesAllowed[ARCHER]) {
|
||||
writeString(23, 7, "3) ");
|
||||
writeString(STRING["stats.classes.3"]);
|
||||
}
|
||||
if (_newChar._classesAllowed[CLERIC]) {
|
||||
writeString(23, 8, "4) ");
|
||||
writeString(STRING["stats.classes.4"]);
|
||||
}
|
||||
if (_newChar._classesAllowed[SORCERER]) {
|
||||
writeString(23, 9, "5) ");
|
||||
writeString(STRING["stats.classes.5"]);
|
||||
}
|
||||
writeString(23, 10, "6) ");
|
||||
writeString(STRING["stats.classes.6"]);
|
||||
|
||||
writeString(22, 13, STRING["dialogs.create_characters.select_class"]);
|
||||
writeString(26, 15, "(1-6)");
|
||||
writeString(21, 17, STRING["dialogs.create_characters.reroll"]);
|
||||
}
|
||||
|
||||
void CreateCharacters::printRaces() {
|
||||
writeString(22, 5, STRING["dialogs.create_characters.class"]);
|
||||
writeString(STRING[Common::String::format("stats.classes.%d", _newChar._class)]);
|
||||
|
||||
writeString(23, 7, "1) ");
|
||||
writeString(STRING["stats.races.1"]);
|
||||
writeString(23, 8, "2) ");
|
||||
writeString(STRING["stats.races.2"]);
|
||||
writeString(23, 9, "3) ");
|
||||
writeString(STRING["stats.races.3"]);
|
||||
writeString(23, 10, "4) ");
|
||||
writeString(STRING["stats.races.4"]);
|
||||
writeString(23, 11, "5) ");
|
||||
writeString(STRING["stats.races.5"]);
|
||||
|
||||
writeString(22, 13, STRING["dialogs.create_characters.select_race"]);
|
||||
writeString(26, 15, "(1-5)");
|
||||
writeString(21, 17, STRING["dialogs.create_characters.start_over"]);
|
||||
}
|
||||
|
||||
void CreateCharacters::printAlignments() {
|
||||
writeString(22, 5, STRING["dialogs.create_characters.class"]);
|
||||
writeString(STRING[Common::String::format("stats.classes.%d", _newChar._class)]);
|
||||
writeString(22, 6, STRING["dialogs.create_characters.race"]);
|
||||
writeString(STRING[Common::String::format("stats.races.%d", _newChar._race)]);
|
||||
|
||||
writeString(23, 8, "1) ");
|
||||
writeString(STRING["stats.alignments.1"]);
|
||||
writeString(23, 9, "2) ");
|
||||
writeString(STRING["stats.alignments.2"]);
|
||||
writeString(23, 10, "3) ");
|
||||
writeString(STRING["stats.alignments.3"]);
|
||||
|
||||
writeString(21, 13, STRING["dialogs.create_characters.select_alignment"]);
|
||||
writeString(26, 15, "(1-3)");
|
||||
writeString(21, 17, STRING["dialogs.create_characters.start_over"]);
|
||||
}
|
||||
|
||||
void CreateCharacters::printSexes() {
|
||||
writeString(22, 5, STRING["dialogs.create_characters.class"]);
|
||||
writeString(STRING[Common::String::format("stats.classes.%d", _newChar._class)]);
|
||||
writeString(22, 6, STRING["dialogs.create_characters.race"]);
|
||||
writeString(STRING[Common::String::format("stats.races.%d", _newChar._race)]);
|
||||
writeString(22, 7, STRING["dialogs.create_characters.alignment"]);
|
||||
writeString(STRING[Common::String::format("stats.alignments.%d", _newChar._alignment)]);
|
||||
|
||||
writeString(23, 9, "1) ");
|
||||
writeString(STRING["stats.sex.1"]);
|
||||
writeString(23, 10, "2) ");
|
||||
writeString(STRING["stats.sex.2"]);
|
||||
|
||||
writeString(23, 13, STRING["dialogs.create_characters.select_sex"]);
|
||||
writeString(26, 15, "(1-2)");
|
||||
writeString(21, 17, STRING["dialogs.create_characters.start_over"]);
|
||||
}
|
||||
|
||||
void CreateCharacters::printSummary(bool promptToSave) {
|
||||
writeString(22, 5, STRING["dialogs.create_characters.class"]);
|
||||
writeString(STRING[Common::String::format("stats.classes.%d", _newChar._class)]);
|
||||
writeString(22, 6, STRING["dialogs.create_characters.race"]);
|
||||
writeString(STRING[Common::String::format("stats.races.%d", _newChar._race)]);
|
||||
writeString(22, 7, STRING["dialogs.create_characters.alignment"]);
|
||||
writeString(STRING[Common::String::format("stats.alignments.%d", _newChar._alignment)]);
|
||||
writeString(22, 8, STRING["dialogs.create_characters.sex"]);
|
||||
writeString(STRING[Common::String::format("stats.sex.%d", _newChar._sex)]);
|
||||
|
||||
writeString(22, 11, STRING["dialogs.create_characters.name"]);
|
||||
writeString(22, 13, _newChar._name);
|
||||
|
||||
if (promptToSave) {
|
||||
writeString(22, 15, STRING["dialogs.create_characters.save_character"]);
|
||||
writeString(26, 17, "(Y/N)?");
|
||||
} else {
|
||||
writeChar('_');
|
||||
writeString(21, 17, STRING["dialogs.create_characters.start_over"]);
|
||||
}
|
||||
}
|
||||
|
||||
bool CreateCharacters::msgKeypress(const KeypressMessage &msg) {
|
||||
switch (_state) {
|
||||
case SELECT_CLASS:
|
||||
if (msg.keycode >= Common::KEYCODE_1 &&
|
||||
msg.keycode <= Common::KEYCODE_6) {
|
||||
if (_newChar._classesAllowed[msg.keycode - Common::KEYCODE_0] &&
|
||||
!g_globals->_roster.full()) {
|
||||
// Selected a valid class
|
||||
_newChar._class = (CharacterClass)(msg.keycode - Common::KEYCODE_0);
|
||||
_state = SELECT_RACE;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SELECT_RACE:
|
||||
if (msg.keycode >= Common::KEYCODE_1 &&
|
||||
msg.keycode <= Common::KEYCODE_5) {
|
||||
// Selected a race
|
||||
_newChar._race = (Race)(msg.keycode - Common::KEYCODE_0);
|
||||
|
||||
switch (_newChar._race) {
|
||||
case ELF:
|
||||
_newChar._attribs1[INTELLECT]++;
|
||||
_newChar._attribs1[ACCURACY]++;
|
||||
_newChar._attribs1[MIGHT]--;
|
||||
_newChar._attribs1[ENDURANCE]--;
|
||||
break;
|
||||
case DWARF:
|
||||
_newChar._attribs1[ENDURANCE]++;
|
||||
_newChar._attribs1[LUCK]++;
|
||||
_newChar._attribs1[INTELLECT]--;
|
||||
_newChar._attribs1[SPEED]--;
|
||||
break;
|
||||
case GNOME:
|
||||
_newChar._attribs1[LUCK] += 2;
|
||||
_newChar._attribs1[SPEED]--;
|
||||
_newChar._attribs1[ACCURACY]--;
|
||||
break;
|
||||
case HALF_ORC:
|
||||
_newChar._attribs1[MIGHT]++;
|
||||
_newChar._attribs1[ENDURANCE]++;
|
||||
_newChar._attribs1[INTELLECT]--;
|
||||
_newChar._attribs1[PERSONALITY]--;
|
||||
_newChar._attribs1[LUCK]--;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_state = SELECT_ALIGNMENT;
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case SELECT_ALIGNMENT:
|
||||
if (msg.keycode >= Common::KEYCODE_1 &&
|
||||
msg.keycode <= Common::KEYCODE_3) {
|
||||
// Selected a valid alignment
|
||||
_newChar._alignment = (Alignment)(msg.keycode - Common::KEYCODE_0);
|
||||
_state = SELECT_SEX;
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case SELECT_SEX:
|
||||
if (msg.keycode >= Common::KEYCODE_1 &&
|
||||
msg.keycode <= Common::KEYCODE_2) {
|
||||
// Selected a valid sex
|
||||
_newChar._sex = (Sex)(msg.keycode - Common::KEYCODE_0);
|
||||
_state = SELECT_NAME;
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case SELECT_NAME:
|
||||
if (msg.ascii >= 32 && msg.ascii <= 127) {
|
||||
_newChar._name += toupper(msg.ascii);
|
||||
redraw();
|
||||
}
|
||||
if (_newChar._name.size() == 15) {
|
||||
_state = SAVE_PROMPT;
|
||||
redraw();
|
||||
} else if (msg.keycode == Common::KEYCODE_BACKSPACE &&
|
||||
!_newChar._name.empty()) {
|
||||
_newChar._name.deleteLastChar();
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case SAVE_PROMPT:
|
||||
if (msg.keycode == Common::KEYCODE_y)
|
||||
_newChar.save();
|
||||
|
||||
_state = SELECT_CLASS;
|
||||
_newChar.reroll();
|
||||
redraw();
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CreateCharacters::msgAction(const ActionMessage &msg) {
|
||||
switch (msg._action) {
|
||||
case KEYBIND_ESCAPE:
|
||||
if (_state == SELECT_CLASS) {
|
||||
close();
|
||||
} else {
|
||||
_state = SELECT_CLASS;
|
||||
_newChar.reroll();
|
||||
redraw();
|
||||
}
|
||||
return true;
|
||||
|
||||
case KEYBIND_SELECT:
|
||||
switch (_state) {
|
||||
case SELECT_CLASS:
|
||||
// Re-roll attributes
|
||||
_newChar.reroll();
|
||||
redraw();
|
||||
break;
|
||||
case SELECT_NAME:
|
||||
_state = SAVE_PROMPT;
|
||||
redraw();
|
||||
break;
|
||||
case SAVE_PROMPT:
|
||||
_newChar.save();
|
||||
|
||||
_state = SELECT_CLASS;
|
||||
_newChar.reroll();
|
||||
redraw();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
112
engines/mm/mm1/views/create_characters.h
Normal file
112
engines/mm/mm1/views/create_characters.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_CREATE_CHARACTERS_H
|
||||
#define MM1_VIEWS_CREATE_CHARACTERS_H
|
||||
|
||||
#include "mm/mm1/data/roster.h"
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class CreateCharacters : public TextView {
|
||||
enum State {
|
||||
SELECT_CLASS, SELECT_RACE, SELECT_ALIGNMENT,
|
||||
SELECT_SEX, SELECT_NAME, SAVE_PROMPT
|
||||
};
|
||||
enum Attribute {
|
||||
INTELLECT, MIGHT, PERSONALITY, ENDURANCE, SPEED,
|
||||
ACCURACY, LUCK
|
||||
};
|
||||
struct NewCharacter {
|
||||
private:
|
||||
void setHP(int hp);
|
||||
void setSP(int sp);
|
||||
public:
|
||||
uint8 _attribs1[LUCK + 1] = { 0 };
|
||||
uint8 _attribs2[LUCK + 1] = { 0 };
|
||||
CharacterClass _class = KNIGHT;
|
||||
Race _race = HUMAN;
|
||||
Alignment _alignment = GOOD;
|
||||
Sex _sex = MALE;
|
||||
Common::String _name;
|
||||
|
||||
bool _classesAllowed[7] = { false };
|
||||
|
||||
void clear();
|
||||
void reroll();
|
||||
void save();
|
||||
};
|
||||
|
||||
private:
|
||||
State _state = SELECT_CLASS;
|
||||
NewCharacter _newChar;
|
||||
|
||||
/**
|
||||
* Displays the new character attributes
|
||||
*/
|
||||
void printAttributes();
|
||||
|
||||
/**
|
||||
* Display the available classes
|
||||
*/
|
||||
void printClasses();
|
||||
|
||||
/**
|
||||
* Display the races
|
||||
*/
|
||||
void printRaces();
|
||||
|
||||
/**
|
||||
* Display the alignments
|
||||
*/
|
||||
void printAlignments();
|
||||
|
||||
/**
|
||||
* Display the sexes
|
||||
*/
|
||||
void printSexes();
|
||||
|
||||
/**
|
||||
* Display the selection summaries and either name entry
|
||||
* or prompt to save character
|
||||
*/
|
||||
void printSummary(bool promptToSave);
|
||||
public:
|
||||
CreateCharacters() : TextView("CreateCharacters") {}
|
||||
virtual ~CreateCharacters() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override {
|
||||
_newChar.reroll();
|
||||
return true;
|
||||
}
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
71
engines/mm/mm1/views/dead.cpp
Normal file
71
engines/mm/mm1/views/dead.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/dead.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
bool Dead::msgFocus(const FocusMessage &msg) {
|
||||
TextView::msgFocus(msg);
|
||||
Sound::sound2(SOUND_4);
|
||||
|
||||
g_globals->_party.clear();
|
||||
g_globals->_roster.load();
|
||||
g_globals->_activeSpells.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dead::draw() {
|
||||
clearSurface();
|
||||
writeLine(4);
|
||||
writeString(11, 6, STRING["dialogs.dead.1"]);
|
||||
writeString(7, 8, STRING["dialogs.dead.2"]);
|
||||
writeString(7, 10, STRING["dialogs.dead.3"]);
|
||||
writeString(8, 12, STRING["dialogs.dead.4"]);
|
||||
writeString(8, 14, STRING["dialogs.dead.5"]);
|
||||
writeString(10, 16, STRING["dialogs.dead.6"]);
|
||||
writeLine(18);
|
||||
}
|
||||
|
||||
void Dead::writeLine(int y) {
|
||||
_textPos = Common::Point(0, y);
|
||||
|
||||
for (int i = 0; i < 40; ++i)
|
||||
writeChar(i == 0 || i == 39 ? '+' : '-');
|
||||
}
|
||||
|
||||
bool Dead::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_SELECT) {
|
||||
replaceView("MainMenu");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
50
engines/mm/mm1/views/dead.h
Normal file
50
engines/mm/mm1/views/dead.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_DEAD_H
|
||||
#define MM1_VIEWS_DEAD_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class Dead : public TextView {
|
||||
private:
|
||||
/**
|
||||
* Writes a horizontal text line
|
||||
*/
|
||||
void writeLine(int y);
|
||||
public:
|
||||
Dead() : TextView("Dead") {}
|
||||
virtual ~Dead() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
31
engines/mm/mm1/views/dialogs.cpp
Normal file
31
engines/mm/mm1/views/dialogs.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/dialogs.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
173
engines/mm/mm1/views/dialogs.h
Normal file
173
engines/mm/mm1/views/dialogs.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_DIALOGS_H
|
||||
#define MM1_VIEWS_DIALOGS_H
|
||||
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/views/are_you_ready.h"
|
||||
#include "mm/mm1/views/bash.h"
|
||||
#include "mm/mm1/views/characters.h"
|
||||
#include "mm/mm1/views/character_view_combat.h"
|
||||
#include "mm/mm1/views/color_questions.h"
|
||||
#include "mm/mm1/views/combat.h"
|
||||
#include "mm/mm1/views/create_characters.h"
|
||||
#include "mm/mm1/views/dead.h"
|
||||
#include "mm/mm1/views/encounter.h"
|
||||
#include "mm/mm1/views/game.h"
|
||||
#include "mm/mm1/views/main_menu.h"
|
||||
#include "mm/mm1/views/order.h"
|
||||
#include "mm/mm1/views/protect.h"
|
||||
#include "mm/mm1/views/quick_ref.h"
|
||||
#include "mm/mm1/views/title.h"
|
||||
#include "mm/mm1/views/character_info.h"
|
||||
#include "mm/mm1/views/character_view_combat.h"
|
||||
#include "mm/mm1/views/characters.h"
|
||||
#include "mm/mm1/views/rest.h"
|
||||
#include "mm/mm1/views/search.h"
|
||||
#include "mm/mm1/views/trap.h"
|
||||
#include "mm/mm1/views/unlock.h"
|
||||
#include "mm/mm1/views/wheel_spin.h"
|
||||
#include "mm/mm1/views/locations/blacksmith.h"
|
||||
#include "mm/mm1/views/locations/inn.h"
|
||||
#include "mm/mm1/views/locations/market.h"
|
||||
#include "mm/mm1/views/locations/statue.h"
|
||||
#include "mm/mm1/views/locations/tavern.h"
|
||||
#include "mm/mm1/views/locations/temple.h"
|
||||
#include "mm/mm1/views/locations/training.h"
|
||||
#include "mm/mm1/views/interactions/access_code.h"
|
||||
#include "mm/mm1/views/interactions/alamar.h"
|
||||
#include "mm/mm1/views/interactions/alien.h"
|
||||
#include "mm/mm1/views/interactions/arenko.h"
|
||||
#include "mm/mm1/views/interactions/arrested.h"
|
||||
#include "mm/mm1/views/interactions/chess.h"
|
||||
#include "mm/mm1/views/interactions/dog_statue.h"
|
||||
#include "mm/mm1/views/interactions/ghost.h"
|
||||
#include "mm/mm1/views/interactions/giant.h"
|
||||
#include "mm/mm1/views/interactions/gypsy.h"
|
||||
#include "mm/mm1/views/interactions/hacker.h"
|
||||
#include "mm/mm1/views/interactions/ice_princess.h"
|
||||
#include "mm/mm1/views/interactions/inspectron.h"
|
||||
#include "mm/mm1/views/interactions/keeper.h"
|
||||
#include "mm/mm1/views/interactions/leprechaun.h"
|
||||
#include "mm/mm1/views/interactions/lion.h"
|
||||
#include "mm/mm1/views/interactions/lord_archer.h"
|
||||
#include "mm/mm1/views/interactions/lord_ironfist.h"
|
||||
#include "mm/mm1/views/interactions/orango.h"
|
||||
#include "mm/mm1/views/interactions/prisoners.h"
|
||||
#include "mm/mm1/views/interactions/resistances.h"
|
||||
#include "mm/mm1/views/interactions/ruby.h"
|
||||
#include "mm/mm1/views/interactions/trivia.h"
|
||||
#include "mm/mm1/views/interactions/volcano_god.h"
|
||||
#include "mm/mm1/views/interactions/won_game.h"
|
||||
#include "mm/mm1/views/spells/cast_spell.h"
|
||||
#include "mm/mm1/views/spells/detect_magic.h"
|
||||
#include "mm/mm1/views/spells/duplication.h"
|
||||
#include "mm/mm1/views/spells/fly.h"
|
||||
#include "mm/mm1/views/spells/location.h"
|
||||
#include "mm/mm1/views/spells/recharge_item.h"
|
||||
#include "mm/mm1/views/spells/teleport.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
struct Dialogs : public ViewsBase {
|
||||
private:
|
||||
Views::AreYouReady _areYouReady;
|
||||
Views::Bash _bash;
|
||||
Views::CharacterInfo _characterInfo;
|
||||
Views::Characters _characters;
|
||||
Views::CharacterViewCombat _characterViewCombat;
|
||||
Views::ColorQuestions _colorQuestions;
|
||||
Views::Combat _combat;
|
||||
Views::CreateCharacters _createCharacters;
|
||||
Views::Dead _dead;
|
||||
Views::Encounter _encounter;
|
||||
Views::Game _game;
|
||||
Views::MainMenu _mainMenu;
|
||||
Views::Order _order;
|
||||
Views::Protect _protect;
|
||||
Views::QuickRef _quickRef;
|
||||
Views::Rest _rest;
|
||||
Views::Search _search;
|
||||
Views::Title _title;
|
||||
Views::Trap _trap;
|
||||
Views::Unlock _unlock;
|
||||
Views::WheelSpin _wheelSpin;
|
||||
|
||||
Views::Locations::Blacksmith _blacksmith;
|
||||
Views::Locations::Inn _inn;
|
||||
Views::Locations::Market _market;
|
||||
Views::Locations::Statue _statue;
|
||||
Views::Locations::Tavern _tavern;
|
||||
Views::Locations::Temple _temple;
|
||||
Views::Locations::Training _training;
|
||||
|
||||
Views::Interactions::AccessCode _accessCode;
|
||||
Views::Interactions::Alamar _alamar;
|
||||
Views::Interactions::Alien _alien;
|
||||
Views::Interactions::Arenko _arenko;
|
||||
Views::Interactions::Arrested _arrested;
|
||||
Views::Interactions::Chess _chess;
|
||||
Views::Interactions::ChildPrisoner _childPrisoner;
|
||||
Views::Interactions::CloakedPrisoner _cloakedPrisoner;
|
||||
Views::Interactions::DemonPrisoner _demonPrisoner;
|
||||
Views::Interactions::MaidenPrisoner _maidenPrisoner;
|
||||
Views::Interactions::ManPrisoner _manPrisoner;
|
||||
Views::Interactions::MutatedPrisoner _mutatedPrisoner;
|
||||
Views::Interactions::VirginPrisoner _virginPrisoner;
|
||||
Views::Interactions::DogStatue _dogStatue;
|
||||
Views::Interactions::Ghost _ghost;
|
||||
Views::Interactions::Giant _giant;
|
||||
Views::Interactions::Gypsy _gypsy;
|
||||
Views::Interactions::Hacker _hacker;
|
||||
Views::Interactions::IcePrincess _icePrincess;
|
||||
Views::Interactions::Inspectron _inspectron;
|
||||
Views::Interactions::Keeper _keeper;
|
||||
Views::Interactions::Leprechaun _leprechaun;
|
||||
Views::Interactions::Lion _lion;
|
||||
Views::Interactions::LordArcher _lordArcher;
|
||||
Views::Interactions::LordIronfist _lordIronfist;
|
||||
Views::Interactions::Orango _orango;
|
||||
Views::Interactions::Resistances _resistances;
|
||||
Views::Interactions::Ruby _ruby;
|
||||
Views::Interactions::Trivia _trivia;
|
||||
Views::Interactions::VolcanoGod _volcanoGod;
|
||||
Views::Interactions::WonGame _wonGame;
|
||||
|
||||
Views::Spells::CastSpell _castSpell;
|
||||
Views::Spells::DetectMagic _detectMagicSpell;
|
||||
Views::Spells::Duplication _duplicationSpell;
|
||||
Views::Spells::Fly _flySpell;
|
||||
Views::Spells::Location _locationSpell;
|
||||
Views::Spells::RechargeItem _rechargeItemSpell;
|
||||
Views::Spells::Teleport _telportSpell;
|
||||
public:
|
||||
Dialogs() {}
|
||||
~Dialogs() override {}
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
403
engines/mm/mm1/views/encounter.cpp
Normal file
403
engines/mm/mm1/views/encounter.cpp
Normal file
@@ -0,0 +1,403 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/encounter.h"
|
||||
#include "mm/mm1/game/encounter.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
Encounter::Encounter() : TextView("Encounter") {
|
||||
}
|
||||
|
||||
bool Encounter::msgFocus(const FocusMessage &msg) {
|
||||
_mode = ALERT;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Encounter::draw() {
|
||||
Game::Encounter &enc = g_globals->_encounters;
|
||||
Graphics::ManagedSurface s = getSurface();
|
||||
|
||||
if (_mode != ALERT)
|
||||
// Clear the commands area
|
||||
s.fillRect(Common::Rect(241, 0, 320, 128), 0);
|
||||
|
||||
switch (_mode) {
|
||||
case ALERT:
|
||||
writeString(9, 6, " ");
|
||||
writeString(9, 7, STRING["dialogs.encounter.title"]);
|
||||
writeString(9, 8, " ");
|
||||
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
case SURPRISED_BY_MONSTERS:
|
||||
writeString(6, 21, STRING["dialogs.encounter.surprised"]);
|
||||
enc._encounterType = Game::FORCE_SURPRISED;
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
case SURPRISED_MONSTERS:
|
||||
writeString(2, 21, STRING["dialogs.encounter.surprise"]);
|
||||
writeString(1, 22, STRING["dialogs.encounter.approach"]);
|
||||
break;
|
||||
|
||||
case ENCOUNTER_OPTIONS: {
|
||||
// Write the encounter options
|
||||
clearLines(20, 24);
|
||||
writeString(0, 21, STRING["dialogs.encounter.options1"]);
|
||||
writeString(10, 22, STRING["dialogs.encounter.options2"]);
|
||||
break;
|
||||
}
|
||||
|
||||
case NOWHERE_TO_RUN:
|
||||
clearLines(20, 24);
|
||||
writeString(11, 21, STRING["dialogs.encounter.nowhere_to_run"]);
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
case SURROUNDED:
|
||||
clearLines(20, 24);
|
||||
writeString(5, 21, STRING["dialogs.encounter.surround"]);
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
case SURRENDER_FAILED:
|
||||
clearLines(20, 24);
|
||||
writeString(2, 21, STRING["dialogs.encounter.surrender_failed"]);
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
case NO_RESPONSE:
|
||||
clearLines(20, 24);
|
||||
writeString(12, 21, STRING["dialogs.encounter.no_response"]);
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
case BRIBE:
|
||||
enc._bribeFleeCtr++;
|
||||
enc._bribeAlignmentCtr++;
|
||||
writeString(5, 21, Common::String::format(
|
||||
STRING["dialogs.encounter.give_up"].c_str(),
|
||||
_bribeTypeStr.c_str()));
|
||||
break;
|
||||
|
||||
case NOT_ENOUGH:
|
||||
clearLines(20, 24);
|
||||
writeString(14, 21, STRING["dialogs.encounter.not_enough"]);
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
case COMBAT:
|
||||
clearLines(20, 24);
|
||||
writeString(16, 21, STRING["dialogs.encounter.combat"]);
|
||||
delaySeconds(2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (_mode != ALERT) {
|
||||
// Display the monster
|
||||
drawGraphic(enc._monsterImgNum);
|
||||
|
||||
// Write the monster list
|
||||
for (uint i = 0; i < enc._monsterList.size(); ++i) {
|
||||
writeChar(22, i, 'A' + i);
|
||||
writeString(") ");
|
||||
writeString(enc._monsterList[i]._name);
|
||||
}
|
||||
}
|
||||
|
||||
if (_mode == NO_RESPONSE || _mode == SURROUNDED ||
|
||||
_mode == NOT_ENOUGH || _mode == COMBAT ||
|
||||
_mode == NOWHERE_TO_RUN || _mode == SURRENDER_FAILED ||
|
||||
_mode == SURPRISED_BY_MONSTERS) {
|
||||
if (enc._alignmentsChanged) {
|
||||
writeString(8, 23, STRING["dialogs.encounter.alignment_slips"]);
|
||||
Sound::sound(SOUND_2);
|
||||
}
|
||||
|
||||
_mode = BATTLE;
|
||||
}
|
||||
}
|
||||
|
||||
void Encounter::timeout() {
|
||||
const Game::Encounter &enc = g_globals->_encounters;
|
||||
const Maps::Map &map = *g_maps->_currentMap;
|
||||
|
||||
switch (_mode) {
|
||||
case ALERT:
|
||||
// Finished displaying initial encounter alert
|
||||
if (enc._encounterType == Game::FORCE_SURPRISED) {
|
||||
_mode = SURPRISED_BY_MONSTERS;
|
||||
} else if (enc._encounterType == Game::NORMAL_SURPRISED ||
|
||||
/* ENCOUNTER_OPTIONS */
|
||||
g_engine->getRandomNumber(100) > map[Maps::MAP_21]) {
|
||||
// Potentially surprised. Check for guard dog spell
|
||||
if (g_globals->_activeSpells._s.guard_dog ||
|
||||
g_engine->getRandomNumber(100) > map[Maps::MAP_20])
|
||||
_mode = ENCOUNTER_OPTIONS;
|
||||
else
|
||||
_mode = SURPRISED_BY_MONSTERS;
|
||||
} else {
|
||||
_mode = SURPRISED_MONSTERS;
|
||||
}
|
||||
break;
|
||||
|
||||
case BATTLE:
|
||||
// Switch to combat view
|
||||
close();
|
||||
send("Combat", GameMessage("COMBAT"));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
bool Encounter::msgKeypress(const KeypressMessage &msg) {
|
||||
const Maps::Map &map = *g_maps->_currentMap;
|
||||
|
||||
switch (_mode) {
|
||||
case SURPRISED_MONSTERS:
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
_mode = ENCOUNTER_OPTIONS;
|
||||
redraw();
|
||||
} else if (msg.keycode == Common::KEYCODE_n) {
|
||||
encounterEnded();
|
||||
}
|
||||
break;
|
||||
|
||||
case ENCOUNTER_OPTIONS:
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_a:
|
||||
attack();
|
||||
break;
|
||||
case Common::KEYCODE_b:
|
||||
bribe();
|
||||
break;
|
||||
case Common::KEYCODE_r:
|
||||
retreat();
|
||||
break;
|
||||
case Common::KEYCODE_s:
|
||||
surrender();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case BRIBE:
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
if (getRandomNumber(100) > map[Maps::MAP_BRIBE_THRESHOLD]) {
|
||||
_mode = NOT_ENOUGH;
|
||||
redraw();
|
||||
} else {
|
||||
switch (_bribeType) {
|
||||
case BRIBE_GOLD:
|
||||
g_globals->_party.clearPartyGold();
|
||||
break;
|
||||
case BRIBE_GEMS:
|
||||
g_globals->_party.clearPartyGems();
|
||||
break;
|
||||
case BRIBE_FOOD:
|
||||
g_globals->_party.clearPartyFood();
|
||||
break;
|
||||
}
|
||||
|
||||
encounterEnded();
|
||||
}
|
||||
} else if (msg.keycode == Common::KEYCODE_n) {
|
||||
_mode = ENCOUNTER_OPTIONS;
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Encounter::encounterEnded() {
|
||||
close();
|
||||
g_events->send("Game", GameMessage("UPDATE"));
|
||||
}
|
||||
|
||||
void Encounter::attack() {
|
||||
const Game::Encounter &enc = g_globals->_encounters;
|
||||
|
||||
if (!enc.checkSurroundParty() || !enc.checkSurroundParty() ||
|
||||
!enc.checkSurroundParty()) {
|
||||
increaseAlignments();
|
||||
}
|
||||
|
||||
_mode = COMBAT;
|
||||
redraw();
|
||||
}
|
||||
|
||||
void Encounter::bribe() {
|
||||
const Game::Encounter &enc = g_globals->_encounters;
|
||||
|
||||
if (enc.checkSurroundParty()) {
|
||||
if (!enc._bribeAlignmentCtr)
|
||||
decreaseAlignments();
|
||||
|
||||
_mode = NO_RESPONSE;
|
||||
redraw();
|
||||
|
||||
} else if (getRandomNumber(7) == 5 && !enc._bribeFleeCtr) {
|
||||
// Rare chance to abort combat immediately
|
||||
encounterEnded();
|
||||
|
||||
} else {
|
||||
_mode = BRIBE;
|
||||
|
||||
int val = getRandomNumber(100);
|
||||
if (val < 6) {
|
||||
_bribeType = BRIBE_GEMS;
|
||||
_bribeTypeStr = STRING["dialogs.encounter.gems"];
|
||||
} else if (val < 16) {
|
||||
_bribeType = BRIBE_FOOD;
|
||||
_bribeTypeStr = STRING["dialogs.encounter.food"];
|
||||
} else {
|
||||
_bribeType = BRIBE_GOLD;
|
||||
_bribeTypeStr = STRING["dialogs.encounter.gold"];
|
||||
}
|
||||
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void Encounter::retreat() {
|
||||
const Maps::Map &map = *g_maps->_currentMap;
|
||||
const Game::Encounter &enc = g_globals->_encounters;
|
||||
int val = getRandomNumber(110);
|
||||
|
||||
if (val >= 100) {
|
||||
// 9% chance of simply fleeing
|
||||
flee();
|
||||
} else if (val > map[Maps::MAP_FLEE_THRESHOLD]) {
|
||||
// Nowhere to run depending on the map
|
||||
_mode = NOWHERE_TO_RUN;
|
||||
redraw();
|
||||
} else if (enc._monsterList.size() < g_globals->_party.size() || !enc.checkSurroundParty()) {
|
||||
// Only allow fleeing if the number of monsters
|
||||
// are less than the size of the party
|
||||
flee();
|
||||
} else {
|
||||
_mode = SURROUNDED;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void Encounter::surrender() {
|
||||
const Game::Encounter &enc = g_globals->_encounters;
|
||||
const Maps::Map &map = *g_maps->_currentMap;
|
||||
|
||||
if (getRandomNumber(100) > map[Maps::MAP_SURRENDER_THRESHOLD] ||
|
||||
getRandomNumber(100) > enc._fleeThreshold) {
|
||||
_mode = SURRENDER_FAILED;
|
||||
redraw();
|
||||
} else {
|
||||
g_maps->_mapPos.x = map[Maps::MAP_SURRENDER_X];
|
||||
g_maps->_mapPos.y = map[Maps::MAP_SURRENDER_Y];
|
||||
g_maps->visitedTile();
|
||||
|
||||
// Randomly remove food, gems, or gold from the party
|
||||
int val = getRandomNumber(200);
|
||||
if (val < 51) {
|
||||
} else if (val < 151) {
|
||||
g_globals->_party.clearPartyGold();
|
||||
} else if (val < 161) {
|
||||
g_globals->_party.clearPartyGems();
|
||||
} else if (val < 171) {
|
||||
g_globals->_party.clearPartyFood();
|
||||
} else if (val < 191) {
|
||||
g_globals->_party.clearPartyFood();
|
||||
g_globals->_party.clearPartyGold();
|
||||
} else if (val < 200) {
|
||||
g_globals->_party.clearPartyGold();
|
||||
g_globals->_party.clearPartyGems();
|
||||
} else {
|
||||
g_globals->_party.clearPartyGems();
|
||||
g_globals->_party.clearPartyFood();
|
||||
g_globals->_party.clearPartyGold();
|
||||
}
|
||||
|
||||
encounterEnded();
|
||||
}
|
||||
}
|
||||
|
||||
void Encounter::flee() {
|
||||
const Maps::Map &map = *g_maps->_currentMap;
|
||||
g_maps->_mapPos.x = map[Maps::MAP_FLEE_X];
|
||||
g_maps->_mapPos.y = map[Maps::MAP_FLEE_Y];
|
||||
encounterEnded();
|
||||
}
|
||||
|
||||
void Encounter::decreaseAlignments() {
|
||||
Game::Encounter &enc = g_globals->_encounters;
|
||||
|
||||
for (uint i = 0; i < g_globals->_party.size(); ++i) {
|
||||
Character &c = g_globals->_party[i];
|
||||
g_globals->_currCharacter = &c;
|
||||
|
||||
if (c._alignmentCtr) {
|
||||
--c._alignmentCtr;
|
||||
if (c._alignmentCtr == 0)
|
||||
enc.changeCharAlignment(GOOD);
|
||||
else if (c._alignmentCtr == 16)
|
||||
enc.changeCharAlignment(NEUTRAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Encounter::increaseAlignments() {
|
||||
Game::Encounter &enc = g_globals->_encounters;
|
||||
|
||||
for (uint i = 0; i < g_globals->_party.size(); ++i) {
|
||||
Character &c = g_globals->_party[i];
|
||||
g_globals->_currCharacter = &c;
|
||||
|
||||
if (c._alignmentCtr != 32) {
|
||||
++c._alignmentCtr;
|
||||
if (c._alignmentCtr == 32)
|
||||
enc.changeCharAlignment(EVIL);
|
||||
else if (c._alignmentCtr == 16)
|
||||
enc.changeCharAlignment(NEUTRAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
116
engines/mm/mm1/views/encounter.h
Normal file
116
engines/mm/mm1/views/encounter.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_ENCOUNTER_H
|
||||
#define MM1_VIEWS_ENCOUNTER_H
|
||||
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class Encounter : public TextView {
|
||||
private:
|
||||
enum Mode {
|
||||
ALERT, SURPRISED_BY_MONSTERS, SURPRISED_MONSTERS,
|
||||
ENCOUNTER_OPTIONS, NOWHERE_TO_RUN, SURROUNDED,
|
||||
SURRENDER_FAILED, NO_RESPONSE, BRIBE, NOT_ENOUGH,
|
||||
COMBAT, BATTLE
|
||||
};
|
||||
Mode _mode = ALERT;
|
||||
enum BribeType { BRIBE_GOLD, BRIBE_GEMS, BRIBE_FOOD };
|
||||
BribeType _bribeType = BRIBE_GOLD;
|
||||
Common::String _bribeTypeStr;
|
||||
|
||||
/**
|
||||
* Handles the end of the encounter
|
||||
*/
|
||||
void encounterEnded();
|
||||
|
||||
/**
|
||||
* Initiates the combat
|
||||
*/
|
||||
void attack();
|
||||
|
||||
/**
|
||||
* Try and bribe the enemies
|
||||
*/
|
||||
void bribe();
|
||||
|
||||
/**
|
||||
* Try and retreat
|
||||
*/
|
||||
void retreat();
|
||||
|
||||
/**
|
||||
* Try and surrender
|
||||
*/
|
||||
void surrender();
|
||||
|
||||
/**
|
||||
* Ends an encounter
|
||||
*/
|
||||
void flee();
|
||||
|
||||
/**
|
||||
* Decreases the alignment counter, gradually turning
|
||||
* EVIL to NEUTRAL to GOOD
|
||||
*/
|
||||
void decreaseAlignments();
|
||||
|
||||
/**
|
||||
* Increases the alignment counter, gradually turning
|
||||
* GOOD to NEUTRAL to EVIL
|
||||
*/
|
||||
void increaseAlignments();
|
||||
public:
|
||||
Encounter();
|
||||
virtual ~Encounter() {}
|
||||
|
||||
/**
|
||||
* Called when the view is focused
|
||||
*/
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
|
||||
/**
|
||||
* Draw the encounter details overlayed on
|
||||
* the existing game screen
|
||||
*/
|
||||
void draw() override;
|
||||
|
||||
/**
|
||||
* Handles delay timeouts
|
||||
*/
|
||||
void timeout() override;
|
||||
|
||||
/**
|
||||
* Handles keypresses
|
||||
*/
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
109
engines/mm/mm1/views/game.cpp
Normal file
109
engines/mm/mm1/views/game.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/game.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/metaengine.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
Game::Game() : TextView("Game"),
|
||||
_view(this), _commands(this), _messages(this), _party(this) {
|
||||
_view.setBounds(Common::Rect(0, 0, 240, 128));
|
||||
}
|
||||
|
||||
bool Game::msgFocus(const FocusMessage &msg) {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_NORMAL);
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
bool Game::msgUnfocus(const UnfocusMessage &msg) {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
return TextView::msgUnfocus(msg);
|
||||
}
|
||||
|
||||
void Game::draw() {
|
||||
clearSurface();
|
||||
Graphics::ManagedSurface surf = getSurface();
|
||||
surf.hLine(0, 128, 320, 2);
|
||||
surf.vLine(240, 0, 128, 2);
|
||||
}
|
||||
|
||||
bool Game::msgAction(const ActionMessage &msg) {
|
||||
switch (msg._action) {
|
||||
case KEYBIND_BASH:
|
||||
send("Bash", GameMessage("SHOW"));
|
||||
break;
|
||||
case KEYBIND_ORDER:
|
||||
addView("Order");
|
||||
return true;
|
||||
case KEYBIND_PROTECT:
|
||||
addView("Protect");
|
||||
return true;
|
||||
case KEYBIND_QUICKREF:
|
||||
addView("QuickRef");
|
||||
return true;
|
||||
case KEYBIND_REST:
|
||||
g_events->send(GameMessage("REST"));
|
||||
return true;
|
||||
case KEYBIND_SEARCH:
|
||||
send("Search", GameMessage("SHOW"));
|
||||
break;
|
||||
case KEYBIND_UNLOCK:
|
||||
send("Unlock", GameMessage("SHOW"));
|
||||
break;
|
||||
case KEYBIND_VIEW_PARTY1:
|
||||
case KEYBIND_VIEW_PARTY2:
|
||||
case KEYBIND_VIEW_PARTY3:
|
||||
case KEYBIND_VIEW_PARTY4:
|
||||
case KEYBIND_VIEW_PARTY5:
|
||||
case KEYBIND_VIEW_PARTY6: {
|
||||
uint charNum = msg._action - KEYBIND_VIEW_PARTY1;
|
||||
if (charNum < g_globals->_party.size()) {
|
||||
g_globals->_currCharacter = &g_globals->_party[charNum];
|
||||
addView("CharacterInfo");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TextView::msgAction(msg);
|
||||
}
|
||||
|
||||
bool Game::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "DISPLAY") {
|
||||
replaceView(this);
|
||||
return true;
|
||||
} else if (msg._name == "REDRAW") {
|
||||
redraw();
|
||||
g_events->drawElements();
|
||||
}
|
||||
|
||||
return TextView::msgGame(msg);
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
56
engines/mm/mm1/views/game.h
Normal file
56
engines/mm/mm1/views/game.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_GAME_H
|
||||
#define MM1_VIEWS_GAME_H
|
||||
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/views/game_commands.h"
|
||||
#include "mm/mm1/views/game_messages.h"
|
||||
#include "mm/mm1/views/game_party.h"
|
||||
#include "mm/mm1/views/game_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class Game : public TextView {
|
||||
private:
|
||||
GameCommands _commands;
|
||||
GameMessages _messages;
|
||||
GameParty _party;
|
||||
GameView _view;
|
||||
public:
|
||||
Game();
|
||||
virtual ~Game() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
37
engines/mm/mm1/views/game_commands.cpp
Normal file
37
engines/mm/mm1/views/game_commands.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/game_commands.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
void GameCommands::draw() {
|
||||
for (int i = 1; i < 17; ++i)
|
||||
writeString(31, i - 1, STRING[Common::String::format(
|
||||
"dialogs.game.commands.%d", i)]);
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
43
engines/mm/mm1/views/game_commands.h
Normal file
43
engines/mm/mm1/views/game_commands.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_GAME_COMMANDS_H
|
||||
#define MM1_VIEWS_GAME_COMMANDS_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class GameCommands : public TextView {
|
||||
public:
|
||||
GameCommands(UIElement *owner) : TextView("GameCommands", owner) {}
|
||||
virtual ~GameCommands() {}
|
||||
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
166
engines/mm/mm1/views/game_messages.cpp
Normal file
166
engines/mm/mm1/views/game_messages.cpp
Normal 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 "common/util.h"
|
||||
#include "mm/mm1/views/game_messages.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
GameMessages::GameMessages(UIElement *owner) :
|
||||
TextView("GameMessages", owner) {
|
||||
_bounds = getLineBounds(21, 24);
|
||||
}
|
||||
|
||||
bool GameMessages::msgUnfocus(const UnfocusMessage &msg) {
|
||||
clearSurface();
|
||||
return true;
|
||||
}
|
||||
|
||||
void GameMessages::draw() {
|
||||
clearSurface();
|
||||
|
||||
if (!_lines.empty()) {
|
||||
if (_lines[0].y == -1) {
|
||||
// No co-ordinates provided, just display
|
||||
for (uint i = 0; i < MIN(_lines.size(), 4U); ++i)
|
||||
writeString(0, i, _lines[i]._text);
|
||||
} else {
|
||||
// Write text at suggested co-ordinates
|
||||
for (uint i = 0; i < MIN(_lines.size(), 4U); ++i)
|
||||
writeString(_lines[i].x, _lines[i].y, _lines[i]._text);
|
||||
}
|
||||
|
||||
_lines.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool GameMessages::msgInfo(const InfoMessage &msg) {
|
||||
if (msg._callback || msg._keyCallback ||
|
||||
g_globals->_party.isPartyDead()) {
|
||||
addView(this);
|
||||
}
|
||||
|
||||
_lines = msg._lines;
|
||||
_callback = msg._callback;
|
||||
_nCallback = msg._nCallback;
|
||||
_keyCallback = msg._keyCallback;
|
||||
|
||||
if (msg._largeMessage)
|
||||
_bounds = getLineBounds(17, 24);
|
||||
else
|
||||
_bounds = getLineBounds(21, 24);
|
||||
|
||||
if (msg._sound)
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
redraw();
|
||||
|
||||
if (msg._delaySeconds)
|
||||
delaySeconds(msg._delaySeconds);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GameMessages::msgKeypress(const KeypressMessage &msg) {
|
||||
if (g_globals->_party.isPartyDead()) {
|
||||
// Party is dead, so now that players have read whatever
|
||||
// message was displayed, switch to the Dead screen
|
||||
g_events->clearViews();
|
||||
addView("Dead");
|
||||
|
||||
} else if (g_events->focusedView()) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
if (_keyCallback) {
|
||||
_keyCallback(msg);
|
||||
} else if (msg.keycode == Common::KEYCODE_n) {
|
||||
close();
|
||||
if (_nCallback)
|
||||
_nCallback();
|
||||
} else if (msg.keycode == Common::KEYCODE_y) {
|
||||
close();
|
||||
_callback();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GameMessages::msgAction(const ActionMessage &msg) {
|
||||
auto focusedView = g_events->focusedView();
|
||||
|
||||
if (g_globals->_party.isPartyDead()) {
|
||||
// Party is dead, so now that players have read whatever
|
||||
// message was displayed, switch to the Dead screen
|
||||
g_events->clearViews();
|
||||
addView("Dead");
|
||||
|
||||
} else if (focusedView == this) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
switch (msg._action) {
|
||||
case KEYBIND_ESCAPE:
|
||||
if (_keyCallback) {
|
||||
_keyCallback(Common::KeyState(Common::KEYCODE_ESCAPE));
|
||||
} else {
|
||||
close();
|
||||
if (_nCallback)
|
||||
_nCallback();
|
||||
}
|
||||
return true;
|
||||
case KEYBIND_SELECT:
|
||||
if (_keyCallback) {
|
||||
_keyCallback(Common::KeyState(Common::KEYCODE_RETURN));
|
||||
} else if (_callback) {
|
||||
close();
|
||||
_callback();
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (msg._action == KEYBIND_SELECT) {
|
||||
clearSurface();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GameMessages::timeout() {
|
||||
if (_callback) {
|
||||
// _ynCallback is also used for timeout callbacks
|
||||
close();
|
||||
_callback();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
54
engines/mm/mm1/views/game_messages.h
Normal file
54
engines/mm/mm1/views/game_messages.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_GAME_MESSAGES_H
|
||||
#define MM1_VIEWS_GAME_MESSAGES_H
|
||||
|
||||
#include "mm/mm1/messages.h"
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class GameMessages : public TextView {
|
||||
private:
|
||||
Common::Array<Line> _lines;
|
||||
YNCallback _callback = nullptr;
|
||||
YNCallback _nCallback = nullptr;
|
||||
KeyCallback _keyCallback = nullptr;
|
||||
public:
|
||||
GameMessages(UIElement *owner);
|
||||
virtual ~GameMessages() {}
|
||||
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgInfo(const InfoMessage &msg) override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
void timeout() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
51
engines/mm/mm1/views/game_party.cpp
Normal file
51
engines/mm/mm1/views/game_party.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/game_party.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
GameParty::GameParty(UIElement *owner) : TextView("GameParty", owner) {
|
||||
_bounds = getLineBounds(17, 19);
|
||||
}
|
||||
|
||||
void GameParty::draw() {
|
||||
clearSurface();
|
||||
|
||||
for (uint i = 0; i < g_globals->_party.size(); ++i) {
|
||||
Character &c = g_globals->_party[i];
|
||||
writeChar((i % 2) * 21, i / 2,
|
||||
c._condition ? '*' : ' ');
|
||||
writeString(Common::String::format("%d) %s",
|
||||
i + 1, c._name));
|
||||
}
|
||||
}
|
||||
|
||||
bool GameParty::msgKeypress(const KeypressMessage &msg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
44
engines/mm/mm1/views/game_party.h
Normal file
44
engines/mm/mm1/views/game_party.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_GAME_PARTY_H
|
||||
#define MM1_VIEWS_GAME_PARTY_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class GameParty : public TextView {
|
||||
public:
|
||||
GameParty(UIElement *owner);
|
||||
virtual ~GameParty() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
211
engines/mm/mm1/views/game_view.cpp
Normal file
211
engines/mm/mm1/views/game_view.cpp
Normal file
@@ -0,0 +1,211 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/game_view.h"
|
||||
#include "mm/mm1/maps/maps.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
static byte ARR1[] = { 8, 6, 4, 2 };
|
||||
static byte ARR2[] = { 6, 4, 2, 1 };
|
||||
static byte ARR3[] = { 4, 5, 3, 2 };
|
||||
static byte ARR4[] = { 4, 9, 6, 2 };
|
||||
static byte ARR5[] = { 4, 5, 3, 2 };
|
||||
static byte ARR6[] = { 22, 12, 6, 2 };
|
||||
static byte ARR7[] = { 0, 8, 18, 24 };
|
||||
static byte ARR8[] = { 0, 0, 12, 24 };
|
||||
static byte ARR9[] = { 52, 42, 36, 32 };
|
||||
static byte ARR10[] = { 52, 42, 36, 32 };
|
||||
static byte ARR11[] = { 8, 18, 24, 28 };
|
||||
static byte ARR12[] = { 8, 10, 6, 4 };
|
||||
static byte ARR13[] = { 44, 24, 12, 4 };
|
||||
static byte ARR14[] = { 0, 0, 0, 0 };
|
||||
static byte ARR15[] = { 36, 4, 0, 0 };
|
||||
static byte ARR16[] = { 36, 14, 6, 0 };
|
||||
static uint16 ARR17[] = { 0, 1, 2, 3 };
|
||||
static uint16 ARR18[] = { 4, 5, 6, 7 };
|
||||
static uint16 ARR19[] = { 8, 9, 10, 11 };
|
||||
|
||||
GameView::GameView(UIElement *owner) : Game::ViewBase(owner) {
|
||||
Common::fill(&_drawFlags[0], &_drawFlags[10], 0);
|
||||
}
|
||||
|
||||
void GameView::draw() {
|
||||
clearSurface();
|
||||
|
||||
if (!_isDark)
|
||||
drawScene();
|
||||
|
||||
if (!_dialogMessage.empty()) {
|
||||
drawDialogMessage();
|
||||
_dialogMessage.clear();
|
||||
} else if (_isDark) {
|
||||
writeString(9, 7, STRING["view.darkness"]);
|
||||
}
|
||||
|
||||
if (!_descriptionLine.empty())
|
||||
drawDescriptionLine();
|
||||
}
|
||||
|
||||
void GameView::drawScene() {
|
||||
Maps::Maps &maps = g_globals->_maps;
|
||||
Maps::Map &map = *maps._currentMap;
|
||||
byte mapOffset = maps._mapOffset;
|
||||
|
||||
Common::fill(&_drawFlags[0], &_drawFlags[10], 0);
|
||||
|
||||
// Loop through four regions in front of the party
|
||||
for (int dist = 0; dist < 4; ++dist,
|
||||
mapOffset += maps._forwardOffset) {
|
||||
byte walls = map._walls[mapOffset];
|
||||
byte wallsLeft = map._walls[mapOffset + maps._leftOffset];
|
||||
byte wallsRight = map._walls[mapOffset + maps._rightOffset];
|
||||
|
||||
// Draw left-hand side
|
||||
_mask = walls & maps._leftMask;
|
||||
if (_mask) {
|
||||
_tileIndex = ARR17[dist];
|
||||
_srcWidth = ARR3[dist];
|
||||
_srcPitch = ARR12[dist];
|
||||
_destLeft = ARR7[dist];
|
||||
_destTop = ARR1[dist];
|
||||
_srcLeft = ARR14[dist];
|
||||
_drawFlags[dist + 1]++;
|
||||
drawTile();
|
||||
|
||||
} else {
|
||||
_mask = wallsLeft & maps._forwardMask;
|
||||
if (_mask) {
|
||||
_tileIndex = ARR19[dist];
|
||||
_drawFlags[dist + 1]++;
|
||||
|
||||
if (_drawFlags[dist]) {
|
||||
_srcWidth = ARR5[dist];
|
||||
_srcPitch = ARR13[dist];
|
||||
_destLeft = ARR7[dist];
|
||||
_destTop = ARR2[dist];
|
||||
_srcLeft = ARR16[dist];
|
||||
} else {
|
||||
_srcWidth = ARR4[dist];
|
||||
_srcPitch = ARR13[dist];
|
||||
_destLeft = ARR8[dist];
|
||||
_destTop = ARR2[dist];
|
||||
_srcLeft = ARR15[dist];
|
||||
}
|
||||
|
||||
drawTile();
|
||||
}
|
||||
}
|
||||
|
||||
// Draw right-hand side
|
||||
_mask = walls & maps._rightMask;
|
||||
if (_mask) {
|
||||
_tileIndex = ARR18[dist];
|
||||
_srcWidth = ARR3[dist];
|
||||
_srcPitch = ARR12[dist];
|
||||
_destLeft = ARR9[dist];
|
||||
_destTop = ARR1[dist];
|
||||
_srcLeft = ARR14[dist];
|
||||
_drawFlags[dist + 6]++;
|
||||
drawTile();
|
||||
|
||||
} else {
|
||||
_mask = wallsRight & maps._forwardMask;
|
||||
if (_mask) {
|
||||
_tileIndex = ARR19[dist];
|
||||
_drawFlags[6 + dist]++;
|
||||
|
||||
if (_drawFlags[5 + dist]) {
|
||||
_srcWidth = ARR5[dist];
|
||||
_srcPitch = ARR13[dist];
|
||||
_destLeft = ARR10[dist];
|
||||
_destTop = ARR2[dist];
|
||||
_srcLeft = ARR14[dist];
|
||||
} else {
|
||||
_srcWidth = ARR4[dist];
|
||||
_srcPitch = ARR13[dist];
|
||||
_destLeft = ARR10[dist];
|
||||
_destTop = ARR2[dist];
|
||||
_srcLeft = ARR14[dist];
|
||||
}
|
||||
|
||||
drawTile();
|
||||
}
|
||||
}
|
||||
|
||||
// Handle drawing any wall directly in front
|
||||
_mask = walls & maps._forwardMask;
|
||||
if (_mask) {
|
||||
_tileIndex = ARR19[dist];
|
||||
_srcWidth = ARR6[dist];
|
||||
_srcPitch = ARR13[dist];
|
||||
_destLeft = ARR11[dist];
|
||||
_destTop = ARR2[dist];
|
||||
_srcLeft = ARR14[dist];
|
||||
drawTile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameView::drawTile() {
|
||||
Maps::Maps &maps = g_globals->_maps;
|
||||
|
||||
// Determine graphics section to use
|
||||
int section = 0;
|
||||
if ((_mask & 0x55) != _mask) {
|
||||
++section;
|
||||
if ((_mask & 0xaa) != _mask)
|
||||
++section;
|
||||
}
|
||||
|
||||
Graphics::ManagedSurface surf = getSurface();
|
||||
const Common::Array<Graphics::ManagedSurface> &tiles =
|
||||
maps._tiles[section];
|
||||
const Graphics::ManagedSurface &tile = tiles[_tileIndex];
|
||||
|
||||
Common::Rect r(_srcLeft * 4, 0, _srcLeft * 4 + _srcWidth * 8, tile.h);
|
||||
Common::Point pos(_destLeft * 4, (8 - _destTop) * 8);
|
||||
pos.x -= _bounds.left;
|
||||
pos.y -= _bounds.top;
|
||||
if (_bounds.top != 0)
|
||||
pos.y += 12;
|
||||
|
||||
surf.blitFrom(tile, r, pos);
|
||||
}
|
||||
|
||||
void GameView::drawDialogMessage() {
|
||||
writeString(9, 6, " ");
|
||||
writeString(9, 7, _dialogMessage);
|
||||
writeString(9, 8, " ");
|
||||
}
|
||||
|
||||
void GameView::drawDescriptionLine() {
|
||||
writeString(10, 15, _descriptionLine);
|
||||
_descriptionLine.clear();
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
71
engines/mm/mm1/views/game_view.h
Normal file
71
engines/mm/mm1/views/game_view.h
Normal 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_VIEWS_GAME_VIEW_H
|
||||
#define MM1_VIEWS_GAME_VIEW_H
|
||||
|
||||
#include "mm/mm1/game/view_base.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
|
||||
class GameView : public Game::ViewBase {
|
||||
private:
|
||||
int _tileIndex = 0, _srcWidth = 0, _srcPitch = 0;
|
||||
int _destLeft = 0, _destTop = 0, _srcLeft = 0;
|
||||
byte _mask = 0;
|
||||
byte _drawFlags[10];
|
||||
private:
|
||||
/**
|
||||
* Draws a tile
|
||||
*/
|
||||
void drawTile();
|
||||
|
||||
/**
|
||||
* Draws the scene
|
||||
*/
|
||||
void drawScene();
|
||||
|
||||
/**
|
||||
* Draws a business name or other information like
|
||||
* container container for searches
|
||||
*/
|
||||
void drawDescriptionLine();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Draws the dialog message
|
||||
*/
|
||||
virtual void drawDialogMessage();
|
||||
|
||||
public:
|
||||
GameView(UIElement *owner);
|
||||
virtual ~GameView() {}
|
||||
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
51
engines/mm/mm1/views/interactions/access_code.cpp
Normal file
51
engines/mm/mm1/views/interactions/access_code.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/access_code.h"
|
||||
#include "mm/mm1/maps/map08.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
AccessCode::AccessCode() :
|
||||
AnswerEntry("AccessCode", Common::Point(16, 3), 8) {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
void AccessCode::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map08.enter_code"]);
|
||||
AnswerEntry::draw();
|
||||
}
|
||||
|
||||
void AccessCode::answerEntered() {
|
||||
MM1::Maps::Map08 &map = *static_cast<MM1::Maps::Map08 *>(g_maps->_currentMap);
|
||||
map.codeEntered(_answer);
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
50
engines/mm/mm1/views/interactions/access_code.h
Normal file
50
engines/mm/mm1/views/interactions/access_code.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_ACCESS_CODE_H
|
||||
#define MM1_VIEWS_MAPS_ACCESS_CODE_H
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class AccessCode : public AnswerEntry {
|
||||
protected:
|
||||
/**
|
||||
* Called when the code has been entered
|
||||
*/
|
||||
void answerEntered() override;
|
||||
public:
|
||||
AccessCode();
|
||||
virtual ~AccessCode() {}
|
||||
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
101
engines/mm/mm1/views/interactions/alamar.cpp
Normal file
101
engines/mm/mm1/views/interactions/alamar.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/alamar.h"
|
||||
#include "mm/mm1/maps/map49.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
#define VAL1 952
|
||||
#define HAS_EYE 154
|
||||
|
||||
Alamar::Alamar() : TextView("Alamar") {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
bool Alamar::msgFocus(const FocusMessage &msg) {
|
||||
MM1::Maps::Map49 &map = *static_cast<MM1::Maps::Map49 *>(g_maps->_currentMap);
|
||||
|
||||
_succeeded = false;
|
||||
for (uint i = 0; i < g_globals->_party.size() && !_succeeded; ++i)
|
||||
_succeeded = (g_globals->_party[i]._flags[13] & CHARFLAG13_ALAMAR) != 0;
|
||||
map[HAS_EYE] = g_globals->_party.hasItem(EYE_OF_GOROS_ID) ? 1 : 0;
|
||||
|
||||
if (!_succeeded && !map[HAS_EYE]) {
|
||||
for (uint i = 0; i < g_globals->_party.size() && !_succeeded; ++i)
|
||||
g_globals->_party[i]._quest = 255;
|
||||
}
|
||||
|
||||
Sound::sound(SOUND_2);
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
void Alamar::draw() {
|
||||
MM1::Maps::Map49 &map = *static_cast<MM1::Maps::Map49 *>(g_maps->_currentMap);
|
||||
clearSurface();
|
||||
|
||||
if (_succeeded) {
|
||||
writeString(0, 0, STRING["maps.map49.alamar1"]);
|
||||
writeString(STRING["maps.map49.alamar3"]);
|
||||
|
||||
} else if (map[HAS_EYE]) {
|
||||
send("View", DrawGraphicMessage(65 + 7));
|
||||
send("View", DrawGraphicMessage(65 + 8));
|
||||
|
||||
writeString(0, 0, STRING["maps.map49.alamar1"]);
|
||||
writeString(STRING["maps.map49.alamar4"]);
|
||||
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
} else {
|
||||
writeString(0, 0, STRING["maps.map49.alamar1"]);
|
||||
writeString(STRING["maps.map49.alamar2"]);
|
||||
}
|
||||
}
|
||||
|
||||
bool Alamar::msgKeypress(const KeypressMessage &msg) {
|
||||
MM1::Maps::Map49 &map = *static_cast<MM1::Maps::Map49 *>(g_maps->_currentMap);
|
||||
close();
|
||||
|
||||
if (map[HAS_EYE]) {
|
||||
map[VAL1]++;
|
||||
map.updateGame();
|
||||
|
||||
} else {
|
||||
g_maps->_mapPos.x = 8;
|
||||
map.updateGame();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
49
engines/mm/mm1/views/interactions/alamar.h
Normal file
49
engines/mm/mm1/views/interactions/alamar.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_ALAMAR_H
|
||||
#define MM1_VIEWS_MAPS_ALAMAR_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Alamar : public TextView {
|
||||
private:
|
||||
bool _succeeded = false;
|
||||
public:
|
||||
Alamar();
|
||||
virtual ~Alamar() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
67
engines/mm/mm1/views/interactions/alien.cpp
Normal file
67
engines/mm/mm1/views/interactions/alien.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/alien.h"
|
||||
#include "mm/mm1/maps/map31.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Alien::Alien() : TextView("Alien") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
void Alien::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map31.alien"]);
|
||||
}
|
||||
|
||||
bool Alien::msgKeypress(const KeypressMessage &msg) {
|
||||
MM1::Maps::Map31 &map = *static_cast<MM1::Maps::Map31 *>(
|
||||
g_maps->_currentMap);
|
||||
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_a:
|
||||
close();
|
||||
map.hostile();
|
||||
break;
|
||||
case Common::KEYCODE_b:
|
||||
close();
|
||||
map.neutral();
|
||||
break;
|
||||
case Common::KEYCODE_c:
|
||||
close();
|
||||
map.friendly();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
46
engines/mm/mm1/views/interactions/alien.h
Normal file
46
engines/mm/mm1/views/interactions/alien.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_ALIEN_H
|
||||
#define MM1_VIEWS_MAPS_ALIEN_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Alien : public TextView {
|
||||
public:
|
||||
Alien();
|
||||
virtual ~Alien() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
80
engines/mm/mm1/views/interactions/answer_entry.cpp
Normal file
80
engines/mm/mm1/views/interactions/answer_entry.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
AnswerEntry::AnswerEntry(const Common::String &name,
|
||||
const Common::Point &pos, size_t maxLength) :
|
||||
TextView(name), _pos(pos), _maxLength(maxLength) {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool AnswerEntry::msgFocus(const FocusMessage &msg) {
|
||||
TextView::msgFocus(msg);
|
||||
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MINIMAL);
|
||||
Sound::sound(SOUND_2);
|
||||
_answer = "";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AnswerEntry::draw() {
|
||||
writeString(_pos.x, _pos.y, _answer);
|
||||
for (uint i = 0; i < (_maxLength - _answer.size()); ++i)
|
||||
writeChar(_blank);
|
||||
}
|
||||
|
||||
bool AnswerEntry::msgKeypress(const KeypressMessage &msg) {
|
||||
if (!isDelayActive()) {
|
||||
if (msg.keycode == Common::KEYCODE_RETURN) {
|
||||
answerEntered();
|
||||
return true;
|
||||
|
||||
} else if (msg.keycode == Common::KEYCODE_SPACE ||
|
||||
(msg.keycode >= Common::KEYCODE_0 &&
|
||||
msg.keycode <= Common::KEYCODE_z)) {
|
||||
_answer += toupper(msg.ascii);
|
||||
redraw();
|
||||
|
||||
if (_answer.size() == _maxLength)
|
||||
answerEntered();
|
||||
|
||||
} else if (msg.keycode == Common::KEYCODE_BACKSPACE && !_answer.empty()) {
|
||||
_answer.deleteLastChar();
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
60
engines/mm/mm1/views/interactions/answer_entry.h
Normal file
60
engines/mm/mm1/views/interactions/answer_entry.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_ANSWER_ENTRY_H
|
||||
#define MM1_VIEWS_MAPS_ANSWER_ENTRY_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class AnswerEntry : public TextView {
|
||||
private:
|
||||
Common::Point _pos;
|
||||
size_t _maxLength;
|
||||
char _blank = '.';
|
||||
protected:
|
||||
Common::String _answer;
|
||||
|
||||
/**
|
||||
* Called when Enter pressed, or maximum length reached
|
||||
*/
|
||||
virtual void answerEntered() = 0;
|
||||
|
||||
public:
|
||||
AnswerEntry(const Common::String &name,
|
||||
const Common::Point &pos, size_t maxLength);
|
||||
virtual ~AnswerEntry() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
98
engines/mm/mm1/views/interactions/arenko.cpp
Normal file
98
engines/mm/mm1/views/interactions/arenko.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/arenko.h"
|
||||
#include "mm/mm1/maps/map28.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
#define VAL1 63
|
||||
#define VAL2 64
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Arenko::Arenko() : TextView("Arenko") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool Arenko::msgFocus(const FocusMessage &msg) {
|
||||
MM1::Maps::Map28 &map = *static_cast<MM1::Maps::Map28 *>(g_maps->_currentMap);
|
||||
|
||||
if (!map[VAL1]) {
|
||||
_line = STRING["maps.map28.arenko"];
|
||||
map[VAL2] = 1;
|
||||
|
||||
} else if (map[VAL1] < 19) {
|
||||
_line = STRING["maps.map28.keep_climbing"];
|
||||
|
||||
} else {
|
||||
_line = STRING["maps.map28.well_done"];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Arenko::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, _line);
|
||||
}
|
||||
|
||||
bool Arenko::msgKeypress(const KeypressMessage &msg) {
|
||||
MM1::Maps::Map28 &map = *static_cast<MM1::Maps::Map28 *>(g_maps->_currentMap);
|
||||
|
||||
if (map[VAL1] == 19) {
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_a:
|
||||
close();
|
||||
giveGold();
|
||||
return true;
|
||||
case Common::KEYCODE_b:
|
||||
close();
|
||||
giveGems();
|
||||
return true;
|
||||
case Common::KEYCODE_c:
|
||||
close();
|
||||
giveItem();
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Arenko::msgAction(const ActionMessage &msg) {
|
||||
MM1::Maps::Map28 &map = *static_cast<MM1::Maps::Map28 *>(g_maps->_currentMap);
|
||||
if (map[VAL1] != 19)
|
||||
close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
51
engines/mm/mm1/views/interactions/arenko.h
Normal file
51
engines/mm/mm1/views/interactions/arenko.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_ARENKO_H
|
||||
#define MM1_VIEWS_MAPS_ARENKO_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
#include "mm/mm1/game/arenko.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Arenko : public TextView, public MM1::Game::Arenko {
|
||||
private:
|
||||
Common::String _line;
|
||||
public:
|
||||
Arenko();
|
||||
virtual ~Arenko() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
86
engines/mm/mm1/views/interactions/arrested.cpp
Normal file
86
engines/mm/mm1/views/interactions/arrested.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/arrested.h"
|
||||
#include "mm/mm1/maps/map04.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Arrested::Arrested() : TextView("Arrested") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool Arrested::msgFocus(const FocusMessage &msg) {
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
void Arrested::draw() {
|
||||
clearSurface();
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
writeString(0, 1, STRING["maps.map04.guards"]);
|
||||
}
|
||||
|
||||
bool Arrested::msgKeypress(const KeypressMessage &msg) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_a:
|
||||
attack();
|
||||
break;
|
||||
case Common::KEYCODE_b:
|
||||
bribe();
|
||||
break;
|
||||
case Common::KEYCODE_c:
|
||||
run();
|
||||
break;
|
||||
case Common::KEYCODE_d:
|
||||
surrender();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Arrested::surrender(int numYears) {
|
||||
Game::Arrested::surrender(numYears);
|
||||
|
||||
// Display sentence
|
||||
clearSurface();
|
||||
Sound::sound(SOUND_2);
|
||||
writeString(0, 1, STRING["maps.map04.sentence"]);
|
||||
writeNumber(numYears);
|
||||
|
||||
delaySeconds(3);
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
51
engines/mm/mm1/views/interactions/arrested.h
Normal file
51
engines/mm/mm1/views/interactions/arrested.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_ARRESTED_H
|
||||
#define MM1_VIEWS_MAPS_ARRESTED_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
#include "mm/mm1/game/arrested.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Arrested : public TextView, public MM1::Game::Arrested {
|
||||
private:
|
||||
void surrender(int numYears = 2);
|
||||
|
||||
public:
|
||||
Arrested();
|
||||
virtual ~Arrested() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
58
engines/mm/mm1/views/interactions/chess.cpp
Normal file
58
engines/mm/mm1/views/interactions/chess.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/chess.h"
|
||||
#include "mm/mm1/maps/map29.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Chess::Chess() :
|
||||
AnswerEntry("Chess", Common::Point(10, 6), 23) {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
bool Chess::msgFocus(const FocusMessage &msg) {
|
||||
Sound::sound(SOUND_3);
|
||||
return AnswerEntry::msgFocus(msg);
|
||||
}
|
||||
|
||||
void Chess::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 0, STRING["maps.map29.chess"]);
|
||||
AnswerEntry::draw();
|
||||
}
|
||||
|
||||
void Chess::answerEntered() {
|
||||
MM1::Maps::Map29 &map = *static_cast<MM1::Maps::Map29 *>(g_maps->_currentMap);
|
||||
clearSurface();
|
||||
close();
|
||||
map.chessAnswer(_answer);
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
49
engines/mm/mm1/views/interactions/chess.h
Normal file
49
engines/mm/mm1/views/interactions/chess.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_CHESS_H
|
||||
#define MM1_VIEWS_MAPS_CHESS_H
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Chess : public AnswerEntry {
|
||||
protected:
|
||||
void answerEntered() override;
|
||||
|
||||
public:
|
||||
Chess();
|
||||
virtual ~Chess() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
98
engines/mm/mm1/views/interactions/dog_statue.cpp
Normal file
98
engines/mm/mm1/views/interactions/dog_statue.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/dog_statue.h"
|
||||
#include "mm/mm1/maps/map42.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
DogStatue::DogStatue() : TextView("DogStatue") {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
bool DogStatue::msgFocus(const FocusMessage &msg) {
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
_completedQuests = false;
|
||||
for (uint i = 0; i < g_globals->_party.size(); ++i) {
|
||||
if ((g_globals->_party[i]._flags[0] &
|
||||
(CHARFLAG0_COURIER3 | CHARFLAG0_FOUND_CHEST | CHARFLAG0_40)) ==
|
||||
(CHARFLAG0_COURIER3 | CHARFLAG0_FOUND_CHEST | CHARFLAG0_40)) {
|
||||
_completedQuests = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
void DogStatue::draw() {
|
||||
MM1::Maps::Map42 &map = *static_cast<MM1::Maps::Map42 *>(g_maps->_currentMap);
|
||||
|
||||
clearSurface();
|
||||
writeString(0, 0, STRING["maps.map42.statue1"]);
|
||||
|
||||
if (_completedQuests) {
|
||||
writeString(0, 2, STRING["maps.map42.statue2"]);
|
||||
map.dogSuccess();
|
||||
|
||||
} else {
|
||||
writeString(0, 3, STRING["maps.map42.statue3"]);
|
||||
}
|
||||
}
|
||||
|
||||
bool DogStatue::msgKeypress(const KeypressMessage &msg) {
|
||||
if (msg.keycode == Common::KEYCODE_y || msg.keycode == Common::KEYCODE_n) {
|
||||
MM1::Maps::Map42 &map = *static_cast<MM1::Maps::Map42 *>(g_maps->_currentMap);
|
||||
close();
|
||||
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
map.dogDesecrate();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DogStatue::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE || msg._action == KEYBIND_SELECT) {
|
||||
MM1::Maps::Map42 &map = *static_cast<MM1::Maps::Map42 *>(g_maps->_currentMap);
|
||||
close();
|
||||
|
||||
if (msg._action == KEYBIND_SELECT)
|
||||
map.dogDesecrate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
50
engines/mm/mm1/views/interactions/dog_statue.h
Normal file
50
engines/mm/mm1/views/interactions/dog_statue.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_DOG_STATUE_H
|
||||
#define MM1_VIEWS_MAPS_DOG_STATUE_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class DogStatue : public TextView {
|
||||
private:
|
||||
bool _completedQuests = false;
|
||||
public:
|
||||
DogStatue();
|
||||
virtual ~DogStatue() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
68
engines/mm/mm1/views/interactions/ghost.cpp
Normal file
68
engines/mm/mm1/views/interactions/ghost.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/ghost.h"
|
||||
#include "mm/mm1/maps/map37.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Ghost::Ghost() : TextView("Ghost") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
void Ghost::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map37.okrim1"]);
|
||||
}
|
||||
|
||||
bool Ghost::msgKeypress(const KeypressMessage &msg) {
|
||||
if (msg.keycode == Common::KEYCODE_y || msg.keycode == Common::KEYCODE_n) {
|
||||
MM1::Maps::Map37 &map = *static_cast<MM1::Maps::Map37 *>(g_maps->_currentMap);
|
||||
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
g_globals->_party[0]._condition = ERADICATED;
|
||||
} else {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map37.okrim2"]);
|
||||
|
||||
map[MM1::Maps::MAP_29] = 32;
|
||||
map[MM1::Maps::MAP_47] = 8;
|
||||
}
|
||||
|
||||
// Note: You get the ring whether or not you agree to it.
|
||||
// This is indeed how the original's logic is implemented
|
||||
close();
|
||||
g_globals->_treasure._items[2] = RING_OF_OKRIM_ID;
|
||||
g_events->addAction(KEYBIND_SEARCH);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
46
engines/mm/mm1/views/interactions/ghost.h
Normal file
46
engines/mm/mm1/views/interactions/ghost.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_GHOST_H
|
||||
#define MM1_VIEWS_MAPS_GHOST_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Ghost : public TextView {
|
||||
public:
|
||||
Ghost();
|
||||
virtual ~Ghost() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
102
engines/mm/mm1/views/interactions/giant.cpp
Normal file
102
engines/mm/mm1/views/interactions/giant.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/giant.h"
|
||||
#include "mm/mm1/maps/map30.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Giant::Giant() : TextView("Giant") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool Giant::msgFocus(const FocusMessage &msg) {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
bool Giant::msgUnfocus(const UnfocusMessage &msg) {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
return TextView::msgUnfocus(msg);
|
||||
}
|
||||
|
||||
void Giant::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map30.giant"]);
|
||||
}
|
||||
|
||||
bool Giant::msgKeypress(const KeypressMessage &msg) {
|
||||
if (endDelay()) {
|
||||
draw();
|
||||
|
||||
} else if (msg.keycode < Common::KEYCODE_1 ||
|
||||
msg.keycode > Common::KEYCODE_6) {
|
||||
close();
|
||||
|
||||
} else {
|
||||
uint charIndex = msg.keycode - Common::KEYCODE_1;
|
||||
charSelected(charIndex);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Giant::msgAction(const ActionMessage &msg) {
|
||||
if (endDelay()) {
|
||||
// Nothing further
|
||||
|
||||
} else if (msg._action >= KEYBIND_VIEW_PARTY1 &&
|
||||
msg._action <= KEYBIND_VIEW_PARTY6) {
|
||||
uint idx = msg._action - KEYBIND_VIEW_PARTY1;
|
||||
charSelected(idx);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Giant::charSelected(uint charIndex) {
|
||||
if (charIndex >= g_globals->_party.size())
|
||||
return;
|
||||
|
||||
MM1::Maps::Map30 &map = *static_cast<MM1::Maps::Map30 *>(g_maps->_currentMap);
|
||||
g_globals->_currCharacter = &g_globals->_party[charIndex];
|
||||
Common::String line = map.worthiness();
|
||||
|
||||
clearSurface();
|
||||
writeString(0, 1, line);
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
delaySeconds(5);
|
||||
}
|
||||
|
||||
void Giant::timeout() {
|
||||
redraw();
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
53
engines/mm/mm1/views/interactions/giant.h
Normal file
53
engines/mm/mm1/views/interactions/giant.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_GIANT_H
|
||||
#define MM1_VIEWS_MAPS_GIANT_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Giant : public TextView {
|
||||
private:
|
||||
void charSelected(uint charIndex);
|
||||
|
||||
public:
|
||||
Giant();
|
||||
virtual ~Giant() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
void timeout() override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
112
engines/mm/mm1/views/interactions/gypsy.cpp
Normal file
112
engines/mm/mm1/views/interactions/gypsy.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/gypsy.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
#define VAL1 123
|
||||
#define ANSWER_OFFSET 167
|
||||
|
||||
Gypsy::Gypsy() : TextView("Gypsy") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool Gypsy::msgFocus(const FocusMessage &msg) {
|
||||
TextView::msgFocus(msg);
|
||||
modeChanged(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Gypsy::msgUnfocus(const UnfocusMessage &msg) {
|
||||
TextView::msgUnfocus(msg);
|
||||
modeChanged(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Gypsy::charSelected(uint charIndex) {
|
||||
if (charIndex < g_globals->_party.size()) {
|
||||
_character = &g_globals->_party[charIndex];
|
||||
|
||||
if (!(_character->_flags[4] & CHARFLAG4_ASSIGNED)) {
|
||||
_character->_flags[4] = CHARFLAG4_ASSIGNED |
|
||||
(getRandomNumber(8) - 1);
|
||||
}
|
||||
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void Gypsy::modeChanged(bool allowSelection) {
|
||||
if (allowSelection)
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
|
||||
else
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
|
||||
}
|
||||
|
||||
void Gypsy::draw() {
|
||||
clearSurface();
|
||||
if (!_character) {
|
||||
writeString(0, 1, STRING["maps.map23.gypsy"]);
|
||||
|
||||
} else {
|
||||
Common::String line = Common::String::format(
|
||||
STRING["maps.map23.your_sign_is"].c_str(),
|
||||
STRING[Common::String::format("colors.%d",
|
||||
_character->_flags[4] & CHARFLAG4_SIGN)].c_str()
|
||||
);
|
||||
|
||||
writeString(0, 1, line);
|
||||
}
|
||||
}
|
||||
|
||||
bool Gypsy::msgKeypress(const KeypressMessage &msg) {
|
||||
if (_character) {
|
||||
_character = nullptr;
|
||||
modeChanged(true);
|
||||
draw();
|
||||
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Gypsy::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action >= KEYBIND_VIEW_PARTY1 &&
|
||||
msg._action <= KEYBIND_VIEW_PARTY6) {
|
||||
uint idx = msg._action - KEYBIND_VIEW_PARTY1;
|
||||
charSelected(idx);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
55
engines/mm/mm1/views/interactions/gypsy.h
Normal file
55
engines/mm/mm1/views/interactions/gypsy.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_GYPSY_H
|
||||
#define MM1_VIEWS_MAPS_GYPSY_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
#include "mm/mm1/data/character.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Gypsy : public TextView {
|
||||
private:
|
||||
Character *_character = nullptr;
|
||||
|
||||
void charSelected(uint charIndex);
|
||||
void modeChanged(bool allowSelection);
|
||||
public:
|
||||
Gypsy();
|
||||
virtual ~Gypsy() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
109
engines/mm/mm1/views/interactions/hacker.cpp
Normal file
109
engines/mm/mm1/views/interactions/hacker.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/hacker.h"
|
||||
#include "mm/mm1/maps/map36.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Hacker::Hacker() : TextView("Hacker") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool Hacker::msgGame(const GameMessage &msg) {
|
||||
if (msg._name != "DISPLAY")
|
||||
return false;
|
||||
|
||||
g_globals->_currCharacter = &g_globals->_party[0];
|
||||
_canAccept = !g_globals->_currCharacter->_quest;
|
||||
|
||||
if (_canAccept) {
|
||||
// Show the view
|
||||
Sound::sound(SOUND_2);
|
||||
addView();
|
||||
|
||||
} else {
|
||||
MM1::Maps::Map36 &map = *static_cast<MM1::Maps::Map36 *>(g_maps->_currentMap);
|
||||
int questNum = g_globals->_party[0]._quest;
|
||||
Common::String line;
|
||||
|
||||
if (questNum >= 15 && questNum <= 21)
|
||||
line = map.checkQuestComplete();
|
||||
else
|
||||
line = STRING["maps.map36.hacker4"];
|
||||
|
||||
g_maps->_mapPos.x--;
|
||||
map.redrawGame();
|
||||
|
||||
send(SoundMessage(
|
||||
0, 1, STRING["maps.map36.hacker1"],
|
||||
0, 2, line
|
||||
));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Hacker::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map36.hacker1"]);
|
||||
writeString(0, 2, STRING["maps.map36.hacker2"]);
|
||||
}
|
||||
|
||||
bool Hacker::msgKeypress(const KeypressMessage &msg) {
|
||||
MM1::Maps::Map36 &map = *static_cast<MM1::Maps::Map36 *>(g_maps->_currentMap);
|
||||
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
close();
|
||||
map.acceptQuest();
|
||||
|
||||
Character &c = g_globals->_party[0];
|
||||
if (c._quest) {
|
||||
Common::String line = Common::String::format("%s %s",
|
||||
STRING["maps.map36.hacker3"].c_str(),
|
||||
STRING[Common::String::format(
|
||||
"maps.map36.ingredients.%d",
|
||||
g_globals->_party[0]._quest - 15)].c_str()
|
||||
);
|
||||
|
||||
send(InfoMessage(
|
||||
0, 1, STRING["maps.map36.hacker1"],
|
||||
0, 2, line
|
||||
));
|
||||
}
|
||||
|
||||
} else if (msg.keycode == Common::KEYCODE_n) {
|
||||
close();
|
||||
map.redrawGame();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
49
engines/mm/mm1/views/interactions/hacker.h
Normal file
49
engines/mm/mm1/views/interactions/hacker.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_HACKER_H
|
||||
#define MM1_VIEWS_MAPS_HACKER_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Hacker : public TextView {
|
||||
private:
|
||||
bool _canAccept;
|
||||
public:
|
||||
Hacker();
|
||||
virtual ~Hacker() {}
|
||||
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
51
engines/mm/mm1/views/interactions/ice_princess.cpp
Normal file
51
engines/mm/mm1/views/interactions/ice_princess.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/ice_princess.h"
|
||||
#include "mm/mm1/maps/map19.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
IcePrincess::IcePrincess() :
|
||||
AnswerEntry("IcePrincess", Common::Point(9, 7), 10) {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
void IcePrincess::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map19.ice_princess"]);
|
||||
AnswerEntry::draw();
|
||||
}
|
||||
|
||||
void IcePrincess::answerEntered() {
|
||||
MM1::Maps::Map19 &map = *static_cast<MM1::Maps::Map19 *>(g_maps->_currentMap);
|
||||
map.riddleAnswer(_answer);
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
48
engines/mm/mm1/views/interactions/ice_princess.h
Normal file
48
engines/mm/mm1/views/interactions/ice_princess.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_ICE_PRINCESS_H
|
||||
#define MM1_VIEWS_MAPS_ICE_PRINCESS_H
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class IcePrincess : public AnswerEntry {
|
||||
protected:
|
||||
void answerEntered() override;
|
||||
|
||||
public:
|
||||
IcePrincess();
|
||||
virtual ~IcePrincess() {}
|
||||
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
107
engines/mm/mm1/views/interactions/inspectron.cpp
Normal file
107
engines/mm/mm1/views/interactions/inspectron.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/inspectron.h"
|
||||
#include "mm/mm1/maps/map35.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
#define VAL1 123
|
||||
#define ANSWER_OFFSET 167
|
||||
|
||||
Inspectron::Inspectron() : TextView("Inspectron") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool Inspectron::msgGame(const GameMessage &msg) {
|
||||
if (msg._name != "DISPLAY")
|
||||
return false;
|
||||
|
||||
g_globals->_currCharacter = &g_globals->_party[0];
|
||||
_canAccept = !g_globals->_currCharacter->_quest;
|
||||
|
||||
if (_canAccept) {
|
||||
// Open the view for display
|
||||
Sound::sound(SOUND_2);
|
||||
addView();
|
||||
|
||||
} else {
|
||||
// There's an active quest, so any result will simply be
|
||||
// displayed as a game message
|
||||
MM1::Maps::Map35 &map = *static_cast<MM1::Maps::Map35 *>(g_maps->_currentMap);
|
||||
int questNum = g_globals->_party[0]._quest;
|
||||
Common::String line;
|
||||
|
||||
if (questNum >= 8 && questNum <= 14)
|
||||
line = map.checkQuestComplete();
|
||||
else
|
||||
line = STRING["maps.map35.inspectron4"];
|
||||
|
||||
g_maps->_mapPos.y++;
|
||||
map.redrawGame();
|
||||
|
||||
send(SoundMessage(
|
||||
0, 1, STRING["maps.map35.inspectron1"],
|
||||
0, 2, line
|
||||
));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Inspectron::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map35.inspectron1"]);
|
||||
writeString(0, 2, STRING["maps.map35.inspectron2"]);
|
||||
}
|
||||
|
||||
bool Inspectron::msgKeypress(const KeypressMessage &msg) {
|
||||
MM1::Maps::Map35 &map = *static_cast<MM1::Maps::Map35 *>(g_maps->_currentMap);
|
||||
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
map.acceptQuest();
|
||||
close();
|
||||
|
||||
send(InfoMessage(
|
||||
0, 1, STRING["maps.map35.inspectron1"],
|
||||
0, 2, STRING[Common::String::format(
|
||||
"maps.map35.quests.%d",
|
||||
g_globals->_party[0]._quest - 8
|
||||
)]
|
||||
));
|
||||
|
||||
} else if (msg.keycode == Common::KEYCODE_n) {
|
||||
close();
|
||||
map.redrawGame();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
49
engines/mm/mm1/views/interactions/inspectron.h
Normal file
49
engines/mm/mm1/views/interactions/inspectron.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_INSPECTRON_H
|
||||
#define MM1_VIEWS_MAPS_INSPECTRON_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Inspectron : public TextView {
|
||||
private:
|
||||
bool _canAccept;
|
||||
public:
|
||||
Inspectron();
|
||||
virtual ~Inspectron() {}
|
||||
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
88
engines/mm/mm1/views/interactions/keeper.cpp
Normal file
88
engines/mm/mm1/views/interactions/keeper.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/keeper.h"
|
||||
#include "mm/mm1/maps/map54.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Keeper::Keeper() : TextView("Keeper") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool Keeper::msgFocus(const FocusMessage &msg) {
|
||||
_pageNum = 0;
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
void Keeper::draw() {
|
||||
MM1::Maps::Map54 &map = *static_cast<MM1::Maps::Map54 *>(g_maps->_currentMap);
|
||||
uint32 perfTotal;
|
||||
bool isWorthy;
|
||||
|
||||
switch (_pageNum) {
|
||||
case 0:
|
||||
_bounds = getLineBounds(20, 24);
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map54.keeper1"]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
_bounds = getLineBounds(0, 24);
|
||||
isWorthy = map.isWorthy(perfTotal);
|
||||
|
||||
clearSurface();
|
||||
writeString(10, 0, STRING["maps.map54.keeper2"]);
|
||||
writeString(0, 2, Common::String::format(
|
||||
STRING["maps.map54.keeper3"].c_str(), perfTotal));
|
||||
writeString(0, 3, STRING[isWorthy ? "maps.map54.keeper5" :
|
||||
"maps.map54.keeper4"]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool Keeper::msgKeypress(const KeypressMessage &msg) {
|
||||
MM1::Maps::Map54 &map = *static_cast<MM1::Maps::Map54 *>(g_maps->_currentMap);
|
||||
|
||||
if (++_pageNum == 2) {
|
||||
close();
|
||||
map.sorpigalInn();
|
||||
} else {
|
||||
redraw();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
49
engines/mm/mm1/views/interactions/keeper.h
Normal file
49
engines/mm/mm1/views/interactions/keeper.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_KEEPER_H
|
||||
#define MM1_VIEWS_MAPS_KEEPER_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Keeper : public TextView {
|
||||
private:
|
||||
int _pageNum = 0;
|
||||
public:
|
||||
Keeper();
|
||||
virtual ~Keeper() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
67
engines/mm/mm1/views/interactions/leprechaun.cpp
Normal file
67
engines/mm/mm1/views/interactions/leprechaun.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/leprechaun.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Leprechaun::Leprechaun() : TextView("Leprechaun") {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
bool Leprechaun::msgFocus(const FocusMessage &msg) {
|
||||
TextView::msgFocus(msg);
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Leprechaun::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map00.leprechaun"]);
|
||||
}
|
||||
|
||||
bool Leprechaun::msgKeypress(const KeypressMessage &msg) {
|
||||
if (msg.keycode >= Common::KEYCODE_1 && msg.keycode <= Common::KEYCODE_5) {
|
||||
teleportToTown(msg.ascii);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Leprechaun::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
close();
|
||||
g_maps->turnAround();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
52
engines/mm/mm1/views/interactions/leprechaun.h
Normal file
52
engines/mm/mm1/views/interactions/leprechaun.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_LEPRECHAUN_H
|
||||
#define MM1_VIEWS_MAPS_LEPRECHAUN_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
#include "mm/mm1/game/leprechaun.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Leprechaun : public TextView, public MM1::Game::Leprechaun {
|
||||
private:
|
||||
void surrender(int numYears = 2);
|
||||
|
||||
public:
|
||||
Leprechaun();
|
||||
virtual ~Leprechaun() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
52
engines/mm/mm1/views/interactions/lion.cpp
Normal file
52
engines/mm/mm1/views/interactions/lion.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/lion.h"
|
||||
#include "mm/mm1/maps/map32.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
#define PASSWORD_INDEX 393
|
||||
|
||||
Lion::Lion() : AnswerEntry("Lion", Common::Point(11, 2), 10) {
|
||||
}
|
||||
|
||||
void Lion::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map32.statue"]);
|
||||
AnswerEntry::draw();
|
||||
}
|
||||
|
||||
void Lion::answerEntered() {
|
||||
MM1::Maps::Map32 &map = *static_cast<MM1::Maps::Map32 *>(g_maps->_currentMap);
|
||||
close();
|
||||
map.passwordEntered(_answer);
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
48
engines/mm/mm1/views/interactions/lion.h
Normal file
48
engines/mm/mm1/views/interactions/lion.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_LION_H
|
||||
#define MM1_VIEWS_MAPS_LION_H
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Lion : public AnswerEntry {
|
||||
protected:
|
||||
void answerEntered() override;
|
||||
|
||||
public:
|
||||
Lion();
|
||||
virtual ~Lion() {}
|
||||
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
64
engines/mm/mm1/views/interactions/lord_archer.cpp
Normal file
64
engines/mm/mm1/views/interactions/lord_archer.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/lord_archer.h"
|
||||
#include "mm/mm1/maps/map40.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
LordArcher::LordArcher() : TextView("LordArcher") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool LordArcher::msgFocus(const FocusMessage &msg) {
|
||||
Sound::sound(SOUND_3);
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
void LordArcher::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map40.archer"]);
|
||||
}
|
||||
|
||||
bool LordArcher::msgKeypress(const KeypressMessage &msg) {
|
||||
if (msg.keycode == Common::KEYCODE_y || msg.keycode == Common::KEYCODE_n) {
|
||||
MM1::Maps::Map40 &map = *static_cast<MM1::Maps::Map40 *>(g_maps->_currentMap);
|
||||
close();
|
||||
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
map.archerSubmit();
|
||||
} else {
|
||||
map.archerResist();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
47
engines/mm/mm1/views/interactions/lord_archer.h
Normal file
47
engines/mm/mm1/views/interactions/lord_archer.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_LORD_ARCHER_H
|
||||
#define MM1_VIEWS_MAPS_LORD_ARCHER_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class LordArcher : public TextView {
|
||||
public:
|
||||
LordArcher();
|
||||
virtual ~LordArcher() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
100
engines/mm/mm1/views/interactions/lord_ironfist.cpp
Normal file
100
engines/mm/mm1/views/interactions/lord_ironfist.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/lord_ironfist.h"
|
||||
#include "mm/mm1/maps/map43.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
LordIronfist::LordIronfist() : TextView("LordIronfist") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool LordIronfist::msgFocus(const FocusMessage &msg) {
|
||||
g_globals->_currCharacter = &g_globals->_party[0];
|
||||
_canAccept = !g_globals->_currCharacter->_quest;
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
void LordIronfist::draw() {
|
||||
MM1::Maps::Map43 &map = *static_cast<MM1::Maps::Map43 *>(g_maps->_currentMap);
|
||||
clearSurface();
|
||||
|
||||
if (_canAccept) {
|
||||
Sound::sound2(SOUND_2);
|
||||
writeString(0, 1, STRING["maps.map43.ironfist1"]);
|
||||
writeString(0, 2, STRING["maps.map43.ironfist2"]);
|
||||
|
||||
} else {
|
||||
int questNum = g_globals->_party[0]._quest;
|
||||
Common::String line;
|
||||
|
||||
if (questNum < 8)
|
||||
line = map.checkQuestComplete();
|
||||
else
|
||||
line = STRING["maps.map43.ironfist4"];
|
||||
|
||||
g_maps->_mapPos.x++;
|
||||
map.redrawGame();
|
||||
|
||||
clearSurface();
|
||||
send(SoundMessage(
|
||||
0, 1, STRING["maps.map43.ironfist1"],
|
||||
0, 2, line
|
||||
));
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
bool LordIronfist::msgKeypress(const KeypressMessage &msg) {
|
||||
MM1::Maps::Map43 &map = *static_cast<MM1::Maps::Map43 *>(g_maps->_currentMap);
|
||||
|
||||
if (_canAccept) {
|
||||
if (msg.keycode == Common::KEYCODE_y) {
|
||||
close();
|
||||
map.acceptQuest();
|
||||
|
||||
send(InfoMessage(
|
||||
0, 1, STRING["maps.map43.ironfist1"],
|
||||
0, 2, STRING[Common::String::format(
|
||||
"maps.map43.quests.%d",
|
||||
g_globals->_party[0]._quest)]
|
||||
));
|
||||
|
||||
} else if (msg.keycode == Common::KEYCODE_n) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
49
engines/mm/mm1/views/interactions/lord_ironfist.h
Normal file
49
engines/mm/mm1/views/interactions/lord_ironfist.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_LORD_IRONFIST_H
|
||||
#define MM1_VIEWS_MAPS_LORD_IRONFIST_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class LordIronfist : public TextView {
|
||||
private:
|
||||
bool _canAccept;
|
||||
public:
|
||||
LordIronfist();
|
||||
virtual ~LordIronfist() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
52
engines/mm/mm1/views/interactions/orango.cpp
Normal file
52
engines/mm/mm1/views/interactions/orango.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/orango.h"
|
||||
#include "mm/mm1/maps/map48.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Orango::Orango() :
|
||||
AnswerEntry("Orango", Common::Point(9, 7), 15) {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
void Orango::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map48.orango1"]);
|
||||
AnswerEntry::draw();
|
||||
}
|
||||
|
||||
void Orango::answerEntered() {
|
||||
MM1::Maps::Map48 &map = *static_cast<MM1::Maps::Map48 *>(g_maps->_currentMap);
|
||||
close();
|
||||
map.orangoAnswer(_answer);
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
48
engines/mm/mm1/views/interactions/orango.h
Normal file
48
engines/mm/mm1/views/interactions/orango.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_ORANGO_H
|
||||
#define MM1_VIEWS_MAPS_ORANGO_H
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Orango : public AnswerEntry {
|
||||
protected:
|
||||
void answerEntered() override;
|
||||
|
||||
public:
|
||||
Orango();
|
||||
virtual ~Orango() {}
|
||||
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
183
engines/mm/mm1/views/interactions/prisoners.cpp
Normal file
183
engines/mm/mm1/views/interactions/prisoners.cpp
Normal 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/views/interactions/prisoners.h"
|
||||
#include "mm/mm1/maps/map11.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Prisoner::Prisoner(const Common::String &name, const Common::String &line1,
|
||||
byte flag, Alignment freeAlignment, Alignment leaveAlignment) :
|
||||
TextView(name), _line1(line1), _flag(flag),
|
||||
_freeAlignment(freeAlignment), _leaveAlignment(leaveAlignment) {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
void Prisoner::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 0, _line1);
|
||||
writeString(0, 3, STRING["maps.prisoners.options1"]);
|
||||
_textPos.x = 10;
|
||||
writeString(STRING["maps.prisoners.options2"]);
|
||||
_textPos.x = 10;
|
||||
writeString(STRING["maps.prisoners.options3"]);
|
||||
}
|
||||
|
||||
bool Prisoner::msgKeypress(const KeypressMessage &msg) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
if (msg.keycode < Common::KEYCODE_1 || msg.keycode > Common::KEYCODE_3)
|
||||
return true;
|
||||
|
||||
Common::String line;
|
||||
int align;
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_1:
|
||||
line = STRING["maps.prisoners.flees"];
|
||||
align = _freeAlignment;
|
||||
g_maps->clearSpecial();
|
||||
flee();
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_2:
|
||||
line = STRING["maps.prisoners.cowers"];
|
||||
align = _leaveAlignment;
|
||||
break;
|
||||
|
||||
default:
|
||||
align = NEUTRAL;
|
||||
break;
|
||||
}
|
||||
|
||||
for (uint i = 0; i < g_globals->_party.size(); ++i) {
|
||||
Character &c = g_globals->_party[i];
|
||||
|
||||
if (!(c._flags[1] & _flag)) {
|
||||
c._flags[1] |= _flag;
|
||||
if (align == c._alignment)
|
||||
c._worthiness += 32;
|
||||
}
|
||||
}
|
||||
|
||||
if (align != NEUTRAL) {
|
||||
clearSurface();
|
||||
writeString(0, 1, line);
|
||||
Sound::sound(SOUND_2);
|
||||
delaySeconds(3);
|
||||
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Prisoner::timeout() {
|
||||
close();
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
ChildPrisoner::ChildPrisoner() :
|
||||
Prisoner("ChildPrisoner", STRING["maps.prisoners.child"],
|
||||
CHARFLAG1_4, GOOD, EVIL) {
|
||||
}
|
||||
|
||||
ManPrisoner::ManPrisoner() :
|
||||
Prisoner("ManPrisoner", STRING["maps.prisoners.man"],
|
||||
CHARFLAG1_20, EVIL, GOOD) {
|
||||
}
|
||||
|
||||
CloakedPrisoner::CloakedPrisoner() :
|
||||
Prisoner("CloakedPrisoner", STRING["maps.prisoners.cloaked"],
|
||||
CHARFLAG1_40, EVIL, GOOD) {
|
||||
}
|
||||
|
||||
DemonPrisoner::DemonPrisoner() :
|
||||
Prisoner("DemonPrisoner", STRING["maps.prisoners.demon"],
|
||||
CHARFLAG1_10, EVIL, GOOD) {
|
||||
}
|
||||
|
||||
MutatedPrisoner::MutatedPrisoner() :
|
||||
Prisoner("MutatedPrisoner", STRING["maps.prisoners.mutated"],
|
||||
CHARFLAG1_2, GOOD, EVIL) {
|
||||
}
|
||||
|
||||
MaidenPrisoner::MaidenPrisoner() :
|
||||
Prisoner("MaidenPrisoner", STRING["maps.prisoners.maiden"],
|
||||
CHARFLAG1_8, GOOD, EVIL) {
|
||||
}
|
||||
|
||||
void MaidenPrisoner::flee() {
|
||||
MM1::Maps::Map &map = *g_maps->_currentMap;
|
||||
map._walls[48] &= 0x7f;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
VirginPrisoner::VirginPrisoner() : TextView("VirginPrisoner") {
|
||||
setBounds(getLineBounds(20, 24));
|
||||
}
|
||||
|
||||
void VirginPrisoner::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map11.virgin"]);
|
||||
}
|
||||
|
||||
bool VirginPrisoner::msgKeypress(const KeypressMessage &msg) {
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_a:
|
||||
g_events->close();
|
||||
g_events->send(SoundMessage(STRING["maps.map11.tip1"]));
|
||||
break;
|
||||
case Common::KEYCODE_b:
|
||||
g_events->close();
|
||||
static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap)->challenge();
|
||||
break;
|
||||
case Common::KEYCODE_c:
|
||||
g_events->close();
|
||||
break;
|
||||
default:
|
||||
return TextView::msgKeypress(msg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VirginPrisoner::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
g_events->close();
|
||||
return true;
|
||||
} else {
|
||||
return TextView::msgAction(msg);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
108
engines/mm/mm1/views/interactions/prisoners.h
Normal file
108
engines/mm/mm1/views/interactions/prisoners.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_PRISONERS_H
|
||||
#define MM1_VIEWS_MAPS_PRISONERS_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
#include "mm/mm1/data/character.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Prisoner : public TextView {
|
||||
private:
|
||||
Common::String _line1;
|
||||
byte _flag;
|
||||
Alignment _freeAlignment;
|
||||
Alignment _leaveAlignment;
|
||||
protected:
|
||||
virtual void flee() {}
|
||||
public:
|
||||
Prisoner(const Common::String &name, const Common::String &line1,
|
||||
byte flag, Alignment freeAlignment, Alignment leaveAlignment);
|
||||
virtual ~Prisoner() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
void timeout() override;
|
||||
};
|
||||
|
||||
class ChildPrisoner : public Prisoner {
|
||||
public:
|
||||
ChildPrisoner();
|
||||
virtual ~ChildPrisoner() {}
|
||||
};
|
||||
|
||||
class ManPrisoner : public Prisoner {
|
||||
public:
|
||||
ManPrisoner();
|
||||
virtual ~ManPrisoner() {}
|
||||
};
|
||||
|
||||
class CloakedPrisoner : public Prisoner {
|
||||
public:
|
||||
CloakedPrisoner();
|
||||
virtual ~CloakedPrisoner() {
|
||||
}
|
||||
};
|
||||
|
||||
class DemonPrisoner : public Prisoner {
|
||||
public:
|
||||
DemonPrisoner();
|
||||
virtual ~DemonPrisoner() {
|
||||
}
|
||||
};
|
||||
|
||||
class MutatedPrisoner : public Prisoner {
|
||||
public:
|
||||
MutatedPrisoner();
|
||||
virtual ~MutatedPrisoner() {
|
||||
}
|
||||
};
|
||||
|
||||
class MaidenPrisoner : public Prisoner {
|
||||
protected:
|
||||
void flee() override;
|
||||
public:
|
||||
MaidenPrisoner();
|
||||
virtual ~MaidenPrisoner() {
|
||||
}
|
||||
};
|
||||
|
||||
class VirginPrisoner : public TextView {
|
||||
public:
|
||||
VirginPrisoner();
|
||||
virtual ~VirginPrisoner() {
|
||||
}
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
105
engines/mm/mm1/views/interactions/resistances.cpp
Normal file
105
engines/mm/mm1/views/interactions/resistances.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/resistances.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Resistances::Resistances() : TextView("Resistances") {
|
||||
_bounds = getLineBounds(20, 24);
|
||||
}
|
||||
|
||||
bool Resistances::msgFocus(const FocusMessage &msg) {
|
||||
_charSelected = false;
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
|
||||
return TextView::msgFocus(msg);
|
||||
}
|
||||
|
||||
bool Resistances::msgUnfocus(const UnfocusMessage &msg) {
|
||||
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
|
||||
return TextView::msgUnfocus(msg);
|
||||
}
|
||||
|
||||
void Resistances::draw() {
|
||||
clearSurface();
|
||||
Sound::sound(SOUND_2);
|
||||
|
||||
if (!_charSelected) {
|
||||
writeString(0, 1, STRING["maps.map02.morango"]);
|
||||
|
||||
} else {
|
||||
Character &c = *g_globals->_currCharacter;
|
||||
writeString(0, 1, STRING["maps.map02.resistances1"]);
|
||||
writeString(c._name);
|
||||
newLine();
|
||||
writeString(0, 1, STRING["maps.map02.resistances2"]);
|
||||
|
||||
writeNumber(6, 1, c._resistances._s._magic);
|
||||
writeNumber(15, 1, c._resistances._s._fire);
|
||||
writeNumber(26, 1, c._resistances._s._cold);
|
||||
writeNumber(36, 1, c._resistances._s._electricity);
|
||||
writeNumber(6, 2, c._resistances._s._acid);
|
||||
writeNumber(15, 2, c._resistances._s._fear);
|
||||
writeNumber(26, 2, c._resistances._s._poison);
|
||||
writeNumber(36, 2, c._resistances._s._psychic);
|
||||
}
|
||||
}
|
||||
|
||||
bool Resistances::msgKeypress(const KeypressMessage &msg) {
|
||||
if (_charSelected)
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Resistances::msgMouseDown(const MouseDownMessage &msg) {
|
||||
if (_charSelected)
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Resistances::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
close();
|
||||
|
||||
} else if (!_charSelected &&
|
||||
msg._action >= KEYBIND_VIEW_PARTY1 &&
|
||||
msg._action <= KEYBIND_VIEW_PARTY6) {
|
||||
uint charIndex = (int)(msg._action - KEYBIND_VIEW_PARTY1);
|
||||
if (charIndex < g_globals->_party.size()) {
|
||||
_charSelected = true;
|
||||
g_globals->_currCharacter = &g_globals->_party[charIndex];
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Spells
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
52
engines/mm/mm1/views/interactions/resistances.h
Normal file
52
engines/mm/mm1/views/interactions/resistances.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_RESISTANCES_H
|
||||
#define MM1_VIEWS_MAPS_RESISTANCES_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Resistances : public TextView {
|
||||
private:
|
||||
bool _charSelected = false;
|
||||
public:
|
||||
Resistances();
|
||||
virtual ~Resistances() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgMouseDown(const MouseDownMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
51
engines/mm/mm1/views/interactions/ruby.cpp
Normal file
51
engines/mm/mm1/views/interactions/ruby.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/ruby.h"
|
||||
#include "mm/mm1/maps/map39.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Ruby::Ruby() : AnswerEntry("Ruby", Common::Point(14, 7), 12) {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
void Ruby::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, STRING["maps.map39.ruby1"]);
|
||||
AnswerEntry::draw();
|
||||
}
|
||||
|
||||
void Ruby::answerEntered() {
|
||||
MM1::Maps::Map39 &map = *static_cast<MM1::Maps::Map39 *>(g_maps->_currentMap);
|
||||
close();
|
||||
map.riddleAnswered(_answer);
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
48
engines/mm/mm1/views/interactions/ruby.h
Normal file
48
engines/mm/mm1/views/interactions/ruby.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_RUBY_H
|
||||
#define MM1_VIEWS_MAPS_RUBY_H
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Ruby : public AnswerEntry {
|
||||
protected:
|
||||
void answerEntered() override;
|
||||
|
||||
public:
|
||||
Ruby();
|
||||
virtual ~Ruby() {}
|
||||
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
76
engines/mm/mm1/views/interactions/trivia.cpp
Normal file
76
engines/mm/mm1/views/interactions/trivia.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/trivia.h"
|
||||
#include "mm/mm1/maps/map21.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
Trivia::Trivia() :
|
||||
AnswerEntry("Trivia", Common::Point(9, 7), 14) {
|
||||
_bounds = getLineBounds(17, 24);
|
||||
}
|
||||
|
||||
bool Trivia::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "TRIVIA") {
|
||||
_question = STRING[Common::String::format(
|
||||
"maps.map21.questions.%d", msg._value)];
|
||||
_correctAnswer = STRING[Common::String::format(
|
||||
"maps.map21.answers.%d", msg._value)];
|
||||
|
||||
open();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Trivia::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 1, _question);
|
||||
writeString(0, 7, STRING["maps.map21.answer"]);
|
||||
AnswerEntry::draw();
|
||||
}
|
||||
|
||||
void Trivia::answerEntered() {
|
||||
close();
|
||||
|
||||
if (_answer.equalsIgnoreCase(_correctAnswer)) {
|
||||
send(InfoMessage(STRING["maps.map21.correct"]));
|
||||
g_globals->_party[0]._gems += 50;
|
||||
Sound::sound(SOUND_3);
|
||||
|
||||
} else {
|
||||
g_maps->_mapPos.x = 15;
|
||||
g_events->send("Game", GameMessage("UPDATE"));
|
||||
send(InfoMessage(STRING["maps.map21.incorrect"]));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
51
engines/mm/mm1/views/interactions/trivia.h
Normal file
51
engines/mm/mm1/views/interactions/trivia.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_TRIVIA_H
|
||||
#define MM1_VIEWS_MAPS_TRIVIA_H
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class Trivia : public AnswerEntry {
|
||||
private:
|
||||
Common::String _question, _correctAnswer;
|
||||
protected:
|
||||
void answerEntered() override;
|
||||
|
||||
public:
|
||||
Trivia();
|
||||
virtual ~Trivia() {}
|
||||
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
108
engines/mm/mm1/views/interactions/volcano_god.cpp
Normal file
108
engines/mm/mm1/views/interactions/volcano_god.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/volcano_god.h"
|
||||
#include "mm/mm1/maps/map11.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
VolcanoGod::VolcanoGod() :
|
||||
AnswerEntry("VolcanoGod", Common::Point(9, 3), 8) {
|
||||
}
|
||||
|
||||
void VolcanoGod::draw() {
|
||||
clearSurface();
|
||||
|
||||
switch (_mode) {
|
||||
case CHOOSE_OPTION:
|
||||
writeString(0, 1, STRING["maps.map11.volcano_god"]);
|
||||
break;
|
||||
|
||||
case ENTER_RESPONSE:
|
||||
writeString(0, 1, STRING["maps.map11.question"]);
|
||||
AnswerEntry::draw();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool VolcanoGod::msgKeypress(const KeypressMessage &msg) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
switch (_mode) {
|
||||
case CHOOSE_OPTION:
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_a:
|
||||
challenge();
|
||||
break;
|
||||
case Common::KEYCODE_b:
|
||||
riddle();
|
||||
break;
|
||||
case Common::KEYCODE_c:
|
||||
clue();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ENTER_RESPONSE:
|
||||
return AnswerEntry::msgKeypress(msg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void VolcanoGod::challenge() {
|
||||
MM1::Maps::Map11 &map = *static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap);
|
||||
map.challenge();
|
||||
}
|
||||
|
||||
void VolcanoGod::riddle() {
|
||||
Sound::sound(SOUND_2);
|
||||
_mode = ENTER_RESPONSE;
|
||||
redraw();
|
||||
}
|
||||
|
||||
void VolcanoGod::clue() {
|
||||
MM1::Maps::Map11 &map = *static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap);
|
||||
close();
|
||||
map.clue();
|
||||
}
|
||||
|
||||
void VolcanoGod::answerEntered() {
|
||||
MM1::Maps::Map11 &map = *static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap);
|
||||
close();
|
||||
map.riddleAnswer(_answer);
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
57
engines/mm/mm1/views/interactions/volcano_god.h
Normal file
57
engines/mm/mm1/views/interactions/volcano_god.h
Normal 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_VIEWS_MAPS_VOLCANO_GOD_H
|
||||
#define MM1_VIEWS_MAPS_VOLCANO_GOD_H
|
||||
|
||||
#include "mm/mm1/views/interactions/answer_entry.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class VolcanoGod : public AnswerEntry {
|
||||
private:
|
||||
enum Mode { CHOOSE_OPTION, ENTER_RESPONSE };
|
||||
Mode _mode = CHOOSE_OPTION;
|
||||
|
||||
void challenge();
|
||||
void riddle();
|
||||
void clue();
|
||||
|
||||
protected:
|
||||
void answerEntered() override;
|
||||
|
||||
public:
|
||||
VolcanoGod();
|
||||
virtual ~VolcanoGod() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
57
engines/mm/mm1/views/interactions/won_game.cpp
Normal file
57
engines/mm/mm1/views/interactions/won_game.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/interactions/won_game.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
WonGame::WonGame() : TextView("WonGame") {
|
||||
Common::Rect r = getLineBounds(5, 11);
|
||||
r.right = 30 * 8;
|
||||
_bounds = r;
|
||||
}
|
||||
|
||||
void WonGame::draw() {
|
||||
clearSurface();
|
||||
writeString(0, 0, STRING["maps.map18.gates"]);
|
||||
writeString(0, 1, STRING["maps.map18.congratulations"]);
|
||||
Sound::sound(SOUND_3);
|
||||
}
|
||||
|
||||
bool WonGame::msgKeypress(const KeypressMessage &msg) {
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WonGame::msgAction(const ActionMessage &msg) {
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
47
engines/mm/mm1/views/interactions/won_game.h
Normal file
47
engines/mm/mm1/views/interactions/won_game.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_MAPS_WON_GAME_H
|
||||
#define MM1_VIEWS_MAPS_WON_GAME_H
|
||||
|
||||
#include "mm/mm1/views/text_view.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Interactions {
|
||||
|
||||
class WonGame : public TextView {
|
||||
public:
|
||||
WonGame();
|
||||
virtual ~WonGame() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
96
engines/mm/mm1/views/locations/blacksmith.cpp
Normal file
96
engines/mm/mm1/views/locations/blacksmith.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith.h"
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
Blacksmith::Blacksmith() : Location("Blacksmith") {
|
||||
}
|
||||
|
||||
bool Blacksmith::msgFocus(const FocusMessage &msg) {
|
||||
send("View", GameMessage("LOCATION", LOC_BLACKSMITH));
|
||||
changeCharacter(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Blacksmith::draw() {
|
||||
Location::draw();
|
||||
|
||||
writeString(22, 1, STRING["dialogs.blacksmith.a"]);
|
||||
writeString(22, 2, STRING["dialogs.blacksmith.b"]);
|
||||
writeString(22, 3, STRING["dialogs.blacksmith.c"]);
|
||||
writeString(22, 4, STRING["dialogs.blacksmith.d"]);
|
||||
}
|
||||
|
||||
bool Blacksmith::msgKeypress(const KeypressMessage &msg) {
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_1:
|
||||
case Common::KEYCODE_2:
|
||||
case Common::KEYCODE_3:
|
||||
case Common::KEYCODE_4:
|
||||
case Common::KEYCODE_5:
|
||||
case Common::KEYCODE_6:
|
||||
changeCharacter(msg.keycode - Common::KEYCODE_1);
|
||||
break;
|
||||
case Common::KEYCODE_a:
|
||||
_buyWeapons.addView();
|
||||
break;
|
||||
case Common::KEYCODE_b:
|
||||
_buyArmor.addView();
|
||||
break;
|
||||
case Common::KEYCODE_c:
|
||||
_buyMisc.addView();
|
||||
break;
|
||||
case Common::KEYCODE_d:
|
||||
_sellItem.addView();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Blacksmith::msgAction(const ActionMessage &msg) {
|
||||
if (endDelay())
|
||||
return true;
|
||||
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
leave();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
57
engines/mm/mm1/views/locations/blacksmith.h
Normal file
57
engines/mm/mm1/views/locations/blacksmith.h
Normal 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_VIEWS_LOCATIONS_BLACKSMITH_H
|
||||
#define MM1_VIEWS_LOCATIONS_BLACKSMITH_H
|
||||
|
||||
#include "mm/mm1/views/locations/location.h"
|
||||
#include "mm/mm1/views/locations/blacksmith_buy_weapons.h"
|
||||
#include "mm/mm1/views/locations/blacksmith_buy_armor.h"
|
||||
#include "mm/mm1/views/locations/blacksmith_buy_misc.h"
|
||||
#include "mm/mm1/views/locations/blacksmith_sell_item.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
class Blacksmith : public Location {
|
||||
private:
|
||||
BlacksmithBuyWeapons _buyWeapons;
|
||||
BlacksmithBuyArmor _buyArmor;
|
||||
BlacksmithBuyMisc _buyMisc;
|
||||
BlacksmithSellItem _sellItem;
|
||||
public:
|
||||
Blacksmith();
|
||||
virtual ~Blacksmith() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
57
engines/mm/mm1/views/locations/blacksmith_buy_armor.cpp
Normal file
57
engines/mm/mm1/views/locations/blacksmith_buy_armor.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_buy_armor.h"
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
BlacksmithBuyArmor::BlacksmithBuyArmor() :
|
||||
BlacksmithSubview("BlacksmithBuyArmor") {
|
||||
_modeString = STRING["dialogs.location.buy"];
|
||||
}
|
||||
|
||||
bool BlacksmithBuyArmor::msgFocus(const FocusMessage &msg) {
|
||||
int townNum = g_maps->_currentMap->dataByte(Maps::MAP_ID);
|
||||
if (townNum < 1 || townNum >= 6)
|
||||
townNum = 1;
|
||||
_items = ARMOR[townNum - 1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlacksmithBuyArmor::draw() {
|
||||
Location::draw();
|
||||
|
||||
writeString(23, 0, STRING["dialogs.blacksmith.armor"]);
|
||||
drawItems();
|
||||
}
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
47
engines/mm/mm1/views/locations/blacksmith_buy_armor.h
Normal file
47
engines/mm/mm1/views/locations/blacksmith_buy_armor.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_LOCATIONS_BLACKSMITH_BUY_ARMOR_H
|
||||
#define MM1_VIEWS_LOCATIONS_BLACKSMITH_BUY_ARMOR_H
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_subview.h"
|
||||
#include "mm/mm1/data/locations.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
class BlacksmithBuyArmor : public BlacksmithSubview, public BuyArmorData {
|
||||
public:
|
||||
BlacksmithBuyArmor();
|
||||
virtual ~BlacksmithBuyArmor() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
57
engines/mm/mm1/views/locations/blacksmith_buy_misc.cpp
Normal file
57
engines/mm/mm1/views/locations/blacksmith_buy_misc.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_buy_misc.h"
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
BlacksmithBuyMisc::BlacksmithBuyMisc() :
|
||||
BlacksmithSubview("BlacksmithBuyMisc") {
|
||||
_modeString = STRING["dialogs.location.buy"];
|
||||
}
|
||||
|
||||
bool BlacksmithBuyMisc::msgFocus(const FocusMessage &msg) {
|
||||
int townNum = g_maps->_currentMap->dataByte(Maps::MAP_ID);
|
||||
if (townNum < 1 || townNum >= 6)
|
||||
townNum = 1;
|
||||
_items = MISC[townNum - 1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlacksmithBuyMisc::draw() {
|
||||
Location::draw();
|
||||
|
||||
writeString(23, 0, STRING["dialogs.blacksmith.misc"]);
|
||||
drawItems();
|
||||
}
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
47
engines/mm/mm1/views/locations/blacksmith_buy_misc.h
Normal file
47
engines/mm/mm1/views/locations/blacksmith_buy_misc.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_LOCATIONS_BLACKSMITH_BUY_MISC_H
|
||||
#define MM1_VIEWS_LOCATIONS_BLACKSMITH_BUY_MISC_H
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_subview.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
class BlacksmithBuyMisc : public BlacksmithSubview,
|
||||
public BuyMiscData {
|
||||
public:
|
||||
BlacksmithBuyMisc();
|
||||
virtual ~BlacksmithBuyMisc() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
57
engines/mm/mm1/views/locations/blacksmith_buy_weapons.cpp
Normal file
57
engines/mm/mm1/views/locations/blacksmith_buy_weapons.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_buy_weapons.h"
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
BlacksmithBuyWeapons::BlacksmithBuyWeapons() :
|
||||
BlacksmithSubview("BlacksmithBuyWeapons") {
|
||||
_modeString = STRING["dialogs.location.buy"];
|
||||
}
|
||||
|
||||
bool BlacksmithBuyWeapons::msgFocus(const FocusMessage &msg) {
|
||||
int townNum = g_maps->_currentMap->dataByte(Maps::MAP_ID);
|
||||
if (townNum < 1 || townNum >= 6)
|
||||
townNum = 1;
|
||||
_items = WEAPONS[townNum - 1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlacksmithBuyWeapons::draw() {
|
||||
Location::draw();
|
||||
|
||||
writeString(23, 0, STRING["dialogs.blacksmith.weapons"]);
|
||||
drawItems();
|
||||
}
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
47
engines/mm/mm1/views/locations/blacksmith_buy_weapons.h
Normal file
47
engines/mm/mm1/views/locations/blacksmith_buy_weapons.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_LOCATIONS_BLACKSMITH_BUY_WEAPONS_H
|
||||
#define MM1_VIEWS_LOCATIONS_BLACKSMITH_BUY_WEAPONS_H
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_subview.h"
|
||||
#include "mm/mm1/data/locations.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
class BlacksmithBuyWeapons : public BlacksmithSubview, public BuyWeaponData {
|
||||
public:
|
||||
BlacksmithBuyWeapons();
|
||||
virtual ~BlacksmithBuyWeapons() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
74
engines/mm/mm1/views/locations/blacksmith_sell_item.cpp
Normal file
74
engines/mm/mm1/views/locations/blacksmith_sell_item.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_sell_item.h"
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
BlacksmithSellItem::BlacksmithSellItem() :
|
||||
BlacksmithSubview("BlacksmithSellItem") {
|
||||
_modeString = STRING["dialogs.location.sell"];
|
||||
}
|
||||
|
||||
void BlacksmithSellItem::draw() {
|
||||
Location::draw();
|
||||
|
||||
writeString(22, 0, STRING["dialogs.blacksmith.backpack"]);
|
||||
drawItems();
|
||||
}
|
||||
|
||||
void BlacksmithSellItem::drawItems() {
|
||||
const Inventory &inv = g_globals->_currCharacter->_backpack;
|
||||
|
||||
for (uint idx = 0; idx < INVENTORY_COUNT; ++idx) {
|
||||
writeChar(17, 1 + idx, 'A' + idx);
|
||||
writeString(") ");
|
||||
|
||||
if (idx < inv.size()) {
|
||||
g_globals->_items.getItem(inv[idx]._id);
|
||||
writeString(g_globals->_currItem._name);
|
||||
_textPos.x = 35;
|
||||
writeNumber(g_globals->_currItem.getSellCost());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BlacksmithSellItem::selectItem(uint index) {
|
||||
Character &c = *g_globals->_currCharacter;
|
||||
Inventory &inv = c._backpack;
|
||||
assert(index < inv.size());
|
||||
g_globals->_items.getItem(inv[index]._id);
|
||||
|
||||
c._gold += g_globals->_currItem.getSellCost();
|
||||
inv.removeAt(index);
|
||||
}
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
53
engines/mm/mm1/views/locations/blacksmith_sell_item.h
Normal file
53
engines/mm/mm1/views/locations/blacksmith_sell_item.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_LOCATIONS_BLACKSMITH_SELL_ITEM_H
|
||||
#define MM1_VIEWS_LOCATIONS_BLACKSMITH_SELL_ITEM_H
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_subview.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
class BlacksmithSellItem : public BlacksmithSubview {
|
||||
private:
|
||||
void drawItems();
|
||||
protected:
|
||||
/**
|
||||
* Selects an item from the list
|
||||
*/
|
||||
void selectItem(uint index) override;
|
||||
|
||||
public:
|
||||
BlacksmithSellItem();
|
||||
virtual ~BlacksmithSellItem() {}
|
||||
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
||||
105
engines/mm/mm1/views/locations/blacksmith_subview.cpp
Normal file
105
engines/mm/mm1/views/locations/blacksmith_subview.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mm/mm1/views/locations/blacksmith_subview.h"
|
||||
#include "mm/mm1/events.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace Views {
|
||||
namespace Locations {
|
||||
|
||||
void BlacksmithSubview::drawItems() {
|
||||
for (int idx = 0; idx < INVENTORY_COUNT; ++idx) {
|
||||
writeChar(17, 1 + idx, 'A' + idx);
|
||||
writeString(") ");
|
||||
|
||||
g_globals->_items.getItem(_items[idx]);
|
||||
drawIsAllowed();
|
||||
writeString(g_globals->_currItem._name);
|
||||
_textPos.x = 35;
|
||||
writeNumber(g_globals->_currItem._cost);
|
||||
}
|
||||
}
|
||||
|
||||
void BlacksmithSubview::drawIsAllowed() {
|
||||
Character &c = *g_globals->_currCharacter;
|
||||
|
||||
if (c._class != NONE && c._class <= ROBBER) {
|
||||
if (!(BLACKSMITH_CLASS_USAGE[c._class - 1] &
|
||||
g_globals->_currItem._disablements))
|
||||
return;
|
||||
}
|
||||
|
||||
_textPos.x--;
|
||||
writeChar('-');
|
||||
}
|
||||
|
||||
bool BlacksmithSubview::msgKeypress(const KeypressMessage &msg) {
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_a:
|
||||
case Common::KEYCODE_b:
|
||||
case Common::KEYCODE_c:
|
||||
case Common::KEYCODE_d:
|
||||
case Common::KEYCODE_e:
|
||||
case Common::KEYCODE_f:
|
||||
selectItem(msg.keycode - Common::KEYCODE_a);
|
||||
draw();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BlacksmithSubview::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void BlacksmithSubview::selectItem(uint index) {
|
||||
switch (g_globals->_currCharacter->buyItem(
|
||||
_items[index])) {
|
||||
case Character::BUY_BACKPACK_FULL:
|
||||
backpackFull();
|
||||
break;
|
||||
case Character::BUY_NOT_ENOUGH_GOLD:
|
||||
notEnoughGold();
|
||||
break;
|
||||
default:
|
||||
// Purchased successfully
|
||||
displayMessage(15, STRING["dialogs.blacksmith.thankyou"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Locations
|
||||
} // namespace Views
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user