From 02c149e174137f179ac94c98979622a51720be31 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Sat, 14 Feb 2009 13:55:00 +0000 Subject: LOL: fixed bug in text displayer and some cleanup svn-id: r36327 --- engines/kyra/gui_lol.cpp | 39 ++++++------- engines/kyra/items_lol.cpp | 8 +-- engines/kyra/lol.cpp | 59 ++++++++++---------- engines/kyra/lol.h | 26 ++++----- engines/kyra/scene_lol.cpp | 134 ++++++++++++++++++++++----------------------- engines/kyra/staticres.cpp | 24 ++++---- engines/kyra/text_lol.cpp | 16 +++--- engines/kyra/text_lol.h | 2 +- 8 files changed, 153 insertions(+), 155 deletions(-) (limited to 'engines') diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 2963d330d0..b2fa4020c3 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -97,7 +97,7 @@ void LoLEngine::gui_drawInventoryItem(int index) { void LoLEngine::gui_drawScroll() { _screen->copyRegion(112, 0, 12, 0, 87, 15, 2, 2, Screen::CR_NO_P_CHECK); int h = 0; - + for (int i = 0; i < 7; i++) { if (_availableSpells[i] != -1) h += 9; @@ -106,7 +106,7 @@ void LoLEngine::gui_drawScroll() { if (h == 18) h = 27; - if (h) { + if (h) { _screen->copyRegion(201, 1, 17, 15, 6, h, 2, 2, Screen::CR_NO_P_CHECK); _screen->copyRegion(208, 1, 89, 15, 6, h, 2, 2, Screen::CR_NO_P_CHECK); _screen->fillRect(21, 15, 89, h + 15, 206); @@ -169,12 +169,12 @@ void LoLEngine::gui_drawCharPortraitWithStats(int charNum) { _screen->drawGridBox(44, (spellLevels << 3) + 1, 22, 32 - (spellLevels << 3), 1); } else { // magic submenu closed - int handIndex = 0; + int handIndex = 0; if (_characters[charNum].items[0]) { if (_itemProperties[_itemsInPlay[_characters[charNum].items[0]].itemPropertyIndex].unk8 != -1) handIndex = _itemsInPlay[_characters[charNum].items[0]].itemPropertyIndex; } - + handIndex = _gameShapeMap[_itemProperties[handIndex].shpIndex << 1]; if (handIndex == 0x5a) { // draw raceClassSex specific hand shape handIndex = _characters[charNum].raceClassSex - 1; @@ -190,7 +190,7 @@ void LoLEngine::gui_drawCharPortraitWithStats(int charNum) { if (spellLevels == 0) _screen->drawGridBox(44, 17, 22, 15, 1); - } + } uint16 f = _characters[charNum].flags & 0x314C; if ((f == 0 && _weaponsDisabled) || (f && (f != 4 || _characters[charNum].weaponHit == 0 || _weaponsDisabled))) @@ -200,7 +200,7 @@ void LoLEngine::gui_drawCharPortraitWithStats(int charNum) { _screen->drawShape(_screen->_curPage, _gameShapes[34], 44, 0, 0, 0); _screen->fprintString("%d", 57, 7, 254, 0, 1, _characters[charNum].weaponHit); } - if (_characters[charNum].damageSuffered) + if (_characters[charNum].damageSuffered) _screen->fprintString("%d", 17, 28, 254, 0, 1, _characters[charNum].damageSuffered); if (!cp) @@ -226,7 +226,7 @@ void LoLEngine::gui_drawBox(int x, int y, int w, int h, int frameColor1, int fra _screen->drawClippedLine(x + 1, y, x + w, y, frameColor2); _screen->drawClippedLine(x + w, y, x + w, y + h - 1, frameColor2); _screen->drawClippedLine(x, y, x, y + h, frameColor1); - _screen->drawClippedLine(x, y + h, x + w, y + h, frameColor1); + _screen->drawClippedLine(x, y + h, x + w, y + h, frameColor1); } void LoLEngine::gui_drawCharFaceShape(int charNum, int x, int y, int pageNum) { @@ -297,7 +297,7 @@ void LoLEngine::calcCharPortraitXpos() { int t = (235 - (nc * 66)) / (nc + 1); for (int i = 0; i < nc; i++) - _activeCharsXpos[i] = i * 66 + t * (i + 1) + 83; + _activeCharsXpos[i] = i * 66 + t * (i + 1) + 83; } void LoLEngine::gui_drawMoneyBox(int pageNum) { @@ -322,7 +322,7 @@ void LoLEngine::gui_drawMoneyBox(int pageNum) { } Screen::FontId backupFont = _screen->setFont(Screen::FID_6_FNT); - _screen->fprintString("%d", 305, 98, 254, 0, 1, _credits); + _screen->fprintString("%d", 305, 98, 254, 0, 1, _credits); _screen->setFont(backupFont); _screen->_curPage = backupPage; @@ -445,10 +445,10 @@ void LoLEngine::gui_toggleButtonDisplayMode(int shapeIndex, int mode) { } _screen->drawShape(pageNum, _gameShapes[shapeIndex], x1, y1, 0, mode, _screen->_paletteOverlay1, 1); - + if (!pageNum) _screen->updateScreen(); - + if (pageNum == 6) { int cp = _screen->setCurPage(6); @@ -485,7 +485,7 @@ void LoLEngine::gui_toggleFightButtons(bool disable) { } else { gui_drawCharPortraitWithStats(i); } - } + } } void LoLEngine::gui_updateInput() { @@ -541,14 +541,14 @@ void LoLEngine::gui_enableSequenceButtons(int x, int y, int w, int h, int enable _sceneWindowButton.h = h; gui_initButtonsFromList(_buttonList3); - + if (enableFlags & 1) gui_initButtonsFromList(_buttonList4); if (enableFlags & 2) gui_initButtonsFromList(_buttonList5); } - + void LoLEngine::gui_resetButtonList() { while (_activeButtons) { Button *n = _activeButtons->nextButton; @@ -607,7 +607,7 @@ void LoLEngine::gui_initButton(int index, int x) { b->unk8 = _buttonData[index].unk2; b->dimTableIndex = _buttonData[index].screenDim; b->flags = _buttonData[index].buttonflags; - + b->data2Val2 = _buttonData[index].index; if (index == 64) { @@ -672,12 +672,12 @@ int LoLEngine::clickedTurnLeftArrow(Button *button) { _sceneDefaultUpdate = 1; runSceneScript(_currentBlock, 0x4000); - updatePortraitUnkTimeSub(2, 0); + initTextFading(2, 0); if (!_sceneDefaultUpdate) gui_drawScene(0); else - movePartySmoothScrollTurnLeft(1); + movePartySmoothScrollTurnLeft(1); gui_toggleButtonDisplayMode(79, 0); runSceneScript(_currentBlock, 0x10); @@ -694,12 +694,12 @@ int LoLEngine::clickedTurnRightArrow(Button *button) { _sceneDefaultUpdate = 1; runSceneScript(_currentBlock, 0x4000); - updatePortraitUnkTimeSub(2, 0); + initTextFading(2, 0); if (!_sceneDefaultUpdate) gui_drawScene(0); else - movePartySmoothScrollTurnRight(1); + movePartySmoothScrollTurnRight(1); gui_toggleButtonDisplayMode(81, 0); runSceneScript(_currentBlock, 0x10); @@ -806,6 +806,7 @@ int LoLEngine::clickedRestParty(Button *button) { } int LoLEngine::clickedMoneyBox(Button *button) { + _txt->printMessage(0, getLangString(_credits == 1 ? 0x402D : 0x402E), _credits); return 1; } diff --git a/engines/kyra/items_lol.cpp b/engines/kyra/items_lol.cpp index ef81f7856f..122d20f93d 100644 --- a/engines/kyra/items_lol.cpp +++ b/engines/kyra/items_lol.cpp @@ -84,7 +84,7 @@ int LoLEngine::makeItem(int itemIndex, int curFrame, int flags) { continue; int diff = ABS(_currentLevel - _itemsInPlay[i].level); - + if (diff <= cnt) continue; @@ -95,7 +95,7 @@ int LoLEngine::makeItem(int itemIndex, int curFrame, int flags) { if (t) break; else - ii = _itemsInPlay[ii - 1].itemIndexUnk; + ii = _itemsInPlay[ii - 1].itemIndexUnk; } if (t) { @@ -114,7 +114,7 @@ int LoLEngine::makeItem(int itemIndex, int curFrame, int flags) { slot = r; } else { int ii = _itemsInPlay[slot].itemIndexUnk; - while (ii) { + while (ii) { if (testUnkItemFlags(ii)) { _itemsInPlay[slot].itemIndexUnk = _itemsInPlay[ii].itemIndexUnk; clearItemTableEntry(ii); @@ -129,7 +129,7 @@ int LoLEngine::makeItem(int itemIndex, int curFrame, int flags) { } memset(&_itemsInPlay[slot], 0, sizeof(ItemInPlay)); - + _itemsInPlay[slot].itemPropertyIndex = itemIndex; _itemsInPlay[slot].shpCurFrame_flg = (curFrame & 0x1fff) | flags; _itemsInPlay[slot].level = -1; diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 62c34e0c76..6f770d50c7 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -147,12 +147,12 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy _dscUnk1 = 0; _dscShapeIndex = 0; - _dscOvlMap = 0; + _dscOvlMap = 0; _dscShapeScaleW = 0; _dscShapeScaleH = 0; _dscShapeX = 0; _dscShapeY = 0; - _dscTileIndex = 0; + _dscTileIndex = 0; _dscUnk2 = 0; _dscDoorShpIndex = 0; _dscDim1 = 0; @@ -180,7 +180,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy memset(_activeTim, 0, 10 * sizeof(TIM*)); memset(_activeVoiceFile, 0, sizeof(_activeVoiceFile)); - + _buttonData = 0; _activeButtons = 0; _buttonList1 = _buttonList2 = _buttonList3 = _buttonList4 = _buttonList5 = _buttonList6 = _buttonList7 = _buttonList8 = 0; @@ -293,13 +293,13 @@ LoLEngine::~LoLEngine() { for (int i = 0; i < 2; i++) delete[] _doorShapes[i]; - + delete _lvlShpFileHandle; if (_ingameSoundList) { for (int i = 0; i < _ingameSoundListSize; i++) delete[] _ingameSoundList[i]; - delete[] _ingameSoundList; + delete[] _ingameSoundList; } gui_resetButtonList(); @@ -389,7 +389,7 @@ Common::Error LoLEngine::init() { memset(_tmpData136, 0, 136); memset(_gameFlags, 0, 15 * sizeof(uint16)); - memset(_unkEMC46, 0, 16 * sizeof(uint16)); + memset(_unkEMC46, 0, 16 * sizeof(uint16)); _levelFileData = 0; _lvlShpFileHandle = 0; @@ -405,7 +405,7 @@ Common::Error LoLEngine::init() { _buf4 = new uint8*[384]; memset(_buf4, 0, 384 * sizeof(uint8*)); memset(&_scriptData, 0, sizeof(EMCData)); - + _levelFlagUnk = 0; _unkCharNum = -1; @@ -471,7 +471,7 @@ Common::Error LoLEngine::go() { if (processSelection == 0) { _sound->loadSoundFile("LOREINTR"); - _sound->playTrack(6); + _sound->playTrack(6); /*int character = */chooseCharacter(); _sound->playTrack(1); _screen->fadeToBlack(); @@ -567,7 +567,7 @@ uint8 *LoLEngine::getItemIconShapePtr(int index) { int ix = _itemProperties[_itemsInPlay[index].itemPropertyIndex].shpIndex; if (_itemProperties[_itemsInPlay[index].itemPropertyIndex].flags & 0x200) ix += (_itemsInPlay[index].shpCurFrame_flg & 0x1fff) - 1; - + return _itemIconShapes[ix]; } @@ -683,7 +683,7 @@ void LoLEngine::startup() { _trueLightTable1 = new uint8[256]; _trueLightTable2 = new uint8[5120]; - + _loadSuppFilesFlag = 1; _txt->setAnimParameters("", 10, 31, 0); @@ -766,7 +766,7 @@ void LoLEngine::runLoop() { //processUnkAnimStructs(); //checkFloatingPointerRegions(); gui_updateInput(); - + update(); if (_sceneUpdateRequired) @@ -967,7 +967,7 @@ void LoLEngine::updatePortraitWithStats() { faceFrameRefresh(_updateCharNum); if (redraw) { gui_drawCharPortraitWithStats(_updateCharNum); - updatePortraitUnkTimeSub(0, 0); + initTextFading(0, 0); } else { gui_drawCharFaceShape(_updateCharNum, x, y, 0); } @@ -985,25 +985,22 @@ void LoLEngine::updatePortraits() { _updateCharNum = -1; if (!_updateCharV2) - updatePortraitUnkTimeSub(0, 0); + initTextFading(0, 0); } -void LoLEngine::updatePortraitUnkTimeSub(int unk1, int unk2) { - if (_textColourFlag == unk1 || !unk1) { +void LoLEngine::initTextFading(int textType, int clearField) { + if (_textColourFlag == textType || !textType) { _fadeText = true; _palUpdateTimer = _system->getMillis(); } - if (!unk2) + if (!clearField) return; updatePortraits(); - if (_hideInventory) { - _screen->hideMouse(); + if (_hideInventory) _screen->clearDim(3); - _screen->showMouse(); - } - + _fadeText = false; //initGuiUnk(11); } @@ -1051,7 +1048,7 @@ void LoLEngine::setupScreenDims() { } else { _screen->modifyScreenDim(4, 11, 124, 28, 9); _screen->modifyScreenDim(5, 85, 123, 233, 18); - } + } } void LoLEngine::initDialogueSequence(int controlMode) { @@ -1082,7 +1079,7 @@ void LoLEngine::toggleSelectedCharacterFrame(bool mode) { void LoLEngine::unkHideInventory() { _hideInventory = 1; - if (!textEnabled() || !(_hideControls & 2)) + if (!textEnabled() || !(_hideControls & 2)) charCallback4(1); removeUnkFlags(2); @@ -1201,7 +1198,7 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) { if (id & 0x4000) { snprintf(pattern1, sizeof(pattern1), "%03X", id & 0x3fff); } else if (id < 1000) { - snprintf(pattern1, sizeof(pattern1), "%03d", id); + snprintf(pattern1, sizeof(pattern1), "%03d", id); } else { snprintf(pattern1, sizeof(pattern1), "@%04d", id - 1000); } @@ -1234,7 +1231,7 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) { strcpy(_activeVoiceFile, *playList.begin()); _sound->voicePlayFromList(playList); - + for (Common::List::iterator i = playList.begin(); i != playList.end(); i++) delete []*i; playList.clear(); @@ -1247,21 +1244,21 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) { int LoLEngine::snd_characterSpeaking() { if (_sound->voiceIsPlaying(_activeVoiceFile)) return 2; - + _lastSpeechId = _lastSpeaker = -1; - + return 1; } int LoLEngine::snd_dialogueSpeechUpdate(int finish) { if (!_sound->voiceIsPlaying(_activeVoiceFile)) return -1; - + //_dlgTimer = 0; if (finish) _tim->_dialogueComplete = 1; - + return 1; } @@ -1292,7 +1289,7 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) { track = track < _ingameGMSoundIndexSize ? _ingameGMSoundIndex[track] - 1: -1; //else if (_sound->getSfxType() == Sound::kAdlib) // track = track < _ingameADLSoundIndexSize ? _ingameADLSoundIndex[track] - 1: -1; - + if (track == 168) track = 167; @@ -1323,7 +1320,7 @@ void LoLEngine::snd_loadSoundFile(int track) { int LoLEngine::snd_playTrack(int track) { if (track == -1) return _lastMusicTrack; - + int res = _lastMusicTrack; _lastMusicTrack = track; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 41121a2d93..f35778ecde 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -251,12 +251,12 @@ private: // main loop void runLoop(); void update(); - + int setUnkFlags(int unk); int removeUnkFlags(int unk); int _intFlag3; - + // mouse void setMouseCursorToIcon(int icon); void setMouseCursorToItemInHand(); @@ -460,7 +460,7 @@ private: void runSceneScript(int block, int sub); void runSceneScriptCustom(int block, int sub, int charNum, int item, int reg3, int reg4); bool checkScriptUnk(int func); - + EMCData _scriptData; bool _scriptBoolSkipExec; uint16 _scriptDirection; @@ -479,7 +479,7 @@ private: int olol_loadMonsterShapes(EMCState *script); int olol_allocItemPropertiesBuffer(EMCState *script); int olol_setItemProperty(EMCState *script); - int olol_makeItem(EMCState *script); + int olol_makeItem(EMCState *script); int olol_getItemPara(EMCState *script); int olol_getCharacterStat(EMCState *script); int olol_setCharacterStat(EMCState *script); @@ -510,7 +510,7 @@ private: // tim scripts TIM *_activeTim[10]; - + // tim opcode void setupOpcodeTable(); @@ -574,7 +574,7 @@ private: void updatePortraitWithStats(); void updatePortraits(); - void updatePortraitUnkTimeSub(int unk1, int unk2); + void initTextFading(int textType, int clearField); void charCallback4(int redraw); void setCharFaceFrame(int charNum, int frameNum); void faceFrameRefresh(int charNum); @@ -647,7 +647,7 @@ private: bool testWallInvisibility(int block, int direction); void drawScene(int pageNum); - + void generateBlockDrawingBuffer(int block, int direction); void generateBlockDrawingBufferF0(int16 wllOffset, uint8 wllIndex, uint8 wllVmpIndex, int16 vmpOffset, uint8 len, uint8 numEntries); void generateBlockDrawingBufferF1(int16 wllOffset, uint8 wllIndex, uint8 wllVmpIndex, int16 vmpOffset, uint8 len, uint8 numEntries); @@ -675,7 +675,7 @@ private: void moveParty(uint16 direction, int unk1, int unk2, int buttonShape); uint16 calcNewBlockPostion(uint16 curBlock, uint16 direction); bool checkBlockPassability(uint16 block, uint16 direction); - void notifyBlockNotPassable(int scrollFlag); + void notifyBlockNotPassable(int scrollFlag); void movePartySmoothScrollBlocked(int speed); void movePartySmoothScrollUp(int speed); @@ -684,7 +684,7 @@ private: void movePartySmoothScrollRight(int speed); void movePartySmoothScrollTurnLeft(int speed); void movePartySmoothScrollTurnRight(int speed); - + int smoothScrollDrawSpecialShape(int pageNum); void setLF2(int block); @@ -700,7 +700,7 @@ private: int _scrollXBottomSize; const uint8 *_scrollYBottom; int _scrollYBottomSize; - + int _unkFlag; int _nextScriptFunc; uint8 _currentLevel; @@ -751,7 +751,7 @@ private: uint16 _partyPosX; uint16 _partyPosY; - + Common::SeekableReadStream *_lvlShpFileHandle; uint16 _lvlShpNum; uint16 _levelFileDataSize; @@ -769,7 +769,7 @@ private: uint8 *_tempBuffer5120; uint8 *_tmpData136; - + const char *const * _levelDatList; int _levelDatListSize; const char *const * _levelShpList; @@ -817,7 +817,7 @@ private: int _dscDoorMonsterXSize; const int16 *_dscDoorMonsterY; int _dscDoorMonsterYSize; - + int _sceneDrawPage1; int _sceneDrawPage2; diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 44f8f1d334..1d97de0fcc 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -49,13 +49,13 @@ void LoLEngine::loadLevel(int index) { resetItems(1); resetLvlBuffer(); - resetBlockProperties(); + resetBlockProperties(); releaseMonsterShapes(0); releaseMonsterShapes(1); // TODO - + _currentLevel = index; _updateFlags = 0; @@ -68,7 +68,7 @@ void LoLEngine::loadLevel(int index) { char filename[13]; snprintf(filename, sizeof(filename), "LEVEL%d.INI", index); - + int f = _levelFlagUnk & (1 << ((index + 0xff) & 0xff)); runInitScript(filename, f ? 0 : 1); @@ -113,7 +113,7 @@ int LoLEngine::initCmzWithScript(int block) { int cnt = 0; CLevelItem *t = 0; - while (i) { + while (i) { t = findItem(i); i = t->itemIndexUnk; if (!(i & 0x8000)) @@ -149,7 +149,7 @@ void LoLEngine::initCMZ1(CLevelItem *l, int a) { l->itemPosX = _partyPosX; l->itemPosY = _partyPosY; cmzS2(l, cmzS1(l->p_1a, l->p_1b, l->itemPosX, l->itemPosY)); - } + } } else { l->field_14 = a; l->field_15 = 0; @@ -179,9 +179,9 @@ void LoLEngine::initCMZ2(CLevelItem *l, uint16 a, uint16 b) { } else { cont = false; } - + l->blockPropertyIndex = cmzS5(a, b); - + if (l->p_1a != a || l->p_1b != b) { l->p_1a = a; l->p_1b = b; @@ -194,7 +194,7 @@ void LoLEngine::initCMZ2(CLevelItem *l, uint16 a, uint16 b) { cmzS6(_levelBlockProperties[l->blockPropertyIndex].itemIndex, ((uint16)l->field_16) | 0x8000); _levelBlockProperties[l->blockPropertyIndex].field_8 = 5; checkScriptUnk(l->blockPropertyIndex); - + if (l->monsters->unk8[0] == 0 || cont == false) return; @@ -228,15 +228,15 @@ int LoLEngine::cmzS1(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { } uint8 f = 0; - + if (t2 >= t1) { if (t2 > t1) f = 1; - SWAP(t1, t2); + SWAP(t1, t2); } r = (r << 1) | f; - + t1 = (t1 + 1) >> 1; f = 0; @@ -278,7 +278,7 @@ void LoLEngine::cmzS7(int a, int block) { void LoLEngine::moveItemToBlock(uint16 *cmzItemIndex, uint16 item) { CLevelItem *tmp = 0; - while (*cmzItemIndex & 0x8000) { + while (*cmzItemIndex & 0x8000) { tmp = findItem(*cmzItemIndex); cmzItemIndex = &tmp->itemIndexUnk; } @@ -322,7 +322,7 @@ void LoLEngine::loadLevelWLL(int index, bool mapShapes) { if (mapShapes) { int16 sh = (int16) READ_LE_UINT16(d); - if (sh > 0) + if (sh > 0) _wllShapeMap[c] = assignLevelShapes(sh); else _wllShapeMap[c] = *d; @@ -333,13 +333,13 @@ void LoLEngine::loadLevelWLL(int index, bool mapShapes) { _wllWallFlags[c] = *d; d += 2; _wllBuffer4[c] = *d; - d += 2; + d += 2; } delete[] file; delete _lvlShpFileHandle; - _lvlShpFileHandle = 0; + _lvlShpFileHandle = 0; } int LoLEngine::assignLevelShapes(int index) { @@ -353,7 +353,7 @@ int LoLEngine::assignLevelShapes(int index) { uint16 o = _lvlBlockIndex++; memcpy(&_levelShapeProperties[o], &_levelFileData[index], sizeof(LevelShapeProperty)); - + for (int i = 0; i < 10; i++) { uint16 t = _levelShapeProperties[o].shapeIndex[i]; if (t == 0xffff) @@ -391,7 +391,7 @@ uint8 *LoLEngine::getLevelShapes(int shapeIndex) { _lvlShpFileHandle->seek(offs, SEEK_SET); uint8 *res = new uint8[size]; _lvlShpFileHandle->read(res, size); - + return res; } @@ -405,7 +405,7 @@ void LoLEngine::loadLevelCmzFile(int index) { char filename[13]; snprintf(filename, sizeof(filename), "LEVEL%d.CMZ", index); - + _screen->loadBitmap(filename, 3, 3, 0); const uint8 *p = _screen->getCPagePtr(2); uint16 len = READ_LE_UINT16(p + 4); @@ -435,7 +435,7 @@ void LoLEngine::loadLevelCmzFile(int index) { initCMZ2(&_cLevelItems[i], _cLevelItems[i].p_1a, _cLevelItems[i].p_1b); } } - + loadCMZ_Sub(tmpLvlVal, (_unkGameFlag & 0x30) >> 4); delete[] cmzdata; @@ -446,7 +446,7 @@ void LoLEngine::loadCMZ_Sub(int index1, int index2) { int val = (table[index2] << 8) / table[index1]; //int r = 0; - + for (int i = 0; i < 30; i++) { if (_cLevelItems[i].field_14 >= 14 || _cLevelItems[i].blockPropertyIndex == 0 || _cLevelItems[i].field_1D <= 0) continue; @@ -466,7 +466,7 @@ void LoLEngine::loadCmzFile(const char *file) { const uint8 *h = _screen->getCPagePtr(2); uint16 len = READ_LE_UINT16(&h[4]); const uint8 *p = h + 6; - + for (int i = 0; i < 1024; i++) { for (int ii = 0; ii < 4; ii++) _levelBlockProperties[i].walls[ii] = p[i * len + ii]; @@ -492,14 +492,14 @@ void LoLEngine::loadMonsterShapes(const char *file, int monsterIndex, int b) { bool replaced = false; int pos = monsterIndex << 4; - + for (int ii = 0; ii < i; ii++) { if (ts[i] != ts[ii]) continue; _monsterShapes[pos + i] = _monsterShapes[pos + ii]; replaced = true; - break; + break; } if (!replaced) @@ -515,7 +515,7 @@ void LoLEngine::loadMonsterShapes(const char *file, int monsterIndex, int b) { uint8 **of = &_buf4[(monsterIndex << 7) + (i << 5) + (ii << 1)]; int s = (i << 4) + ii + 17; *of = _screen->makeShapeCopy(p, s); - + ////TODO } } @@ -544,11 +544,11 @@ void LoLEngine::loadMonsterShapes(const char *file, int monsterIndex, int b) { int pos = (monsterIndex << 4) + i; memcpy(tmpPal2, _monsterShapes[pos] + 10, 256); uint8 numCol = *tmpPal2; - + for (int ii = 0; ii < numCol; ii++) { uint8 *cl = (uint8*)memchr(tmpPal1, tmpPal2[1 + ii], 64); if (!cl) - continue; + continue; tmpPal3[ii] = (uint16) (cl - tmpPal1); } @@ -581,7 +581,7 @@ void LoLEngine::releaseMonsterShapes(int monsterIndex) { if (_monsterPalettes[pos]) { delete[] _monsterPalettes[pos]; _monsterPalettes[pos] = 0; - } + } } } @@ -630,7 +630,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight _lastOverridePalFilePtr = 0; } } - + char fname[13]; snprintf(fname, sizeof(fname), "%s.VCN", _lastSuppFile); @@ -652,14 +652,14 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight memcpy(_vcnShift, v, tlen); v += tlen; - + memcpy(_vcnExpTable, v, 128); v += 128; - + if (_lastOverridePalFilePtr) { uint8 *tpal = _res->fileData(_lastOverridePalFilePtr, 0); memcpy(_screen->_currentPalette, tpal, 384); - delete[] tpal; + delete[] tpal; } else { memcpy(_screen->_currentPalette, v, 384); } @@ -669,7 +669,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight memcpy(tmpPal, _screen->_currentPalette + 384, 384); memset(_screen->_currentPalette + 384, 0xff, 384); memcpy(_screen->_currentPalette + 384, tmpPal, 384);*/ - + //loadSwampIceCol(); memcpy(_vcnBlocks, v, vcnLen); @@ -762,7 +762,7 @@ void LoLEngine::resetBlockProperties() { if (l->flags & 0x40) l->flags &= 0xbf; else if (l->flags & 0x80) - l->flags &= 0x7f; + l->flags &= 0x7f; } } } @@ -771,7 +771,7 @@ bool LoLEngine::testWallFlag(int block, int direction, int flag) { if (_levelBlockProperties[block].flags & 0x10) return true; - if (direction != -1) + if (direction != -1) return (_wllWallFlags[_levelBlockProperties[block].walls[direction ^ 2]] & flag) ? true : false; for (int i = 0; i < 4; i++) { @@ -779,7 +779,7 @@ bool LoLEngine::testWallFlag(int block, int direction, int flag) { return true; } - return false; + return false; } bool LoLEngine::testWallInvisibility(int block, int direction) { @@ -814,7 +814,7 @@ void LoLEngine::updateLampStatus() { if (!_brightness || !_lampStatusUnk) { newLampOilStatus = 8; if (newLampOilStatus != _lampOilStatus && _screen->_fadeFlag == 0) - _screen->setPaletteBrightness(_screen->_currentPalette, _lampOilStatus, newLampOilStatus); + _screen->setPaletteBrightness(_screen->_currentPalette, _lampOilStatus, newLampOilStatus); } else { tmp2 = (_lampStatusUnk < 100) ? _lampStatusUnk : 100; newLampOilStatus = (3 - (tmp2 - 1) / 25) << 1; @@ -850,7 +850,7 @@ void LoLEngine::updateLampStatus() { } void LoLEngine::updateCompass() { - + } void LoLEngine::moveParty(uint16 direction, int unk1, int unk2, int buttonShape) { @@ -859,7 +859,7 @@ void LoLEngine::moveParty(uint16 direction, int unk1, int unk2, int buttonShape) uint16 opos = _currentBlock; uint16 npos = calcNewBlockPostion(_currentBlock, direction); - + if (!checkBlockPassability(npos, direction)) { notifyBlockNotPassable(unk2 ? 0 : 1); gui_toggleButtonDisplayMode(buttonShape, 0); @@ -872,12 +872,12 @@ void LoLEngine::moveParty(uint16 direction, int unk1, int unk2, int buttonShape) calcCoordinates(_partyPosX, _partyPosY, opos, 0x80, 0x80); _unkFlag &= 0xfdff; - + runSceneScript(opos, 4); runSceneScript(npos, 1); if (!(_unkFlag & 0x200)) { - updatePortraitUnkTimeSub(2, 0); + initTextFading(2, 0); if (_sceneDefaultUpdate) { switch (unk2) { @@ -953,7 +953,7 @@ void LoLEngine::movePartySmoothScrollBlocked(int speed) { _screen->smoothScrollZoomStepBottom(6, 2, _scrollXBottom[i], _scrollYBottom[i]); _screen->restoreSceneWindow(2, 0); _screen->updateScreen(); - fadeText(); + fadeText(); delayUntil(_smoothScrollTimer); if (!_smoothScrollModeNormal) i++; @@ -965,7 +965,7 @@ void LoLEngine::movePartySmoothScrollBlocked(int speed) { _screen->smoothScrollZoomStepBottom(6, 2, _scrollXBottom[i], _scrollYBottom[i]); _screen->restoreSceneWindow(2, 0); _screen->updateScreen(); - fadeText(); + fadeText(); delayUntil(_smoothScrollTimer); if (!_smoothScrollModeNormal) i++; @@ -996,7 +996,7 @@ void LoLEngine::movePartySmoothScrollUp(int speed) { _screen->copyRegionToBuffer(2, 112, 0, 176, 120, _scrollSceneBuffer); _screen->backupSceneWindow(6, 6); } - + for (int i = 0; i < 5; i++) { _smoothScrollTimer = _system->getMillis() + speed * _tickLength; _screen->smoothScrollZoomStepTop(6, 2, _scrollXTop[i], _scrollYTop[i]); @@ -1004,7 +1004,7 @@ void LoLEngine::movePartySmoothScrollUp(int speed) { //if (d) // unk(_tempBuffer5120, page2); - + _screen->restoreSceneWindow(2, 0); _screen->updateScreen(); fadeText(); @@ -1039,7 +1039,7 @@ void LoLEngine::movePartySmoothScrollDown(int speed) { //if (d) // unk(_tempBuffer5120, page2); - + _screen->restoreSceneWindow(2, 0); _screen->updateScreen(); fadeText(); @@ -1221,7 +1221,7 @@ int LoLEngine::smoothScrollDrawSpecialShape(int pageNum) { void LoLEngine::setLF2(int block) { if (!(_screen->_drawGuiFlag & 0x1000)) - return; + return; _levelBlockProperties[block].flags |= 7; // TODO } @@ -1458,8 +1458,8 @@ void LoLEngine::assignBlockCaps(int block, int direction) { } void LoLEngine::drawVcnBlocks(uint8 *vcnBlocks, uint16 *blockDrawingBuffer, uint8 *vcnShift, int pageNum) { - uint8 *d = _sceneWindowBuffer; - + uint8 *d = _sceneWindowBuffer; + for (int y = 0; y < 15; y++) { for (int x = 0; x < 22; x++) { bool flag = false; @@ -1484,11 +1484,11 @@ void LoLEngine::drawVcnBlocks(uint8 *vcnBlocks, uint16 *blockDrawingBuffer, uint vcnOffset &= 0x3fff; } } - + uint8 shift = vcnShift[vcnOffset]; uint8 *src = &vcnBlocks[vcnOffset << 5]; - if (flag) { + if (flag) { for (int blockY = 0; blockY < 8; blockY++) { src += 3; for (int blockX = 0; blockX < 4; blockX++) { @@ -1507,7 +1507,7 @@ void LoLEngine::drawVcnBlocks(uint8 *vcnBlocks, uint16 *blockDrawingBuffer, uint *d++ = _vcnExpTable[(t & 0x0f) | shift]; } d += 168; - } + } } d -= 1400; @@ -1523,17 +1523,17 @@ void LoLEngine::drawVcnBlocks(uint8 *vcnBlocks, uint16 *blockDrawingBuffer, uint shift = vcnShift[remainder]; src = &vcnBlocks[remainder << 5]; - if (flag) { + if (flag) { for (int blockY = 0; blockY < 8; blockY++) { src += 3; for (int blockX = 0; blockX < 4; blockX++) { uint8 t = *src--; uint8 h = _vcnExpTable[(t & 0x0f) | shift]; uint8 l = _vcnExpTable[(t >> 4) | shift]; - if (h) + if (h) *d = h; d++; - if (l) + if (l) *d = l; d++; } @@ -1544,12 +1544,12 @@ void LoLEngine::drawVcnBlocks(uint8 *vcnBlocks, uint16 *blockDrawingBuffer, uint for (int blockY = 0; blockY < 8; blockY++) { for (int blockX = 0; blockX < 4; blockX++) { uint8 t = *src++; - uint8 h = _vcnExpTable[(t >> 4) | shift]; + uint8 h = _vcnExpTable[(t >> 4) | shift]; uint8 l = _vcnExpTable[(t & 0x0f) | shift]; - if (h) + if (h) *d = h; d++; - if (l) + if (l) *d = l; d++; } @@ -1599,7 +1599,7 @@ void LoLEngine::drawSceneShapes() { continue; uint16 v = 20 * (s - _dscUnk2[s]); - + scaleLevelShapesDim(t, dimY1, dimY2, 13); drawDoor(_doorShapes[_dscDoorShpIndex[s]], 0, t, 10, 0, -v, 2); setLevelShapesDim(t, dimY1, dimY2, 13); @@ -1630,7 +1630,7 @@ void LoLEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim) { } t = _dscDim2[((m + i) << 1) + 1]; - + if (t < x2) { x2 = t; if (!(a & 0x10)) @@ -1638,7 +1638,7 @@ void LoLEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim) { } } else { int t = _dscDim1[m + i]; - + if (!_wllVmpMap[d] || t == -40) continue; @@ -1654,11 +1654,11 @@ void LoLEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim) { if (t < 0 && x1 < -t) x1 = -t; } - + if (x2 < x1) break; } - + x1 += 14; x2 += 14; @@ -1802,8 +1802,8 @@ void LoLEngine::drawDoor(uint8 *shape, uint8 *table, int index, int unk2, int w, int u = 0; - if (flags & 2) { - uint8 dimW = _dscDimMap[index]; + if (flags & 2) { + uint8 dimW = _dscDimMap[index]; _dmScaleW = _dscDoorMonsterScaleTable[dimW << 1]; _dmScaleH = _dscDoorMonsterScaleTable[(dimW << 1) + 1]; u = _dscDoor4[dimW]; @@ -1830,7 +1830,7 @@ void LoLEngine::drawDoor(uint8 *shape, uint8 *table, int index, int unk2, int w, uint8 *ovl = _screen->getLevelOverlay(d); int doorScaledWitdh = _screen->getShapeScaledWidth(shape, _dmScaleW); - + _shpDmX -= (doorScaledWitdh >> 1); _shpDmY -= s; @@ -1851,9 +1851,9 @@ void LoLEngine::drawDoorOrMonsterShape(uint8 *shape, uint8 *table, int x, int y, if (flg & 0x1000) { if (table) - _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x9104, table, ovl, 1, _trueLightTable1, _trueLightTable2, _dmScaleW, _dmScaleH); + _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x9104, table, ovl, 1, _trueLightTable1, _trueLightTable2, _dmScaleW, _dmScaleH); else - _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x1104, ovl, 1, _trueLightTable1, _trueLightTable2, _dmScaleW, _dmScaleH); + _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x1104, ovl, 1, _trueLightTable1, _trueLightTable2, _dmScaleW, _dmScaleH); } else { if (table) _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x8104, table, ovl, 1, _dmScaleW, _dmScaleH); diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index e69d3ed8d8..988cfd4584 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -382,7 +382,7 @@ bool StaticResource::init() { { lolLevelShpList, kStringList, "SHPFILES.TXT" }, { lolLevelDatList, kStringList, "DATFILES.TXT" }, { lolCompassDefs, lolCompassData, "COMPASS.DEF" }, - + { lolDscUnk1, kRawData, "DSCSHPU1.DEF" }, { lolDscShapeIndex, kRawData, "DSCSHPI1.DEF" }, { lolDscOvlMap, kRawData, "DSCSHPI2.DEF" }, @@ -939,7 +939,7 @@ bool StaticResource::loadCharData(const char *filename, void *&ptr, int &size) { size = file->size() / 130; LoLCharacter *charData = new LoLCharacter[size]; - + for (int i = 0; i < size; i++) { LoLCharacter *t = &charData[i]; @@ -999,7 +999,7 @@ bool StaticResource::loadCharData(const char *filename, void *&ptr, int &size) { }; ptr = charData; - + return true; } @@ -1011,7 +1011,7 @@ bool StaticResource::loadSpellData(const char *filename, void *&ptr, int &size) size = file->size() / 28; SpellProperty *spellData = new SpellProperty[size]; - + for (int i = 0; i < size; i++) { SpellProperty *t = &spellData[i]; @@ -1028,7 +1028,7 @@ bool StaticResource::loadSpellData(const char *filename, void *&ptr, int &size) }; ptr = spellData; - + return true; } @@ -1040,7 +1040,7 @@ bool StaticResource::loadCompassData(const char *filename, void *&ptr, int &size size = file->size() / 4; CompassDef *defs = new CompassDef[size]; - + for (int i = 0; i < size; i++) { CompassDef *t = &defs[i]; t->shapeIndex = file->readByte(); @@ -1050,7 +1050,7 @@ bool StaticResource::loadCompassData(const char *filename, void *&ptr, int &size }; ptr = defs; - + return true; } @@ -1065,7 +1065,7 @@ bool StaticResource::loadRawDataBe16(const char *filename, void *&ptr, int &size r[i] = file->readUint16BE(); ptr = r; - + return true; } @@ -1088,9 +1088,9 @@ bool StaticResource::loadButtonDefs(const char *filename, void *&ptr, int &size) r[i].index = file->readUint16BE(); r[i].screenDim = file->readUint16BE(); } - + ptr = r; - + return true; } @@ -1681,7 +1681,7 @@ void KyraEngine_MR::initStaticResource() { } void LoLEngine::initStaticResource() { - _charDefaults = _staticres->loadCharData(lolCharacterDefs, _charDefaultsSize); + _charDefaults = _staticres->loadCharData(lolCharacterDefs, _charDefaultsSize); _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(lolIngameSfxIndex, _ingameSoundIndexSize); _musicTrackMap = _staticres->loadRawData(lolMusicTrackMap, _musicTrackMapSize); _ingameGMSoundIndex = _staticres->loadRawData(lolIngameGMSfxIndex, _ingameGMSoundIndexSize); @@ -1840,7 +1840,7 @@ void LoLEngine::assignButtonCallback(Button *button, int index) { }; #undef cb - button->buttonCallback = buttonCallbacks[index]; + button->buttonCallback = buttonCallbacks[index]; } const ScreenDim Screen_LoK::_screenDimTable[] = { diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp index b85d12710a..48d67b7dda 100644 --- a/engines/kyra/text_lol.cpp +++ b/engines/kyra/text_lol.cpp @@ -193,15 +193,15 @@ void TextDisplayer_LoL::playDialogue(int dim, char *str, EMCState *script, int16 _vm->_fadeText = false; } -void TextDisplayer_LoL::printMessage(uint16 flags, char *str, ...) { +void TextDisplayer_LoL::printMessage(uint16 type, char *str, ...) { static uint8 textColours[] = { 0xfe, 0xa2, 0x84, 0x97, 0x9F }; static uint8 soundEffect[] = { 0x0B, 0x00, 0x2B, 0x1B, 0x00 }; - if (flags & 4) - flags ^= 4; + if (type & 4) + type ^= 4; else _vm->updatePortraits(); - uint16 col = textColours[flags & 0x7fff]; + uint16 col = textColours[type & 0x7fff]; int od = _screen->curDimIndex(); @@ -225,14 +225,14 @@ void TextDisplayer_LoL::printMessage(uint16 flags, char *str, ...) { va_end(args); - displayText(str); + displayText(_buffer); _screen->setScreenDim(od); - if (!(flags & 0x8000) && soundEffect[flags]) - _vm->sound()->playSoundEffect(soundEffect[flags]); + if (!(type & 0x8000) && soundEffect[type]) + _vm->sound()->playSoundEffect(soundEffect[type]); - _vm->_textColourFlag = flags & 0x7fff; + _vm->_textColourFlag = type & 0x7fff; _vm->_fadeText = false; } diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h index d921dacb0b..730ff6df9c 100644 --- a/engines/kyra/text_lol.h +++ b/engines/kyra/text_lol.h @@ -45,7 +45,7 @@ public: void expandField(); void playDialogue(int dim, char *str, EMCState *script, int16 *paramList, int16 paramIndex); - void printMessage(uint16 colSnd, char *str, ...); + void printMessage(uint16 type, char *str, ...); int16 _scriptParameter; -- cgit v1.2.3