MADS: Added skeleton files for the game and dialogs

This commit is contained in:
Paul Gilbert 2014-02-19 23:17:57 -05:00
parent 7593ec29d0
commit 58bb1383d0
11 changed files with 222 additions and 11 deletions

View File

@ -22,6 +22,7 @@
#include "common/scummsys.h"
#include "common/events.h"
#include "engines/util.h"
#include "mads/mads.h"
#include "mads/events.h"
@ -31,4 +32,12 @@ EventsManager::EventsManager(MADSEngine *vm) {
_vm = vm;
}
void EventsManager::handleEvents() {
Common::Event e;
while (!_vm->shouldQuit()) {
g_system->getEventManager()->pollEvent(e);
g_system->delayMillis(10);
}
}
} // End of namespace MADS

View File

@ -35,7 +35,7 @@ private:
public:
EventsManager(MADSEngine *vm);
void handleEvents() { /* TODO */ }
void handleEvents();
};
} // End of namespace MADS

View File

@ -23,17 +23,29 @@
#include "common/scummsys.h"
#include "mads/mads.h"
#include "mads/game.h"
#include "mads/nebular/game_nebular.h"
#include "mads/graphics.h"
#include "mads/msurface.h"
namespace MADS {
Game *Game::init(MADSEngine *vm) {
return new Game(vm);
if (vm->getGameID() == GType_RexNebular)
return new Nebular::GameNebular(vm);
return nullptr;
}
Game::Game(MADSEngine *vm): _vm(vm), _surface(MSurface::init(
MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT)) {
Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr) {
}
Game::~Game() {
delete _surface;
}
void Game::run() {
if (!checkCopyProtection())
return;
}
} // End of namespace MADS

View File

@ -30,15 +30,25 @@ namespace MADS {
class MADSEngine;
class Game {
private:
protected:
MADSEngine *_vm;
MSurface *_surface;
Game(MADSEngine *vm);
/**
* Perform any copy protection check
*/
virtual bool checkCopyProtection() = 0;
public:
static Game *init(MADSEngine *vm);
public:
~Game();
virtual ~Game();
/**
* Run the game
*/
void run();
};
} // End of namespace MADS

View File

@ -44,6 +44,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
_events = nullptr;
_font = nullptr;
_game = nullptr;
_palette = nullptr;
_resources = nullptr;
_screen = nullptr;
@ -54,6 +55,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
MADSEngine::~MADSEngine() {
delete _events;
delete _font;
delete _game;
delete _palette;
delete _resources;
delete _screen;
@ -77,6 +79,7 @@ void MADSEngine::initialise() {
_screen = MSurface::init(true);
_sound = new SoundManager(this, _mixer);
_userInterface = UserInterface::init(this);
_game = Game::init(this);
_screen->empty();
}
@ -85,11 +88,11 @@ Common::Error MADSEngine::run() {
initGraphics(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT, false);
initialise();
Common::Event e;
while (!shouldQuit()) {
g_system->getEventManager()->pollEvent(e);
g_system->delayMillis(10);
}
// Run the game
_game->run();
// Dummy loop to keep application active
_events->handleEvents();
return Common::kNoError;
}

View File

@ -32,6 +32,7 @@
#include "graphics/surface.h"
#include "mads/events.h"
#include "mads/font.h"
#include "mads/game.h"
#include "mads/msurface.h"
#include "mads/resources.h"
#include "mads/sound.h"
@ -91,6 +92,7 @@ protected:
public:
EventsManager *_events;
Font *_font;
Game *_game;
Palette *_palette;
ResourcesManager *_resources;
MSurface *_screen;

View File

@ -1,6 +1,8 @@
MODULE := engines/mads
MODULE_OBJS := \
nebular/dialogs_nebular.o \
nebular/game_nebular.o \
compression.o \
detection.o \
events.o \

View 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 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "mads/mads.h"
#include "mads/graphics.h"
#include "mads/msurface.h"
#include "mads/nebular/dialogs_nebular.h"
namespace MADS {
namespace Nebular {
} // End of namespace Nebular
} // End of namespace MADS

View File

@ -0,0 +1,42 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef MADS_GAME_NEBULAR_H
#define MADS_GAME_NEBULAR_H
#include "common/scummsys.h"
#include "mads/game.h"
namespace MADS {
namespace Nebular {
class CopyProtectionDialog {
public:
static bool show() { return false; }
};
} // End of namespace Nebular
} // End of namespace MADS
#endif /* MADS_GAME_NEBULAR_H */

View File

@ -0,0 +1,49 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "mads/mads.h"
#include "mads/game.h"
#include "mads/graphics.h"
#include "mads/msurface.h"
#include "mads/nebular/game_nebular.h"
namespace MADS {
namespace Nebular {
GameNebular::GameNebular(MADSEngine *vm): Game(vm) {
_surface =MSurface::init(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT);
}
bool GameNebular::checkCopyProtection() {
if (!ConfMan.getBool("copy_protection") || (ConfMan.hasKey("passed_protection") &&
ConfMan.getInt("passed_protection") == 1))
return true;
return false;
}
} // End of namespace Nebular
} // End of namespace MADS

View File

@ -0,0 +1,45 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef MADS_GAME_NEBULAR_H
#define MADS_GAME_NEBULAR_H
#include "common/scummsys.h"
#include "mads/game.h"
namespace MADS {
namespace Nebular {
class GameNebular: public Game {
friend class Game;
protected:
GameNebular(MADSEngine *vm);
virtual bool checkCopyProtection();
};
} // End of namespace Nebular
} // End of namespace MADS
#endif /* MADS_GAME_NEBULAR_H */