Permalink
Browse files

STARTREK: Import my startrek engine

Now updated even
  • Loading branch information...
clone2727 authored and sev- committed Feb 20, 2011
1 parent b47cae7 commit e07fe3f1a438b245b0a4dbf4506fe4c9d03d9258
@@ -0,0 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
add_engine startrek "Star Trek 25th Anniversary/Judgment Rites" no
@@ -0,0 +1,217 @@
/* 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.
*
* $URL: https://scummvm-startrek.googlecode.com/svn/trunk/detection.cpp $
* $Id: detection.cpp 15 2010-06-27 06:13:42Z clone2727 $
*
*/

#include "base/plugins.h"

#include "engines/advancedDetector.h"
#include "common/config-manager.h"
#include "common/file.h"

#include "startrek/startrek.h"

namespace StarTrek {

struct StarTrekGameDescription {
ADGameDescription desc;

uint8 gameType;
uint32 features;
uint16 version;
};

uint32 StarTrekEngine::getFeatures() const {
return _gameDescription->features;
}

Common::Platform StarTrekEngine::getPlatform() const {
return _gameDescription->desc.platform;
}

uint16 StarTrekEngine::getVersion() const {
return _gameDescription->version;
}

uint8 StarTrekEngine::getGameType() {
return _gameDescription->gameType;
}

Common::Language StarTrekEngine::getLanguage() {
return _gameDescription->desc.language;
}

} // End of Namespace StarTrek

static const PlainGameDescriptor starTrekGames[] = {
{"startrek", "Star Trek game"},
{"st25", "Star Trek: 25th Anniversary"},
{"stjr", "Star Trek: Judgment Rites"},
{0, 0}
};


namespace StarTrek {

static const StarTrekGameDescription gameDescriptions[] = {
{
{
"st25",
"",
AD_ENTRY1("data.001", "57040928a0f374281aa86ba4e7db8444"),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
GUIO0()
},
GType_ST25,
0,
0,
},

{
{
"st25",
"",
AD_ENTRY1("data.000", "f0918b6d096455ce2ae6dd5ef973292e"),
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
GUIO0()
},
GType_ST25,
0,
0,
},

{
{
"st25",
"",
AD_ENTRY1("data.000", "70d0e374d5fa973e536dba0f42310672"),
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
GUIO0()
},
GType_ST25,
0,
0,
},

{
{
"st25",
"",
AD_ENTRY1("data.000", "d0299af1385edd7c7612ed453e417dd8"),
Common::FR_FRA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
GUIO0()
},
GType_ST25,
0,
0,
},

{
{
"st25",
"",
AD_ENTRY1("Star Trek Data", "871fa51c7680c0a43df9622128f1569f"),
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_MACRESFORK,
GUIO0()
},
GType_ST25,
0,
0,
},

{
{
"st25",
"Demo",
AD_ENTRY1("data.001", "f68126e7e36ce6286c4c8575f8b594f5"),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_DEMO,
GUIO0()
},
GType_ST25,
GF_DEMO,
0,
},

{
{
"stjr",
"",
AD_ENTRY1("data.001", "1c8de3c02f69c07c582d59d3c29e4dd9"),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
GUIO0()
},
GType_STJR,
0,
0,
},

{ AD_TABLE_END_MARKER, 0, 0, 0 }
};

} // End of namespace StarTrek

class StarTrekMetaEngine : public AdvancedMetaEngine {
public:
StarTrekMetaEngine() : AdvancedMetaEngine(StarTrek::gameDescriptions, sizeof(StarTrek::StarTrekGameDescription), starTrekGames) {
_singleId = "startrek";
}

virtual const char *getName() const {
return "Star Trek Engine";
}

virtual const char *getOriginalCopyright() const {
return "Star Trek: 25th Anniversary, Star Trek: Judgment Rites (C) Interplay";
}

virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
};

bool StarTrekMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const StarTrek::StarTrekGameDescription *gd = (const StarTrek::StarTrekGameDescription *)desc;

*engine = new StarTrek::StarTrekEngine(syst, gd);

return (gd != 0);
}

#if PLUGIN_ENABLED_DYNAMIC(STARTREK)
REGISTER_PLUGIN_DYNAMIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine);
#else
REGISTER_PLUGIN_STATIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine);
#endif

@@ -0,0 +1,69 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 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.
*
* $URL: https://scummvm-startrek.googlecode.com/svn/trunk/font.cpp $
* $Id: font.cpp 2 2009-09-12 20:13:40Z clone2727 $
*
*/

#include "startrek/font.h"

namespace StarTrek {

static const byte CHARACTER_COUNT = 0x80;
static const byte CHARACTER_SIZE = 0x40;

Font::Font(StarTrekEngine *vm) : _vm(vm) {
Common::SeekableReadStream *fontStream = _vm->openFile("FONT.FNT");

_characters = new Character[CHARACTER_COUNT];

for (byte i = 0; i < CHARACTER_COUNT; i++)
fontStream->read(_characters[i].data, CHARACTER_SIZE);

delete fontStream;

#if 0
// Code to dump the font
printf ("DUMPING FONT");
for (byte i = 0; i < CHARACTER_COUNT; i++) {
printf ("\n\nCHARACTER %02x (%d):\n", i, i);
for (byte j = 0; j < CHARACTER_SIZE; j++) {
if (!(j % 8))
printf ("\n");
if (_characters[i].data[j] == 0x7d)
printf ("1 ");
else if (_characters[i].data[j] == 0x78)
printf ("0 ");
else if (_characters[i].data[j] == 0)
printf (" ");
else
printf ("? ");
}
}
printf("\n\n");
#endif
}

Font::~Font() {
delete[] _characters;
}

}
@@ -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 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.
*
* $URL: https://scummvm-startrek.googlecode.com/svn/trunk/font.h $
* $Id: font.h 2 2009-09-12 20:13:40Z clone2727 $
*
*/

#ifndef STARTREK_FONT_H
#define STARTREK_FONT_H

#include "startrek/startrek.h"

namespace StarTrek {

class StarTrekEngine;

class Font {
public:
Font(StarTrekEngine *vm);
~Font();

private:
StarTrekEngine *_vm;

struct Character {
byte data[0x40];
} *_characters;
};


}

#endif
Oops, something went wrong.

0 comments on commit e07fe3f

Please sign in to comment.