mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 15:40:57 +00:00
FREESCAPE: implemented fullscreen messages in dark dos demo
This commit is contained in:
parent
57a9a801a6
commit
60a40ed6f4
@ -263,7 +263,7 @@ public:
|
||||
bool executeEndIfBitNotEqual(FCLInstruction &instruction);
|
||||
bool executeEndIfVisibilityIsEqual(FCLInstruction &instruction);
|
||||
void executeSwapJet(FCLInstruction &instruction);
|
||||
void executePrint(FCLInstruction &instruction);
|
||||
virtual void executePrint(FCLInstruction &instruction);
|
||||
void executeSPFX(FCLInstruction &instruction);
|
||||
|
||||
// Sound
|
||||
@ -448,10 +448,12 @@ public:
|
||||
|
||||
void loadAssets() override;
|
||||
void initGameState() override;
|
||||
void borderScreen() override;
|
||||
|
||||
void gotoArea(uint16 areaID, int entranceID) override;
|
||||
void checkIfStillInArea() override;
|
||||
void pressedKey(const int keycode) override;
|
||||
void executePrint(FCLInstruction &instruction) override;
|
||||
|
||||
void loadAssetsDemo();
|
||||
void loadAssetsFullGame();
|
||||
@ -461,6 +463,7 @@ public:
|
||||
|
||||
void drawUI() override;
|
||||
void drawDOSUI(Graphics::Surface *surface);
|
||||
void drawFullscreenMessage(Common::String message);
|
||||
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
|
||||
Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
|
||||
};
|
||||
|
@ -65,6 +65,7 @@ void DarkEngine::loadAssetsDemo() {
|
||||
if (!file.isOpen())
|
||||
error("Failed to open DSIDEE.EXE");
|
||||
loadMessagesFixedSize(&file, 0x4525, 16, 27);
|
||||
loadMessagesFixedSize(&file, 0x9959, 307, 5);
|
||||
loadFonts(&file, 0xa598);
|
||||
load8bitBinary(&file, 0xa700, 16);
|
||||
} else if (isDOS() && _renderMode == Common::kRenderCGA) {
|
||||
@ -135,6 +136,13 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
|
||||
if (!_gameStateBits.contains(areaID))
|
||||
_gameStateBits[areaID] = 0;
|
||||
|
||||
if (isDemo()) {
|
||||
if (!_areaMap.contains(areaID)) {
|
||||
drawFullscreenMessage(_messagesList[30]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
assert(_areaMap.contains(areaID));
|
||||
_currentArea = _areaMap[areaID];
|
||||
_currentArea->show();
|
||||
@ -336,6 +344,110 @@ void DarkEngine::drawUI() {
|
||||
delete surface;
|
||||
}
|
||||
|
||||
void DarkEngine::borderScreen() {
|
||||
if (_border) {
|
||||
drawBorder();
|
||||
if (isDemo()) {
|
||||
drawFullscreenMessage(_messagesList[27]);
|
||||
drawFullscreenMessage(_messagesList[28]);
|
||||
drawFullscreenMessage(_messagesList[29]);
|
||||
} else {
|
||||
_gfx->flipBuffer();
|
||||
g_system->updateScreen();
|
||||
g_system->delayMillis(3000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DarkEngine::executePrint(FCLInstruction &instruction) {
|
||||
uint16 index = instruction._source - 1;
|
||||
debugC(1, kFreescapeDebugCode, "Printing message %d", index);
|
||||
_currentAreaMessages.clear();
|
||||
if (index > 127) {
|
||||
index = _messagesList.size() - (index - 254) - 2;
|
||||
drawFullscreenMessage(_messagesList[index]);
|
||||
return;
|
||||
}
|
||||
_currentAreaMessages.push_back(_messagesList[index]);
|
||||
}
|
||||
|
||||
void DarkEngine::drawFullscreenMessage(Common::String message) {
|
||||
_savedScreen = _gfx->getScreenshot();
|
||||
|
||||
uint32 color = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
|
||||
Graphics::Surface *surface = new Graphics::Surface();
|
||||
surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
|
||||
surface->fillRect(_fullscreenViewArea, color);
|
||||
|
||||
uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
|
||||
surface->fillRect(_viewArea, black);
|
||||
|
||||
switch (_renderMode) {
|
||||
case Common::kRenderCGA:
|
||||
color = 1;
|
||||
break;
|
||||
case Common::kRenderZX:
|
||||
color = 6;
|
||||
break;
|
||||
default:
|
||||
color = 14;
|
||||
}
|
||||
uint8 r, g, b;
|
||||
_gfx->readFromPalette(color, r, g, b);
|
||||
uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
int x, y;
|
||||
x = 42;
|
||||
y = 30;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
Common::String line = message.substr(28 * i, 28);
|
||||
debug("'%s' %d", line.c_str(), line.size());
|
||||
drawStringInSurface(line, x, y, front, black, surface);
|
||||
y = y + 12;
|
||||
}
|
||||
|
||||
if (!_uiTexture)
|
||||
_uiTexture = _gfx->createTexture(surface);
|
||||
else
|
||||
_uiTexture->update(surface);
|
||||
|
||||
_gfx->setViewport(_fullscreenViewArea);
|
||||
_gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _uiTexture);
|
||||
_gfx->setViewport(_viewArea);
|
||||
|
||||
_gfx->flipBuffer();
|
||||
g_system->updateScreen();
|
||||
|
||||
Common::Event event;
|
||||
bool cont = true;
|
||||
while (!shouldQuit() && cont) {
|
||||
while (g_system->getEventManager()->pollEvent(event)) {
|
||||
|
||||
// Events
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode == Common::KEYCODE_SPACE) {
|
||||
cont = false;
|
||||
}
|
||||
break;
|
||||
case Common::EVENT_SCREEN_CHANGED:
|
||||
_gfx->computeScreenViewport();
|
||||
// TODO: properly refresh screen
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
_savedScreen->free();
|
||||
delete _savedScreen;
|
||||
surface->free();
|
||||
delete surface;
|
||||
}
|
||||
|
||||
Common::Error DarkEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ void FreescapeEngine::loadMessagesFixedSize(Common::SeekableReadStream *file, in
|
||||
file->read(buffer, size);
|
||||
Common::String message = (const char *)buffer;
|
||||
_messagesList.push_back(message);
|
||||
debugC(1, kFreescapeDebugParser, "%s", _messagesList[i].c_str());
|
||||
debugC(1, kFreescapeDebugParser, "%s", _messagesList[_messagesList.size() - 1].c_str());
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user