[Scummvm-git-logs] scummvm master -> b108f1377e5f603559d0c230a4b4ca0c8ccc55e3
sev-
sev at scummvm.org
Thu May 13 23:02:10 UTC 2021
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:
da75beb668 AUDIO: Added possibility to start MOD playback from a given pattern
51d56fdcea SLUDGE: Implement handling MOD track starting playback position
836825abcf SLUDGE: Merge Parallax stuff back into GraphicsManager
90a998f742 SLUDGE: Added debug ouptut to parallax drawing
98b0fe53bc SLUDGE: Added more debug output to parallax drawing
b108f1377e SLUDGE: Further work on parallax rendering
Commit: da75beb66855c91aca0be7a367557efa3040e806
https://github.com/scummvm/scummvm/commit/da75beb66855c91aca0be7a367557efa3040e806
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-14T01:01:58+02:00
Commit Message:
AUDIO: Added possibility to start MOD playback from a given pattern
Changed paths:
audio/mods/mod_xm_s3m.cpp
audio/mods/mod_xm_s3m.h
diff --git a/audio/mods/mod_xm_s3m.cpp b/audio/mods/mod_xm_s3m.cpp
index 170c9306f6..807f31e153 100644
--- a/audio/mods/mod_xm_s3m.cpp
+++ b/audio/mods/mod_xm_s3m.cpp
@@ -167,7 +167,7 @@ public:
virtual int getRate() const override { return _sampleRate; }
virtual bool endOfData() const override { return _dataLeft <= 0; }
- ModXmS3mStream(Common::SeekableReadStream *stream, int rate, int interpolation);
+ ModXmS3mStream(Common::SeekableReadStream *stream, int initialPos, int rate, int interpolation);
~ModXmS3mStream();
};
@@ -179,7 +179,7 @@ const short ModXmS3mStream::sinetable[] = {
255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24
};
-ModXmS3mStream::ModXmS3mStream(Common::SeekableReadStream *stream, int rate, int interpolation) {
+ModXmS3mStream::ModXmS3mStream(Common::SeekableReadStream *stream, int initialPos, int rate, int interpolation) {
_rampBuf = nullptr;
_playCount = nullptr;
_channels = nullptr;
@@ -200,6 +200,8 @@ ModXmS3mStream::ModXmS3mStream(Common::SeekableReadStream *stream, int rate, int
_initialDataLength = _dataLeft = calculateDuration() * 4; // stereo and uint16
_mixBuffer = nullptr;
_finished = false;
+
+ _seqPos = initialPos;
}
ModXmS3mStream::~ModXmS3mStream() {
@@ -1369,8 +1371,8 @@ void ModXmS3mStream::setSequencePos(int pos) {
namespace Audio {
-RewindableAudioStream *makeModXmS3mStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, int rate, int interpolation) {
- Modules::ModXmS3mStream *soundStream = new Modules::ModXmS3mStream(stream, rate, interpolation);
+RewindableAudioStream *makeModXmS3mStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, int initialPos, int rate, int interpolation) {
+ Modules::ModXmS3mStream *soundStream = new Modules::ModXmS3mStream(stream, initialPos, rate, interpolation);
if (disposeAfterUse == DisposeAfterUse::YES)
delete stream;
diff --git a/audio/mods/mod_xm_s3m.h b/audio/mods/mod_xm_s3m.h
index c778d24ed5..a025da59e2 100644
--- a/audio/mods/mod_xm_s3m.h
+++ b/audio/mods/mod_xm_s3m.h
@@ -82,11 +82,13 @@ class AudioStream;
*
* @param stream the ReadStream from which to read the tracker sound data
* @param disposeAfterUse whether to delete the stream after use
+ * @param initialPos initial track to start playback from
* @param rate sample rate
* @param interpolation interpolation effect level
*/
RewindableAudioStream *makeModXmS3mStream(Common::SeekableReadStream *stream,
DisposeAfterUse::Flag disposeAfterUse,
+ int initialPos = 0,
int rate = 48000, int interpolation = 0);
} // End of namespace Audio
Commit: 51d56fdcea5d24816bbe1c6af5dbbf1ce8a17b2e
https://github.com/scummvm/scummvm/commit/51d56fdcea5d24816bbe1c6af5dbbf1ce8a17b2e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-14T01:01:58+02:00
Commit Message:
SLUDGE: Implement handling MOD track starting playback position
Changed paths:
engines/sludge/sound.cpp
diff --git a/engines/sludge/sound.cpp b/engines/sludge/sound.cpp
index 4b3411692e..7f2fe55460 100644
--- a/engines/sludge/sound.cpp
+++ b/engines/sludge/sound.cpp
@@ -224,7 +224,7 @@ bool SoundManager::playMOD(int f, int a, int fromTrack) {
if (memImage->size() != (int)length || readStream->err()) {
return fatal("Sound reading failed");
}
- Audio::LoopingAudioStream *stream = new Audio::LoopingAudioStream(Audio::makeModXmS3mStream(memImage, DisposeAfterUse::NO), 0, DisposeAfterUse::YES);
+ Audio::LoopingAudioStream *stream = new Audio::LoopingAudioStream(Audio::makeModXmS3mStream(memImage, DisposeAfterUse::NO, fromTrack), 0, DisposeAfterUse::YES, false);
if (stream) {
// play sound
Commit: 836825abcfe4969ab35cb91f21c8ddb831bd4ef7
https://github.com/scummvm/scummvm/commit/836825abcfe4969ab35cb91f21c8ddb831bd4ef7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-14T01:01:58+02:00
Commit Message:
SLUDGE: Merge Parallax stuff back into GraphicsManager
Changed paths:
R engines/sludge/backdrop.h
engines/sludge/backdrop.cpp
engines/sludge/cursors.cpp
engines/sludge/event.cpp
engines/sludge/event.h
engines/sludge/freeze.cpp
engines/sludge/freeze.h
engines/sludge/graphics.cpp
engines/sludge/graphics.h
engines/sludge/main_loop.cpp
engines/sludge/people.cpp
engines/sludge/region.cpp
engines/sludge/speech.cpp
engines/sludge/sprites.cpp
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index ccaa015413..6efc4d4605 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -22,7 +22,6 @@
#include "image/png.h"
-#include "sludge/backdrop.h"
#include "sludge/event.h"
#include "sludge/fileset.h"
#include "sludge/graphics.h"
@@ -38,25 +37,25 @@
namespace Sludge {
-Parallax::Parallax() {
- _parallaxLayers.clear();
-}
-
-Parallax::~Parallax() {
- kill();
-}
+void GraphicsManager::killParallax() {
+ if (!_parallaxLayers)
+ return;
-void Parallax::kill() {
- ParallaxLayers::iterator it;
- for (it = _parallaxLayers.begin(); it != _parallaxLayers.end(); ++it) {
+ for (ParallaxLayers::iterator it = _parallaxLayers->begin(); it != _parallaxLayers->end(); ++it) {
(*it)->surface.free();
delete (*it);
(*it) = nullptr;
}
- _parallaxLayers.clear();
+ _parallaxLayers->clear();
+
+ delete _parallaxLayers;
+ _parallaxLayers = nullptr;
}
-bool Parallax::add(uint16 v, uint16 fracX, uint16 fracY) {
+bool GraphicsManager::loadParallax(uint16 v, uint16 fracX, uint16 fracY) {
+ if (!_parallaxLayers)
+ _parallaxLayers = new ParallaxLayers;
+
setResourceForFatal(v);
if (!g_sludge->_resMan->openFileFromNum(v))
return fatal("Can't open parallax image");
@@ -65,7 +64,7 @@ bool Parallax::add(uint16 v, uint16 fracX, uint16 fracY) {
if (!checkNew(nP))
return false;
- _parallaxLayers.push_back(nP);
+ _parallaxLayers->push_back(nP);
if (!ImgLoader::loadImage(v, "parallax", g_sludge->_resMan->getData(), &nP->surface, 0))
return false;
@@ -112,21 +111,23 @@ bool Parallax::add(uint16 v, uint16 fracX, uint16 fracY) {
return true;
}
-void Parallax::draw() {
- // draw parallaxStuff
- if (!_parallaxLayers.empty()) {
+void GraphicsManager::drawParallax() {
+ if (!_parallaxLayers || _parallaxLayers->empty())
+ return;
+
// TODO: simulate image repeating effect
warning("Drawing parallaxStuff");
#if 0
// display parallax from bottom to top
- ParallaxLayers::iterator it;
- for (it = _parallax.begin(); it != _parallax.end(); ++it) {
- (*it)->cameraX = sortOutPCamera(cameraX, (*it)->fractionX, (int)(sceneWidth - (float)winWidth / cameraZoom), (int)((*it)->surface.w - (float)winWidth / cameraZoom));
- (*it)->cameraY = sortOutPCamera(cameraY, (*it)->fractionY, (int)(sceneHeight - (float)winHeight / cameraZoom), (int)((*it)->surface.h - (float)winHeight / cameraZoom));
+ for (ParallaxLayers::iterator it it = _parallax.begin(); it != _parallax.end(); ++it) {
+ (*it)->cameraX = sortOutPCamera(cameraX, (*it)->fractionX, (int)(_sceneWidth - (float)winWidth / cameraZoom), (int)((*it)->surface.w - (float)winWidth / cameraZoom));
+ (*it)->cameraY = sortOutPCamera(cameraY, (*it)->fractionY, (int)(_sceneHeight - (float)winHeight / cameraZoom), (int)((*it)->surface.h - (float)winHeight / cameraZoom));
uint w = ((*it)->wrapS) ? sceneWidth : (*it)->surface.w;
uint h = ((*it)->wrapT) ? sceneHeight : (*it)->surface.h;
+ warning("camX: %d camY: %d dims: %d x %d sceneDims: %d x %d", (*it)->cameraX, (*it)->cameraY, w, h, _sceneWidth, _sceneHeight);
+
const GLfloat vertices[] = {
(GLfloat) - (*it)->cameraX, (GLfloat) - (*it)->cameraY, 0.1f,
w - (*it)->cameraX, (GLfloat) - (*it)->cameraY, 0.1f,
@@ -144,12 +145,11 @@ void Parallax::draw() {
}
#endif
- }
}
-void Parallax::save(Common::WriteStream *stream) {
+void GraphicsManager::saveParallax(Common::WriteStream *stream) {
ParallaxLayers::iterator it;
- for (it = _parallaxLayers.begin(); it != _parallaxLayers.end(); ++it) {
+ for (it = _parallaxLayers->begin(); it != _parallaxLayers->end(); ++it) {
stream->writeByte(1);
stream->writeUint16BE((*it)->fileNum);
stream->writeUint16BE((*it)->fractionX);
diff --git a/engines/sludge/backdrop.h b/engines/sludge/backdrop.h
deleted file mode 100644
index 027707a42c..0000000000
--- a/engines/sludge/backdrop.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef SLUDGE_BACKDROP_H
-#define SLUDGE_BACKDROP_H
-
-#include "graphics/surface.h"
-
-namespace Common {
-class SeekableReadStream;
-class WriteStream;
-}
-
-namespace Sludge {
-
-/**
- * parallax layers can scroll at different speeds
- * to the background image, giving the illusion of
- * depth to a scene as it moves.
- */
-class Parallax {
-public:
- struct ParallaxLayer {
- Graphics::Surface surface;
- int speedX, speedY;
- bool wrapS, wrapT;
- uint16 fileNum, fractionX, fractionY;
- int cameraX, cameraY;
- };
- typedef Common::List<ParallaxLayer *> ParallaxLayers;
-
- Parallax();
- ~Parallax();
-
- void kill();
- bool add(uint16 v, uint16 fracX, uint16 fracY);
- void save(Common::WriteStream *fp);
- void draw();
-private:
- ParallaxLayers _parallaxLayers;
-
- inline int sortOutPCamera(int cX, int fX, int sceneMax, int boxMax) {
- return (fX == 65535) ? (sceneMax ? ((cX * boxMax) / sceneMax) : 0) : ((cX * fX) / 100);
- }
-};
-
-} // End of namespace Sludge
-
-#endif
diff --git a/engines/sludge/cursors.cpp b/engines/sludge/cursors.cpp
index d53a05764a..32601e35b7 100644
--- a/engines/sludge/cursors.cpp
+++ b/engines/sludge/cursors.cpp
@@ -24,8 +24,8 @@
#include "sludge/cursors.h"
#include "sludge/event.h"
-#include "sludge/freeze.h"
#include "sludge/graphics.h"
+#include "sludge/freeze.h"
#include "sludge/newfatal.h"
#include "sludge/people.h"
#include "sludge/sludge.h"
diff --git a/engines/sludge/event.cpp b/engines/sludge/event.cpp
index 0269c8abea..43662c2b75 100644
--- a/engines/sludge/event.cpp
+++ b/engines/sludge/event.cpp
@@ -24,9 +24,9 @@
#include "common/system.h"
#include "sludge/event.h"
+#include "sludge/graphics.h"
#include "sludge/freeze.h"
#include "sludge/function.h"
-#include "sludge/graphics.h"
#include "sludge/newfatal.h"
#include "sludge/objtypes.h"
#include "sludge/region.h"
diff --git a/engines/sludge/event.h b/engines/sludge/event.h
index 77304f2cda..5d58f44380 100644
--- a/engines/sludge/event.h
+++ b/engines/sludge/event.h
@@ -23,6 +23,11 @@
#ifndef SLUDGE_EVENT_H
#define SLUDGE_EVENT_H
+namespace Common {
+class SeekableReadStream;
+class WriteStream;
+}
+
namespace Sludge {
struct FrozenStuffStruct;
diff --git a/engines/sludge/freeze.cpp b/engines/sludge/freeze.cpp
index c201db8936..f24c5f6ec9 100644
--- a/engines/sludge/freeze.cpp
+++ b/engines/sludge/freeze.cpp
@@ -20,11 +20,10 @@
*
*/
-#include "sludge/backdrop.h"
#include "sludge/cursors.h"
#include "sludge/event.h"
-#include "sludge/freeze.h"
#include "sludge/graphics.h"
+#include "sludge/freeze.h"
#include "sludge/newfatal.h"
#include "sludge/people.h"
#include "sludge/region.h"
@@ -64,8 +63,9 @@ bool GraphicsManager::freeze() {
newFreezer->lightMapSurface.copyFrom(_lightMap);
newFreezer->lightMapNumber = _lightMapNumber;
- newFreezer->parallaxStuff = _parallaxStuff;
- _parallaxStuff = NULL;
+ newFreezer->parallaxLayers = _parallaxLayers;
+ _parallaxLayers = NULL;
+
newFreezer->zBufferSprites = _zBuffer->sprites;
newFreezer->zBufferNumber = _zBuffer->originalNum;
newFreezer->zPanels = _zBuffer->numPanels;
@@ -148,7 +148,8 @@ void GraphicsManager::unfreeze(bool killImage) {
}
killParallax();
- _parallaxStuff = _frozenStuff->parallaxStuff;
+ _parallaxLayers = _frozenStuff->parallaxLayers;
+
_vm->_cursorMan->resotre(_frozenStuff);
_vm->_statusBar->restoreBarStuff(_frozenStuff->frozenStatus);
_vm->_evtMan->restore(_frozenStuff);
diff --git a/engines/sludge/freeze.h b/engines/sludge/freeze.h
index 4a7740887f..caf77c3b65 100644
--- a/engines/sludge/freeze.h
+++ b/engines/sludge/freeze.h
@@ -46,7 +46,7 @@ struct FrozenStuffStruct {
Graphics::Surface lightMapSurface;
Graphics::Surface *zBufferSprites;
int zPanels;
- Parallax *parallaxStuff;
+ ParallaxLayers *parallaxLayers;
int lightMapNumber, zBufferNumber;
SpeechStruct *speech;
StatusStuff *frozenStatus;
diff --git a/engines/sludge/graphics.cpp b/engines/sludge/graphics.cpp
index 3a453a0ab4..3ed9b8404e 100644
--- a/engines/sludge/graphics.cpp
+++ b/engines/sludge/graphics.cpp
@@ -24,10 +24,9 @@
#include "engines/util.h"
-#include "sludge/backdrop.h"
#include "sludge/event.h"
-#include "sludge/freeze.h"
#include "sludge/graphics.h"
+#include "sludge/freeze.h"
#include "sludge/newfatal.h"
#include "sludge/sludge.h"
#include "sludge/sludger.h"
@@ -53,8 +52,7 @@ void GraphicsManager::init() {
_lightMapMode = LIGHTMAPMODE_PIXEL;
_lightMapNumber = 0;
- // Parallax
- _parallaxStuff = new Parallax;
+ _parallaxLayers = nullptr;
// Camera
_cameraZoom = 1.0;
@@ -95,12 +93,7 @@ void GraphicsManager::init() {
}
void GraphicsManager::kill() {
- // kill parallax
- if (_parallaxStuff) {
- _parallaxStuff->kill();
- delete _parallaxStuff;
- _parallaxStuff = nullptr;
- }
+ killParallax();
// kill frozen stuff
FrozenStuffStruct *killMe = _frozenStuff;
@@ -175,28 +168,6 @@ void GraphicsManager::clear() {
_renderSurface.format.RGBToColor(0, 0, 0));
}
-bool GraphicsManager::loadParallax(uint16 v, uint16 fracX, uint16 fracY) {
- if (!_parallaxStuff)
- _parallaxStuff = new Parallax;
- return _parallaxStuff->add(v, fracX, fracY);
-}
-
-void GraphicsManager::killParallax() {
- if (!_parallaxStuff)
- return;
- _parallaxStuff->kill();
-}
-
-void GraphicsManager::saveParallax(Common::WriteStream *fp) {
- if (_parallaxStuff)
- _parallaxStuff->save(fp);
-}
-
-void GraphicsManager::drawParallax() {
- if (_parallaxStuff)
- _parallaxStuff->draw();
-}
-
void GraphicsManager::aimCamera(int cameraX, int cameraY) {
_cameraX = cameraX;
_cameraY = cameraY;
diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h
index 2a103b12ff..d702b8c3a3 100644
--- a/engines/sludge/graphics.h
+++ b/engines/sludge/graphics.h
@@ -52,6 +52,16 @@ enum ELightMapMode {
LIGHTMAPMODE_NUM
};
+// Parallax
+struct ParallaxLayer {
+ Graphics::Surface surface;
+ int speedX, speedY;
+ bool wrapS, wrapT;
+ uint16 fileNum, fractionX, fractionY;
+ int cameraX, cameraY;
+};
+typedef Common::List<ParallaxLayer *> ParallaxLayers;
+
class GraphicsManager {
public:
GraphicsManager(SludgeEngine *vm);
@@ -191,9 +201,6 @@ private:
int _lightMapNumber;
Graphics::Surface _lightMap;
- // Parallax
- Parallax *_parallaxStuff;
-
// Camera
float _cameraZoom;
int _cameraX, _cameraY;
@@ -234,6 +241,13 @@ private:
// Transition
byte _brightnessLevel;
byte _fadeMode;
+
+ // Parallax
+ ParallaxLayers *_parallaxLayers;
+
+ inline int sortOutPCamera(int cX, int fX, int sceneMax, int boxMax) {
+ return (fX == 65535) ? (sceneMax ? ((cX * boxMax) / sceneMax) : 0) : ((cX * fX) / 100);
+ }
};
} // End of namespace Sludge
diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp
index 96e384518a..f3810c3271 100644
--- a/engines/sludge/main_loop.cpp
+++ b/engines/sludge/main_loop.cpp
@@ -20,7 +20,8 @@
*
*/
-#include "sludge/backdrop.h"
+#include "common/system.h"
+
#include "sludge/event.h"
#include "sludge/function.h"
#include "sludge/graphics.h"
diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp
index cbda12370c..a0eda91763 100644
--- a/engines/sludge/people.cpp
+++ b/engines/sludge/people.cpp
@@ -21,9 +21,9 @@
*/
#include "sludge/floor.h"
+#include "sludge/graphics.h"
#include "sludge/freeze.h"
#include "sludge/function.h"
-#include "sludge/graphics.h"
#include "sludge/newfatal.h"
#include "sludge/objtypes.h"
#include "sludge/people.h"
diff --git a/engines/sludge/region.cpp b/engines/sludge/region.cpp
index bb38814c82..948bb6aed8 100644
--- a/engines/sludge/region.cpp
+++ b/engines/sludge/region.cpp
@@ -20,10 +20,9 @@
*
*/
-#include "sludge/backdrop.h"
#include "sludge/event.h"
-#include "sludge/freeze.h"
#include "sludge/graphics.h"
+#include "sludge/freeze.h"
#include "sludge/newfatal.h"
#include "sludge/objtypes.h"
#include "sludge/region.h"
diff --git a/engines/sludge/speech.cpp b/engines/sludge/speech.cpp
index 9ce3f614f2..91495e6eec 100644
--- a/engines/sludge/speech.cpp
+++ b/engines/sludge/speech.cpp
@@ -23,8 +23,8 @@
#include "common/system.h"
#include "sludge/fonttext.h"
-#include "sludge/freeze.h"
#include "sludge/graphics.h"
+#include "sludge/freeze.h"
#include "sludge/moreio.h"
#include "sludge/newfatal.h"
#include "sludge/objtypes.h"
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 0781286b3b..4521707230 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -20,7 +20,6 @@
*
*/
-#include "sludge/backdrop.h"
#include "sludge/event.h"
#include "sludge/fileset.h"
#include "sludge/graphics.h"
Commit: 90a998f7420d649b13a2a6f3fcc7b19433628ff5
https://github.com/scummvm/scummvm/commit/90a998f7420d649b13a2a6f3fcc7b19433628ff5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-14T01:01:58+02:00
Commit Message:
SLUDGE: Added debug ouptut to parallax drawing
Changed paths:
engines/sludge/backdrop.cpp
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index 6efc4d4605..f6be2af214 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -115,36 +115,36 @@ void GraphicsManager::drawParallax() {
if (!_parallaxLayers || _parallaxLayers->empty())
return;
- // TODO: simulate image repeating effect
- warning("Drawing parallaxStuff");
+ // TODO: simulate image repeating effect
+ warning("Drawing parallaxStuff");
+ // display parallax from bottom to top
+ for (ParallaxLayers::iterator it = _parallaxLayers->begin(); it != _parallaxLayers->end(); ++it) {
+ (*it)->cameraX = sortOutPCamera(_cameraX, (*it)->fractionX, (int)(_sceneWidth - (float)_winWidth / _cameraZoom), (int)((*it)->surface.w - (float)_winWidth / _cameraZoom));
+ (*it)->cameraY = sortOutPCamera(_cameraY, (*it)->fractionY, (int)(_sceneHeight - (float)_winHeight / _cameraZoom), (int)((*it)->surface.h - (float)_winHeight / _cameraZoom));
+
+ uint w = ((*it)->wrapS) ? _sceneWidth : (*it)->surface.w;
+ uint h = ((*it)->wrapT) ? _sceneHeight : (*it)->surface.h;
+
+ warning("camX: %d camY: %d dims: %d x %d sceneDims: %d x %d", (*it)->cameraX, (*it)->cameraY, w, h, _sceneWidth, _sceneHeight);
+
#if 0
- // display parallax from bottom to top
- for (ParallaxLayers::iterator it it = _parallax.begin(); it != _parallax.end(); ++it) {
- (*it)->cameraX = sortOutPCamera(cameraX, (*it)->fractionX, (int)(_sceneWidth - (float)winWidth / cameraZoom), (int)((*it)->surface.w - (float)winWidth / cameraZoom));
- (*it)->cameraY = sortOutPCamera(cameraY, (*it)->fractionY, (int)(_sceneHeight - (float)winHeight / cameraZoom), (int)((*it)->surface.h - (float)winHeight / cameraZoom));
-
- uint w = ((*it)->wrapS) ? sceneWidth : (*it)->surface.w;
- uint h = ((*it)->wrapT) ? sceneHeight : (*it)->surface.h;
-
- warning("camX: %d camY: %d dims: %d x %d sceneDims: %d x %d", (*it)->cameraX, (*it)->cameraY, w, h, _sceneWidth, _sceneHeight);
-
- const GLfloat vertices[] = {
- (GLfloat) - (*it)->cameraX, (GLfloat) - (*it)->cameraY, 0.1f,
- w - (*it)->cameraX, (GLfloat) - (*it)->cameraY, 0.1f,
- (GLfloat) - (*it)->cameraX, h - (*it)->cameraY, 0.1f,
- w - (*it)->cameraX, h - (*it)->cameraY, 0.1f
- };
-
- const GLfloat texCoords[] = {
- 0.0f, 0.0f,
- texw, 0.0f,
- 0.0f, texh,
- texw, texh
- };
+ const GLfloat vertices[] = {
+ (GLfloat) - (*it)->cameraX, (GLfloat) - (*it)->cameraY, 0.1f,
+ w - (*it)->cameraX, (GLfloat) - (*it)->cameraY, 0.1f,
+ (GLfloat) - (*it)->cameraX, h - (*it)->cameraY, 0.1f,
+ w - (*it)->cameraX, h - (*it)->cameraY, 0.1f
+ };
+
+ const GLfloat texCoords[] = {
+ 0.0f, 0.0f,
+ texw, 0.0f,
+ 0.0f, texh,
+ texw, texh
+ };
drawQuad(shader.smartScaler, vertices, 1, texCoords);
-
- }
#endif
+
+ }
}
void GraphicsManager::saveParallax(Common::WriteStream *stream) {
Commit: 98b0fe53bc09b178e8ee44cf20a94d47be8e83c9
https://github.com/scummvm/scummvm/commit/98b0fe53bc09b178e8ee44cf20a94d47be8e83c9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-14T01:01:58+02:00
Commit Message:
SLUDGE: Added more debug output to parallax drawing
Changed paths:
engines/sludge/backdrop.cpp
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index f6be2af214..6a86e738cb 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -76,36 +76,24 @@ bool GraphicsManager::loadParallax(uint16 v, uint16 fracX, uint16 fracY) {
// 65535 is the value of AUTOFIT constant in Sludge
if (fracX == 65535) {
nP->wrapS = false;
-// if (nP->surface.w < _winWidth) {
-// fatal("For AUTOFIT parallax backgrounds, the image must be at least as wide as the game window/screen.");
-// return false;
-// }
+ if (nP->surface.w < _winWidth) {
+ fatal("For AUTOFIT parallax backgrounds, the image must be at least as wide as the game window/screen.");
+ return false;
+ }
} else {
nP->wrapS = true;
}
if (fracY == 65535) {
nP->wrapT = false;
-// if (nP->surface.h < _winHeight) {
-// fatal("For AUTOFIT parallax backgrounds, the image must be at least as tall as the game window/screen.");
-// return false;
-// }
+ if (nP->surface.h < _winHeight) {
+ fatal("For AUTOFIT parallax backgrounds, the image must be at least as tall as the game window/screen.");
+ return false;
+ }
} else {
nP->wrapT = true;
}
- // TODO: reinterpret this part
-#if 0
- if (nP->wrapS)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- else
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- if (nP->wrapT)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- else
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-#endif
-
g_sludge->_resMan->finishAccess();
setResourceForFatal(-1);
return true;
@@ -119,13 +107,14 @@ void GraphicsManager::drawParallax() {
warning("Drawing parallaxStuff");
// display parallax from bottom to top
for (ParallaxLayers::iterator it = _parallaxLayers->begin(); it != _parallaxLayers->end(); ++it) {
- (*it)->cameraX = sortOutPCamera(_cameraX, (*it)->fractionX, (int)(_sceneWidth - (float)_winWidth / _cameraZoom), (int)((*it)->surface.w - (float)_winWidth / _cameraZoom));
- (*it)->cameraY = sortOutPCamera(_cameraY, (*it)->fractionY, (int)(_sceneHeight - (float)_winHeight / _cameraZoom), (int)((*it)->surface.h - (float)_winHeight / _cameraZoom));
+ ParallaxLayer *p = *it;
+ p->cameraX = sortOutPCamera(_cameraX, p->fractionX, (int)(_sceneWidth - (float)_winWidth / _cameraZoom), (int)(p->surface.w - (float)_winWidth / _cameraZoom));
+ p->cameraY = sortOutPCamera(_cameraY, p->fractionY, (int)(_sceneHeight - (float)_winHeight / _cameraZoom), (int)(p->surface.h - (float)_winHeight / _cameraZoom));
- uint w = ((*it)->wrapS) ? _sceneWidth : (*it)->surface.w;
- uint h = ((*it)->wrapT) ? _sceneHeight : (*it)->surface.h;
+ uint w = p->wrapS ? _sceneWidth : p->surface.w;
+ uint h = p->wrapT ? _sceneHeight : p->surface.h;
- warning("camX: %d camY: %d dims: %d x %d sceneDims: %d x %d", (*it)->cameraX, (*it)->cameraY, w, h, _sceneWidth, _sceneHeight);
+ warning("camX: %d camY: %d dims: %d x %d sceneDims: %d x %d winDims: %d x %d surf: %d x %d", p->cameraX, p->cameraY, w, h, _sceneWidth, _sceneHeight, _winWidth, _winHeight, p->surface.w, p->surface.h);
#if 0
const GLfloat vertices[] = {
Commit: b108f1377e5f603559d0c230a4b4ca0c8ccc55e3
https://github.com/scummvm/scummvm/commit/b108f1377e5f603559d0c230a4b4ca0c8ccc55e3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-14T01:01:58+02:00
Commit Message:
SLUDGE: Further work on parallax rendering
Changed paths:
engines/sludge/backdrop.cpp
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index 6a86e738cb..698bfcb680 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -103,8 +103,6 @@ void GraphicsManager::drawParallax() {
if (!_parallaxLayers || _parallaxLayers->empty())
return;
- // TODO: simulate image repeating effect
- warning("Drawing parallaxStuff");
// display parallax from bottom to top
for (ParallaxLayers::iterator it = _parallaxLayers->begin(); it != _parallaxLayers->end(); ++it) {
ParallaxLayer *p = *it;
@@ -114,25 +112,15 @@ void GraphicsManager::drawParallax() {
uint w = p->wrapS ? _sceneWidth : p->surface.w;
uint h = p->wrapT ? _sceneHeight : p->surface.h;
- warning("camX: %d camY: %d dims: %d x %d sceneDims: %d x %d winDims: %d x %d surf: %d x %d", p->cameraX, p->cameraY, w, h, _sceneWidth, _sceneHeight, _winWidth, _winHeight, p->surface.w, p->surface.h);
-
-#if 0
- const GLfloat vertices[] = {
- (GLfloat) - (*it)->cameraX, (GLfloat) - (*it)->cameraY, 0.1f,
- w - (*it)->cameraX, (GLfloat) - (*it)->cameraY, 0.1f,
- (GLfloat) - (*it)->cameraX, h - (*it)->cameraY, 0.1f,
- w - (*it)->cameraX, h - (*it)->cameraY, 0.1f
- };
-
- const GLfloat texCoords[] = {
- 0.0f, 0.0f,
- texw, 0.0f,
- 0.0f, texh,
- texw, texh
- };
- drawQuad(shader.smartScaler, vertices, 1, texCoords);
-#endif
+ debugC(1, kSludgeDebugGraphics, "drawParallax(): camX: %d camY: %d dims: %d x %d sceneDims: %d x %d winDims: %d x %d surf: %d x %d", p->cameraX, p->cameraY, w, h, _sceneWidth, _sceneHeight, _winWidth, _winHeight, p->surface.w, p->surface.h);
+ Graphics::TransparentSurface tmp(p->surface, false);
+ for (uint y = 0; y < _sceneHeight; y += p->surface.h) {
+ for (uint x = 0; x < _sceneWidth; x += p->surface.w) {
+ tmp.blit(_renderSurface, x - p->cameraX, y - p->cameraY);
+ debugC(3, kSludgeDebugGraphics, "drawParallax(): blit to: %d, %d", x - p->cameraX, y - p->cameraY);
+ }
+ }
}
}
More information about the Scummvm-git-logs
mailing list