[Scummvm-git-logs] scummvm master -> 530206ed338ced09b613d96d9f68f8f6dd18b8d4
yuv422
yuv422 at users.noreply.github.com
Wed Mar 11 22:57:02 UTC 2020
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:
bd463a89d8 DRAGONS: Added support for wrapping backgrounds.
530206ed33 DRAGONS: Fixed bug when showing actors
Commit: bd463a89d8b9b4f853f82120dbd919a7ad594856
https://github.com/scummvm/scummvm/commit/bd463a89d8b9b4f853f82120dbd919a7ad594856
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-03-12T09:56:35+11:00
Commit Message:
DRAGONS: Added support for wrapping backgrounds.
Used for dance battle and castle fog effects
Changed paths:
engines/dragons/scene.cpp
engines/dragons/screen.cpp
engines/dragons/screen.h
diff --git a/engines/dragons/scene.cpp b/engines/dragons/scene.cpp
index ab12d1ef00..bc5e0ed7dd 100644
--- a/engines/dragons/scene.cpp
+++ b/engines/dragons/scene.cpp
@@ -517,7 +517,7 @@ void Scene::drawBgLayer(uint8 layerNumber, Common::Rect rect, Graphics::Surface
rect.bottom += offset.y;
}
// clippedRect.bottom += offset.y < 0 ? -offset.y : 0;
- _screen->copyRectToSurface8bpp(*surface, _screen->getPalette(0), 0, 0, rect, false, _stage->getLayerAlphaMode(layerNumber));
+ _screen->copyRectToSurface8bppWrappedX(*surface, _screen->getPalette(0), rect, _stage->getLayerAlphaMode(layerNumber));
}
ScaleLayer *Scene::getScaleLayer() {
diff --git a/engines/dragons/screen.cpp b/engines/dragons/screen.cpp
index 9a03267399..8a22c4fe9b 100644
--- a/engines/dragons/screen.cpp
+++ b/engines/dragons/screen.cpp
@@ -408,4 +408,30 @@ void Screen::copyRectToSurface8bppWrappedY(const Graphics::Surface &srcSurface,
}
}
+void Screen::copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, byte *palette, Common::Rect srcRect,
+ AlphaBlendMode alpha) {
+ // Copy buffer data to internal buffer
+ const byte *src = (const byte *)srcSurface.getBasePtr(0, 0);
+ int width = srcSurface.w > DRAGONS_SCREEN_WIDTH ? DRAGONS_SCREEN_WIDTH : srcSurface.w;
+ int height = srcRect.height();
+
+ byte *dst = (byte *)_backSurface->getBasePtr(0, 0);
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < width; j++) {
+ int32 srcIdx = (i + srcRect.top) * srcSurface.w + ((j + srcRect.left) % srcSurface.w);
+ uint16 c = READ_LE_UINT16(&palette[src[srcIdx] * 2]);
+ if (c != 0) {
+ if (!(c & 0x8000) || alpha == NONE) {
+ // only copy opaque pixels
+ WRITE_LE_UINT16(&dst[j * 2], c & ~0x8000);
+ } else {
+ WRITE_LE_UINT16(&dst[j * 2], alpha == NORMAL ? alphaBlendRGB555(c, READ_LE_INT16(&dst[j * 2]), 128) : alphaBlendAdditiveRGB555(c, READ_LE_INT16(&dst[j * 2])));
+ // semi-transparent pixels.
+ }
+ }
+ }
+ dst += _backSurface->pitch;
+ }
+}
+
} // End of namespace Dragons
diff --git a/engines/dragons/screen.h b/engines/dragons/screen.h
index 4639a48c04..130a542b98 100644
--- a/engines/dragons/screen.h
+++ b/engines/dragons/screen.h
@@ -56,6 +56,7 @@ public:
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY);
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE);
void copyRectToSurface8bpp(const Graphics::Surface &srcSurface, byte *palette, int destX, int destY, Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE, uint16 scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE);
+ void copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, byte *palette, Common::Rect srcRect, AlphaBlendMode alpha = NONE);
void updateScreen();
void loadPalette(uint16 paletteNum, byte *palette);
byte *getPalette(uint16 paletteNum);
Commit: 530206ed338ced09b613d96d9f68f8f6dd18b8d4
https://github.com/scummvm/scummvm/commit/530206ed338ced09b613d96d9f68f8f6dd18b8d4
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-03-12T09:56:35+11:00
Commit Message:
DRAGONS: Fixed bug when showing actors
Changed paths:
engines/dragons/actor.h
engines/dragons/scriptopcodes.cpp
engines/dragons/sound.cpp
engines/dragons/talk.cpp
diff --git a/engines/dragons/actor.h b/engines/dragons/actor.h
index a6dac1f768..136ce042a0 100644
--- a/engines/dragons/actor.h
+++ b/engines/dragons/actor.h
@@ -43,7 +43,7 @@ enum ActorFlags {
ACTOR_FLAG_80 = 0x80,
ACTOR_FLAG_100 = 0x100,
ACTOR_FLAG_200 = 0x200, // Use screen coordinates not map coordinates.
- ACTOR_FLAG_400 = 0x400,
+ ACTOR_FLAG_400 = 0x400, // Actor is hidden
ACTOR_FLAG_800 = 0x800,
ACTOR_FLAG_1000 = 0x1000,
ACTOR_FLAG_2000 = 0x2000,
diff --git a/engines/dragons/scriptopcodes.cpp b/engines/dragons/scriptopcodes.cpp
index afccc467e5..6b80680f5c 100644
--- a/engines/dragons/scriptopcodes.cpp
+++ b/engines/dragons/scriptopcodes.cpp
@@ -1214,7 +1214,7 @@ void ScriptOpcodes::opShowActor(ScriptOpCall &scriptOpCall) {
}
DragonINI *ini = _vm->getINI(iniId - 1);
- ini->actor->setFlag(ACTOR_FLAG_400);
+ ini->actor->clearFlag(ACTOR_FLAG_400);
}
void ScriptOpcodes::opHideActor(ScriptOpCall &scriptOpCall) {
diff --git a/engines/dragons/sound.cpp b/engines/dragons/sound.cpp
index 491e2854e1..f81e55cfd2 100644
--- a/engines/dragons/sound.cpp
+++ b/engines/dragons/sound.cpp
@@ -89,6 +89,7 @@ void SoundManager::playSpeech(uint32 textIndex) {
error("Failed to open dtspeech.xa");
}
CdIntToPos_0(speechLocation.sectorStart * 32);
+ //TODO move the stream creation logic inside PSXAudioTrack.
fd->seek(((speechLocation.sectorStart * 32) + speechLocation.startOffset) * RAW_CD_SECTOR_SIZE);
PSXAudioTrack *_audioTrack = new PSXAudioTrack(fd, Audio::Mixer::kSpeechSoundType);
for (int i = 0x0; i < speechLocation.sectorEnd - speechLocation.sectorStart; i++) {
diff --git a/engines/dragons/talk.cpp b/engines/dragons/talk.cpp
index 77e018afc9..31f430f417 100644
--- a/engines/dragons/talk.cpp
+++ b/engines/dragons/talk.cpp
@@ -61,7 +61,7 @@ bool Talk::loadText(uint32 textIndex, uint16 *textBuffer, uint16 bufferLength) {
copyTextToBuffer(textBuffer, data + 10 + fileOffset, bufferLength);
bool status = (READ_LE_INT16(data) != 0);
- delete data;
+ free(data);
return status;
}
More information about the Scummvm-git-logs
mailing list