MM: MM1: Beginnings of enhanced mode

This commit is contained in:
Paul Gilbert 2022-06-01 19:29:13 -07:00 committed by Eugene Sandulenko
parent 5012806724
commit ffef7976f2
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
11 changed files with 241 additions and 5 deletions

View File

@ -27,6 +27,7 @@
static const PlainGameDescriptor MIGHT_AND_MAGIC_GAMES[] = {
{ "mm1", "Might and Magic: Book One - Secret of the Inner Sanctum"},
{ "mm1_enh", "Might and Magic: Book One - Secret of the Inner Sanctum - Enhanced"},
{ "cloudsofxeen", "Might and Magic IV: Clouds of Xeen" },
{ "darksideofxeen", "Might and Magic V: Darkside of Xeen" },
{ "worldofxeen", "Might and Magic: World of Xeen" },

View File

@ -34,6 +34,11 @@ enum {
GType_Swords
};
enum GameFeature {
GF_NONE = 0,
GF_ENHANCED = 1
};
struct MightAndMagicGameDescription {
ADGameDescription desc;

View File

@ -37,6 +37,20 @@ static const MightAndMagicGameDescription GAME_DESCRIPTIONS[] = {
0
},
{
// Might and Magic 1 (Enhanced)
{
"mm1_enh",
nullptr,
AD_ENTRY1s("wallpix.dta", "86a7ef03fd5bf434d83012b07fa92680", 123059),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_UNSTABLE,
GUIO0()
},
GType_MightAndMagic1,
GF_ENHANCED
},
{
// World of Xeen

View File

@ -25,6 +25,7 @@
#include "mm/mm1/mm1.h"
#include "mm/mm1/gfx/gfx.h"
#include "mm/mm1/views/dialogs.h"
#include "mm/mm1/views_enh/dialogs.h"
namespace MM {
namespace MM1 {
@ -34,7 +35,8 @@ namespace MM1 {
Events *g_events;
Events::Events() : UIElement("", nullptr) {
Events::Events(bool enhancedMode) : UIElement("", nullptr),
_enhancedMode(enhancedMode) {
g_events = this;
}
@ -43,8 +45,9 @@ Events::~Events() {
}
void Events::runGame() {
Views::Dialogs dialogsContainer; // Load up all the dialogs
UIElement *allViews = _enhancedMode ?
(UIElement *)new ViewsEnh::Dialogs() :
(UIElement *)new Views::Dialogs();
uint currTime, nextFrameTime = 0;
_screen = new Graphics::Screen();
@ -71,6 +74,7 @@ void Events::runGame() {
}
delete _screen;
delete allViews;
}
void Events::processEvent(Common::Event &ev) {

View File

@ -152,13 +152,14 @@ class Events : public UIElement {
private:
Graphics::Screen *_screen = nullptr;
Common::Stack<UIElement *> _views;
bool _enhancedMode;
protected:
/**
* Process an event
*/
void processEvent(Common::Event &ev);
public:
Events();
Events(bool enhancedMode);
virtual ~Events();
/**

View File

@ -34,7 +34,8 @@ namespace MM1 {
MM1Engine *g_engine = nullptr;
MM1Engine::MM1Engine(OSystem *syst, const MightAndMagicGameDescription *gameDesc)
: Engine(syst), _gameDescription(gameDesc), _randomSource("MM1") {
: Engine(syst), Events(gameDesc->features & GF_ENHANCED),
_gameDescription(gameDesc), _randomSource("MM1") {
g_engine = this;
}

View 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

View File

@ -0,0 +1,62 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MM1_VIEWS_ENH_DIALOGS_H
#define MM1_VIEWS_ENH_DIALOGS_H
#include "mm/mm1/events.h"
#include "mm/mm1/views/are_you_ready.h"
#include "mm/mm1/views/create_characters.h"
#include "mm/mm1/views/inn.h"
#include "mm/mm1/views/main_menu.h"
#include "mm/mm1/views/protect.h"
#include "mm/mm1/views/quick_ref.h"
#include "mm/mm1/views/title.h"
#include "mm/mm1/views/view_characters.h"
#include "mm/mm1/views_enh/game.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
struct Dialogs {
private:
ViewsEnh::Game _game;
// Unenhanced views
Views::AreYouReady _areYouReady;
Views::CreateCharacters _createCharacters;
Views::Inn _inn;
Views::MainMenu _mainMenu;
Views::Protect _protect;
Views::QuickRef _quickRef;
Views::Title _title;
Views::ViewCharacters _viewCharacters;
Views::ViewCharacter _viewCharacter;
public:
Dialogs() {}
};
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
#endif

View File

@ -0,0 +1,65 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "mm/mm1/views_enh/game.h"
#include "mm/mm1/globals.h"
#include "mm/mm1/meta_engine.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
Game::Game() : TextView("Game"),
_view(this) {
}
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 true;
}
void Game::draw() {
if (_needsRedraw)
clearSurface();
UIElement::draw();
}
bool Game::msgKeypress(const KeypressMessage &msg) {
return true;
}
bool Game::msgGame(const GameMessage &msg) {
if (msg._name == "DISPLAY") {
replaceView(this);
return true;
}
return TextView::msgGame(msg);
}
} // namespace Views
} // namespace MM1
} // namespace MM

View File

@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MM1_VIEWS_ENH_GAME_H
#define MM1_VIEWS_ENH_GAME_H
#include "mm/mm1/events.h"
#include "mm/mm1/views/game_view.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
class Game : public Views::TextView {
private:
Views::GameView _view;
public:
Game();
virtual ~Game() {}
bool msgFocus(const FocusMessage &msg) override;
bool msgUnfocus(const UnfocusMessage &msg) override;
void draw() override;
bool msgKeypress(const KeypressMessage &msg) override;
bool msgGame(const GameMessage &msg) override;
};
} // namespace Views
} // namespace MM1
} // namespace MM
#endif

View File

@ -31,6 +31,8 @@ MODULE_OBJS := \
mm1/views/title.o \
mm1/views/text_view.o \
mm1/views/view_characters.o \
mm1/views_enh/dialogs.o \
mm1/views_enh/game.o \
mm1/maps/maps.o \
mm1/maps/map.o \
mm1/maps/map00.o \