Skip to content

Commit

Permalink
ACCESS: Added initial resources and detection entry for Martian Memor…
Browse files Browse the repository at this point in the history
…andum
  • Loading branch information
dreammaster committed Aug 21, 2014
1 parent a8dd2de commit afc41c7
Show file tree
Hide file tree
Showing 16 changed files with 1,288 additions and 5 deletions.
2 changes: 1 addition & 1 deletion engines/access/access.h
Expand Up @@ -59,7 +59,7 @@ namespace Access {

enum {
GType_Amazon = 1,
GType_MeanStreets = 2,
GType_MartianMemorandum = 2,
GType_Noctropolis = 3
};

Expand Down
2 changes: 1 addition & 1 deletion engines/access/amazon/amazon_game.cpp
Expand Up @@ -175,8 +175,8 @@ void AmazonEngine::setupGame() {
}

// Miscellaneous
_fonts._font1.load(FONT6x6_INDEX, FONT6x6_DATA);
_fonts._font2.load(FONT2_INDEX, FONT2_DATA);
_fonts._font6x6.load(FONT6x6_INDEX, FONT6x6_DATA);

// Set player room and position
_player->_roomNumber = 4;
Expand Down
2 changes: 1 addition & 1 deletion engines/access/data.h
Expand Up @@ -145,7 +145,7 @@ class FontManager {
Common::Point _printOrg;
Common::Point _printStart;
int _printMaxX;
Font _font6x6;
Font _font1;
Font _font2;
public:
FontManager();
Expand Down
5 changes: 5 additions & 0 deletions engines/access/detection.cpp
Expand Up @@ -23,6 +23,7 @@

#include "access/access.h"
#include "access/amazon/amazon_game.h"
#include "access/martian/martian_game.h"

#include "base/plugins.h"
#include "common/savefile.h"
Expand Down Expand Up @@ -73,6 +74,7 @@ Common::Platform AccessEngine::getPlatform() const {
static const PlainGameDescriptor AccessGames[] = {
{"Access", "Access"},
{"amazon", "Amazon: Guardians of Eden"},
{ "martian", "Martian Memorandum"},
{0, 0}
};

Expand Down Expand Up @@ -123,6 +125,9 @@ bool AccessMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGa
case Access::GType_Amazon:
*engine = new Access::Amazon::AmazonEngine(syst, gd);
break;
case Access::GType_MartianMemorandum:
*engine = new Access::Martian::MartianEngine(syst, gd);
break;
default:
error("Unknown game");
}
Expand Down
18 changes: 18 additions & 0 deletions engines/access/detection_tables.h
Expand Up @@ -59,6 +59,24 @@ static const AccessGameDescription gameDescriptions[] = {
0
},

{
// Martian Memorandum
{
"martian",
nullptr,
{
{ "r00.ap", 0, "af98db5ee7f9ef86c6b1f43187a3691b", 31 },
AD_LISTEND
},
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
},
GType_MartianMemorandum,
0
},

{ AD_TABLE_END_MARKER, 0, 0 }
};

Expand Down
4 changes: 4 additions & 0 deletions engines/access/files.cpp
Expand Up @@ -22,6 +22,7 @@

#include "access/files.h"
#include "access/amazon/amazon_resources.h"
#include "access/martian/martian_resources.h"
#include "access/access.h"

namespace Access {
Expand All @@ -31,6 +32,9 @@ FileManager::FileManager(AccessEngine *vm): _vm(vm) {
case GType_Amazon:
_filenames = &Amazon::FILENAMES[0];
break;
case GType_MartianMemorandum:
_filenames = &Martian::FILENAMES[0];
break;
default:
error("Unknown game");
}
Expand Down
8 changes: 7 additions & 1 deletion engines/access/inventory.cpp
Expand Up @@ -23,6 +23,7 @@
#include "access/inventory.h"
#include "access/access.h"
#include "access/amazon/amazon_resources.h"
#include "access/martian/martian_resources.h"

namespace Access {

Expand All @@ -35,11 +36,16 @@ InventoryManager::InventoryManager(AccessEngine *vm) : Manager(vm) {
_startAboutItem = 0;
_startTravelItem = 0;

const char *const *names = Amazon::INVENTORY_NAMES;
const char *const *names;
switch (vm->getGameID()) {
case GType_Amazon:
names = Amazon::INVENTORY_NAMES;
_inv.resize(85);
break;
case GType_MartianMemorandum:
names = Martian::INVENTORY_NAMES;
_inv.resize(54);
break;
default:
error("Unknown game");
}
Expand Down
172 changes: 172 additions & 0 deletions engines/access/martian/martian_game.cpp
@@ -0,0 +1,172 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 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 "access/resources.h"
#include "access/martian/martian_game.h"
#include "access/martian/martian_resources.h"
#include "access/martian/martian_room.h"
#include "access/martian/martian_scripts.h"
#include "access/amazon/amazon_resources.h"

namespace Access {

namespace Martian {

MartianEngine::MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc) :
AccessEngine(syst, gameDesc) {
}

MartianEngine::~MartianEngine() {
}

void MartianEngine::playGame() {
// Do introduction
doIntroduction();
if (shouldQuit())
return;

// Setup the game
setupGame();

_screen->clearScreen();
_screen->setPanel(0);
_screen->forceFadeOut();

_events->showCursor();

// Setup and execute the room
_room = new MartianRoom(this);
_scripts = new MartianScripts(this);
_room->doRoom();
}

void MartianEngine::doIntroduction() {
_screen->setInitialPalettte();
_events->setCursor(CURSOR_ARROW);
_events->showCursor();
_screen->setPanel(0);

// TODO: Worry about implementing full intro sequence later
return;

doTitle();
if (shouldQuit())
return;

if (!_skipStart) {
_screen->setPanel(3);
doOpening();
if (shouldQuit())
return;

if (!_skipStart) {
doTent();
if (shouldQuit())
return;
}
}

doTitle();
}

void MartianEngine::doTitle() {
_screen->setDisplayScan();
_destIn = &_buffer2;

_screen->forceFadeOut();
_events->hideCursor();

_sound->queueSound(0, 98, 30);
_sound->_soundPriority[0] = 1;

_screen->_loadPalFlag = false;
_files->loadScreen(0, 3);

_buffer2.copyFrom(*_screen);
_buffer1.copyFrom(*_screen);
_screen->forceFadeIn();
_sound->playSound(1);

byte *spriteData = _files->loadFile(0, 2);
_objectsTable[0] = new SpriteResource(this, spriteData, _files->_filesize,
DisposeAfterUse::YES);

_sound->playSound(1);

_screen->_loadPalFlag = false;
_files->loadScreen(0, 4);
_sound->playSound(1);

_buffer2.copyFrom(*_screen);
_buffer1.copyFrom(*_screen);
_sound->playSound(1);

const int COUNTDOWN[6] = { 2, 0x80, 1, 0x7d, 0, 0x87 };
for (_pCount = 0; _pCount < 3; ++_pCount) {
_buffer2.copyFrom(_buffer1);
int id = READ_LE_UINT16(COUNTDOWN + _pCount * 4);
int xp = READ_LE_UINT16(COUNTDOWN + _pCount * 4 + 2);
_screen->plotImage(_objectsTable[0], id, Common::Point(xp, 71));
}
// TODO: More to do

delete _objectsTable[0];
}

void MartianEngine::doOpening() {
warning("TODO doOpening");
}

void MartianEngine::doTent() {
warning("TODO doTent");
}

void MartianEngine::setupGame() {

// Setup timers
const int TIMER_DEFAULTS[] = { 4, 10, 8, 1, 1, 1, 1, 2 };
for (int i = 0; i < 32; ++i) {
TimerEntry te;
te._initTm = te._timer = (i < 8) ? TIMER_DEFAULTS[i] : 1;
te._flag = 1;

_timers.push_back(te);
}

// Miscellaneous
// TODO: Replace with Martian fonts when located
_fonts._font1.load(Amazon::FONT6x6_INDEX, Amazon::FONT6x6_DATA);
_fonts._font2.load(Amazon::FONT2_INDEX, Amazon::FONT2_DATA);

// Set player room and position
_player->_roomNumber = 7;
_player->_playerX = _player->_rawPlayer.x = TRAVEL_POS[_player->_roomNumber][0];
_player->_playerY = _player->_rawPlayer.y = TRAVEL_POS[_player->_roomNumber][1];
}

void MartianEngine::drawHelp() {
error("TODO: drawHelp");
}

} // End of namespace Martian

} // End of namespace Access
79 changes: 79 additions & 0 deletions engines/access/martian/martian_game.h
@@ -0,0 +1,79 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can 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 ACCESS_MARTIAN_GAME_H
#define ACCESS_MARTIAN_GAME_H

#include "access/access.h"

namespace Access {

namespace Martian {

class MartianEngine : public AccessEngine {
private:
bool _skipStart;

/**
* Do the game introduction
*/
void doIntroduction();

/**
* Do title sequence
*/
void doTitle();

/**
* Do opening sequence
*/
void doOpening();

/**
* Do tent scene of introduction
*/
void doTent();

/**
* Setup variables for the game
*/
void setupGame();

protected:
/**
* Play the game
*/
virtual void playGame();
public:
public:
MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc);

virtual ~MartianEngine();

void drawHelp();
};

} // End of namespace Martian

} // End of namespace Access

#endif /* ACCESS_MARTIAN_GAME_H */

0 comments on commit afc41c7

Please sign in to comment.