[Scummvm-git-logs] scummvm master -> 312f0771984dba76a2d2faaf7634deb424096e5c
bluegr
noreply at scummvm.org
Tue Aug 8 14:34:51 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
841d088060 AGI: Use OSystem::setShakePos() for screen shaking
312f077198 COMMON: Fix comments about screen shaking
Commit: 841d088060c25a8123daa575a6533e5f0623b310
https://github.com/scummvm/scummvm/commit/841d088060c25a8123daa575a6533e5f0623b310
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-08-08T17:34:47+03:00
Commit Message:
AGI: Use OSystem::setShakePos() for screen shaking
Changed paths:
engines/agi/graphics.cpp
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index d2e9564e7bb..ad4b373ac6a 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -1191,20 +1191,16 @@ void GfxMgr::drawCharacterOnDisplay(int16 x, int16 y, const byte character, byte
#define SHAKE_VERTICAL_PIXELS 4
#define SHAKE_HORIZONTAL_PIXELS 4
-// Sierra used some EGA port trickery to do it, we have to do it by copying pixels around
+// Sierra used some EGA port trickery to do it, we let the backend take care of it.
//
// Shaking locations:
// - Fanmade "Enclosure" right during the intro
// - Space Quest 2 almost right at the start when getting captured (after walking into the space ship)
void GfxMgr::shakeScreen(int16 repeatCount) {
int shakeNr, shakeCount;
- uint8 *blackSpace;
int16 shakeHorizontalPixels = SHAKE_HORIZONTAL_PIXELS * (2 + _displayWidthMulAdjust);
int16 shakeVerticalPixels = SHAKE_VERTICAL_PIXELS * (1 + _displayHeightMulAdjust);
- if ((blackSpace = (uint8 *)calloc(shakeHorizontalPixels * _displayScreenWidth, 1)) == nullptr)
- return;
-
shakeCount = repeatCount * 8; // effectively 4 shakes per repeat
// it's 4 pixels down and 8 pixels to the right
@@ -1212,18 +1208,13 @@ void GfxMgr::shakeScreen(int16 repeatCount) {
for (shakeNr = 0; shakeNr < shakeCount; shakeNr++) {
if (shakeNr & 1) {
// move back
- copyDisplayToScreen();
+ g_system->setShakePos(0, 0);
} else {
- g_system->copyRectToScreen(_displayScreen, _displayScreenWidth, shakeHorizontalPixels, shakeVerticalPixels, _displayScreenWidth - shakeHorizontalPixels, _displayScreenHeight - shakeVerticalPixels);
- // additionally fill the remaining space with black
- g_system->copyRectToScreen(blackSpace, _displayScreenWidth, 0, 0, _displayScreenWidth, shakeVerticalPixels);
- g_system->copyRectToScreen(blackSpace, shakeHorizontalPixels, 0, 0, shakeHorizontalPixels, _displayScreenHeight);
+ g_system->setShakePos(shakeHorizontalPixels, shakeVerticalPixels);
}
g_system->updateScreen();
g_system->delayMillis(66); // Sierra waited for 4 V'Syncs, which is around 66 milliseconds
}
-
- free(blackSpace);
}
void GfxMgr::updateScreen() {
Commit: 312f0771984dba76a2d2faaf7634deb424096e5c
https://github.com/scummvm/scummvm/commit/312f0771984dba76a2d2faaf7634deb424096e5c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-08-08T17:34:47+03:00
Commit Message:
COMMON: Fix comments about screen shaking
Changed paths:
common/system.h
diff --git a/common/system.h b/common/system.h
index 121a18530fe..958b04715e1 100644
--- a/common/system.h
+++ b/common/system.h
@@ -635,15 +635,15 @@ public:
* than a single pixel on the screen. p_w and p_h are defined to be
* the width and, respectively, height of a game pixel on the screen.
*
- * In addition, there is a vertical "shake offset" (as defined by
- * setShakePos) that is used in some games to provide a shaking
- * effect. Note that shaking is applied to all three layers, i.e.
- * also to the overlay and the mouse. The shake offset is denoted
- * by S.
+ * In addition, there is a horizontal and vertical "shake offset" (as
+ * defined by setShakePos) that are used in some games to provide a
+ * shaking effect. Note that shaking is applied to all three layers,
+ * i.e. also to the overlay and the mouse. The shake offsets are
+ * denoted by XS and YS.
*
* Putting this together, a pixel (x,y) of the game graphics is
* transformed to a rectangle of height p_h and width p_w
- * appearing at position (p_w * x, p_hw * (y + S)) on the real
+ * appearing at position (p_w * (x + XS), p_hw * (y + YS)) on the real
* screen. In addition, a backend may choose to offset
* everything, e.g. to center the graphics on the screen.
*
@@ -1205,9 +1205,9 @@ public:
* Set current shake position, a feature needed for screen effects in some
* engines.
*
- * The effect causes the displayed graphics to be shifted upwards and
- * rightward by the specified offsets (the offsets can be negative to shift
- * downward or leftward). The area at the border of the screen which is
+ * The effect causes the displayed graphics to be shifted downwards and
+ * rightwards by the specified offsets (the offsets can be negative to shift
+ * upwards or leftwards). The area at the border of the screen which is
* moved into view by this (for example at the bottom when moving
* upward) is filled with black. This does not cause any graphic data to
* be lost. To restore the original view, the game engine only has to call
More information about the Scummvm-git-logs
mailing list