various fixes

svn-id: r24628
This commit is contained in:
Gregory Montoir 2006-11-05 22:24:15 +00:00
parent 424e9e362e
commit ec177bc6ce
5 changed files with 22 additions and 18 deletions

View file

@ -176,7 +176,7 @@ void Graphics::copyRect(uint8 *dst, int dstPitch, int dstX, int dstY, const uint
} }
void Graphics::copyMask(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, uint8 fillColor) { void Graphics::copyMask(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, uint8 fillColor) {
dst += dstY * dstPitch * dstX; dst += dstY * dstPitch + dstX;
src += srcY * srcPitch + srcX; src += srcY * srcPitch + srcX;
while (h--) { while (h--) {
for (int i = 0; i < w; ++i) { for (int i = 0; i < w; ++i) {

View file

@ -843,9 +843,9 @@ void ToucheEngine::op_setupFollowingKeyChar() {
void ToucheEngine::op_startAnimation() { void ToucheEngine::op_startAnimation() {
debugC(9, kDebugOpcodes, "ToucheEngine::op_startAnimation()"); debugC(9, kDebugOpcodes, "ToucheEngine::op_startAnimation()");
int16 num = _script.readNextWord(); int16 keyChar = _script.readNextWord();
int16 pos = _script.readNextWord(); int16 pos = _script.readNextWord();
int16 keyChar = *_script.stackDataPtr; int16 num = *_script.stackDataPtr;
addToAnimationTable(num, pos, keyChar, 3); addToAnimationTable(num, pos, keyChar, 3);
} }

View file

@ -454,9 +454,9 @@ void ToucheEngine::res_loadSprite(int num, int index) {
} }
spr->w = _currentImageWidth; spr->w = _currentImageWidth;
spr->h = _currentImageHeight; spr->h = _currentImageHeight;
Graphics::copyRect(_offscreenBuffer, 640, 0, 0, // Graphics::copyRect(_offscreenBuffer, 640, 0, 0,
_backdropBuffer, _currentImageWidth, _flagsTable[614], _flagsTable[615], // _backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615],
640, 100); // 640, 100);
} }
void ToucheEngine::res_loadSequence(int num, int index) { void ToucheEngine::res_loadSequence(int num, int index) {
@ -564,7 +564,7 @@ void ToucheEngine::res_loadMusic(int num) {
uint32 size; uint32 size;
const uint32 offs = res_getDataOffset(kResourceTypeMusic, num, &size); const uint32 offs = res_getDataOffset(kResourceTypeMusic, num, &size);
_fData.seek(offs); _fData.seek(offs);
_midiPlayer->play(_fData, size); _midiPlayer->play(_fData, size, true);
} }
void ToucheEngine::res_loadSpeech(int num) { void ToucheEngine::res_loadSpeech(int num) {

View file

@ -420,7 +420,7 @@ void ToucheEngine::setupEpisode(int num) {
if (_flagsTable[911] != 0) { if (_flagsTable[911] != 0) {
// load scripts from external data files // load scripts from external data files
} }
debug(0, "Setting up episode %d\n", num); debug(0, "Setting up episode %d", num);
res_loadProgram(num); res_loadProgram(num);
_disabledInputCounter = 0; _disabledInputCounter = 0;
} }
@ -830,6 +830,8 @@ void ToucheEngine::fadePalette(int firstColor, int lastColor, int scale, int sca
scale = 0; scale = 0;
} }
setPalette(firstColor, lastColor, scale, scale, scale); setPalette(firstColor, lastColor, scale, scale, scale);
_system->updateScreen();
_system->delayMillis(10);
} }
} }
@ -1186,7 +1188,7 @@ void ToucheEngine::setKeyCharRandomFrame(KeyChar *key) {
} }
void ToucheEngine::setKeyCharMoney() { void ToucheEngine::setKeyCharMoney() {
_keyCharsTable[_currentKeyCharNum].money = _currentAmountOfMoney; _keyCharsTable[_currentKeyCharNum].money += _currentAmountOfMoney;
drawAmountOfMoneyInInventory(); drawAmountOfMoneyInInventory();
} }
@ -1251,7 +1253,7 @@ int ToucheEngine::restartKeyCharScriptOnAction(int action, int obj1, int obj2) {
for (uint i = 0; i < _programActionScriptOffsetTable.size(); ++i) { for (uint i = 0; i < _programActionScriptOffsetTable.size(); ++i) {
const ProgramActionScriptOffsetData *pasod = &_programActionScriptOffsetTable[i]; const ProgramActionScriptOffsetData *pasod = &_programActionScriptOffsetTable[i];
if (pasod->object1 == obj1 && pasod->action == action && pasod->object2 == obj2) { if (pasod->object1 == obj1 && pasod->action == action && pasod->object2 == obj2) {
debug(0, "Found matching action i=%d %d,%d,%d\n", i, pasod->action, pasod->object1, pasod->object2); debug(0, "Found matching action i=%d %d,%d,%d", i, pasod->action, pasod->object1, pasod->object2);
KeyChar *key = &_keyCharsTable[_currentKeyCharNum]; KeyChar *key = &_keyCharsTable[_currentKeyCharNum];
key->scriptDataOffset = pasod->offset; key->scriptDataOffset = pasod->offset;
key->scriptStackPtr = &key->scriptStackTable[39]; key->scriptStackPtr = &key->scriptStackTable[39];
@ -1706,7 +1708,7 @@ void ToucheEngine::clearRoomArea() {
} }
void ToucheEngine::startNewMusic() { void ToucheEngine::startNewMusic() {
// bool unkMidiFlag = _flagsTable[619] != 0; // bool loopMusic = _flagsTable[619] != 0; // ?
if (_newMusicNum != 0 && _newMusicNum != _currentMusicNum) { if (_newMusicNum != 0 && _newMusicNum != _currentMusicNum) {
res_loadMusic(_newMusicNum); res_loadMusic(_newMusicNum);
_currentMusicNum = _newMusicNum; _currentMusicNum = _newMusicNum;
@ -2054,15 +2056,15 @@ void ToucheEngine::drawInventory(int index, int flag) {
void ToucheEngine::drawAmountOfMoneyInInventory() { void ToucheEngine::drawAmountOfMoneyInInventory() {
if (_flagsTable[606] == 0 && !_hideInventoryTexts) { if (_flagsTable[606] == 0 && !_hideInventoryTexts) {
char text[4]; char text[10];
snprintf(text, sizeof(text)-1, "%d", _keyCharsTable[0].money); sprintf(text, "%d", _keyCharsTable[0].money);
Graphics::fillRect(_offscreenBuffer, 640, 74, 354, 40, 16, 0xD2); Graphics::fillRect(_offscreenBuffer, 640, 74, 354, 40, 16, 0xD2);
drawGameString(16, 217, 94, 355, text); drawGameString(16, 217, 94, 355, text);
updateScreenArea(_offscreenBuffer, 640, 74, 354, 74, 354, 40, 16); updateScreenArea(_offscreenBuffer, 640, 74, 354, 74, 354, 40, 16);
Graphics::fillRect(_offscreenBuffer, 640, 150, 353, 40, 41, 0xD2); Graphics::fillRect(_offscreenBuffer, 640, 150, 353, 40, 41, 0xD2);
if (_currentAmountOfMoney != 0) { if (_currentAmountOfMoney != 0) {
drawIcon(141, 348, 1); drawIcon(141, 348, 1);
snprintf(text, sizeof(text)-1, "%d", _currentAmountOfMoney); sprintf(text, "%d", _currentAmountOfMoney);
drawGameString(16, 217, 170, 378, text); drawGameString(16, 217, 170, 378, text);
} }
updateScreenArea(_offscreenBuffer, 640, 150, 353, 150, 353, 40, 41); updateScreenArea(_offscreenBuffer, 640, 150, 353, 150, 353, 40, 41);
@ -2248,9 +2250,10 @@ int ToucheEngine::updateKeyCharTalk(int skipFlag) {
} }
const char *ToucheEngine::formatTalkText(int mode, int *y, int *h, const char *text) { const char *ToucheEngine::formatTalkText(int mode, int *y, int *h, const char *text) {
static char talkTextBuffer[200];
int newLineWidth = 0; int newLineWidth = 0;
int lineWidth = 0; int lineWidth = 0;
char *textBuffer = _talkTextBuffer; char *textBuffer = talkTextBuffer;
char *textLine = textBuffer; char *textLine = textBuffer;
if (mode != 16) { if (mode != 16) {
return text; return text;
@ -2286,7 +2289,7 @@ const char *ToucheEngine::formatTalkText(int mode, int *y, int *h, const char *t
if (*y < 0) { if (*y < 0) {
*y = 1; *y = 1;
} }
return _talkTextBuffer; return talkTextBuffer;
} }
} }
@ -3067,11 +3070,12 @@ void ToucheEngine::addToAnimationTable(int num, int posNum, int keyChar, int del
anim->posNum = posNum; anim->posNum = posNum;
int16 xPos, yPos, x2Pos, y2Pos; int16 xPos, yPos, x2Pos, y2Pos;
if (posNum >= 0) { if (posNum >= 0) {
assert(posNum >= 0 && posNum < NUM_KEYCHARS); assert(posNum < NUM_KEYCHARS);
xPos = _keyCharsTable[posNum].xPos; xPos = _keyCharsTable[posNum].xPos;
yPos = _keyCharsTable[posNum].yPos - 50; yPos = _keyCharsTable[posNum].yPos - 50;
} else { } else {
posNum = -posNum; posNum = -posNum;
assert((uint)posNum < _programPointsTable.size());
xPos = _programPointsTable[posNum].x; xPos = _programPointsTable[posNum].x;
yPos = _programPointsTable[posNum].y; yPos = _programPointsTable[posNum].y;
} }
@ -3090,6 +3094,7 @@ void ToucheEngine::addToAnimationTable(int num, int posNum, int keyChar, int del
anim->dy = yPos; anim->dy = yPos;
anim->displayCounter = 8; anim->displayCounter = 8;
anim->displayRect.left = -1; anim->displayRect.left = -1;
break;
} }
} }
} }

View file

@ -632,7 +632,6 @@ protected:
int _talkTableLastOtherKeyChar; int _talkTableLastOtherKeyChar;
int _talkTableLastStringNum; int _talkTableLastStringNum;
int _objectDescriptionNum; int _objectDescriptionNum;
char _talkTextBuffer[200];
TalkEntry _talkTable[NUM_TALK_ENTRIES]; TalkEntry _talkTable[NUM_TALK_ENTRIES];
bool _conversationChoicesUpdated; bool _conversationChoicesUpdated;