[Scummvm-git-logs] scummvm master -> d534299d384dfe4543208419cb372a63c2891a00
bgK
bastien.bouclet at gmail.com
Tue Sep 12 20:28:31 CEST 2017
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6506b95fce PEGASUS: Call OSystem::updateScreen on each frame
64967c6222 PEGASUS: Reset the Pegasus biochip when toggling the shared screen space
731028460f PEGASUS: Ignore events occuring while the GUI is visible
8e235f07a7 PEGASUS: Disallow loading / saving from the GMM from inner loops
1519b2befc PEGASUS: Free the interface data when destroying the engine
d534299d38 PEGASUS: Don't do virtual calls when fading the screen
Commit: 6506b95fceb603c79bdd67a30bf82739bd7e463e
https://github.com/scummvm/scummvm/commit/6506b95fceb603c79bdd67a30bf82739bd7e463e
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-09-12T20:25:24+02:00
Commit Message:
PEGASUS: Call OSystem::updateScreen on each frame
Fixes the display of OSD information when toggling fullscreen.
Changed paths:
engines/pegasus/cursor.cpp
engines/pegasus/graphics.cpp
engines/pegasus/graphics.h
engines/pegasus/pegasus.cpp
diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp
index 6b7965d..636b520 100644
--- a/engines/pegasus/cursor.cpp
+++ b/engines/pegasus/cursor.cpp
@@ -89,8 +89,6 @@ void Cursor::setCurrentFrameIndex(int32 index) {
} else {
CursorMan.replaceCursor(_info[index].surface->getPixels(), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, _info[index].surface->format.RGBToColor(0xFF, 0xFF, 0xFF), false, &_info[index].surface->format);
}
-
- ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
}
}
@@ -104,13 +102,11 @@ void Cursor::show() {
CursorMan.showMouse(true);
_cursorObscured = false;
- ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
void Cursor::hide() {
CursorMan.showMouse(false);
setCurrentFrameIndex(0);
- ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
void Cursor::hideUntilMoved() {
@@ -125,7 +121,6 @@ void Cursor::useIdleTime() {
_cursorLocation = g_system->getEventManager()->getMousePos();
if (_index != -1 && _cursorObscured)
show();
- ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
}
diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp
index 634b0eb..7748c26 100644
--- a/engines/pegasus/graphics.cpp
+++ b/engines/pegasus/graphics.cpp
@@ -44,7 +44,6 @@ GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) {
_frontLayer = kMaxAvailableOrder;
_firstDisplayElement = _lastDisplayElement = 0;
_workArea.create(640, 480, _vm->_system->getScreenFormat());
- _modifiedScreen = false;
_curSurface = &_workArea;
_erase = false;
_updatesEnabled = true;
@@ -152,8 +151,6 @@ void GraphicsManager::removeDisplayElement(DisplayElement *oldElement) {
}
void GraphicsManager::updateDisplay() {
- bool screenDirty = false;
-
if (!_dirtyRect.isEmpty()) {
// Fill the dirty area with black if erase mode is enabled
if (_erase)
@@ -167,29 +164,18 @@ void GraphicsManager::updateDisplay() {
// but it should work fine for now.
if (bounds.intersects(_dirtyRect) && runner->validToDraw(_backLayer, _frontLayer)) {
runner->draw(bounds);
- screenDirty = true;
}
}
// Copy only the dirty rect to the screen
- if (screenDirty)
- g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height());
+ g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height());
// Clear the dirty rect
_dirtyRect = Common::Rect();
}
- if (_updatesEnabled && (screenDirty || _modifiedScreen))
+ if (_updatesEnabled)
g_system->updateScreen();
-
- _modifiedScreen = false;
-}
-
-void GraphicsManager::clearScreen() {
- Graphics::Surface *screen = g_system->lockScreen();
- screen->fillRect(Common::Rect(0, 0, 640, 480), g_system->getScreenFormat().RGBToColor(0, 0, 0));
- g_system->unlockScreen();
- _modifiedScreen = true;
}
DisplayElement *GraphicsManager::findDisplayElement(const DisplayElementID id) {
@@ -214,10 +200,6 @@ void GraphicsManager::doFadeInSync(const TimeValue time, const TimeScale scale,
_updatesEnabled = true;
}
-void GraphicsManager::markCursorAsDirty() {
- _modifiedScreen = true;
-}
-
void GraphicsManager::newShakePoint(int32 index1, int32 index2, int32 maxRadius) {
int32 index3 = (index1 + index2) >> 1;
diff --git a/engines/pegasus/graphics.h b/engines/pegasus/graphics.h
index 7b48ea4..9ae45c3 100644
--- a/engines/pegasus/graphics.h
+++ b/engines/pegasus/graphics.h
@@ -57,7 +57,6 @@ public:
Graphics::Surface *getCurSurface() { return _curSurface; }
void setCurSurface(Graphics::Surface *surface) { _curSurface = surface; }
Graphics::Surface *getWorkArea() { return &_workArea; }
- void clearScreen();
DisplayElement *findDisplayElement(const DisplayElementID id);
void shakeTheWorld(TimeValue time, TimeScale scale);
void enableErase();
@@ -69,13 +68,10 @@ public:
void doFadeOutSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
void doFadeInSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
-protected:
- void markCursorAsDirty();
-
private:
PegasusEngine *_vm;
- bool _modifiedScreen, _erase;
+ bool _erase;
Common::Rect _dirtyRect;
DisplayOrder _backLayer, _frontLayer;
DisplayElement *_firstDisplayElement, *_lastDisplayElement;
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 1f77caa..7898d0b 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -939,8 +939,9 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) {
} else {
_gfx->doFadeOutSync();
useMenu(0);
- _gfx->clearScreen();
+ _gfx->enableErase();
_gfx->updateDisplay();
+ _gfx->disableErase();
Video::VideoDecoder *video = new Video::QuickTimeDecoder();
if (!video->loadFile(_introDirectory + "/Closing.movie"))
@@ -1655,10 +1656,12 @@ void PegasusEngine::startNewGame() {
GameState.resetGameState();
GameState.setWalkthroughMode(isWalkthrough);
- // TODO: Enable erase
_gfx->doFadeOutSync();
useMenu(0);
+
+ _gfx->enableErase();
_gfx->updateDisplay();
+ _gfx->disableErase();
_gfx->enableUpdates();
createInterface();
Commit: 64967c6222dd4a3eb0589ba970ff27c57f3461bb
https://github.com/scummvm/scummvm/commit/64967c6222dd4a3eb0589ba970ff27c57f3461bb
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-09-12T20:25:24+02:00
Commit Message:
PEGASUS: Reset the Pegasus biochip when toggling the shared screen space
Fixes a crash to debugger in the following case:
- TSA: Select he Pegasus biochip. The recall button is disabled.
- Select the gas canister in the inventory
- Jump to Norad VI
- Press T to show the Pegasus biochip. The recall button is still
incorrectly disabled. Clicking on it triggers an error.
Changed paths:
engines/pegasus/items/biochips/pegasuschip.cpp
engines/pegasus/items/biochips/pegasuschip.h
diff --git a/engines/pegasus/items/biochips/pegasuschip.cpp b/engines/pegasus/items/biochips/pegasuschip.cpp
index c74cc34..574316b 100644
--- a/engines/pegasus/items/biochips/pegasuschip.cpp
+++ b/engines/pegasus/items/biochips/pegasuschip.cpp
@@ -49,6 +49,11 @@ void PegasusChip::select() {
setUpPegasusChip();
}
+void PegasusChip::takeSharedArea() {
+ BiochipItem::takeSharedArea();
+ setUpPegasusChip();
+}
+
void PegasusChip::setUpPegasusChip() {
switch (GameState.getCurrentNeighborhood()) {
case kCaldoriaID:
diff --git a/engines/pegasus/items/biochips/pegasuschip.h b/engines/pegasus/items/biochips/pegasuschip.h
index c4f1e6c..b81df94 100644
--- a/engines/pegasus/items/biochips/pegasuschip.h
+++ b/engines/pegasus/items/biochips/pegasuschip.h
@@ -38,6 +38,8 @@ public:
void select();
+ void takeSharedArea() override;
+
void setUpPegasusChip();
// Called to set up the Pegasus chip when the Pegasus chip is the current chip but does not
Commit: 731028460fe37f534118ba1d30380460f1f9de80
https://github.com/scummvm/scummvm/commit/731028460fe37f534118ba1d30380460f1f9de80
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-09-12T20:25:24+02:00
Commit Message:
PEGASUS: Ignore events occuring while the GUI is visible
Otherwise, pressing escape to close the GMM opens the game's own menu.
Changed paths:
engines/pegasus/input.cpp
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp
index f483403..47ec44a 100644
--- a/engines/pegasus/input.cpp
+++ b/engines/pegasus/input.cpp
@@ -26,6 +26,8 @@
#include "common/events.h"
#include "common/system.h"
+#include "gui/gui-manager.h"
+
#include "pegasus/cursor.h"
#include "pegasus/input.h"
#include "pegasus/pegasus.h"
@@ -148,6 +150,7 @@ void InputDeviceManager::getInput(Input &input, const InputBits filter) {
// Set the console to be requested or not
input.setConsoleRequested(_consoleRequested);
+ _consoleRequested = false;
// WORKAROUND: The original had this in currentBits, but then
// pressing alt would count as an event (and mess up someone
@@ -173,9 +176,14 @@ void InputDeviceManager::waitInput(const InputBits filter) {
}
bool InputDeviceManager::notifyEvent(const Common::Event &event) {
+ if (GUI::GuiManager::instance().isActive()) {
+ // For some reason, the engine hooks in the event system using an EventObserver.
+ // So we need to explicitly ignore events that happen while ScummVM's GUI is open.
+ return false;
+ }
+
// We're mapping from ScummVM events to pegasus events, which
// are based on pippin events.
- _consoleRequested = false;
switch (event.type) {
case Common::EVENT_KEYDOWN:
Commit: 8e235f07a762ea281d0ce366242522b84c518e3b
https://github.com/scummvm/scummvm/commit/8e235f07a762ea281d0ce366242522b84c518e3b
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-09-12T20:25:24+02:00
Commit Message:
PEGASUS: Disallow loading / saving from the GMM from inner loops
InputDeviceManager::pumpEvents is called from neighborhood classes that
are destroyed when loading.
Don't allow loading from that method to prevent use after free bugs.
Changed paths:
engines/pegasus/input.cpp
engines/pegasus/neighborhood/mars/mars.cpp
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp
index 47ec44a..36a84db 100644
--- a/engines/pegasus/input.cpp
+++ b/engines/pegasus/input.cpp
@@ -223,10 +223,18 @@ bool InputDeviceManager::notifyEvent(const Common::Event &event) {
}
void InputDeviceManager::pumpEvents() {
+ PegasusEngine *vm = ((PegasusEngine *)g_engine);
+
+ bool saveAllowed = vm->swapSaveAllowed(false);
+ bool openAllowed = vm->swapLoadAllowed(false);
+
// Just poll for events. notifyEvent() will pick up on them.
Common::Event event;
while (g_system->getEventManager()->pollEvent(event))
;
+
+ vm->swapSaveAllowed(saveAllowed);
+ vm->swapLoadAllowed(openAllowed);
}
int operator==(const Input &arg1, const Input &arg2) {
diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp
index 4329095..6e3795d 100644
--- a/engines/pegasus/neighborhood/mars/mars.cpp
+++ b/engines/pegasus/neighborhood/mars/mars.cpp
@@ -2422,9 +2422,7 @@ void Mars::doCanyonChase() {
_vm->drawScaledFrame(frame, 0, 0);
}
- Common::Event event;
- while (g_system->getEventManager()->pollEvent(event))
- ;
+ InputDevice.pumpEvents();
g_system->delayMillis(10);
}
@@ -3055,9 +3053,7 @@ void Mars::transportToRobotShip() {
_vm->drawScaledFrame(frame, 0, 0);
}
- Common::Event event;
- while (g_system->getEventManager()->pollEvent(event))
- ;
+ InputDevice.pumpEvents();
g_system->delayMillis(10);
}
Commit: 1519b2befcb71ff52f92144406d67ce8a7b76b35
https://github.com/scummvm/scummvm/commit/1519b2befcb71ff52f92144406d67ce8a7b76b35
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-09-12T20:25:24+02:00
Commit Message:
PEGASUS: Free the interface data when destroying the engine
Fixes loading a game from the launcher after returning to the launcher.
Changed paths:
engines/pegasus/pegasus.cpp
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 7898d0b..5f75644 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -98,6 +98,8 @@ PegasusEngine::PegasusEngine(OSystem *syst, const PegasusGameDescription *gamede
}
PegasusEngine::~PegasusEngine() {
+ throwAwayEverything();
+
delete _resFork;
delete _console;
delete _cursor;
Commit: d534299d384dfe4543208419cb372a63c2891a00
https://github.com/scummvm/scummvm/commit/d534299d384dfe4543208419cb372a63c2891a00
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-09-12T20:25:24+02:00
Commit Message:
PEGASUS: Don't do virtual calls when fading the screen
For better performance.
Changed paths:
engines/pegasus/transition.cpp
engines/pegasus/transition.h
diff --git a/engines/pegasus/transition.cpp b/engines/pegasus/transition.cpp
index b6b13be..b22f51f 100644
--- a/engines/pegasus/transition.cpp
+++ b/engines/pegasus/transition.cpp
@@ -34,54 +34,52 @@ ScreenFader::ScreenFader() {
_isBlack = true;
// Initially, assume screens are on at full brightness.
Fader::setFaderValue(100);
- _screen = new Graphics::Surface();
}
ScreenFader::~ScreenFader() {
- _screen->free();
- delete _screen;
+ _screen.free();
}
void ScreenFader::doFadeOutSync(const TimeValue duration, const TimeValue scale, bool isBlack) {
_isBlack = isBlack;
- _screen->copyFrom(*g_system->lockScreen());
+ _screen.copyFrom(*g_system->lockScreen());
g_system->unlockScreen();
FaderMoveSpec spec;
spec.makeTwoKnotFaderSpec(scale, 0, getFaderValue(), duration, 0);
startFaderSync(spec);
- _screen->free();
+ _screen.free();
}
void ScreenFader::doFadeInSync(const TimeValue duration, const TimeValue scale, bool isBlack) {
_isBlack = isBlack;
- _screen->copyFrom(*g_system->lockScreen());
+ _screen.copyFrom(*g_system->lockScreen());
g_system->unlockScreen();
FaderMoveSpec spec;
spec.makeTwoKnotFaderSpec(scale, 0, getFaderValue(), duration, 100);
startFaderSync(spec);
- _screen->free();
+ _screen.free();
}
void ScreenFader::setFaderValue(const int32 value) {
if (value != getFaderValue()) {
Fader::setFaderValue(value);
- if (_screen->getPixels()) {
+ if (_screen.getPixels()) {
// The original game does a gamma fade here using the Mac API. In order to do
// that, it would require an immense amount of CPU processing. This does a
// linear fade instead, which looks fairly well, IMO.
Graphics::Surface *screen = g_system->lockScreen();
- for (uint y = 0; y < _screen->h; y++) {
- for (uint x = 0; x < _screen->w; x++) {
- if (_screen->format.bytesPerPixel == 2)
- WRITE_UINT16(screen->getBasePtr(x, y), fadePixel(READ_UINT16(_screen->getBasePtr(x, y)), value));
+ for (uint y = 0; y < _screen.h; y++) {
+ for (uint x = 0; x < _screen.w; x++) {
+ if (_screen.format.bytesPerPixel == 2)
+ WRITE_UINT16(screen->getBasePtr(x, y), fadePixel(READ_UINT16(_screen.getBasePtr(x, y)), value));
else
- WRITE_UINT32(screen->getBasePtr(x, y), fadePixel(READ_UINT32(_screen->getBasePtr(x, y)), value));
+ WRITE_UINT32(screen->getBasePtr(x, y), fadePixel(READ_UINT32(_screen.getBasePtr(x, y)), value));
}
}
@@ -97,7 +95,7 @@ static inline byte fadeComponent(byte comp, int32 percent) {
uint32 ScreenFader::fadePixel(uint32 color, int32 percent) const {
byte r, g, b;
- g_system->getScreenFormat().colorToRGB(color, r, g, b);
+ _screen.format.colorToRGB(color, r, g, b);
if (_isBlack) {
r = fadeComponent(r, percent);
@@ -109,7 +107,7 @@ uint32 ScreenFader::fadePixel(uint32 color, int32 percent) const {
b = 0xFF - fadeComponent(0xFF - b, percent);
}
- return g_system->getScreenFormat().RGBToColor(r, g, b);
+ return _screen.format.RGBToColor(r, g, b);
}
Transition::Transition(const DisplayElementID id) : FaderAnimation(id) {
diff --git a/engines/pegasus/transition.h b/engines/pegasus/transition.h
index e1f0822..f8cdb3e 100644
--- a/engines/pegasus/transition.h
+++ b/engines/pegasus/transition.h
@@ -47,7 +47,7 @@ public:
private:
bool _isBlack;
uint32 fadePixel(uint32 color, int32 percent) const;
- Graphics::Surface *_screen;
+ Graphics::Surface _screen;
};
// Transitions are faders that range over [0,1000], which makes their
More information about the Scummvm-git-logs
mailing list