LOL: - fixed transparency tables in PC-98 16 color version

- renamed some variables

svn-id: r45847
This commit is contained in:
Florian Kagerer 2009-11-11 23:05:19 +00:00
parent e0ae43ded7
commit c0fc64ecbf
8 changed files with 96 additions and 97 deletions

View file

@ -145,8 +145,8 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
_vcnExpTable = 0; _vcnExpTable = 0;
_vmpPtr = 0; _vmpPtr = 0;
_vcfBlocks = 0; _vcfBlocks = 0;
_trueLightTable2 = 0; _transparencyTable2 = 0;
_trueLightTable1 = 0; _transparencyTable1 = 0;
_levelShapeProperties = 0; _levelShapeProperties = 0;
_levelShapes = 0; _levelShapes = 0;
_specialGuiShape = 0; _specialGuiShape = 0;
@ -356,8 +356,8 @@ LoLEngine::~LoLEngine() {
delete[] _vcnShift; delete[] _vcnShift;
delete[] _vmpPtr; delete[] _vmpPtr;
delete[] _vcfBlocks; delete[] _vcfBlocks;
delete[] _trueLightTable2; delete[] _transparencyTable2;
delete[] _trueLightTable1; delete[] _transparencyTable1;
delete[] _levelShapeProperties; delete[] _levelShapeProperties;
delete[] _blockDrawingBuffer; delete[] _blockDrawingBuffer;
delete[] _sceneWindowBuffer; delete[] _sceneWindowBuffer;
@ -867,8 +867,8 @@ void LoLEngine::startup() {
runInitScript("ONETIME.INF", 0); runInitScript("ONETIME.INF", 0);
_emc->load("ITEM.INF", &_itemScript, &_opcodes); _emc->load("ITEM.INF", &_itemScript, &_opcodes);
_trueLightTable1 = new uint8[256]; _transparencyTable1 = new uint8[256];
_trueLightTable2 = new uint8[5120]; _transparencyTable2 = new uint8[5120];
_loadSuppFilesFlag = 1; _loadSuppFilesFlag = 1;
@ -1754,33 +1754,31 @@ void LoLEngine::generateFlashPalette(const Palette &src, Palette &dst, int color
dst.copy(src, 128); dst.copy(src, 128);
} }
void LoLEngine::createGfxTables() { void LoLEngine::createTransparencyTables() {
if (_flags.isTalkie || _loadSuppFilesFlag) if (_flags.isTalkie || _loadSuppFilesFlag)
return; return;
Palette tpal(256); Palette tpal(256);
if (_flags.use16ColorMode) { if (_flags.use16ColorMode) {
static const uint8 colTbl[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; 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 };
tpal.fill(0, 256, 0xff); memset(tpal.getData(), 0xff, 768);
uint8 *p = _screen->getPalette(0).getData();
uint8 *d = tpal.getData();
_res->loadFileToBuf("LOL.NOL", p, 48); _res->loadFileToBuf("LOL.NOL", tpal.getData(), 48);
for (int i = 15; i > -1; i--) {
for (int i = 15; i >= 0; i--) { int s = colTbl[i << 1] * 3;
d[colTbl[i] * 3 + 2] = p[i * 3 + 2]; tpal[s] = tpal[i * 3];
d[colTbl[i] * 3 + 1] = p[i * 3 + 1]; tpal[s + 1] = tpal[i * 3 + 1];
d[colTbl[i] * 3] = p[i * 3]; 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->createTransparencyTablesIntern(colTbl, 16, tpal, tpal, _transparencyTable1, _transparencyTable2, 80);
_screen->loadPalette("LOL.NOL", _screen->getPalette(0));
} else { } else {
_screen->loadPalette("fxpal.col", tpal); _screen->loadPalette("fxpal.col", tpal);
_screen->loadBitmap("fxpal.shp", 3, 3, 0); _screen->loadBitmap("fxpal.shp", 3, 3, 0);
const uint8 *shpPal = _screen->getPtrToShape(_screen->getCPagePtr(2), 0) + 11; 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; _loadSuppFilesFlag = 1;
@ -2114,7 +2112,7 @@ int LoLEngine::processMagicSpark(int charNum, int spellLevel) {
if ((i - wFrames[ii]) == 1) if ((i - wFrames[ii]) == 1)
snd_playSoundEffect(162, -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->copyRegion(wX[ii], wY[ii], wX[ii], wY[ii], width, height, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen(); _screen->updateScreen();
} }
@ -2237,7 +2235,7 @@ int LoLEngine::processMagicHeal(int charNum, int spellLevel) {
increaseCharacterHitpoints(charNum, pts[charNum] / 256, true); increaseCharacterHitpoints(charNum, pts[charNum] / 256, true);
gui_drawCharPortraitWithStats(charNum); 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->fillRect(0, 0, 31, 31, 0);
_screen->drawShape(_screen->_curPage, _healiShapes[healiShpFrames[i]], 0, 0, 0, 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) if (_flags.use16ColorMode)
_screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 4, sW, sH); _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 4, sW, sH);
else 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) { if (finShpIndex2[fb->finProgress] != -1) {
shp = _fireballShapes[finShpIndex2[fb->finProgress]]; shp = _fireballShapes[finShpIndex2[fb->finProgress]];
@ -2530,7 +2528,7 @@ int LoLEngine::processMagicFireball(int charNum, int spellLevel) {
if (_flags.use16ColorMode) if (_flags.use16ColorMode)
_screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 4, sW, sH); _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 4, sW, sH);
else 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) { if (fb->finalize) {
@ -2751,7 +2749,7 @@ int LoLEngine::processMagicFog() {
for (int curFrame = 0; curFrame < numFrames; curFrame++) { for (int curFrame = 0; curFrame < numFrames; curFrame++) {
uint32 delayTimer = _system->getMillis() + 3 * _tickLength; uint32 delayTimer = _system->getMillis() + 3 * _tickLength;
_screen->copyPage(12, 2); _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->copyRegion(112, 0, 112, 0, 176, 120, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen(); _screen->updateScreen();
delayUntil(delayTimer); delayUntil(delayTimer);
@ -2775,7 +2773,7 @@ int LoLEngine::processMagicFog() {
} }
int LoLEngine::processMagicSwarm(int charNum, int damage) { int LoLEngine::processMagicSwarm(int charNum, int damage) {
createGfxTables(); createTransparencyTables();
int cp = _screen->setCurPage(2); int cp = _screen->setCurPage(2);
_screen->copyPage(0, 12); _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) { void LoLEngine::drinkBezelCup(int numUses, int charNum) {
createGfxTables(); createTransparencyTables();
int cp = _screen->setCurPage(2); int cp = _screen->setCurPage(2);
snd_playSoundEffect(73, -1); snd_playSoundEffect(73, -1);
@ -3027,7 +3025,7 @@ void LoLEngine::drinkBezelCup(int numUses, int charNum) {
uint32 etime = _system->getMillis() + 4 * _tickLength; uint32 etime = _system->getMillis() + 4 * _tickLength;
_screen->copyRegion(0, 0, x, y, w, h, 2, 2, Screen::CR_NO_P_CHECK); _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->copyRegion(x, y, x, y, w, h, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen(); _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 wsaX = vX + (((((cX - vX) << 8) / 16) * i) >> 8) - 16;
int wsaY = vY + (((((160 - vY) << 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->copyRegion(wsaX, wsaY, wsaX, wsaY, mov->width() + 48, mov->height() + 48, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen(); _screen->updateScreen();
@ -3211,7 +3209,7 @@ void LoLEngine::playSpellAnimation(WSAMovie_v2 *mov, int firstFrame, int lastFra
(this->*callback)(mov, x, y); (this->*callback)(mov, x, y);
if (mov) 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) { if (mov || callback) {
_screen->copyRegion(x, y, x, y, w2, h2, 2, 0, Screen::CR_NO_P_CHECK); _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]) if (frm == v[2])
snd_playSoundEffect(172, -1); 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->copyRegion(112, 0, 112, 0, 176, 120, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen(); _screen->updateScreen();
delayUntil(etime); delayUntil(etime);

View file

@ -656,7 +656,7 @@ private:
int olol_setGameFlag(EMCState *script); int olol_setGameFlag(EMCState *script);
int olol_testGameFlag(EMCState *script); int olol_testGameFlag(EMCState *script);
int olol_loadLevelGraphics(EMCState *script); int olol_loadLevelGraphics(EMCState *script);
int olol_loadCmzFile(EMCState *script); int olol_loadBlockProperties(EMCState *script);
int olol_loadMonsterShapes(EMCState *script); int olol_loadMonsterShapes(EMCState *script);
int olol_deleteHandItem(EMCState *script); int olol_deleteHandItem(EMCState *script);
int olol_allocItemPropertiesBuffer(EMCState *script); int olol_allocItemPropertiesBuffer(EMCState *script);
@ -888,7 +888,7 @@ private:
void setPaletteBrightness(const Palette &srcPal, int brightness, int modifier); void setPaletteBrightness(const Palette &srcPal, int brightness, int modifier);
void generateBrightnessPalette(const Palette &src, Palette &dst, 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 generateFlashPalette(const Palette &src, Palette &dst, int colorFlags);
void createGfxTables(); void createTransparencyTables();
void updateSequenceBackgroundAnimations(); void updateSequenceBackgroundAnimations();
bool _dialogueField; bool _dialogueField;
@ -980,12 +980,12 @@ private:
void loadLevel(int index); void loadLevel(int index);
void addLevelItems(); void addLevelItems();
void loadLevelWallData(int index, bool mapShapes); void loadLevelWallData(int index, bool mapShapes);
void assignBlockObject(uint16 *cmzItemIndex, uint16 item); void assignBlockObject(LevelBlockProperty *l, uint16 item);
int assignLevelShapes(int index); int assignLevelShapes(int index);
uint8 *getLevelShapes(int index); uint8 *getLevelShapes(int index);
void restoreBlockTempData(int index); void restoreBlockTempData(int index);
void restoreTempDataAdjustMonsterStrength(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 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); void loadLevelGraphics(const char *file, int specialColor, int weight, int vcnLen, int vmpLen, const char *palFile);
@ -1106,8 +1106,8 @@ private:
int _sceneDrawVarLeft; int _sceneDrawVarLeft;
int _wllProcessFlag; int _wllProcessFlag;
uint8 *_trueLightTable2; uint8 *_transparencyTable2;
uint8 *_trueLightTable1; uint8 *_transparencyTable1;
int _loadSuppFilesFlag; int _loadSuppFilesFlag;
@ -1284,9 +1284,9 @@ private:
void redrawSceneItem(); void redrawSceneItem();
int calcItemMonsterPosition(ItemInPlay *i, uint16 direction); int calcItemMonsterPosition(ItemInPlay *i, uint16 direction);
void calcSpriteRelPosition(uint16 x1, uint16 y1, int &x2, int &y2, 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 drawDoor(uint8 *shape, uint8 *doorPalette, 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); void drawDoorOrMonsterEquipment(uint8 *shape, uint8 *objectPalette, int x, int y, int flags, const uint8 *brightnessOverlay);
uint8 *drawItemOrMonster(uint8 *shape, uint8 *ovl, int x, int y, int fineX, int fineY, int flags, int tblValue, bool vflip); 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); int calcDrawingLayerParameters(int srcX, int srcY, int &x2, int &y2, uint16 &w, uint16 &h, uint8 *shape, int vflip);
void updateMonster(MonsterInPlay *monster); void updateMonster(MonsterInPlay *monster);

View file

@ -109,38 +109,39 @@ void LoLEngine::addLevelItems() {
if (_itemsInPlay[i].level != _currentLevel) if (_itemsInPlay[i].level != _currentLevel)
continue; continue;
assignBlockObject(&_levelBlockProperties[_itemsInPlay[i].block].assignedObjects, i); assignBlockObject(&_levelBlockProperties[_itemsInPlay[i].block], i);
_levelBlockProperties[_itemsInPlay[i].block].direction = 5; _levelBlockProperties[_itemsInPlay[i].block].direction = 5;
_itemsInPlay[i].nextDrawObject = 0; _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; ItemInPlay *tmp = 0;
while (*cmzItemIndex & 0x8000) { while (*index & 0x8000) {
tmp = findObject(*cmzItemIndex); tmp = findObject(*index);
cmzItemIndex = &tmp->nextAssignedObject; index = &tmp->nextAssignedObject;
} }
tmp = findObject(item); tmp = findObject(item);
tmp->level = -1; tmp->level = -1;
uint16 ix = *cmzItemIndex; uint16 ix = *index;
if (ix == item) if (ix == item)
return; return;
*cmzItemIndex = item; *index = item;
cmzItemIndex = &tmp->nextAssignedObject; index = &tmp->nextAssignedObject;
while (*cmzItemIndex) { while (*index) {
tmp = findObject(*cmzItemIndex); tmp = findObject(*index);
cmzItemIndex = &tmp->nextAssignedObject; index = &tmp->nextAssignedObject;
} }
*cmzItemIndex = ix; *index = ix;
} }
void LoLEngine::loadLevelWallData(int index, bool mapShapes) { 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)); memset(_levelBlockProperties, 0, 1024 * sizeof(LevelBlockProperty));
_screen->loadBitmap(file, 2, 2, 0); _screen->loadBitmap(cmzFile, 2, 2, 0);
const uint8 *h = _screen->getCPagePtr(2); const uint8 *h = _screen->getCPagePtr(2);
uint16 len = READ_LE_UINT16(&h[4]); uint16 len = READ_LE_UINT16(&h[4]);
const uint8 *p = h + 6; const uint8 *p = h + 6;
@ -508,11 +509,11 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
char tname[13]; char tname[13];
snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel); snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel);
Common::SeekableReadStream *s = _res->createReadStream(tname); Common::SeekableReadStream *s = _res->createReadStream(tname);
s->read(_trueLightTable1, 256); s->read(_transparencyTable1, 256);
s->read(_trueLightTable2, 5120); s->read(_transparencyTable2, 5120);
delete s; delete s;
} else { } else {
createGfxTables(); createTransparencyTables();
} }
_loadSuppFilesFlag = 1; _loadSuppFilesFlag = 1;

View file

@ -245,7 +245,7 @@ uint8 *Screen_LoL::generateLevelOverlay(const Palette &srcPal, uint8 *ovl, int o
return ovl; 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); memset(outTable1, 0xff, 256);
for (int i = 0; i < a; i++) 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 fcol[3];
uint16 scol[3]; uint16 scol[3];
int t1 = (b << 6) / 100; uint16 t1 = (b << 6) / 100;
int t2 = 64 - t1; uint16 t2 = 64 - t1;
uint8 c = ovl[i]; uint8 c = ovl[i];
fcol[0] = fxPal[3 * c]; fcol[0] = fxPal[3 * c];

View file

@ -82,7 +82,7 @@ public:
uint8 *generateLevelOverlay(const Palette &Pal, uint8 *ovl, int opColor, int weight); uint8 *generateLevelOverlay(const Palette &Pal, uint8 *ovl, int opColor, int weight);
uint8 *getLevelOverlay(int index) { return _levelOverlays[index]; } 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 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); void applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl);

View file

@ -233,9 +233,9 @@ int LoLEngine::olol_loadLevelGraphics(EMCState *script) {
return 1; return 1;
} }
int LoLEngine::olol_loadCmzFile(EMCState *script) { int LoLEngine::olol_loadBlockProperties(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadCmzFile(%p) (%s)", (const void *)script, stackPosString(0)); debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadBlockProperties(%p) (%s)", (const void *)script, stackPosString(0));
loadCmzFile(stackPosString(0)); loadBlockProperties(stackPosString(0));
return 1; return 1;
} }
@ -2715,7 +2715,7 @@ void LoLEngine::setupOpcodeTable() {
// 0x08 // 0x08
Opcode(olol_testGameFlag); Opcode(olol_testGameFlag);
Opcode(olol_loadLevelGraphics); Opcode(olol_loadLevelGraphics);
Opcode(olol_loadCmzFile); Opcode(olol_loadBlockProperties);
Opcode(olol_loadMonsterShapes); Opcode(olol_loadMonsterShapes);
// 0x0C // 0x0C

View file

@ -1161,7 +1161,7 @@ void TIMInterpreter_LoL::playAnimationPart(int animIndex, int firstFrame, int la
uint32 next = _system->getMillis() + delay * _vm->_tickLength; uint32 next = _system->getMillis() + delay * _vm->_tickLength;
if (anim->wsaCopyParams & 0x4000) { if (anim->wsaCopyParams & 0x4000) {
_screen->copyRegion(112, 0, 112, 0, 176, 120, 6, 2); _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->copyRegion(112, 0, 112, 0, 176, 120, 2, 0);
_screen->updateScreen(); _screen->updateScreen();
} else { } else {

View file

@ -665,8 +665,8 @@ void LoLEngine::drawMonster(uint16 id) {
if (m->properties->flags & 0x800) if (m->properties->flags & 0x800)
flg |= 0x20; flg |= 0x20;
uint8 *ovl1 = d ? _monsterPalettes[(m->properties->shapeIndex << 4) + (curFrm & 0x0f)] + (shp[10] * (d - 1)) : 0; uint8 *monsterPalette = 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 *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++) { for (int i = 0; i < 4; i++) {
int v = m->equipmentShapes[i] - 1; int v = m->equipmentShapes[i] - 1;
@ -677,7 +677,7 @@ void LoLEngine::drawMonster(uint16 id) {
if (!shp2) if (!shp2)
continue; 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; 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]; uint8 c = _dscDoor1[(_currentDirection << 5) + unk2];
int r = (c / 5) + 5 * _dscDimMap[index]; int r = (c / 5) + 5 * _dscDimMap[index];
uint16 d = _dscShapeOvlIndex[r]; uint16 d = _dscShapeOvlIndex[r];
@ -950,16 +950,16 @@ void LoLEngine::drawDoor(uint8 *shape, uint8 *table, int index, int unk2, int w,
d = 0; d = 0;
} }
uint8 *ovl = _screen->getLevelOverlay(d); uint8 *brightnessOverlay = _screen->getLevelOverlay(d);
int doorScaledWitdh = _screen->getShapeScaledWidth(shape, _dmScaleW); int doorScaledWitdh = _screen->getShapeScaledWidth(shape, _dmScaleW);
_shpDmX -= (doorScaledWitdh >> 1); _shpDmX -= (doorScaledWitdh >> 1);
_shpDmY -= s; _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; int flg = 0;
if (flags & 0x10) if (flags & 0x10)
@ -972,27 +972,27 @@ void LoLEngine::drawDoorOrMonsterShape(uint8 *shape, uint8 *table, int x, int y,
flg |= 2; flg |= 2;
if (flg & 0x1000) { if (flg & 0x1000) {
if (table) if (objectPalette)
_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, objectPalette, brightnessOverlay, 1, _transparencyTable1, _transparencyTable2, _dmScaleW, _dmScaleH);
else 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 { } else {
if (table) if (objectPalette)
_screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x8104, table, ovl, 1, _dmScaleW, _dmScaleH); _screen->drawShape(_sceneDrawPage1, shape, x, y, 13, flg | 0x8104, objectPalette, brightnessOverlay, 1, _dmScaleW, _dmScaleH);
else 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 *ovl2 = 0;
uint8 *ovl = 0; uint8 *brightnessOverlay = 0;
uint8 tmpOvl[16]; uint8 tmpOvl[16];
if (flags & 0x80) { if (flags & 0x80) {
flags &= 0xff7f; flags &= 0xff7f;
ovl2 = table; ovl2 = monsterPalette;
table = 0; monsterPalette = 0;
} else { } else {
ovl2 = _screen->getLevelOverlay(_flags.use16ColorMode ? 5 : 4); ovl2 = _screen->getLevelOverlay(_flags.use16ColorMode ? 5 : 4);
} }
@ -1009,12 +1009,12 @@ uint8 *LoLEngine::drawItemOrMonster(uint8 *shape, uint8 *table, int x, int y, in
else else
r = 0; r = 0;
} }
ovl = _screen->getLevelOverlay(r); brightnessOverlay = _screen->getLevelOverlay(r);
} else { } else {
memset(tmpOvl + 1, tblValue, 15); memset(tmpOvl + 1, tblValue, 15);
tmpOvl[0] = 0; tmpOvl[0] = 0;
table = tmpOvl; monsterPalette = tmpOvl;
ovl = _screen->getLevelOverlay(7); brightnessOverlay = _screen->getLevelOverlay(7);
} }
int flg = flags & 0x10 ? 1 : 0; int flg = flags & 0x10 ? 1 : 0;
@ -1029,8 +1029,8 @@ uint8 *LoLEngine::drawItemOrMonster(uint8 *shape, uint8 *table, int x, int y, in
} else { } else {
if (_currentLevel == 22) { if (_currentLevel == 22) {
if (ovl) if (brightnessOverlay)
ovl[255] = 0; brightnessOverlay[255] = 0;
} else { } else {
flg |= 0x2000; 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; int dH = _screen->getShapeScaledHeight(shape, _dmScaleH) >> 1;
if (flg & 0x1000) { if (flg & 0x1000) {
if (table) if (monsterPalette)
_screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x8124, table, ovl, 0, _trueLightTable1, _trueLightTable2, _dmScaleW, _dmScaleH, ovl2); _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x8124, monsterPalette, brightnessOverlay, 0, _transparencyTable1, _transparencyTable2, _dmScaleW, _dmScaleH, ovl2);
else 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 { } else {
if (table) if (monsterPalette)
_screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x8124, table, ovl, 1, _dmScaleW, _dmScaleH, ovl2); _screen->drawShape(_sceneDrawPage1, shape, _shpDmX, _shpDmY, 13, flg | 0x8124, monsterPalette, brightnessOverlay, 1, _dmScaleW, _dmScaleH, ovl2);
else 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); _shpDmX -= (_screen->getShapeScaledWidth(shape, _dmScaleW) >> 1);
_shpDmY -= dH; _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) { int LoLEngine::calcDrawingLayerParameters(int x1, int y1, int &x2, int &y2, uint16 &w, uint16 &h, uint8 *shape, int vflip) {