diff options
author | Kamil Zbróg | 2013-10-13 02:42:09 +0100 |
---|---|---|
committer | Kamil Zbróg | 2013-10-13 02:42:09 +0100 |
commit | fb2627569e03f3a1f51d7619db381253b30b9a0b (patch) | |
tree | 70fd753fd802f38e5eb1e1bae2a2e1595e482a3e /engines/prince/prince.cpp | |
parent | b49707d9485c4d1eaf05fc079e15625b4e2672da (diff) | |
download | scummvm-rg350-fb2627569e03f3a1f51d7619db381253b30b9a0b.tar.gz scummvm-rg350-fb2627569e03f3a1f51d7619db381253b30b9a0b.tar.bz2 scummvm-rg350-fb2627569e03f3a1f51d7619db381253b30b9a0b.zip |
PRINCE: mhwanh decoder added. simple game loop works
Diffstat (limited to 'engines/prince/prince.cpp')
-rw-r--r-- | engines/prince/prince.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index e2149e9919..2791bda86c 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -35,6 +35,7 @@ #include "graphics/surface.h"
#include "graphics/palette.h"
#include "graphics/pixelformat.h"
+#include "graphics/decoders/bmp.h"
#include "engines/util.h"
#include "engines/advancedDetector.h"
@@ -42,11 +43,14 @@ #include "audio/audiostream.h"
#include "prince/prince.h"
+#include "prince/font.h"
+#include "prince/mhwanh.h"
namespace Prince {
PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
_rnd = new Common::RandomSource("prince");
+
}
PrinceEngine::~PrinceEngine() {
@@ -59,9 +63,95 @@ Common::Error PrinceEngine::run() { initGraphics(640, 480, true);
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+
+ debug("Adding all path: %s", gameDataDir.getPath().c_str());
+
+ SearchMan.addSubDirectoryMatching(gameDataDir, "all", 0, 2);
+ SearchMan.addSubDirectoryMatching(gameDataDir, "01", 0, 2);
+
+ Common::SeekableReadStream * walizka = SearchMan.createReadStreamForMember("walizka");
+
+ Common::SeekableReadStream *font1stream = SearchMan.createReadStreamForMember("font1.raw");
+ if (!font1stream)
+ return Common::kPathNotFile;
+
+ Font font1 = Font();
+ if (font1.load(*font1stream))
+ {
+ font1.getCharWidth(103);
+ }
+
+ Common::SeekableReadStream *room = SearchMan.createReadStreamForMember("room");
+
+ _frontScreen = new Graphics::Surface();
+ _frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
+
+ if (room)
+ {
+ Graphics::BitmapDecoder roomBmp;
+ roomBmp.loadStream(*room);
+ _roomBackground = roomBmp.getSurface();
+ _system->getPaletteManager()->setPalette(roomBmp.getPalette(), 0, 256);
+
+ font1.drawString(_frontScreen, "Hello World", 10, 10, 640, 1);
+
+ MhwanhDecoder walizkaBmp;
+ if (walizka)
+ {
+ debug("Loading walizka");
+ if (walizkaBmp.loadStream(*walizka))
+ {
+ _roomBackground = walizkaBmp.getSurface();
+ _system->getPaletteManager()->setPalette(walizkaBmp.getPalette(), 0, 256);
+ }
+ }
+
+
+ mainLoop();
+ }
+ delete room;
+
+
+
return Common::kNoError;
}
+void PrinceEngine::mainLoop() {
+ uint32 nextFrameTime = 0;
+ while (!shouldQuit()) {
+ Common::Event event;
+ Common::EventManager *eventMan = _system->getEventManager();
+ while (eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ break;
+ case Common::EVENT_KEYUP:
+ break;
+ case Common::EVENT_MOUSEMOVE:
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN:
+ break;
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONUP:
+ break;
+ case Common::EVENT_QUIT:
+ _system->quit();
+ break;
+ default:
+ break;
+ }
+ }
+ _system->copyRectToScreen((byte*)_roomBackground->getBasePtr(0,0), 640, 0, 0, 640, 480);
+
+ _system->updateScreen();
+
+ _system->delayMillis(40);
+
+ }
+}
+
void PrinceEngine::setFullPalette() {
_system->getPaletteManager()->setPalette(_palette, 0, 256);
}
|