aboutsummaryrefslogtreecommitdiff
path: root/engines/tucker
diff options
context:
space:
mode:
authorMax Horn2009-01-16 20:53:43 +0000
committerMax Horn2009-01-16 20:53:43 +0000
commit1082d82ba8d4ab966cba862b57f66ac9e059f656 (patch)
treedf7cfe3989de97f4b16bd8291b5502757b88b202 /engines/tucker
parent9f1ac87466717d2095539ea9a2a37c77698605fc (diff)
downloadscummvm-rg350-1082d82ba8d4ab966cba862b57f66ac9e059f656.tar.gz
scummvm-rg350-1082d82ba8d4ab966cba862b57f66ac9e059f656.tar.bz2
scummvm-rg350-1082d82ba8d4ab966cba862b57f66ac9e059f656.zip
TUCKER: Simplify TuckerEngine::copyLocBitmap
svn-id: r35873
Diffstat (limited to 'engines/tucker')
-rw-r--r--engines/tucker/locations.cpp2
-rw-r--r--engines/tucker/resource.cpp24
-rw-r--r--engines/tucker/tucker.cpp12
-rw-r--r--engines/tucker/tucker.h2
4 files changed, 17 insertions, 23 deletions
diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index d0e380eea4..7c1dbf7709 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -189,7 +189,7 @@ void TuckerEngine::execData3PreUpdate_locationNum2() {
}
if (_flagsTable[10] == 0) {
strcpy(_fileToLoad, "path02b.pcx");
- copyLocBitmap(0, 1);
+ copyLocBitmap(0, true);
}
for (int i = 0; i < 3; ++i) {
if (_updateLocationYPosTable2[i] > 0) {
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index f0441a8bf6..100913952b 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -431,26 +431,26 @@ void TuckerEngine::loadCTable02(int fl) {
void TuckerEngine::loadLoc() {
int i = _locationWidthTable[_locationNum];
_locationHeight = (_locationNum < 73) ? 140 : 200;
- strcpy(_fileToLoad, (i == 1) ? "loc00.pcx" : "loc00a.pcx");
- copyLocBitmap(0, 0);
+ sprintf(_fileToLoad, (i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
+ copyLocBitmap(0, false);
Graphics::copyFrom640(_locationBackgroundGfxBuf, _quadBackgroundGfxBuf, 320, _locationHeight);
if (_locationHeight == 200) {
return;
}
- strcpy(_fileToLoad, (i != 2) ? "path00.pcx" : "path00a.pcx");
- copyLocBitmap(0, 1);
+ sprintf(_fileToLoad, (i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
+ copyLocBitmap(0, true);
if (i > 1) {
- strcpy(_fileToLoad, "loc00b.pcx");
- copyLocBitmap(320, 0);
+ sprintf(_fileToLoad, "loc%02db.pcx", _locationNum);
+ copyLocBitmap(320, false);
Graphics::copyFrom640(_locationBackgroundGfxBuf + 320, _quadBackgroundGfxBuf + 44800, 320, 140);
if (i == 2) {
- strcpy(_fileToLoad, "path00b.pcx");
- copyLocBitmap(320, 1);
+ sprintf(_fileToLoad, "path%02db.pcx", _locationNum);
+ copyLocBitmap(320, true);
}
}
if (i > 2) {
- strcpy(_fileToLoad, "loc00c.pcx");
- copyLocBitmap(0, 0);
+ sprintf(_fileToLoad, "loc%02dc.pcx", _locationNum);
+ copyLocBitmap(0, false);
Graphics::copyFrom640(_locationBackgroundGfxBuf, _quadBackgroundGfxBuf + 89600, 320, 140);
}
if (_locationNum == 1) {
@@ -459,8 +459,8 @@ void TuckerEngine::loadLoc() {
loadImage(_loadLocBufPtr, 0);
}
if (i > 3) {
- strcpy(_fileToLoad, "loc00d.pcx");
- copyLocBitmap(0, 0);
+ sprintf(_fileToLoad, "loc%02dd.pcx", _locationNum);
+ copyLocBitmap(0, false);
Graphics::copyFrom640(_locationBackgroundGfxBuf + 320, _quadBackgroundGfxBuf + 134400, 320, 140);
}
_fullRedrawCounter = 2;
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 873f3e41b9..165ecf4576 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -720,19 +720,13 @@ void TuckerEngine::setupNewLocation() {
}
}
-void TuckerEngine::copyLocBitmap(int offset, int isMask) {
- int type = (isMask == 0) ? 1 : 0;
+void TuckerEngine::copyLocBitmap(int offset, bool isMask) {
+ int type = !isMask ? 1 : 0;
if (offset > 0 && _locationNum == 16) {
type = 0;
}
- if (isMask < 2) {
- char strNum[3];
- sprintf(strNum, "%02d", _locationNum);
- const int digitOffset = (isMask == 0) ? 3 : 4;
- memcpy(_fileToLoad + digitOffset, strNum, 2);
- }
loadImage(_loadTempBuf, type);
- uint8 *dst = (isMask == 1) ? _locationBackgroundMaskBuf : _locationBackgroundGfxBuf;
+ uint8 *dst = isMask ? _locationBackgroundMaskBuf : _locationBackgroundGfxBuf;
dst += offset;
const uint8 *src = _loadTempBuf;
for (int y = 0; y < _locationHeight; ++y) {
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index 9cbe9c4528..e67fd61310 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -256,7 +256,7 @@ protected:
void setCursorNum(int num);
void setCursorType(int type);
void setupNewLocation();
- void copyLocBitmap(int offset, int isMask);
+ void copyLocBitmap(int offset, bool isMask);
void updateMouseState();
void updateCharPositionHelper();
void updateCharPosition();