[Scummvm-git-logs] scummvm master -> 90b490f026d16439ab94a33f5fdd61cc3fec6082
mgerhardy
martin.gerhardy at gmail.com
Thu Jun 3 20:07:37 UTC 2021
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b3241ea04a TWINE: use Graphics::Screen
ac39581c16 TWINE: draw the render rect
fb2533ebd6 TWINE: cleanup blitting
0c826f8a2a TWINE: don't update the screen twice a frame
90b490f026 TWINE: fixed showing gif 'animation' replacement
Commit: b3241ea04adfa56ac0dd18384999b075a9732024
https://github.com/scummvm/scummvm/commit/b3241ea04adfa56ac0dd18384999b075a9732024
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-06-03T22:07:26+02:00
Commit Message:
TWINE: use Graphics::Screen
Changed paths:
engines/twine/debugger/debug_scene.cpp
engines/twine/flamovies.cpp
engines/twine/menu/interface.cpp
engines/twine/menu/menu.cpp
engines/twine/renderer/redraw.cpp
engines/twine/renderer/screens.cpp
engines/twine/twine.cpp
engines/twine/twine.h
graphics/screen.cpp
diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index d0dc41b38a..d30b73d655 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -228,18 +228,14 @@ bool DebugScene::displayZones() {
}
void DebugScene::renderDebugView() {
- bool dirty = false;
if (showingZones) {
- dirty |= displayZones();
+ displayZones();
}
if (showingActors) {
- dirty |= displayActors();
+ displayActors();
}
if (showingTracks) {
- dirty |= displayTracks();
- }
- if (dirty) {
- _engine->flip();
+ displayTracks();
}
}
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 2f05a80faf..fe77b02e95 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -409,8 +409,8 @@ void FlaMovies::playFlaMovie(const char *flaName) {
_engine->_screens->fadeIn(_engine->_screens->paletteRGBACustom);
} else {
_engine->setPalette(_engine->_screens->paletteRGBACustom);
+ _engine->flip();
}
- _engine->flip();
}
// TRICKY: fade in tricky
diff --git a/engines/twine/menu/interface.cpp b/engines/twine/menu/interface.cpp
index 158c12260a..89124a4a0b 100644
--- a/engines/twine/menu/interface.cpp
+++ b/engines/twine/menu/interface.cpp
@@ -22,6 +22,7 @@
#include "twine/menu/interface.h"
#include "graphics/managed_surface.h"
+#include "graphics/primitives.h"
#include "twine/twine.h"
namespace TwinE {
@@ -106,6 +107,7 @@ bool Interface::drawLine(int32 startWidth, int32 startHeight, int32 endWidth, in
}
uint8 *out = (uint8*)_engine->frontVideoBuffer.getBasePtr(startWidth, startHeight);
+ _engine->frontVideoBuffer.addDirtyRect(Common::Rect(startWidth, startHeight, startWidth + endWidth, startHeight + endHeight));
if (endWidth < endHeight) { // significant slope
SWAP(endWidth, endHeight);
@@ -168,6 +170,7 @@ void Interface::drawTransparentBox(const Common::Rect &rect, int32 colorAdj) {
}
pos += _engine->frontVideoBuffer.pitch;
}
+ _engine->frontVideoBuffer.addDirtyRect(r);
}
void Interface::drawFilledRect(const Common::Rect &rect, uint8 colorIndex) {
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 5a31184e96..bc83189bef 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -413,7 +413,6 @@ int32 Menu::processMenu(MenuSettings *menuSettings, bool showCredits) {
// if we are running the game already, the buttons are just rendered on top of the scene
if (_engine->_scene->isGameRunning()) {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
} else {
_engine->_screens->loadMenuImage(false);
}
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 36f258fdfb..c534ab5ced 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -766,11 +766,7 @@ void Redraw::drawBubble(int32 actorIdx) {
renderRect.bottom = spriteHeight + renderRect.top - 1;
_engine->_interface->setClip(renderRect);
-
- if (_engine->_grid->drawSprite(renderRect.left, renderRect.top, spritePtr)) {
- _engine->copyBlockPhys(renderRect, true);
- }
-
+ _engine->_grid->drawSprite(renderRect.left, renderRect.top, spritePtr);
_engine->_interface->resetClip();
}
diff --git a/engines/twine/renderer/screens.cpp b/engines/twine/renderer/screens.cpp
index f60af68508..84cbd69be0 100644
--- a/engines/twine/renderer/screens.cpp
+++ b/engines/twine/renderer/screens.cpp
@@ -80,15 +80,14 @@ void Screens::loadImage(int32 index, int32 paletteIndex, bool fadeIn) {
fadeToPal(pal);
} else {
_engine->setPalette(pal);
+ _engine->flip();
}
- _engine->flip();
}
bool Screens::loadImageDelay(int32 index, int32 paletteIndex, int32 seconds) {
loadImage(index, paletteIndex);
if (_engine->delaySkip(1000 * seconds)) {
adjustPalette(0, 0, 0, paletteRGBACustom, 100);
- _engine->flip();
return true;
}
fadeOut(paletteRGBACustom);
@@ -150,6 +149,8 @@ void Screens::adjustPalette(uint8 r, uint8 g, uint8 b, const uint32 *rgbaPal, in
}
_engine->setPalette(pal);
+ _engine->flip();
+ _engine->frontVideoBuffer.update();
}
void Screens::adjustCrossPalette(const uint32 *pal1, const uint32 *pal2) {
@@ -198,7 +199,6 @@ void Screens::fadeToBlack(const uint32 *pal) {
for (int32 i = 100; i >= 0; i -= 3) {
FrameMarker frame(_engine, 50);
adjustPalette(0, 0, 0, pal, i);
- _engine->flip();
}
palResetted = true;
@@ -208,7 +208,6 @@ void Screens::fadeToPal(const uint32 *pal) {
for (int32 i = 0; i <= 100; i += 3) {
FrameMarker frame(_engine, 50);
adjustPalette(0, 0, 0, pal, i);
- _engine->flip();
}
_engine->setPalette(pal);
@@ -225,6 +224,7 @@ void Screens::blackToWhite() {
_engine->setPalette(pal);
_engine->flip();
+ _engine->frontVideoBuffer.update();
}
}
@@ -242,7 +242,6 @@ void Screens::fadePalRed(const uint32 *pal) {
for (int32 i = 100; i >= 0; i -= 2) {
FrameMarker frame(_engine, 50);
adjustPalette(0xFF, 0, 0, pal, i);
- _engine->flip();
}
}
@@ -250,7 +249,6 @@ void Screens::fadeRedPal(const uint32 *pal) {
for (int32 i = 0; i <= 100; i += 2) {
FrameMarker frame(_engine, 50);
adjustPalette(0xFF, 0, 0, pal, i);
- _engine->flip();
}
}
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index d3fa6a3cbb..6b259ccf8d 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -95,10 +95,11 @@ ScopedCursor::~ScopedCursor() {
FrameMarker::FrameMarker(TwinEEngine *engine, uint32 fps) : _engine(engine), _fps(fps) {
_start = g_system->getMillis();
+ ++_engine->frameCounter;
}
FrameMarker::~FrameMarker() {
- g_system->updateScreen();
+ _engine->frontVideoBuffer.update();
if (_fps == 0) {
return;
}
@@ -1060,11 +1061,11 @@ void TwinEEngine::setPalette(const uint32 *palette) {
}
void TwinEEngine::setPalette(uint startColor, uint numColors, const byte *palette) {
- g_system->getPaletteManager()->setPalette(palette, startColor, numColors);
+ frontVideoBuffer.setPalette(palette, startColor, numColors);
}
void TwinEEngine::flip() {
- g_system->copyRectToScreen(frontVideoBuffer.getPixels(), frontVideoBuffer.pitch, 0, 0, frontVideoBuffer.w, frontVideoBuffer.h);
+ frontVideoBuffer.makeAllDirty();
}
void TwinEEngine::copyBlockPhys(const Common::Rect &rect, bool updateScreen) {
@@ -1085,9 +1086,9 @@ void TwinEEngine::copyBlockPhys(int32 left, int32 top, int32 right, int32 bottom
if (width <= 0 || height <= 0) {
return;
}
- g_system->copyRectToScreen(frontVideoBuffer.getBasePtr(left, top), frontVideoBuffer.pitch, left, top, width, height);
+ frontVideoBuffer.addDirtyRect(Common::Rect(left, top, right, bottom));
if (updateScreen) {
- g_system->updateScreen();
+ frontVideoBuffer.update();
}
}
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 0390a03e3c..d3c70a85df 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -31,6 +31,7 @@
#include "engines/metaengine.h"
#include "graphics/managed_surface.h"
+#include "graphics/screen.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
#include "twine/detection.h"
@@ -267,6 +268,8 @@ public:
* Contains all the data used in the engine to configurated the game in particulary ways. */
ConfigFile cfgfile;
+ int32 frameCounter = 0;
+
int width() const;
int height() const;
Common::Rect rect() const;
@@ -288,7 +291,7 @@ public:
/** Work video buffer */
Graphics::ManagedSurface workVideoBuffer;
/** Main game video buffer */
- Graphics::ManagedSurface frontVideoBuffer;
+ Graphics::Screen frontVideoBuffer;
int32 loopInventoryItem = 0;
int32 loopActorStep = 0;
diff --git a/graphics/screen.cpp b/graphics/screen.cpp
index 59ab767543..3e4ab49b25 100644
--- a/graphics/screen.cpp
+++ b/graphics/screen.cpp
@@ -72,6 +72,7 @@ void Screen::addDirtyRect(const Common::Rect &r) {
}
void Screen::makeAllDirty() {
+ _dirtyRects.clear();
addDirtyRect(Common::Rect(0, 0, this->w, this->h));
}
Commit: ac39581c16c23d898f002574f0dbc3ff9205ebf4
https://github.com/scummvm/scummvm/commit/ac39581c16c23d898f002574f0dbc3ff9205ebf4
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-06-03T22:07:26+02:00
Commit Message:
TWINE: draw the render rect
Changed paths:
engines/twine/renderer/redraw.cpp
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index c534ab5ced..f1dd78c434 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -334,8 +334,7 @@ void Redraw::processDrawListShadows(const DrawListStruct &drawCmd) {
addRedrawArea(_engine->_interface->textWindow);
- // show clipping area
- //drawBox(_engine->_renderer->renderRect.left, _engine->_renderer->renderRect.top, _engine->_renderer->renderRect.right, _engine->_renderer->renderRect.bottom);
+ _engine->_debugScene->drawClip(renderRect);
}
void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw) {
@@ -451,8 +450,7 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
_engine->_interface->blitBox(_engine->_interface->textWindow, _engine->frontVideoBuffer, _engine->workVideoBuffer);
}
- // show clipping area
- //_engine->_debugScene->drawClip(renderRect);
+ _engine->_debugScene->drawClip(renderRect);
}
}
Commit: fb2533ebd6cbc13039e3ab94add78118442e9af0
https://github.com/scummvm/scummvm/commit/fb2533ebd6cbc13039e3ab94add78118442e9af0
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-06-03T22:07:26+02:00
Commit Message:
TWINE: cleanup blitting
Changed paths:
engines/twine/flamovies.cpp
engines/twine/holomap.cpp
engines/twine/menu/menu.cpp
engines/twine/menu/menuoptions.cpp
engines/twine/renderer/redraw.cpp
engines/twine/renderer/screens.cpp
engines/twine/resources/resources.cpp
engines/twine/scene/gamestate.cpp
engines/twine/scene/grid.cpp
engines/twine/script/script_life_v1.cpp
engines/twine/script/script_move_v1.cpp
engines/twine/twine.cpp
engines/twine/twine.h
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index fe77b02e95..3c74d36293 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -409,13 +409,11 @@ void FlaMovies::playFlaMovie(const char *flaName) {
_engine->_screens->fadeIn(_engine->_screens->paletteRGBACustom);
} else {
_engine->setPalette(_engine->_screens->paletteRGBACustom);
- _engine->flip();
}
}
// TRICKY: fade in tricky
if (_fadeOutFrames >= 2) {
- _engine->flip();
_engine->_screens->convertPalToRGBA(_engine->_screens->palette, _engine->_screens->paletteRGBACustom);
_engine->_screens->fadeToPal(_engine->_screens->paletteRGBACustom);
_fadeOut = -1;
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 4a570c29ca..9d78585ef4 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -291,7 +291,6 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
const Location &loc = _locations[data->locationIdx];
renderHolomapModel(_engine->_resources->holomapPointModelPtr, loc.angle.x, loc.angle.y, 0);
- _engine->flip();
ActorMoveStruct move;
AnimTimerDataStruct animTimerData;
AnimData animData;
@@ -483,7 +482,6 @@ void Holomap::processHolomap() {
int32 currentLocation = _engine->_scene->currentSceneIdx;
_engine->_text->drawHolomapLocation(_locations[currentLocation].textIndex);
- _engine->flip();
int32 time = _engine->lbaTime;
int32 xRot = ClampAngle(_locations[currentLocation].angle.x);
@@ -588,7 +586,6 @@ void Holomap::processHolomap() {
// pos 0x140,0x19?
//_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- //_engine->flip();
if (fadeInPalette) {
fadeInPalette = false;
// TODO: this does a flip - which puts stuff onto the screen that shouldn't be there
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index bc83189bef..6761c1d37f 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -612,7 +612,6 @@ int32 Menu::processMenu(MenuSettings *menuSettings, bool showCredits) {
int32 Menu::advoptionsMenu() {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
ScopedCursor scoped(_engine);
for (;;) {
@@ -637,7 +636,6 @@ int32 Menu::advoptionsMenu() {
int32 Menu::savemanageMenu() {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
ScopedCursor scoped(_engine);
for (;;) {
@@ -663,7 +661,6 @@ int32 Menu::savemanageMenu() {
int32 Menu::volumeMenu() {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
ScopedCursor scoped(_engine);
for (;;) {
@@ -696,7 +693,6 @@ void Menu::inGameOptionsMenu() {
int32 Menu::optionsMenu() {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
_engine->_sound->stopSamples();
_engine->_music->playTrackMusic(9); // LBA's Theme
diff --git a/engines/twine/menu/menuoptions.cpp b/engines/twine/menu/menuoptions.cpp
index 00c0e897b3..4eddfb7f40 100644
--- a/engines/twine/menu/menuoptions.cpp
+++ b/engines/twine/menu/menuoptions.cpp
@@ -78,7 +78,6 @@ void MenuOptions::newGame() {
_engine->_screens->fadeToBlack(_engine->_screens->paletteRGBACustom);
_engine->_screens->clearScreen();
- _engine->flip();
if (!aborted) {
// _engine->_music->playMidiMusic(1);
@@ -93,7 +92,6 @@ void MenuOptions::newGame() {
// set main palette back
_engine->setPalette(_engine->_screens->paletteRGBA);
- _engine->flip();
}
void MenuOptions::showCredits() {
@@ -112,7 +110,6 @@ void MenuOptions::showCredits() {
_engine->cfgfile.ShadowMode = tmpShadowMode;
_engine->_screens->clearScreen();
- _engine->flip();
_engine->_input->enableKeyMap(uiKeyMapId);
}
@@ -122,7 +119,6 @@ void MenuOptions::showEndSequence() {
_engine->_screens->clearScreen();
_engine->setPalette(_engine->_screens->paletteRGBA);
- _engine->flip();
}
void MenuOptions::drawSelectableCharacter(int32 x, int32 y, Common::Rect &dirtyRect) {
@@ -258,7 +254,6 @@ bool MenuOptions::enterText(TextId textIdx, char *textTargetBuf, size_t bufSize)
const int halfScreenWidth = (_engine->width() / 2);
_engine->_text->drawText(halfScreenWidth - (_engine->_text->getTextSize(buffer) / 2), 20, buffer);
_engine->copyBlockPhys(0, 0, _engine->width() - 1, 99);
- _engine->flip();
Common::fill(&_onScreenKeyboardDirty[0], &_onScreenKeyboardDirty[ARRAYSIZE(_onScreenKeyboardDirty)], 1);
ScopedFeatureState scopedVirtualKeyboard(OSystem::kFeatureVirtualKeyboard, true);
@@ -354,7 +349,6 @@ bool MenuOptions::enterText(TextId textIdx, char *textTargetBuf, size_t bufSize)
bool MenuOptions::newGameMenu() {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
if (!enterText(TextId::kEnterYourName, saveGameName, sizeof(saveGameName))) {
return false;
}
@@ -407,7 +401,6 @@ int MenuOptions::chooseSave(TextId textIdx, bool showEmptySlots) {
bool MenuOptions::continueGameMenu() {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
const int slot = chooseSave(TextId::kContinueGame);
if (slot >= 0) {
debug("Load slot %i", slot);
@@ -424,7 +417,6 @@ bool MenuOptions::continueGameMenu() {
bool MenuOptions::deleteSaveMenu() {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
const int slot = chooseSave(TextId::kDeleteSaveGame);
if (slot >= 0) {
_engine->wipeSaveSlot(slot);
@@ -435,7 +427,6 @@ bool MenuOptions::deleteSaveMenu() {
bool MenuOptions::saveGameMenu() {
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
const int slot = chooseSave(TextId::kCreateSaveGame, true);
if (slot >= 0) {
// TODO: enter description
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index f1dd78c434..46a308545f 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -717,7 +717,6 @@ void Redraw::redrawEngineActions(bool bgRedraw) {
}
if (bgRedraw) {
- _engine->flip();
moveNextAreas();
_engine->unfreezeTime();
} else {
diff --git a/engines/twine/renderer/screens.cpp b/engines/twine/renderer/screens.cpp
index 84cbd69be0..34cf400ce9 100644
--- a/engines/twine/renderer/screens.cpp
+++ b/engines/twine/renderer/screens.cpp
@@ -80,7 +80,6 @@ void Screens::loadImage(int32 index, int32 paletteIndex, bool fadeIn) {
fadeToPal(pal);
} else {
_engine->setPalette(pal);
- _engine->flip();
}
}
@@ -102,7 +101,6 @@ void Screens::fadeIn(const uint32 *pal) {
}
_engine->setPalette(pal);
- _engine->flip();
}
void Screens::fadeOut(const uint32 *pal) {
@@ -149,7 +147,6 @@ void Screens::adjustPalette(uint8 r, uint8 g, uint8 b, const uint32 *rgbaPal, in
}
_engine->setPalette(pal);
- _engine->flip();
_engine->frontVideoBuffer.update();
}
@@ -186,8 +183,8 @@ void Screens::adjustCrossPalette(const uint32 *pal1, const uint32 *pal2) {
}
_engine->setPalette(pal);
- _engine->flip();
intensity++;
+ _engine->frontVideoBuffer.update();
} while (intensity <= 100);
}
@@ -211,7 +208,6 @@ void Screens::fadeToPal(const uint32 *pal) {
}
_engine->setPalette(pal);
- _engine->flip();
palResetted = false;
}
@@ -223,7 +219,6 @@ void Screens::blackToWhite() {
memset(pal, i, sizeof(pal));
_engine->setPalette(pal);
- _engine->flip();
_engine->frontVideoBuffer.update();
}
}
@@ -233,7 +228,6 @@ void Screens::setBackPal() {
memset(paletteRGBA, 0, sizeof(paletteRGBA));
_engine->setPalette(paletteRGBA);
- _engine->flip();
palResetted = true;
}
diff --git a/engines/twine/resources/resources.cpp b/engines/twine/resources/resources.cpp
index d94895e892..9412fbf693 100644
--- a/engines/twine/resources/resources.cpp
+++ b/engines/twine/resources/resources.cpp
@@ -58,7 +58,6 @@ void Resources::initPalettes() {
_engine->_screens->convertPalToRGBA(_engine->_screens->palette, _engine->_screens->paletteRGBA);
_engine->setPalette(_engine->_screens->paletteRGBA);
- _engine->flip();
}
void Resources::preloadSprites() {
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 6b0c659418..f016929ae3 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -333,7 +333,6 @@ void GameState::processFoundItem(InventoryItems item) {
const int32 itemZ = (_engine->_scene->sceneHero->pos.z + BRICK_HEIGHT) / BRICK_SIZE;
_engine->_grid->drawOverModelActor(itemX, itemY, itemZ);
- _engine->flip();
_engine->_renderer->projectPositionOnScreen(bodyX, bodyY, bodyZ);
_engine->_renderer->projPos.y -= 150;
@@ -487,7 +486,6 @@ void GameState::processGameoverAnimation() {
// TODO: inSceneryView
_engine->setPalette(_engine->_screens->paletteRGBA);
- _engine->flip();
_engine->_screens->copyScreen(_engine->frontVideoBuffer, _engine->workVideoBuffer);
BodyData gameOverPtr;
if (!gameOverPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_GAMEOVERMDL)) {
@@ -529,7 +527,6 @@ void GameState::processGameoverAnimation() {
_engine->_interface->resetClip();
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
- _engine->flip();
initEngineProjections();
_engine->lbaTime = tmpLbaTime;
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index 05f975f19d..fba05918c5 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -504,7 +504,8 @@ bool Grid::drawSprite(int32 posX, int32 posY, const SpriteData &ptr) {
return false;
}
- _engine->frontVideoBuffer.transBlitFrom(ptr.surface(), Common::Point(left, top));
+ const Common::Point pos(left, top);
+ _engine->frontVideoBuffer.transBlitFrom(ptr.surface(), pos);
return true;
}
@@ -584,6 +585,10 @@ bool Grid::drawBrickSprite(int32 index, int32 posX, int32 posY, const uint8 *ptr
x = left;
}
}
+
+ Common::Rect rect(left, top, right, bottom);
+ _engine->frontVideoBuffer.addDirtyRect(rect);
+
return true;
}
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index bbb5792d48..2a8afbb77b 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1209,7 +1209,6 @@ static int32 lPLAY_FLA(TwinEEngine *engine, LifeScriptContext &ctx) {
engine->_flaMovies->playFlaMovie(movie);
engine->setPalette(engine->_screens->paletteRGBA);
engine->_screens->clearScreen();
- engine->flip();
return 0;
}
@@ -1563,7 +1562,6 @@ static int32 lSET_DARK_PAL(TwinEEngine *engine, LifeScriptContext &ctx) {
if (!engine->_screens->lockPalette) {
engine->_screens->convertPalToRGBA(engine->_screens->palette, engine->_screens->paletteRGBA);
engine->setPalette(engine->_screens->paletteRGBA);
- engine->flip();
}
engine->_screens->useAlternatePalette = true;
return 0;
@@ -1577,7 +1575,6 @@ static int32 lSET_NORMAL_PAL(TwinEEngine *engine, LifeScriptContext &ctx) {
engine->_screens->useAlternatePalette = false;
if (!engine->_screens->lockPalette) {
engine->setPalette(engine->_screens->mainPaletteRGBA);
- engine->flip();
}
return 0;
}
@@ -1602,7 +1599,6 @@ static int32 lMESSAGE_SENDELL(TwinEEngine *engine, LifeScriptContext &ctx) {
engine->_screens->fadeToBlack(engine->_screens->paletteRGBACustom);
engine->_screens->clearScreen();
engine->setPalette(engine->_screens->paletteRGBA);
- engine->flip();
return 0;
}
@@ -1692,7 +1688,6 @@ static int32 lPROJ_ISO(TwinEEngine *engine, LifeScriptContext &ctx) {
static int32 lPROJ_3D(TwinEEngine *engine, LifeScriptContext &ctx) {
// TODO: only used for credits scene? If not, then move the credits related code into the menu->showCredits method
engine->_screens->copyScreen(engine->frontVideoBuffer, engine->workVideoBuffer);
- engine->flip();
engine->_scene->enableGridTileRendering = false;
engine->_renderer->setCameraPosition(engine->width() / 2, engine->height() / 2, 128, 1024, 1024);
diff --git a/engines/twine/script/script_move_v1.cpp b/engines/twine/script/script_move_v1.cpp
index a64c93dd48..fb11299a82 100644
--- a/engines/twine/script/script_move_v1.cpp
+++ b/engines/twine/script/script_move_v1.cpp
@@ -585,7 +585,6 @@ static int32 mPLAY_FLA(TwinEEngine *engine, MoveScriptContext &ctx) {
engine->_flaMovies->playFlaMovie(movie);
engine->setPalette(engine->_screens->paletteRGBA);
engine->_screens->clearScreen();
- engine->flip();
return 0;
}
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 6b259ccf8d..c999dc0301 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -114,8 +114,15 @@ FrameMarker::~FrameMarker() {
g_system->delayMillis(waitMillis);
}
+TwineScreen::TwineScreen(TwinEEngine *engine) : _engine(engine) {
+}
+
+void TwineScreen::update() {
+ Super::update();
+}
+
TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flags, TwineGameType gameType)
- : Engine(system), _gameType(gameType), _gameLang(language), _gameFlags(flags), _rnd("twine") {
+ : Engine(system), _gameType(gameType), _gameLang(language), frontVideoBuffer(this), _gameFlags(flags), _rnd("twine") {
// Add default file directories
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "fla");
@@ -578,7 +585,6 @@ void TwinEEngine::processBookOfBu() {
_screens->fadeToBlack(_screens->paletteRGBACustom);
_screens->clearScreen();
setPalette(_screens->paletteRGBA);
- flip();
_screens->lockPalette = true;
}
@@ -1064,15 +1070,11 @@ void TwinEEngine::setPalette(uint startColor, uint numColors, const byte *palett
frontVideoBuffer.setPalette(palette, startColor, numColors);
}
-void TwinEEngine::flip() {
- frontVideoBuffer.makeAllDirty();
+void TwinEEngine::copyBlockPhys(const Common::Rect &rect) {
+ copyBlockPhys(rect.left, rect.top, rect.right, rect.bottom);
}
-void TwinEEngine::copyBlockPhys(const Common::Rect &rect, bool updateScreen) {
- copyBlockPhys(rect.left, rect.top, rect.right, rect.bottom, updateScreen);
-}
-
-void TwinEEngine::copyBlockPhys(int32 left, int32 top, int32 right, int32 bottom, bool updateScreen) {
+void TwinEEngine::copyBlockPhys(int32 left, int32 top, int32 right, int32 bottom) {
assert(left <= right);
assert(top <= bottom);
int32 width = right - left + 1;
@@ -1087,9 +1089,6 @@ void TwinEEngine::copyBlockPhys(int32 left, int32 top, int32 right, int32 bottom
return;
}
frontVideoBuffer.addDirtyRect(Common::Rect(left, top, right, bottom));
- if (updateScreen) {
- frontVideoBuffer.update();
- }
}
void TwinEEngine::crossFade(const Graphics::ManagedSurface &buffer, const uint32 *palette) {
@@ -1113,12 +1112,10 @@ void TwinEEngine::crossFade(const Graphics::ManagedSurface &buffer, const uint32
surfaceTable.blitFrom(backupSurface);
surfaceTable.transBlitFrom(newSurface, 0, false, 0, i * NUMOFCOLORS / 8);
frontVideoBuffer.blitFrom(surfaceTable);
- flip();
delaySkip(50);
}
frontVideoBuffer.blitFrom(newSurface);
- flip();
backupSurface.free();
newSurface.free();
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index d3c70a85df..fa16aaeffb 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -177,6 +177,17 @@ public:
~FrameMarker();
};
+class TwineScreen : public Graphics::Screen {
+private:
+ using Super = Graphics::Screen;
+ TwinEEngine *_engine;
+
+public:
+ TwineScreen(TwinEEngine *engine);
+
+ void update() override;
+};
+
class TwinEEngine : public Engine {
private:
int32 _isTimeFreezed = 0;
@@ -291,7 +302,7 @@ public:
/** Work video buffer */
Graphics::ManagedSurface workVideoBuffer;
/** Main game video buffer */
- Graphics::Screen frontVideoBuffer;
+ TwineScreen frontVideoBuffer;
int32 loopInventoryItem = 0;
int32 loopActorStep = 0;
@@ -330,19 +341,15 @@ public:
*/
void setPalette(uint startColor, uint numColors, const byte *palette);
- /** Blit surface in the screen */
- void flip();
-
/**
* Blit surface in the screen in a determinate area
* @param left left position to start copy
* @param top top position to start copy
* @param right right position to start copy
* @param bottom bottom position to start copy
- * @param updateScreen Perform blitting to screen if @c true, otherwise just prepare the blit
*/
- void copyBlockPhys(int32 left, int32 top, int32 right, int32 bottom, bool updateScreen = false);
- void copyBlockPhys(const Common::Rect &rect, bool updateScreen = false);
+ void copyBlockPhys(int32 left, int32 top, int32 right, int32 bottom);
+ void copyBlockPhys(const Common::Rect &rect);
/** Cross fade feature
* @param buffer screen buffer
Commit: 0c826f8a2a238fd0846db9e92117217cc3a10cc1
https://github.com/scummvm/scummvm/commit/0c826f8a2a238fd0846db9e92117217cc3a10cc1
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-06-03T22:07:26+02:00
Commit Message:
TWINE: don't update the screen twice a frame
Changed paths:
engines/twine/twine.cpp
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index c999dc0301..abb88199ac 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -118,6 +118,11 @@ TwineScreen::TwineScreen(TwinEEngine *engine) : _engine(engine) {
}
void TwineScreen::update() {
+ static int lastFrame = 0;
+ if (lastFrame == _engine->frameCounter) {
+ return;
+ }
+ lastFrame = _engine->frameCounter;
Super::update();
}
Commit: 90b490f026d16439ab94a33f5fdd61cc3fec6082
https://github.com/scummvm/scummvm/commit/90b490f026d16439ab94a33f5fdd61cc3fec6082
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-06-03T22:07:26+02:00
Commit Message:
TWINE: fixed showing gif 'animation' replacement
Changed paths:
engines/twine/flamovies.cpp
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 3c74d36293..d82c92eecf 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -343,26 +343,26 @@ void FlaMovies::playGIFMovie(const char *flaName) {
void FlaMovies::playFlaMovie(const char *flaName) {
_engine->_sound->stopSamples();
- if (_engine->cfgfile.Movie == CONF_MOVIE_FLAGIF) {
- playGIFMovie(flaName);
- return;
- }
-
- _engine->_music->stopMusic();
-
Common::String fileNamePath = Common::String::format("%s", flaName);
const size_t n = fileNamePath.findLastOf(".");
if (n != Common::String::npos) {
fileNamePath.erase(n);
}
- fileNamePath += FLA_EXT;
+
+ if (_engine->cfgfile.Movie == CONF_MOVIE_FLAGIF) {
+ playGIFMovie(fileNamePath.c_str());
+ return;
+ }
+
+ _engine->_music->stopMusic();
_fadeOut = -1;
_fadeOutFrames = 0;
_file.close();
- if (!_file.open(fileNamePath)) {
+ if (!_file.open(fileNamePath + FLA_EXT)) {
warning("Failed to open fla movie '%s'", fileNamePath.c_str());
+ playGIFMovie(fileNamePath.c_str());
return;
}
More information about the Scummvm-git-logs
mailing list