diff options
author | Florian Kagerer | 2009-11-11 23:05:19 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-11-11 23:05:19 +0000 |
commit | c0fc64ecbf8964a6047faf2c86240ca5e8608f4f (patch) | |
tree | 78243a883a1fef5306629c377da18f87c84d7a34 /engines/kyra | |
parent | e0ae43ded79f1b968e6939b863f5e1bcd7144732 (diff) | |
download | scummvm-rg350-c0fc64ecbf8964a6047faf2c86240ca5e8608f4f.tar.gz scummvm-rg350-c0fc64ecbf8964a6047faf2c86240ca5e8608f4f.tar.bz2 scummvm-rg350-c0fc64ecbf8964a6047faf2c86240ca5e8608f4f.zip |
LOL: - fixed transparency tables in PC-98 16 color version
- renamed some variables
svn-id: r45847
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/lol.cpp | 62 | ||||
-rw-r--r-- | engines/kyra/lol.h | 18 | ||||
-rw-r--r-- | engines/kyra/scene_lol.cpp | 35 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/screen_lol.h | 2 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/script_tim.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/sprites_lol.cpp | 58 |
8 files changed, 96 insertions, 97 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 7b4e2343dd..209e112f95 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -145,8 +145,8 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy _vcnExpTable = 0; _vmpPtr = 0; _vcfBlocks = 0; - _trueLightTable2 = 0; - _trueLightTable1 = 0; + _transparencyTable2 = 0; + _transparencyTable1 = 0; _levelShapeProperties = 0; _levelShapes = 0; _specialGuiShape = 0; @@ -356,8 +356,8 @@ LoLEngine::~LoLEngine() { delete[] _vcnShift; delete[] _vmpPtr; delete[] _vcfBlocks; - delete[] _trueLightTable2; - delete[] _trueLightTable1; + delete[] _transparencyTable2; + delete[] _transparencyTable1; delete[] _levelShapeProperties; delete[] _blockDrawingBuffer; delete[] _sceneWindowBuffer; @@ -867,8 +867,8 @@ void LoLEngine::startup() { runInitScript("ONETIME.INF", 0); _emc->load("ITEM.INF", &_itemScript, &_opcodes); - _trueLightTable1 = new uint8[256]; - _trueLightTable2 = new uint8[5120]; + _transparencyTable1 = new uint8[256]; + _transparencyTable2 = new uint8[5120]; _loadSuppFilesFlag = 1; @@ -1754,33 +1754,31 @@ void LoLEngine::generateFlashPalette(const Palette &src, Palette &dst, int color dst.copy(src, 128); } -void LoLEngine::createGfxTables() { +void LoLEngine::createTransparencyTables() { if (_flags.isTalkie || _loadSuppFilesFlag) return; Palette tpal(256); if (_flags.use16ColorMode) { - static const uint8 colTbl[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; - tpal.fill(0, 256, 0xff); - uint8 *p = _screen->getPalette(0).getData(); - uint8 *d = tpal.getData(); - - _res->loadFileToBuf("LOL.NOL", p, 48); - - for (int i = 15; i >= 0; i--) { - d[colTbl[i] * 3 + 2] = p[i * 3 + 2]; - d[colTbl[i] * 3 + 1] = p[i * 3 + 1]; - d[colTbl[i] * 3] = p[i * 3]; + static const uint8 colTbl[] = { 0x00, 0x00, 0x11, 0x00, 0x22, 0x00, 0x33, 0x00, 0x44, 0x00, 0x55, 0x00, 0x66, 0x00, 0x77, 0x00, 0x88, 0x00, 0x99, 0x00, 0xAA, 0x00, 0xBB, 0x00, 0xCC, 0x00, 0xDD, 0x00, 0xEE, 0x00, 0xFF, 0x00 }; + memset(tpal.getData(), 0xff, 768); + + _res->loadFileToBuf("LOL.NOL", tpal.getData(), 48); + for (int i = 15; i > -1; i--) { + int s = colTbl[i << 1] * 3; + tpal[s] = tpal[i * 3]; + tpal[s + 1] = tpal[i * 3 + 1]; + tpal[s + 2] = tpal[i * 3 + 2]; + tpal[i * 3 + 2] = tpal[i * 3 + 1] = tpal[i * 3] = 0xff; } - _screen->generateTruelightTables(colTbl, 16, tpal, tpal, _trueLightTable1, _trueLightTable2, 80); - _screen->loadPalette("LOL.NOL", _screen->getPalette(0)); + _screen->createTransparencyTablesIntern(colTbl, 16, tpal, tpal, _transparencyTable1, _transparencyTable2, 80); } else { _screen->loadPalette("fxpal.col", tpal); _screen->loadBitmap("fxpal.shp", 3, 3, 0); const uint8 *shpPal = _screen->getPtrToShape(_screen->getCPagePtr(2), 0) + 11; - _screen->generateTruelightTables(shpPal, 20, tpal, _screen->getPalette(1), _trueLightTable1, _trueLightTable2, 70); + _screen->createTransparencyTablesIntern(shpPal, 20, tpal, _screen->getPalette(1), _transparencyTable1, _transparencyTable2, 70); } _loadSuppFilesFlag = 1; @@ -2114,7 +2112,7 @@ int LoLEngine::processMagicSpark(int charNum, int spellLevel) { if ((i - wFrames[ii]) == 1) snd_playSoundEffect(162, -1); - mov->displayFrame(((i - wFrames[ii]) + (dist << 4)) % numFrames, 2, wX[ii], wY[ii], 0x5000, _trueLightTable1, _trueLightTable2); + mov->displayFrame(((i - wFrames[ii]) + (dist << 4)) % numFrames, 2, wX[ii], wY[ii], 0x5000, _transparencyTable1, _transparencyTable2); _screen->copyRegion(wX[ii], wY[ii], wX[ii], wY[ii], width, height, 2, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); } @@ -2237,7 +2235,7 @@ int LoLEngine::processMagicHeal(int charNum, int spellLevel) { increaseCharacterHitpoints(charNum, pts[charNum] / 256, true); gui_drawCharPortraitWithStats(charNum); - _screen->drawShape(2, _healShapes[healShpFrames[i]], pX[charNum], pY, 0, 0x1000, _trueLightTable1, _trueLightTable2); + _screen->drawShape(2, _healShapes[healShpFrames[i]], pX[charNum], pY, 0, 0x1000, _transparencyTable1, _transparencyTable2); _screen->fillRect(0, 0, 31, 31, 0); _screen->drawShape(_screen->_curPage, _healiShapes[healiShpFrames[i]], 0, 0, 0, 0); @@ -2515,7 +2513,7 @@ int LoLEngine::processMagicFireball(int charNum, int spellLevel) { if (_flags.use16ColorMode) _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 4, sW, sH); else - _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 0x1004, _trueLightTable1, _trueLightTable2, sW, sH); + _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 0x1004, _transparencyTable1, _transparencyTable2, sW, sH); if (finShpIndex2[fb->finProgress] != -1) { shp = _fireballShapes[finShpIndex2[fb->finProgress]]; @@ -2530,7 +2528,7 @@ int LoLEngine::processMagicFireball(int charNum, int spellLevel) { if (_flags.use16ColorMode) _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 4, sW, sH); else - _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 0x1004, _trueLightTable1, _trueLightTable2, sW, sH); + _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 0x1004, _transparencyTable1, _transparencyTable2, sW, sH); } if (fb->finalize) { @@ -2751,7 +2749,7 @@ int LoLEngine::processMagicFog() { for (int curFrame = 0; curFrame < numFrames; curFrame++) { uint32 delayTimer = _system->getMillis() + 3 * _tickLength; _screen->copyPage(12, 2); - mov->displayFrame(curFrame % numFrames, 2, 112, 0, 0x5000, _trueLightTable1, _trueLightTable2); + mov->displayFrame(curFrame % numFrames, 2, 112, 0, 0x5000, _transparencyTable1, _transparencyTable2); _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); delayUntil(delayTimer); @@ -2775,7 +2773,7 @@ int LoLEngine::processMagicFog() { } int LoLEngine::processMagicSwarm(int charNum, int damage) { - createGfxTables(); + createTransparencyTables(); int cp = _screen->setCurPage(2); _screen->copyPage(0, 12); @@ -2997,7 +2995,7 @@ void LoLEngine::callbackProcessMagicLightning(WSAMovie_v2 *mov, int x, int y) { } void LoLEngine::drinkBezelCup(int numUses, int charNum) { - createGfxTables(); + createTransparencyTables(); int cp = _screen->setCurPage(2); snd_playSoundEffect(73, -1); @@ -3027,7 +3025,7 @@ void LoLEngine::drinkBezelCup(int numUses, int charNum) { uint32 etime = _system->getMillis() + 4 * _tickLength; _screen->copyRegion(0, 0, x, y, w, h, 2, 2, Screen::CR_NO_P_CHECK); - mov->displayFrame(frm, 2, x, y, _flags.use16ColorMode ? 0x4000 : 0x5000, _trueLightTable1, _trueLightTable2); + mov->displayFrame(frm, 2, x, y, _flags.use16ColorMode ? 0x4000 : 0x5000, _transparencyTable1, _transparencyTable2); _screen->copyRegion(x, y, x, y, w, h, 2, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); @@ -3140,7 +3138,7 @@ void LoLEngine::transferSpellToScollAnimation(int charNum, int spell, int slot) int wsaX = vX + (((((cX - vX) << 8) / 16) * i) >> 8) - 16; int wsaY = vY + (((((160 - vY) << 8) / 16) * i) >> 8) - 16; - mov->displayFrame(51, 2, wsaX, wsaY, 0x5000, _trueLightTable1, _trueLightTable2); + mov->displayFrame(51, 2, wsaX, wsaY, 0x5000, _transparencyTable1, _transparencyTable2); _screen->copyRegion(wsaX, wsaY, wsaX, wsaY, mov->width() + 48, mov->height() + 48, 2, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); @@ -3211,7 +3209,7 @@ void LoLEngine::playSpellAnimation(WSAMovie_v2 *mov, int firstFrame, int lastFra (this->*callback)(mov, x, y); if (mov) - mov->displayFrame(curFrame % mov->frames(), 2, x, y, _flags.use16ColorMode ? 0x4000 : 0x5000, _trueLightTable1, _trueLightTable2); + mov->displayFrame(curFrame % mov->frames(), 2, x, y, _flags.use16ColorMode ? 0x4000 : 0x5000, _transparencyTable1, _transparencyTable2); if (mov || callback) { _screen->copyRegion(x, y, x, y, w2, h2, 2, 0, Screen::CR_NO_P_CHECK); @@ -3852,7 +3850,7 @@ void LoLEngine::launchMagicViper() { if (frm == v[2]) snd_playSoundEffect(172, -1); - mov->displayFrame(frm++ % numFrames, 2, 112, 0, 0x5000, _trueLightTable1, _trueLightTable2); + mov->displayFrame(frm++ % numFrames, 2, 112, 0, 0x5000, _transparencyTable1, _transparencyTable2); _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); delayUntil(etime); diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 9e4258f657..35560969b9 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -656,7 +656,7 @@ private: int olol_setGameFlag(EMCState *script); int olol_testGameFlag(EMCState *script); int olol_loadLevelGraphics(EMCState *script); - int olol_loadCmzFile(EMCState *script); + int olol_loadBlockProperties(EMCState *script); int olol_loadMonsterShapes(EMCState *script); int olol_deleteHandItem(EMCState *script); int olol_allocItemPropertiesBuffer(EMCState *script); @@ -888,7 +888,7 @@ private: void setPaletteBrightness(const Palette &srcPal, int brightness, int modifier); void generateBrightnessPalette(const Palette &src, Palette &dst, int brightness, int modifier); void generateFlashPalette(const Palette &src, Palette &dst, int colorFlags); - void createGfxTables(); + void createTransparencyTables(); void updateSequenceBackgroundAnimations(); bool _dialogueField; @@ -980,12 +980,12 @@ private: void loadLevel(int index); void addLevelItems(); void loadLevelWallData(int index, bool mapShapes); - void assignBlockObject(uint16 *cmzItemIndex, uint16 item); + void assignBlockObject(LevelBlockProperty *l, uint16 item); int assignLevelShapes(int index); uint8 *getLevelShapes(int index); void restoreBlockTempData(int index); void restoreTempDataAdjustMonsterStrength(int index); - void loadCmzFile(const char *file); + void loadBlockProperties(const char *cmzFile); void loadLevelShpDat(const char *shpFile, const char *datFile, bool flag); void loadLevelGraphics(const char *file, int specialColor, int weight, int vcnLen, int vmpLen, const char *palFile); @@ -1106,8 +1106,8 @@ private: int _sceneDrawVarLeft; int _wllProcessFlag; - uint8 *_trueLightTable2; - uint8 *_trueLightTable1; + uint8 *_transparencyTable2; + uint8 *_transparencyTable1; int _loadSuppFilesFlag; @@ -1284,9 +1284,9 @@ private: void redrawSceneItem(); int calcItemMonsterPosition(ItemInPlay *i, uint16 direction); void calcSpriteRelPosition(uint16 x1, uint16 y1, int &x2, int &y2, uint16 direction); - void drawDoor(uint8 *shape, uint8 *table, int index, int unk2, int w, int h, int flags); - void drawDoorOrMonsterShape(uint8 *shape, uint8 *table, int x, int y, int flags, const uint8 *ovl); - uint8 *drawItemOrMonster(uint8 *shape, uint8 *ovl, int x, int y, int fineX, int fineY, int flags, int tblValue, bool vflip); + void drawDoor(uint8 *shape, uint8 *doorPalette, int index, int unk2, int w, int h, int flags); + void drawDoorOrMonsterEquipment(uint8 *shape, uint8 *objectPalette, int x, int y, int flags, const uint8 *brightnessOverlay); + uint8 *drawItemOrMonster(uint8 *shape, uint8 *monsterPalette, int x, int y, int fineX, int fineY, int flags, int tblValue, bool vflip); int calcDrawingLayerParameters(int srcX, int srcY, int &x2, int &y2, uint16 &w, uint16 &h, uint8 *shape, int vflip); void updateMonster(MonsterInPlay *monster); diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 82930ef36d..75bd813fe9 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -109,38 +109,39 @@ void LoLEngine::addLevelItems() { if (_itemsInPlay[i].level != _currentLevel) continue; - assignBlockObject(&_levelBlockProperties[_itemsInPlay[i].block].assignedObjects, i); + assignBlockObject(&_levelBlockProperties[_itemsInPlay[i].block], i); _levelBlockProperties[_itemsInPlay[i].block].direction = 5; _itemsInPlay[i].nextDrawObject = 0; } } -void LoLEngine::assignBlockObject(uint16 *cmzItemIndex, uint16 item) { +void LoLEngine::assignBlockObject(LevelBlockProperty *l, uint16 item) { + uint16 *index = &l->assignedObjects; ItemInPlay *tmp = 0; - while (*cmzItemIndex & 0x8000) { - tmp = findObject(*cmzItemIndex); - cmzItemIndex = &tmp->nextAssignedObject; + while (*index & 0x8000) { + tmp = findObject(*index); + index = &tmp->nextAssignedObject; } tmp = findObject(item); tmp->level = -1; - uint16 ix = *cmzItemIndex; + uint16 ix = *index; if (ix == item) return; - *cmzItemIndex = item; - cmzItemIndex = &tmp->nextAssignedObject; + *index = item; + index = &tmp->nextAssignedObject; - while (*cmzItemIndex) { - tmp = findObject(*cmzItemIndex); - cmzItemIndex = &tmp->nextAssignedObject; + while (*index) { + tmp = findObject(*index); + index = &tmp->nextAssignedObject; } - *cmzItemIndex = ix; + *index = ix; } void LoLEngine::loadLevelWallData(int index, bool mapShapes) { @@ -291,9 +292,9 @@ void LoLEngine::restoreTempDataAdjustMonsterStrength(int index) { } } -void LoLEngine::loadCmzFile(const char *file) { +void LoLEngine::loadBlockProperties(const char *cmzFile) { memset(_levelBlockProperties, 0, 1024 * sizeof(LevelBlockProperty)); - _screen->loadBitmap(file, 2, 2, 0); + _screen->loadBitmap(cmzFile, 2, 2, 0); const uint8 *h = _screen->getCPagePtr(2); uint16 len = READ_LE_UINT16(&h[4]); const uint8 *p = h + 6; @@ -508,11 +509,11 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight char tname[13]; snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel); Common::SeekableReadStream *s = _res->createReadStream(tname); - s->read(_trueLightTable1, 256); - s->read(_trueLightTable2, 5120); + s->read(_transparencyTable1, 256); + s->read(_transparencyTable2, 5120); delete s; } else { - createGfxTables(); + createTransparencyTables(); } _loadSuppFilesFlag = 1; diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 284158e586..86e113ded9 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -245,7 +245,7 @@ uint8 *Screen_LoL::generateLevelOverlay(const Palette &srcPal, uint8 *ovl, int o return ovl; } -void Screen_LoL::generateTruelightTables(const uint8 *ovl, int a, const Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b) { +void Screen_LoL::createTransparencyTablesIntern(const uint8 *ovl, int a, const Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b) { memset(outTable1, 0xff, 256); for (int i = 0; i < a; i++) @@ -257,8 +257,8 @@ void Screen_LoL::generateTruelightTables(const uint8 *ovl, int a, const Palette uint16 fcol[3]; uint16 scol[3]; - int t1 = (b << 6) / 100; - int t2 = 64 - t1; + uint16 t1 = (b << 6) / 100; + uint16 t2 = 64 - t1; uint8 c = ovl[i]; fcol[0] = fxPal[3 * c]; @@ -277,7 +277,7 @@ void Screen_LoL::generateTruelightTables(const uint8 *ovl, int a, const Palette tcol[2] = CLIP(((fcol[2] * t2) >> 6) + ((scol[2] * t1) >> 6), 0, 63); o[ii] = findLeastDifferentColor(tcol, screenPal, 0, 255); - } + } } else { memset(&outTable2[i << 8], 0, 256); diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index e455976d76..087793a80e 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -82,7 +82,7 @@ public: uint8 *generateLevelOverlay(const Palette &Pal, uint8 *ovl, int opColor, int weight); uint8 *getLevelOverlay(int index) { return _levelOverlays[index]; } - void generateTruelightTables(const uint8 *ovl, int a, const Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b); + void createTransparencyTablesIntern(const uint8 *ovl, int a, const Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b); void copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl); void applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 56ab913a4a..7fe89fb1cb 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -233,9 +233,9 @@ int LoLEngine::olol_loadLevelGraphics(EMCState *script) { return 1; } -int LoLEngine::olol_loadCmzFile(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadCmzFile(%p) (%s)", (const void *)script, stackPosString(0)); - loadCmzFile(stackPosString(0)); +int LoLEngine::olol_loadBlockProperties(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadBlockProperties(%p) (%s)", (const void *)script, stackPosString(0)); + loadBlockProperties(stackPosString(0)); return 1; } @@ -2715,7 +2715,7 @@ void LoLEngine::setupOpcodeTable() { // 0x08 Opcode(olol_testGameFlag); Opcode(olol_loadLevelGraphics); - Opcode(olol_loadCmzFile); + Opcode(olol_loadBlockProperties); Opcode(olol_loadMonsterShapes); // 0x0C diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index c2de015a0b..e4e834b86f 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -1161,7 +1161,7 @@ void TIMInterpreter_LoL::playAnimationPart(int animIndex, int firstFrame, int la uint32 next = _system->getMillis() + delay * _vm->_tickLength; if (anim->wsaCopyParams & 0x4000) { _screen->copyRegion(112, 0, 112, 0, 176, 120, 6, 2); - anim->wsa->displayFrame(i - 1, 2, anim->x, anim->y, anim->wsaCopyParams & 0x1000 ? 0x5000 : 0x4000, _vm->_trueLightTable1, _vm->_trueLightTable2); + anim->wsa->displayFrame(i - 1, 2, anim->x, anim->y, anim->wsaCopyParams & 0x1000 ? 0x5000 : 0x4000, _vm->_transparencyTable1, _vm->_transparencyTable2); _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0); _screen->updateScreen(); } else { diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index 3279560650..a943853867 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -665,8 +665,8 @@ void LoLEngine::drawMonster(uint16 id) { if (m->properties->flags & 0x800) flg |= 0x20; - uint8 *ovl1 = d ? _monsterPalettes[(m->properties->shapeIndex << 4) + (curFrm & 0x0f)] + (shp[10] * (d - 1)) : 0; - uint8 *ovl2 = drawItemOrMonster(shp, ovl1, m->x + _monsterShiftOffs[m->shiftStep << 1], m->y + _monsterShiftOffs[(m->shiftStep << 1) + 1], 0, 0, flg | 1, -1, flip); + uint8 *monsterPalette = d ? _monsterPalettes[(m->properties->shapeIndex << 4) + (curFrm & 0x0f)] + (shp[10] * (d - 1)) : 0; + uint8 *brightnessOverlay = drawItemOrMonster(shp, monsterPalette, m->x + _monsterShiftOffs[m->shiftStep << 1], m->y + _monsterShiftOffs[(m->shiftStep << 1) + 1], 0, 0, flg | 1, -1, flip); for (int i = 0; i < 4; i++) { int v = m->equipmentShapes[i] - 1; @@ -677,7 +677,7 @@ void LoLEngine::drawMonster(uint16 id) { if (!shp2) continue; - drawDoorOrMonsterShape(shp2, 0, _shpDmX, _shpDmY, flg | 1, ovl2); + drawDoorOrMonsterEquipment(shp2, 0, _shpDmX, _shpDmY, flg | 1, brightnessOverlay); } } @@ -901,7 +901,7 @@ void LoLEngine::calcSpriteRelPosition(uint16 x1, uint16 y1, int &x2, int &y2, ui y2 = b; } -void LoLEngine::drawDoor(uint8 *shape, uint8 *table, int index, int unk2, int w, int h, int flags) { +void LoLEngine::drawDoor(uint8 *shape, uint8 *doorPalette, int index, int unk2, int w, int h, int flags) { uint8 c = _dscDoor1[(_currentDirection << 5) + unk2]; int r = (c / 5) + 5 * _dscDimMap[index]; uint16 d = _dscShapeOvlIndex[r]; @@ -950,16 +950,16 @@ void LoLEngine::drawDoor(uint8 *shape, uint8 *table, int index, int unk2, int w, d = 0; } - uint8 *ovl = _screen->getLevelOverlay(d); + uint8 *brightnessOverlay = _screen->getLevelOverlay(d); int doorScaledWitdh = _screen->getShapeScaledWidth(shape, _dmScaleW); _shpDmX -= (doorScaledWitdh >> 1); _shpDmY -= s; - drawDoorOrMonsterShape(shape, table, _shpDmX, _shpDmY, flags, ovl); + drawDoorOrMonsterEquipment(shape, doorPalette, _shpDmX, _shpDmY, flags, brightnessOverlay); } -void LoLEngine::drawDoorOrMonsterShape(uint8 *shape, uint8 *table, int x, int y, int flags, const uint8 *ovl) { +void LoLEngine::drawDoorOrMonsterEquipment(uint8 *shape, uint8 *objectPalette, int x, int y, int flags, const uint8 *brightnessOverlay) { int flg = 0; if (flags & 0x10) @@ -972,27 +972,27 @@ void LoLEngine::drawDoorOrMonsterShape(uint8 *shape, uint8 *table, int x, int y, flg |= 2; if (flg & 0x1000) { - if (table) - _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x9104, table, ovl, 1, _trueLightTable1, _trueLightTable2, _dmScaleW, _dmScaleH); + if (objectPalette) + _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x9104, objectPalette, brightnessOverlay, 1, _transparencyTable1, _transparencyTable2, _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, brightnessOverlay, 1, _transparencyTable1, _transparencyTable2, _dmScaleW, _dmScaleH); } else { - if (table) - _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x8104, table, ovl, 1, _dmScaleW, _dmScaleH); + if (objectPalette) + _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x8104, objectPalette, brightnessOverlay, 1, _dmScaleW, _dmScaleH); else - _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x104, ovl, 1, _dmScaleW, _dmScaleH); + _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x104, brightnessOverlay, 1, _dmScaleW, _dmScaleH); } } -uint8 *LoLEngine::drawItemOrMonster(uint8 *shape, uint8 *table, int x, int y, int fineX, int fineY, int flags, int tblValue, bool vflip) { +uint8 *LoLEngine::drawItemOrMonster(uint8 *shape, uint8 *monsterPalette, int x, int y, int fineX, int fineY, int flags, int tblValue, bool vflip) { uint8 *ovl2 = 0; - uint8 *ovl = 0; + uint8 *brightnessOverlay = 0; uint8 tmpOvl[16]; if (flags & 0x80) { flags &= 0xff7f; - ovl2 = table; - table = 0; + ovl2 = monsterPalette; + monsterPalette = 0; } else { ovl2 = _screen->getLevelOverlay(_flags.use16ColorMode ? 5 : 4); } @@ -1009,12 +1009,12 @@ uint8 *LoLEngine::drawItemOrMonster(uint8 *shape, uint8 *table, int x, int y, in else r = 0; } - ovl = _screen->getLevelOverlay(r); + brightnessOverlay = _screen->getLevelOverlay(r); } else { memset(tmpOvl + 1, tblValue, 15); tmpOvl[0] = 0; - table = tmpOvl; - ovl = _screen->getLevelOverlay(7); + monsterPalette = tmpOvl; + brightnessOverlay = _screen->getLevelOverlay(7); } int flg = flags & 0x10 ? 1 : 0; @@ -1029,8 +1029,8 @@ uint8 *LoLEngine::drawItemOrMonster(uint8 *shape, uint8 *table, int x, int y, in } else { if (_currentLevel == 22) { - if (ovl) - ovl[255] = 0; + if (brightnessOverlay) + brightnessOverlay[255] = 0; } else { flg |= 0x2000; } @@ -1042,21 +1042,21 @@ uint8 *LoLEngine::drawItemOrMonster(uint8 *shape, uint8 *table, int x, int y, in int dH = _screen->getShapeScaledHeight(shape, _dmScaleH) >> 1; if (flg & 0x1000) { - if (table) - _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x8124, table, ovl, 0, _trueLightTable1, _trueLightTable2, _dmScaleW, _dmScaleH, ovl2); + if (monsterPalette) + _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x8124, monsterPalette, brightnessOverlay, 0, _transparencyTable1, _transparencyTable2, _dmScaleW, _dmScaleH, ovl2); else - _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x124, ovl, 0, _trueLightTable1, _trueLightTable2, _dmScaleW, _dmScaleH, ovl2); + _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x124, brightnessOverlay, 0, _transparencyTable1, _transparencyTable2, _dmScaleW, _dmScaleH, ovl2); } else { - if (table) - _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x8124, table, ovl, 1, _dmScaleW, _dmScaleH, ovl2); + if (monsterPalette) + _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x8124, monsterPalette, brightnessOverlay, 1, _dmScaleW, _dmScaleH, ovl2); else - _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x124, ovl, 1, _dmScaleW, _dmScaleH, ovl2); + _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x124, brightnessOverlay, 1, _dmScaleW, _dmScaleH, ovl2); } _shpDmX -= (_screen->getShapeScaledWidth(shape, _dmScaleW) >> 1); _shpDmY -= dH; - return ovl; + return brightnessOverlay; } int LoLEngine::calcDrawingLayerParameters(int x1, int y1, int &x2, int &y2, uint16 &w, uint16 &h, uint8 *shape, int vflip) { |