TUCKER: Simplify TuckerEngine::copyLocBitmap

svn-id: r35873
This commit is contained in:
Max Horn 2009-01-16 20:53:43 +00:00
parent 9f1ac87466
commit 1082d82ba8
4 changed files with 17 additions and 23 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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) {

View File

@ -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();