[Scummvm-git-logs] scummvm master -> 79dbb566254eb7fa23c28b6b739bf8ca624bebf8
yinsimei
roseline.yin at gmail.com
Wed Aug 2 17:47:11 CEST 2017
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c4fbb545a6 SLUDGE: Reset zBuffers when blank back drop
44c5f5e474 SLUDGE: Refine debug channels
79dbb56625 SLUDGE: Fix ZBuffer order bug
Commit: c4fbb545a67635f58a7163bf01500f763e25df36
https://github.com/scummvm/scummvm/commit/c4fbb545a67635f58a7163bf01500f763e25df36
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-08-02T17:46:42+02:00
Commit Message:
SLUDGE: Reset zBuffers when blank back drop
Changed paths:
engines/sludge/backdrop.cpp
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index 9bc2a56..701f5db 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -300,6 +300,11 @@ void GraphicsManager::blankScreen(int x1, int y1, int x2, int y2) {
y2 = (int)_sceneHeight;
_backdropSurface.fillRect(Common::Rect(x1, y1, x2, y2), _currentBlankColour);
+
+ // reset zBuffer
+ if (_zBuffer->originalNum >= 0) {
+ setZBuffer(_zBuffer->originalNum);
+ }
}
void GraphicsManager::blankAllScreen() {
@@ -345,6 +350,11 @@ void GraphicsManager::drawHorizontalLine(uint x1, uint y, uint x2) {
void GraphicsManager::darkScreen() {
Graphics::TransparentSurface tmp(_backdropSurface, false);
tmp.blit(_backdropSurface, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB(0, 255 >> 1, 0, 0));
+
+ // reset zBuffer
+ if (_zBuffer->originalNum >= 0) {
+ setZBuffer(_zBuffer->originalNum);
+ }
}
void GraphicsManager::drawBackDrop() {
Commit: 44c5f5e474f192f2a14b6430ecfe55601027119e
https://github.com/scummvm/scummvm/commit/44c5f5e474f192f2a14b6430ecfe55601027119e
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-08-02T17:46:42+02:00
Commit Message:
SLUDGE: Refine debug channels
Changed paths:
engines/sludge/backdrop.cpp
engines/sludge/fileset.cpp
engines/sludge/hsi.cpp
engines/sludge/imgloader.cpp
engines/sludge/language.cpp
engines/sludge/moreio.cpp
engines/sludge/newfatal.cpp
engines/sludge/sludge.cpp
engines/sludge/sludge.h
engines/sludge/sludger.cpp
engines/sludge/sprbanks.cpp
engines/sludge/sprites.cpp
engines/sludge/variable.cpp
engines/sludge/zbuffer.cpp
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index 701f5db..5622d16 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -235,7 +235,7 @@ void GraphicsManager::killAllBackDrop() {
}
bool GraphicsManager::resizeBackdrop(int x, int y) {
- debug(kSludgeDebugGraphics, "Load HSI");
+ debugC(1, kSludgeDebugGraphics, "Load HSI");
_sceneWidth = x;
_sceneHeight = y;
return reserveBackdrop();
@@ -247,7 +247,7 @@ bool GraphicsManager::killResizeBackdrop(int x, int y) {
}
void GraphicsManager::loadBackDrop(int fileNum, int x, int y) {
- debug(kSludgeDebugGraphics, "Load back drop of num %i at position %i, %i", fileNum, x, y);
+ debugC(1, kSludgeDebugGraphics, "Load back drop of num %i at position %i, %i", fileNum, x, y);
setResourceForFatal(fileNum);
if (!g_sludge->_resMan->openFileFromNum(fileNum)) {
fatal("Can't load overlay image");
@@ -269,7 +269,7 @@ void GraphicsManager::loadBackDrop(int fileNum, int x, int y) {
}
void GraphicsManager::mixBackDrop(int fileNum, int x, int y) {
- debug(kSludgeDebugGraphics, "Mix back drop of num %i at position %i, %i", fileNum, x, y);
+ debugC(1, kSludgeDebugGraphics, "Mix back drop of num %i at position %i, %i", fileNum, x, y);
setResourceForFatal(fileNum);
if (!g_sludge->_resMan->openFileFromNum(fileNum)) {
fatal("Can't load overlay image");
@@ -415,7 +415,7 @@ bool GraphicsManager::loadLightMap(int ssgVersion, Common::SeekableReadStream *s
}
bool GraphicsManager::loadHSI(Common::SeekableReadStream *stream, int x, int y, bool reserve) {
- debug(kSludgeDebugGraphics, "Load HSI");
+ debugC(1, kSludgeDebugGraphics, "Load HSI");
if (reserve) {
killAllBackDrop(); // kill all
}
@@ -439,7 +439,7 @@ bool GraphicsManager::loadHSI(Common::SeekableReadStream *stream, int x, int y,
if (y == IN_THE_CENTRE)
y = (_sceneHeight - realPicHeight) >> 1;
if (x < 0 || x + realPicWidth > _sceneWidth || y < 0 || y + realPicHeight > _sceneHeight) {
- debug(kSludgeDebugGraphics, "Illegal back drop size");
+ debugC(0, kSludgeDebugGraphics, "Illegal back drop size");
return false;
}
@@ -454,7 +454,7 @@ bool GraphicsManager::loadHSI(Common::SeekableReadStream *stream, int x, int y,
}
bool GraphicsManager::mixHSI(Common::SeekableReadStream *stream, int x, int y) {
- debug(kSludgeDebugGraphics, "Load mixHSI");
+ debugC(1, kSludgeDebugGraphics, "Load mixHSI");
Graphics::Surface mixSurface;
if (!ImgLoader::loadImage(stream, &mixSurface, 0))
return false;
diff --git a/engines/sludge/fileset.cpp b/engines/sludge/fileset.cpp
index 4f88fe9..c9cdefd 100644
--- a/engines/sludge/fileset.cpp
+++ b/engines/sludge/fileset.cpp
@@ -181,7 +181,7 @@ void ResourceManager::setFileIndices(uint numLanguages, uint skipBefore) {
skipBefore--;
}
_startOfTextIndex = _bigDataFile->pos() + 4;
- debug(kSludgeDebugDataLoad, "startOfTextIndex: %i", _startOfTextIndex);
+ debugC(2, kSludgeDebugDataLoad, "startOfTextIndex: %i", _startOfTextIndex);
_bigDataFile->seek(_bigDataFile->readUint32LE(), SEEK_SET);
@@ -192,15 +192,15 @@ void ResourceManager::setFileIndices(uint numLanguages, uint skipBefore) {
_startOfSubIndex = _bigDataFile->pos() + 4;
_bigDataFile->seek(_bigDataFile->readUint32LE(), SEEK_CUR);
- debug(kSludgeDebugDataLoad, "startOfSubIndex: %i", _startOfSubIndex);
+ debugC(2, kSludgeDebugDataLoad, "startOfSubIndex: %i", _startOfSubIndex);
_startOfObjectIndex = _bigDataFile->pos() + 4;
_bigDataFile->seek(_bigDataFile->readUint32LE(), SEEK_CUR);
- debug(kSludgeDebugDataLoad, "startOfObjectIndex: %i", _startOfObjectIndex);
+ debugC(2, kSludgeDebugDataLoad, "startOfObjectIndex: %i", _startOfObjectIndex);
// Remember that the data section starts here
_startOfDataIndex = _bigDataFile->pos();
- debug(kSludgeDebugDataLoad, "startOfDataIndex: %i", _startOfDataIndex);
+ debugC(2, kSludgeDebugDataLoad, "startOfDataIndex: %i", _startOfDataIndex);
}
} // End of namespace Sludge
diff --git a/engines/sludge/hsi.cpp b/engines/sludge/hsi.cpp
index e5bb990..cd366ef 100644
--- a/engines/sludge/hsi.cpp
+++ b/engines/sludge/hsi.cpp
@@ -50,9 +50,9 @@ bool HSIDecoder::loadStream(Common::SeekableReadStream &stream) {
int32 transCol = _reserve > 0 ? -1 : 63519;
int n;
uint16 width = stream.readUint16BE();
- debug(kSludgeDebugGraphics, "picWidth : %i", width);
+ debugC(2, kSludgeDebugGraphics, "picWidth : %i", width);
uint16 height = stream.readUint16BE();
- debug(kSludgeDebugGraphics, "picHeight : %i", height);
+ debugC(2, kSludgeDebugGraphics, "picHeight : %i", height);
_surface = new Graphics::Surface();
_surface->create(width, height, *g_sludge->getScreenPixelFormat());
diff --git a/engines/sludge/imgloader.cpp b/engines/sludge/imgloader.cpp
index 002e850..86f6b2f 100644
--- a/engines/sludge/imgloader.cpp
+++ b/engines/sludge/imgloader.cpp
@@ -33,7 +33,7 @@
namespace Sludge {
bool ImgLoader::loadImage(Common::SeekableReadStream *stream, Graphics::Surface *dest, int reserve) {
- debug(kSludgeDebugDataLoad, "Loading image at position: %i", stream->pos());
+ debugC(2, kSludgeDebugDataLoad, "Loading image at position: %i", stream->pos());
int32 start_ptr = stream->pos();
if (!loadPNGImage(stream, dest)) {
stream->seek(start_ptr);
diff --git a/engines/sludge/language.cpp b/engines/sludge/language.cpp
index a446941..858c44d 100644
--- a/engines/sludge/language.cpp
+++ b/engines/sludge/language.cpp
@@ -48,7 +48,7 @@ void LanguageManager::init(Common::File *fp) {
// get number of languages
_numLanguages =
(gameVersion >= VERSION(1, 3)) ? (fp->readByte()) : 0;
- debug(kSludgeDebugDataLoad, "numLanguages : %c", _numLanguages);
+ debugC(2, kSludgeDebugDataLoad, "numLanguages : %c", _numLanguages);
// make language table
_languageTable = new uint[_numLanguages + 1];
@@ -61,12 +61,12 @@ void LanguageManager::init(Common::File *fp) {
for (uint i = 0; i <= _numLanguages; i++) {
_languageTable[i] = i ? fp->readUint16BE() : 0;
- debug(kSludgeDebugDataLoad, "languageTable %i: %i", i, _languageTable[i]);
+ debugC(2, kSludgeDebugDataLoad, "languageTable %i: %i", i, _languageTable[i]);
_languageNames[i].clear();
if (gameVersion >= VERSION(2, 0)) {
if (_numLanguages) {
_languageNames[i] = readString(fp);
- debug(kSludgeDebugDataLoad, "languageName %i: %s\n", i, _languageNames[i].c_str());
+ debugC(2, kSludgeDebugDataLoad, "languageName %i: %s\n", i, _languageNames[i].c_str());
}
}
}
diff --git a/engines/sludge/moreio.cpp b/engines/sludge/moreio.cpp
index bc1c57e..a5c7318 100644
--- a/engines/sludge/moreio.cpp
+++ b/engines/sludge/moreio.cpp
@@ -46,7 +46,7 @@ Common::String readString(Common::SeekableReadStream *stream) {
for (int a = 0; a < len; a++) {
res += (char)(stream->readByte() - 1);
}
- debug(kSludgeDebugDataLoad, "Read string of length %i: %s", len, res.c_str());
+ debugC(2, kSludgeDebugDataLoad, "Read string of length %i: %s", len, res.c_str());
return res;
}
diff --git a/engines/sludge/newfatal.cpp b/engines/sludge/newfatal.cpp
index b86ddb2..673fc02 100644
--- a/engines/sludge/newfatal.cpp
+++ b/engines/sludge/newfatal.cpp
@@ -73,7 +73,7 @@ int checkNew(const void *mem) {
void setFatalInfo(const Common::String &userFunc, const Common::String &BIF) {
g_sludge->fatalInfo = "Currently in this sub: " + userFunc + "\nCalling: " + BIF;
- debug(kSludgeDebugFatal, "%s", g_sludge->fatalInfo.c_str());
+ debugC(0, kSludgeDebugFatal, "%s", g_sludge->fatalInfo.c_str());
}
void setResourceForFatal(int n) {
diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp
index 36b1fa2..18d0e3a 100644
--- a/engines/sludge/sludge.cpp
+++ b/engines/sludge/sludge.cpp
@@ -52,6 +52,10 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc)
DebugMan.addDebugChannel(kSludgeDebugStackMachine, "Stack Machine", "Stack Machine debug level");
DebugMan.addDebugChannel(kSludgeDebugBuiltin, "Built-in", "Built-in debug level");
DebugMan.addDebugChannel(kSludgeDebugGraphics, "Graphics", "Graphics debug level");
+ DebugMan.addDebugChannel(kSludgeDebugZBuffer, "ZBuffer", "ZBuffer debug level");
+
+ DebugMan.enableDebugChannel("Graphics");
+ DebugMan.enableDebugChannel("ZBuffer");
// init graphics
_origFormat = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
diff --git a/engines/sludge/sludge.h b/engines/sludge/sludge.h
index d1dcb92..ada139a 100644
--- a/engines/sludge/sludge.h
+++ b/engines/sludge/sludge.h
@@ -54,7 +54,8 @@ enum {
kSludgeDebugDataLoad = 1 << 1,
kSludgeDebugStackMachine = 1 << 2,
kSludgeDebugBuiltin = 1 << 3,
- kSludgeDebugGraphics = 1 << 4
+ kSludgeDebugGraphics = 1 << 4,
+ kSludgeDebugZBuffer = 1 << 5
};
class SludgeEngine: public Engine {
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index 418ec31..5e00996 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -115,15 +115,13 @@ Common::File *openAndVerify(const Common::String &filename, char extra1, char ex
}
char c;
c = fp->readByte();
- debug(kSludgeDebugDataLoad, "%c", c);
- while ((c = fp->readByte())) {
- debug(kSludgeDebugDataLoad, "%c", c);
- }
+ while ((c = fp->readByte()))
+ ;
int majVersion = fp->readByte();
- debug(kSludgeDebugDataLoad, "majVersion %i", majVersion);
+ debugC(2, kSludgeDebugDataLoad, "majVersion %i", majVersion);
int minVersion = fp->readByte();
- debug(kSludgeDebugDataLoad, "minVersion %i", minVersion);
+ debugC(2, kSludgeDebugDataLoad, "minVersion %i", minVersion);
fileVersion = majVersion * 256 + minVersion;
Common::String txtVer = "";
@@ -150,7 +148,7 @@ bool initSludge(const Common::String &filename) {
char c = fp->readByte();
if (c) {
numBIFNames = fp->readUint16BE();
- debug(kSludgeDebugDataLoad, "numBIFNames %i", numBIFNames);
+ debugC(2, kSludgeDebugDataLoad, "numBIFNames %i", numBIFNames);
allBIFNames = new Common::String[numBIFNames];
if (!checkNew(allBIFNames))
return false;
@@ -160,7 +158,7 @@ bool initSludge(const Common::String &filename) {
allBIFNames[fn] = readString(fp);
}
numUserFunc = fp->readUint16BE();
- debug(kSludgeDebugDataLoad, "numUserFunc %i", numUserFunc);
+ debugC(2, kSludgeDebugDataLoad, "numUserFunc %i", numUserFunc);
allUserFunc = new Common::String[numUserFunc];
if (!checkNew(allUserFunc))
return false;
@@ -171,7 +169,7 @@ bool initSludge(const Common::String &filename) {
}
if (gameVersion >= VERSION(1, 3)) {
numResourceNames = fp->readUint16BE();
- debug(kSludgeDebugDataLoad, "numResourceNames %i",
+ debugC(2, kSludgeDebugDataLoad, "numResourceNames %i",
numResourceNames);
allResourceNames = new Common::String[numResourceNames];
if (!checkNew(allResourceNames))
@@ -185,24 +183,24 @@ bool initSludge(const Common::String &filename) {
}
int winWidth = fp->readUint16BE();
- debug(kSludgeDebugDataLoad, "winWidth : %i", winWidth);
+ debugC(2, kSludgeDebugDataLoad, "winWidth : %i", winWidth);
int winHeight = fp->readUint16BE();
- debug(kSludgeDebugDataLoad, "winHeight : %i", winHeight);
+ debugC(2, kSludgeDebugDataLoad, "winHeight : %i", winHeight);
g_sludge->_gfxMan->setWindowSize(winWidth, winHeight);
int specialSettings = fp->readByte();
- debug(kSludgeDebugDataLoad, "specialSettings : %i", specialSettings);
+ debugC(2, kSludgeDebugDataLoad, "specialSettings : %i", specialSettings);
g_sludge->_timer.setDesiredfps(1000 / fp->readByte());
readString(fp); // Unused - was used for registration purposes.
uint bytes_read = fp->read(&fileTime, sizeof(FILETIME));
if (bytes_read != sizeof(FILETIME) && fp->err()) {
- debug("Reading error in initSludge.");
+ debug(0, "Reading error in initSludge.");
}
Common::String dataFol = (gameVersion >= VERSION(1, 3)) ? readString(fp) : "";
- debug(kSludgeDebugDataLoad, "dataFol : %s", dataFol.c_str());
+ debugC(2, kSludgeDebugDataLoad, "dataFol : %s", dataFol.c_str());
g_sludge->_languageMan->init(fp);
@@ -215,17 +213,17 @@ bool initSludge(const Common::String &filename) {
}
Common::String checker = readString(fp);
- debug(kSludgeDebugDataLoad, "checker : %s", checker.c_str());
+ debugC(2, kSludgeDebugDataLoad, "checker : %s", checker.c_str());
if (checker != "okSoFar")
return fatal(ERROR_BAD_HEADER, filename);
byte customIconLogo = fp->readByte();
- debug(kSludgeDebugDataLoad, "Game icon type: %i", customIconLogo);
+ debugC(2, kSludgeDebugDataLoad, "Game icon type: %i", customIconLogo);
if (customIconLogo & 1) {
// There is an icon - read it!
- debug(kSludgeDebugDataLoad, "There is an icon - read it!");
+ debugC(2, kSludgeDebugDataLoad, "There is an icon - read it!");
// read game icon
Graphics::Surface gameIcon;
@@ -236,7 +234,7 @@ bool initSludge(const Common::String &filename) {
if (customIconLogo & 2) {
// There is an logo - read it!
- debug(kSludgeDebugDataLoad, "There is an logo - read it!");
+ debugC(2, kSludgeDebugDataLoad, "There is an logo - read it!");
// read game logo
Graphics::Surface gameLogo;
@@ -245,7 +243,7 @@ bool initSludge(const Common::String &filename) {
}
numGlobals = fp->readUint16BE();
- debug(kSludgeDebugDataLoad, "numGlobals : %i", numGlobals);
+ debugC(2, kSludgeDebugDataLoad, "numGlobals : %i", numGlobals);
globalVars = new Variable[numGlobals];
if (!checkNew(globalVars))
@@ -414,7 +412,7 @@ bool continueFunction(LoadedFunction *fun) {
while (keepLooping) {
advanceNow = true;
- debug(kSludgeDebugStackMachine, "Executing command line %i : ", fun->runThisLine);
+ debugC(2, kSludgeDebugStackMachine, "Executing command line %i : ", fun->runThisLine);
param = fun->compiledLines[fun->runThisLine].param;
com = fun->compiledLines[fun->runThisLine].theCommand;
// fprintf (stderr, "com: %d param: %d (%s)\n", com, param,
@@ -466,7 +464,7 @@ bool continueFunction(LoadedFunction *fun) {
break;
case SVT_BUILT: {
- debug(kSludgeDebugStackMachine, "Built-in init value: %i",
+ debugC(2, kSludgeDebugStackMachine, "Built-in init value: %i",
fun->reg.varData.intValue);
BuiltReturn br = callBuiltIn(fun->reg.varData.intValue, param,
fun);
@@ -920,16 +918,16 @@ bool loadFunctionCode(LoadedFunction *newFunc) {
if (!g_sludge->_resMan->openSubSlice(newFunc->originalNumber))
return false;
- debug(kSludgeDebugDataLoad, "Load function code");
+ debugC(2, kSludgeDebugDataLoad, "Load function code");
Common::SeekableReadStream *readStream = g_sludge->_resMan->getData();
newFunc->unfreezable = readStream->readByte();
numLines = readStream->readUint16BE();
- debug(kSludgeDebugDataLoad, "numLines: %i", numLines);
+ debugC(2, kSludgeDebugDataLoad, "numLines: %i", numLines);
newFunc->numArgs = readStream->readUint16BE();
- debug(kSludgeDebugDataLoad, "numArgs: %i", newFunc->numArgs);
+ debugC(2, kSludgeDebugDataLoad, "numArgs: %i", newFunc->numArgs);
newFunc->numLocals = readStream->readUint16BE();
- debug(kSludgeDebugDataLoad, "numLocals: %i", newFunc->numLocals);
+ debugC(2, kSludgeDebugDataLoad, "numLocals: %i", newFunc->numLocals);
newFunc->compiledLines = new LineOfCode[numLines];
if (!checkNew(newFunc->compiledLines))
return false;
@@ -937,7 +935,7 @@ bool loadFunctionCode(LoadedFunction *newFunc) {
for (numLinesRead = 0; numLinesRead < numLines; numLinesRead++) {
newFunc->compiledLines[numLinesRead].theCommand = (sludgeCommand)readStream->readByte();
newFunc->compiledLines[numLinesRead].param = readStream->readUint16BE();
- debug(kSludgeDebugDataLoad, "command line %i: %i", numLinesRead,
+ debugC(2, kSludgeDebugDataLoad, "command line %i: %i", numLinesRead,
newFunc->compiledLines[numLinesRead].theCommand);
}
g_sludge->_resMan->finishAccess();
diff --git a/engines/sludge/sprbanks.cpp b/engines/sludge/sprbanks.cpp
index 9cb4a58..265257c 100644
--- a/engines/sludge/sprbanks.cpp
+++ b/engines/sludge/sprbanks.cpp
@@ -46,11 +46,11 @@ LoadedSpriteBank *GraphicsManager::loadBankForAnim(int ID) {
returnMe->ID = ID;
if (loadSpriteBank(ID, returnMe->bank, false)) {
returnMe->timesUsed = 0;
- debug(kSludgeDebugDataLoad, "loadBankForAnim: New sprite bank created OK");
+ debugC(2, kSludgeDebugDataLoad, "loadBankForAnim: New sprite bank created OK");
_allLoadedBanks.push_back(returnMe);
return returnMe;
} else {
- debug(kSludgeDebugDataLoad, "loadBankForAnim: I guess I couldn't load the sprites...");
+ debugC(2, kSludgeDebugDataLoad, "loadBankForAnim: I guess I couldn't load the sprites...");
return nullptr;
}
} else
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index ddea063..ed5691e 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -130,7 +130,7 @@ bool GraphicsManager::loadSpriteBank(int fileNum, SpriteBank &loadhere, bool isF
// version 3, sprite is png
if (spriteBankVersion == 3) {
- debug(kSludgeDebugGraphics, "png sprite");
+ debugC(2, kSludgeDebugGraphics, "png sprite");
for (int i = 0; i < total; i++) {
loadhere.sprites[i].xhot = readStream->readSint16LE();
loadhere.sprites[i].yhot = readStream->readSint16LE();
@@ -416,9 +416,11 @@ void GraphicsManager::resetSpriteLayers(ZBufferData *pz, int x, int y, bool upsi
if (_spriteLayers->numLayers > 0)
killSpriteLayers();
_spriteLayers->numLayers = pz->numPanels;
+ debugC(3, kSludgeDebugZBuffer, "%i zBuffer layers", _spriteLayers->numLayers);
for (int i = 0; i < _spriteLayers->numLayers; ++i) {
SpriteDisplay node(x, y, (upsidedown ? Graphics::FLIP_V : Graphics::FLIP_NONE), &pz->sprites[i], pz->sprites[i].w, pz->sprites[i].h);
_spriteLayers->layer[i].push_back(node);
+ debugC(3, kSludgeDebugZBuffer, "Layer %i is of depth %i", i, pz->panel[i]);
}
}
@@ -430,12 +432,14 @@ void GraphicsManager::addSpriteDepth(Graphics::Surface *ptr, int depth, int x, i
}
}
--i;
+ debugC(3, kSludgeDebugZBuffer, "Add sprite of Y-value : %i in layer %i", depth, i);
SpriteDisplay node(x, y, flip, ptr, width, height, color);
_spriteLayers->layer[i].push_back(node);
}
void GraphicsManager::displaySpriteLayers() {
for (int i = 0; i < _spriteLayers->numLayers; ++i) {
+ debugC(3, kSludgeDebugGraphics, "Display layer %i with %i sprites", i, _spriteLayers->layer[i].size());
Common::List<SpriteDisplay>::iterator it;
for (it = _spriteLayers->layer[i].begin(); it != _spriteLayers->layer[i].end(); ++it) {
Graphics::TransparentSurface tmp(*it->surface, false);
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index 541d13b..4579dc8 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -453,7 +453,7 @@ bool addVarToStack(const Variable &va, VariableStack *&thisStack) {
return false;
newStack->next = thisStack;
thisStack = newStack;
- //debug(kSludgeDebugStackMachine, "Variable %s was added to stack", getTextFromAnyVar(va));
+ //debugC(2, kSludgeDebugStackMachine, "Variable %s was added to stack", getTextFromAnyVar(va));
return true;
}
@@ -469,7 +469,7 @@ bool addVarToStackQuick(Variable &va, VariableStack *&thisStack) {
newStack->next = thisStack;
thisStack = newStack;
- //debug(kSludgeDebugStackMachine, "Variable %s was added to stack quick", getTextFromAnyVar(va));
+ //debugC(2, kSludgeDebugStackMachine, "Variable %s was added to stack quick", getTextFromAnyVar(va));
return true;
}
@@ -544,7 +544,7 @@ void trimStack(VariableStack *&stack) {
VariableStack *killMe = stack;
stack = stack->next;
- //debug(kSludgeDebugStackMachine, "Variable %s was removed from stack", getTextFromAnyVar(killMe->thisVar));
+ //debugC(2, kSludgeDebugStackMachine, "Variable %s was removed from stack", getTextFromAnyVar(killMe->thisVar));
// When calling this, we've ALWAYS checked that stack != NULL
unlinkVar(killMe->thisVar);
diff --git a/engines/sludge/zbuffer.cpp b/engines/sludge/zbuffer.cpp
index a62c5ef..fba6515 100644
--- a/engines/sludge/zbuffer.cpp
+++ b/engines/sludge/zbuffer.cpp
@@ -115,12 +115,14 @@ bool GraphicsManager::setZBuffer(int num) {
}
_zBuffer->numPanels = readStream->readByte();
+ debugC(2, kSludgeDebugZBuffer, "Loading zBuffer : %i panels", _zBuffer->numPanels);
for (int y = 0; y < _zBuffer->numPanels; y++) {
yPalette[y] = readStream->readUint16BE();
}
sortZPal(yPalette, sorted, _zBuffer->numPanels);
for (int y = 0; y < _zBuffer->numPanels; y++) {
_zBuffer->panel[y] = yPalette[sorted[y]];
+ debugC(2, kSludgeDebugZBuffer, "Y-value : %i", _zBuffer->panel[y]);
sortback[sorted[y]] = y;
}
Commit: 79dbb566254eb7fa23c28b6b739bf8ca624bebf8
https://github.com/scummvm/scummvm/commit/79dbb566254eb7fa23c28b6b739bf8ca624bebf8
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-08-02T17:46:42+02:00
Commit Message:
SLUDGE: Fix ZBuffer order bug
Changed paths:
engines/sludge/zbuffer.cpp
diff --git a/engines/sludge/zbuffer.cpp b/engines/sludge/zbuffer.cpp
index fba6515..bc9a1cf 100644
--- a/engines/sludge/zbuffer.cpp
+++ b/engines/sludge/zbuffer.cpp
@@ -77,7 +77,7 @@ bool GraphicsManager::setZBuffer(int num) {
debug (kSludgeDebugGraphics, "Setting zBuffer");
uint32 stillToGo = 0;
- int yPalette[16], sorted[16], sortback[16];
+ int yPalette[16], sorted[16];
killZBuffer();
@@ -123,7 +123,6 @@ bool GraphicsManager::setZBuffer(int num) {
for (int y = 0; y < _zBuffer->numPanels; y++) {
_zBuffer->panel[y] = yPalette[sorted[y]];
debugC(2, kSludgeDebugZBuffer, "Y-value : %i", _zBuffer->panel[y]);
- sortback[sorted[y]] = y;
}
int picWidth = _sceneWidth;
@@ -150,7 +149,7 @@ bool GraphicsManager::setZBuffer(int num) {
}
for (int i = 0; i < _zBuffer->numPanels; ++i) {
byte *target = (byte *)_zBuffer->sprites[i].getBasePtr(x, y);
- if (n && (sortback[i] == n || i == 0)) {
+ if (n && (sorted[i] == n || i == 0)) {
byte *source = (byte *)_backdropSurface.getBasePtr(x, y);
target[0] = source[0];
target[1] = source[1];
More information about the Scummvm-git-logs
mailing list