HDB: Setup system for drawing Title Screen

This commit is contained in:
Nipun Garg 2019-05-31 19:52:13 +05:30 committed by Eugene Sandulenko
parent e4e9f4ff34
commit 1624c765a0
7 changed files with 59 additions and 24 deletions

View File

@ -47,6 +47,15 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_DEMO,
GUIO1(GUIO_NONE)
},
{
"hdb",
"",
AD_ENTRY1s("hyperdemo.mpc", "f3bc878e179f00b8666a9846f3d9f9f5", 5236568),
Common::EN_ANY,
Common::kPlatformUnknown,
ADGF_DEMO,
GUIO1(GUIO_NONE)
},
AD_TABLE_END_MARKER
};
} // End of namespace HDB
@ -85,4 +94,4 @@ bool HDBMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD
REGISTER_PLUGIN_DYNAMIC(HDB, PLUGIN_TYPE_ENGINE, HDBMetaEngine);
#else
REGISTER_PLUGIN_STATIC(HDB, PLUGIN_TYPE_ENGINE, HDBMetaEngine);
#endif
#endif

View File

@ -31,6 +31,11 @@ DrawMan::DrawMan() {
bool DrawMan::init() {
_systemInit = true;
return true;
}
void DrawMan::loadTile32(char *name, uint32 *length) {
}
}

View File

@ -48,6 +48,7 @@ public:
bool init();
// void saveToFile(const Common::String &filename);
// void loadFromFile(const Common::String &filename);
void loadTile32(char *name, uint32 *length);
bool cursorDisplay;
int cursorX, cursorY;

View File

@ -31,9 +31,13 @@ bool FileMan::openMPC(const Common::String &filename) {
uint32 offset;
if (!_mpcFile->open(filename)) {
debug("The MPC file doesn't exist.");
error("FileMan::openMSD(): Error reading the MSD file");
return false;
}
else {
debug("The MPC file exists");
}
_mpcFile->read(&dataHeader.id, 4);
@ -82,17 +86,20 @@ void FileMan::closeMPC() {
_mpcFile->close();
}
MPCEntry **FileMan::findFirstData(char *string, DataType type) {
MPCEntry *FileMan::findFirstData(const char *string, DataType type) {
Common::String fileString;
for (MPCIterator it = _dir.begin(); it != _dir.end(); it++) {
debug("Hello");
int i = 0;
/*for (MPCIterator it = _dir.begin(); it != _dir.end(); it++) {
fileString = (*it)->filename;
if (fileString.contains(string)) {
if ((*it)->type == type) {
return it;
}
}
}
}*/
return NULL;
}
@ -109,7 +116,7 @@ MPCEntry **FileMan::findNextData(MPCIterator begin) {
}
return NULL;
}
/*
int FileMan::findAmount(char *string, DataType type) {
int count = 0;
@ -120,6 +127,6 @@ int FileMan::findAmount(char *string, DataType type) {
}
return count;
}
}*/
} // End of Namespace HDB

View File

@ -26,6 +26,8 @@
#include "common/array.h"
#include "common/file.h"
#include "common/error.h"
#include "common/stream.h"
#include "common/memstream.h"
#define MPCIterator Common::Array<MPCEntry *>::iterator
@ -112,9 +114,10 @@ public:
void loadData(char *string, uint32 *length);
*/
MPCEntry **findFirstData(char *string, DataType type);
MPCEntry *findFirstData(const char *string, DataType type);
MPCEntry **findNextData(MPCIterator it);
int findAmount(char *string, DataType type);
//int findAmount(char *string, DataType type);
};

View File

@ -28,6 +28,8 @@
#include "common/file.h"
#include "common/error.h"
#include "graphics/surface.h"
#include "common/stream.h"
#include "common/memstream.h"
#include "hdb.h"
#include "console.h"
@ -36,6 +38,7 @@ namespace HDB {
HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
_console = nullptr;
_systemInit = false;
DebugMan.addDebugChannel(kDebugExample1, "Example1", "This is just an example to test");
DebugMan.addDebugChannel(kDebugExample2, "Example2", "This is also an example");
@ -53,9 +56,10 @@ bool HDBGame::init() {
Game Subsystem Initializations
*/
// Init _fileMan
// Init fileMan
if (fileMan->openMPC("hyperdemo.mpc")) {
gameShutdown = false;
_systemInit = true;
return true;
}
@ -92,22 +96,27 @@ void HDBGame::changeGameState() {
}
Common::Error HDBGame::run() {
// Initializes Graphics
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
initGraphics(640, 320, &format);
_console = new Console();
/*
if (!_game->init()) {
error("Couldn't initialize Game.");
return Common::kUnknownError;
// Initialize System
if (!_systemInit) {
init();
}
_game->start();
_game->mainLoop();
*/
// Initializes Graphics
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
initGraphics(640, 480, &format);
_console = new Console();
MPCEntry *titleScreen = fileMan->findFirstData("monkeylogoscreen", DataType::TYPE_PIC);
debug("Hi");
//Common::MemoryReadStream *stream = new Common::MemoryReadStream((byte *)titleScreen, titleScreen->ulength);
//if (titleScreen == NULL) {
//debug("titleScreen: NULL");
//}
//else {
//debug("Works.");
//}
while (!shouldQuit()) {
Common::Event event;
@ -125,10 +134,10 @@ Common::Error HDBGame::run() {
}
Graphics::Surface screen;
screen.create(800, 600, g_system->getScreenFormat());
screen.create(640, 480, g_system->getScreenFormat());
screen.drawLine(100, 100, 200, 200, 0xffffffff);
g_system->copyRectToScreen(screen.getBasePtr(0, 0), screen.pitch, 0, 0, 800, 600);
g_system->copyRectToScreen(screen.getBasePtr(0, 0), screen.pitch, 0, 0, 640, 480);
g_system->updateScreen();
g_system->delayMillis(10);

View File

@ -90,6 +90,7 @@ private:
// Game Variables
bool _systemInit;
GameState _gameState;
bool _voiceless;