aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Kagerer2009-04-04 21:10:35 +0000
committerFlorian Kagerer2009-04-04 21:10:35 +0000
commit44fa38b2afa2279a19a09a973dc157606b865008 (patch)
treed19ec427d9d67a96358618afb62edf773ff63f52
parentaf0efd8938f896305e18a10f4cdd260f426f2b24 (diff)
downloadscummvm-rg350-44fa38b2afa2279a19a09a973dc157606b865008.tar.gz
scummvm-rg350-44fa38b2afa2279a19a09a973dc157606b865008.tar.bz2
scummvm-rg350-44fa38b2afa2279a19a09a973dc157606b865008.zip
LOL: implemented compass
svn-id: r39852
-rw-r--r--engines/kyra/gui_lol.cpp32
-rw-r--r--engines/kyra/lol.cpp68
-rw-r--r--engines/kyra/lol.h23
-rw-r--r--engines/kyra/scene_lol.cpp82
-rw-r--r--engines/kyra/script_lol.cpp16
5 files changed, 141 insertions, 80 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 3494de8131..30e0ec7c15 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -133,7 +133,7 @@ void LoLEngine::gui_displayCharInventory(int charNum) {
int cp = _screen->setCurPage(2);
LoLCharacter *l = &_characters[charNum];
-
+
int id = l->id;
if (id < 0)
id = -id;
@@ -274,7 +274,7 @@ void LoLEngine::gui_changeCharacterStats(int charNum) {
} while (prc);
}
-void LoLEngine::gui_drawCharInventoryItem(int itemIndex) {
+void LoLEngine::gui_drawCharInventoryItem(int itemIndex) {
static const uint8 slotShapes[] = { 0x30, 0x34, 0x30, 0x34, 0x2E, 0x2F, 0x32, 0x33, 0x31, 0x35, 0x35 };
const uint8 *coords = &_charInvDefs[_charInvIndex[_characters[_selectedCharacter].raceClassSex] * 22 + itemIndex * 2];
@@ -307,7 +307,7 @@ void LoLEngine::gui_drawBarGraph(int x, int y, int w, int h, int32 cur, int32 ma
cur = 0;
int32 e = MIN(cur, max);
-
+
if (!--w)
return;
if (!--h)
@@ -803,7 +803,7 @@ void LoLEngine::gui_triggerEvent(int eventType) {
break;
}
}
-
+
removeInputTop();
_eventList.push_back(Event(evt, true));
_preserveEvents = true;
@@ -883,7 +883,7 @@ void LoLEngine::gui_initCharInventorySpecialButtons(int charNum) {
if (*s != 0xff)
gui_initButton(33 + i, s[0], s[1], i);
s += 2;
- }
+ }
}
void LoLEngine::gui_initMagicScrollButtons() {
@@ -1063,7 +1063,7 @@ int LoLEngine::clickedMagicSubmenu(Button *button) {
int c = button->data2Val2;
gui_enableDefaultPlayfieldButtons();
-
+
if (notEnoughMagic(c, _availableSpells[_selectedSpell], spellLevel)) {
_characters[c].flags &= 0xffef;
gui_drawCharPortraitWithStats(c);
@@ -1139,7 +1139,7 @@ int LoLEngine::clickedCharInventorySlot(Button *button) {
int type = _itemProperties[_itemsInPlay[_itemInHand].itemPropertyIndex].type;
if (!(sl & type)) {
bool f = false;
-
+
for (int i = 0; i < 11; i++) {
if (!(type & (1 << i)))
continue;
@@ -1205,7 +1205,7 @@ int LoLEngine::clickedExitCharInventory(Button *button) {
_lastCharInventory = -1;
updateDrawPage2();
enableSysTimer(2);
-
+
return 1;
}
@@ -1228,7 +1228,7 @@ int LoLEngine::clickedSceneDropItem(Button *button) {
uint16 x = 0;
uint16 y = 0;
int i = dirIndex[(_currentDirection << 2) + button->data2Val2];
-
+
calcCoordinates(x, y, block, offsX[i], offsY[i]);
setItemPosition(_itemInHand, x, y, 0, 1);
setHandItem(0);
@@ -1309,7 +1309,7 @@ int LoLEngine::clickedInventorySlot(Button *button) {
}
_screen->showMouse();
-
+
wsa->close();
delete wsa;
@@ -1353,7 +1353,7 @@ int LoLEngine::clickedWall(Button *button) {
int block = calcNewBlockPosition(_currentBlock, _currentDirection);
int dir = _currentDirection ^ 2;
uint8 type = _wllBuffer3[_levelBlockProperties[block].walls[dir]];
-
+
int res = 0;
switch (type) {
case 1:
@@ -1449,6 +1449,16 @@ int LoLEngine::clickedMoneyBox(Button *button) {
}
int LoLEngine::clickedCompass(Button *button) {
+ if (!(_gameFlags[15] & 0x4000))
+ return 0;
+
+ if (_compassBroken) {
+ if (characterSays(0x425b, -1, true))
+ _txt->printMessage(4, getLangString(0x425b));
+ } else {
+ _txt->printMessage(0, getLangString(0x402f + _currentDirection));
+ }
+
return 1;
}
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 3eea582229..6034639114 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -192,17 +192,17 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
memset(_activeTim, 0, sizeof(_activeTim));
memset(_activeVoiceFile, 0, sizeof(_activeVoiceFile));
memset(_openDoorState, 0, sizeof(_openDoorState));
-
+
_activeVoiceFileTotalTime = 0;
_pageBuffer1 = _pageBuffer2 = 0;
memset(_charStatsTemp, 0, sizeof(_charStatsTemp));
-
- _unkBt1 = _unkBt2 = 0;
+
+ _compassBroken = _unkBt2 = 0;
_dialogueField = false;
_rndSpecial = 0x12349876;
-
+
_buttonData = 0;
_activeButtons = 0;
_preserveEvents = false;
@@ -214,10 +214,12 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
memset(_lvlTempData, 0, sizeof(_lvlTempData));
_unkIceSHpFlag = 0;
-
+
_mapOverlay = 0;
_automapShapes = 0;
_defaultLegendData = 0;
+
+ _compassTimer = 0;
}
LoLEngine::~LoLEngine() {
@@ -352,7 +354,7 @@ LoLEngine::~LoLEngine() {
delete[] _lvlTempData[i]->monsters;
delete[] _lvlTempData[i]->flyingObjects;
delete _lvlTempData[i];
- }
+ }
}
delete[] _defaultLegendData;
@@ -390,7 +392,7 @@ Common::Error LoLEngine::init() {
memset(_pageBuffer1, 0, 0xfa00);
_pageBuffer2 = new uint8[0xfa00];
memset(_pageBuffer2, 0, 0xfa00);
-
+
_itemsInPlay = new ItemInPlay[400];
memset(_itemsInPlay, 0, sizeof(ItemInPlay) * 400);
@@ -755,11 +757,11 @@ void LoLEngine::startup() {
void LoLEngine::startupNew() {
_selectedSpell = 0;
- _compassUnk = 0;
+ _compassStep = 0;
_compassDirection = _compassDirectionIndex = -1;
_lastMouseRegion = -1;
-
+
/*
_unk5 = 1;
_unk6 = 1;
@@ -830,7 +832,7 @@ void LoLEngine::update() {
if (_gameFlags[15] & 0x800 || !(_updateFlags & 4))
updateLampStatus();
- if (_gameFlags[15] & 0x4000 && !(_updateFlags & 4) && (_compassDirection == -1 || (_currentDirection << 6) != _compassDirection || _compassUnk))
+ if (_gameFlags[15] & 0x4000 && !(_updateFlags & 4) && (_compassDirection == -1 || (_currentDirection << 6) != _compassDirection || _compassStep))
updateCompass();
snd_characterSpeaking();
@@ -933,7 +935,7 @@ void LoLEngine::setFaceFramesUnkArrays(int charNum, int unk1, int unk2, int unk3
l->arrayUnk2[i] = unk1;
l->arrayUnk1[i] = unk2;
_timer->setNextRun(3, _system->getMillis());
- _timer->enable(3);
+ _timer->enable(3);
}
}
@@ -1157,7 +1159,7 @@ void LoLEngine::increaseExperience(int charNum, int skill, uint32 points) {
_txt->printMessage(0x8003, getLangString(0x4024), _characters[charNum].name);
inc = (_characters[charNum].defaultModifiers[6] * (_rnd.getRandomNumberRng(1, 8) + 17)) >> 8;
_characters[charNum].magicPointsCur += inc;
- _characters[charNum].magicPointsMax += inc;
+ _characters[charNum].magicPointsMax += inc;
inc = _rnd.getRandomNumberRng(1, 6);
_characters[charNum].hitPointsCur += inc;
_characters[charNum].hitPointsMax += inc;
@@ -1308,9 +1310,9 @@ void LoLEngine::initDialogueSequence(int controlMode, int pageNum) {
setupScreenDims();
_txt->clearDim(4);
}
-
+
_currentControlMode = controlMode;
- _dialogueField = true;
+ _dialogueField = true;
}
void LoLEngine::restoreAfterDialogueSequence(int controlMode) {
@@ -1375,7 +1377,7 @@ void LoLEngine::generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness
if (brightness < 0)
brightness = 0;
}
-
+
for (int i = 0; i < 384; i++) {
uint16 c = (dst[i] * brightness) >> 8;
dst[i] = c & 0xff;
@@ -1401,7 +1403,7 @@ void LoLEngine::savePage5() {
void LoLEngine::restorePage5() {
if (!_pageSavedFlag)
return;
-
+
for (int i = 0; i < 6; i++)
_tim->freeAnimStruct(i);
@@ -1667,6 +1669,8 @@ int LoLEngine::snd_stopMusic() {
int LoLEngine::characterSays(int track, int charId, bool redraw) {
if (charId == 1) {
charId = _selectedCharacter;
+ } if (charId <= 0) {
+ charId = 0;
} else {
int i = 0;
for (;i < 4; i++) {
@@ -1798,10 +1802,10 @@ uint8 LoLEngine::getRandomNumberSpecial() {
uint cs = c >> 7;
a >>= 1;
- c = (c << 1) | as;
+ c = (c << 1) | as;
b = (b << 1) | cs;
- a -= ((_rndSpecial & 0xff) - bs);
+ a -= ((_rndSpecial & 0xff) - bs);
as = a & 1;
a >>= 1;
@@ -1839,7 +1843,7 @@ int LoLEngine::battleHitSkillTest(int16 attacker, int16 target, int skill) {
if (_monsters[target & 0x7fff].mode >= 13)
return 0;
}
-
+
uint16 hitChanceModifier = 0;
uint16 evadeChanceModifier = 0;
int sk = 0;
@@ -1848,7 +1852,7 @@ int LoLEngine::battleHitSkillTest(int16 attacker, int16 target, int skill) {
hitChanceModifier = _monsters[target & 0x7fff].properties->fightingStats[0];
sk = 100 - _monsters[target & 0x7fff].properties->skillLevel;
} else {
- hitChanceModifier = _characters[attacker].defaultModifiers[0];
+ hitChanceModifier = _characters[attacker].defaultModifiers[0];
uint8 m = _characters[attacker].skillModifiers[skill];
if (skill == 1)
m *= 3;
@@ -1876,7 +1880,7 @@ int LoLEngine::battleHitSkillTest(int16 attacker, int16 target, int skill) {
int LoLEngine::calcInflictableDamage(int16 attacker, int16 target, int hitType) {
const uint16 *s = getCharacterOrMonsterStats(attacker);
-
+
int res = 0;
for (int i = 0; i < 8; i++)
res += calcInflictableDamagePerStat(attacker, target, s[2 + i], i, hitType);
@@ -1904,7 +1908,7 @@ uint16 LoLEngine::getClosestMonster(int x, int y) {
if (_monsters[i].mode > 13)
continue;
- int d = ABS(x - _monsters[i].x) + ABS(y - _monsters[i].y);
+ int d = ABS(x - _monsters[i].x) + ABS(y - _monsters[i].y);
if (d < minDist) {
minDist = d;
id = 0x8000 | i;
@@ -1996,7 +2000,7 @@ void LoLEngine::displayAutomap() {
for (int i = 0; i < 109; i++)
_automapShapes[i] = _screen->getPtrToShape(shp, i + 11);
-
+
_screen->generateGrayOverlay(_screen->getPalette(3), _mapOverlay, 52, 0, 0, 0, 256, false);
_screen->loadFont(Screen::FID_9_FNT, "FONT9PN.FNT");
@@ -2124,7 +2128,7 @@ bool LoLEngine::updateAutoMapIntern(uint16 block, uint16 x, uint16 y, int16 xOff
}
void LoLEngine::loadMapLegendData(int level) {
- uint16 *legendData = (uint16 *)_tempBuffer5120;
+ uint16 *legendData= (uint16*) _tempBuffer5120;
for (int i = 0; i < 32; i++) {
legendData[i * 6] = 0xffff;
legendData[i * 6 + 5] = 0xffff;
@@ -2159,7 +2163,7 @@ void LoLEngine::loadMapLegendData(int level) {
void LoLEngine::drawMapPage(int pageNum) {
for (int i = 0; i < 2; i++) {
_screen->loadBitmap("parch.cps", pageNum, pageNum, _screen->getPalette(3));
-
+
int cp = _screen->setCurPage(pageNum);
Screen::FontId of = _screen->setFont(Screen::FID_9_FNT);
_screen->printText(getLangString(_autoMapStrings[_currentMapLevel]), 236, 8, 1, 0);
@@ -2227,7 +2231,7 @@ void LoLEngine::drawMapPage(int pageNum) {
sx = mapGetStartPosX();
sy = mapGetStartPosY();
- uint16 *legendData = (uint16 *)_tempBuffer5120;
+ uint16 *legendData = (uint16*)_tempBuffer5120;
for (int ii = 0; ii < 32; ii++) {
uint16 *l = &legendData[ii * 6];
@@ -2252,9 +2256,9 @@ void LoLEngine::drawMapPage(int pageNum) {
_levelBlockProperties[cbl2].flags |= 7;
_screen->drawShape(2, _automapShapes[l[5] << 2], (l[3] - sx) * 7 + _automapTopLeftX - 3, (l[4] - sy) * 6 + _automapTopLeftY - 3, 0, 0);
_screen->drawShape(2, _automapShapes[l[5] << 2], 231, (tY << 3) + 19, 0, 0);
- tY++;
+ tY++;
}
-
+
cp = _screen->setCurPage(pageNum);
for (int ii = 0; ii < 11; ii++) {
@@ -2293,7 +2297,7 @@ bool LoLEngine::automapProcessButtons(int inputFlag) {
delay (_tickLength);
}
- if (r == 0) {
+ if (r == 0) {
automapForwardButton();
printMapExitButtonText();
} else if (r == 1) {
@@ -2312,7 +2316,7 @@ void LoLEngine::automapForwardButton() {
if (i >= 32 || i == _currentMapLevel)
return;
}
-
+
for (int l = 0; l < 11; l++) {
_defaultLegendData[l].enable = false;
_defaultLegendData[l].shapeIndex = 255;
@@ -2331,7 +2335,7 @@ void LoLEngine::automapBackButton() {
if (i < 0 || i == _currentMapLevel)
return;
}
-
+
for (int l = 0; l < 11; l++) {
_defaultLegendData[l].enable = false;
_defaultLegendData[l].shapeIndex = 255;
@@ -2403,7 +2407,7 @@ int LoLEngine::mapGetStartPosX() {
do {
for (a = 0; a < 32; a++) {
if (_levelBlockProperties[(a << 5) + d].flags)
- break;
+ break;
}
if (a == 32)
d--;
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index f717ece3bf..5444e87d41 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -443,8 +443,9 @@ private:
uint32 _buttonPressTimer;
int _selectedCharacter;
int _compassDirection;
- int _compassUnk;
+ int _compassStep;
int _compassDirectionIndex;
+ uint32 _compassTimer;
int _charInventoryUnk;
const CompassDef *_compassDefs;
@@ -578,7 +579,7 @@ private:
int olol_clearDialogueField(EMCState *script);
int olol_setupBackgroundAnimationPart(EMCState *script);
int olol_startBackgroundAnimation(EMCState *script);
- int olol_fadeToBlack(EMCState *script);
+ int olol_fadeToBlack(EMCState *script);
int olol_fadePalette(EMCState *script);
int olol_loadBitmap(EMCState *script);
int olol_stopBackgroundAnimation(EMCState *script);
@@ -633,7 +634,7 @@ private:
int olol_checkMonsterTypeHostility(EMCState *script);
int olol_setNextFunc(EMCState *script);
int olol_dummy1(EMCState *script);
- int olol_suspendMonster(EMCState *script);
+ int olol_suspendMonster(EMCState *script);
int olol_setDoorState(EMCState *script);
int olol_processButtonClick(EMCState *script);
int olol_savePage5(EMCState *script);
@@ -648,7 +649,7 @@ private:
int olol_enableSysTimer(EMCState *script);
int olol_disableControls(EMCState *script);
int olol_enableControls(EMCState *script);
- int olol_characterSays(EMCState *script);
+ int olol_characterSays(EMCState *script);
int olol_queueSpeech(EMCState *script);
int olol_getItemPrice(EMCState *script);
int olol_getLanguage(EMCState *script);
@@ -676,7 +677,7 @@ private:
int tlol_drawScene(const TIM *tim, const uint16 *param);
int tlol_update(const TIM *tim, const uint16 *param);
int tlol_loadSoundFile(const TIM *tim, const uint16 *param);
- int tlol_playMusicTrack(const TIM *tim, const uint16 *param);
+ int tlol_playMusicTrack(const TIM *tim, const uint16 *param);
int tlol_playDialogueTalkText(const TIM *tim, const uint16 *param);
int tlol_playSoundEffect(const TIM *tim, const uint16 *param);
int tlol_startBackgroundAnimation(const TIM *tim, const uint16 *param);
@@ -954,9 +955,9 @@ private:
int _lastMouseRegion;
int _seqWindowX1, _seqWindowY1, _seqWindowX2, _seqWindowY2, _seqTrigger;
int _spsWindowX, _spsWindowY, _spsWindowW, _spsWindowH;
-
+
uint8 *_tempBuffer5120;
-
+
const char *const * _levelDatList;
int _levelDatListSize;
const char *const * _levelShpList;
@@ -1027,7 +1028,7 @@ private:
void processObjectFlight(FlyingObject *t, int x, int y);
void updateObjectFlightPosition(FlyingObject *t);
void objectFlightProcessHits(FlyingObject *t, int x, int y, int objectOnNextBlock);
- void updateFlyingObjects(FlyingObject *t);
+ void updateFlyingObjects(FlyingObject *t);
void assignItemToBlock(uint16 *assignedBlockObjects, int id);
int checkDrawObjectSpace(int itemX, int itemY, int partyX, int partyY);
@@ -1081,7 +1082,7 @@ private:
void giveItemToMonster(MonsterInPlay *monster, uint16 item);
int checkBlockBeforeObjectPlacement(int x, int y, int objectWidth, int testFlag, int wallFlag);
int checkBlockForWallsAndSufficientSpace(int block, int x, int y, int objectWidth, int testFlag, int wallFlag);
- int calcMonsterSkillLevel(int id, int a);
+ int calcMonsterSkillLevel(int id, int a);
bool checkBlockOccupiedByParty(int x, int y, int testFlag);
const uint16 *getCharacterOrMonsterStats(int id);
void drawBlockObjects(int blockArrayIndex);
@@ -1138,7 +1139,7 @@ private:
void delay(uint32 millis, bool cUpdate = false, bool isMainLoop = false);
uint8 getRandomNumberSpecial();
- uint8 _unkBt1;
+ uint8 _compassBroken;
uint8 _unkBt2;
uint16 _unkWordArraySize8[8];
@@ -1152,7 +1153,7 @@ private:
void battleHit_sub2(int16 target, int damageInflicted, int16 attacker, uint32 b);
void battleHit_sub3(MonsterInPlay *monster, int16 target, int16 damageInflicted);
int calcInflictableDamagePerStat(int16 attacker, int16 target, uint16 stat2m, int index, int hitType);
-
+
uint16 getClosestMonster(int x, int y);
uint16 getClosestPartyMember(int x, int y);
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 726905c299..e467749700 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -403,7 +403,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
uint8 *pal2 = _screen->getPalette(2);
for (int i = 1; i < 768; i++)
SWAP(pal0[i], pal2[i]);
- }
+ }
}
memcpy(_vcnBlocks, v, vcnLen);
@@ -584,7 +584,53 @@ void LoLEngine::updateLampStatus() {
}
void LoLEngine::updateCompass() {
+ if (!(_gameFlags[15] & 0x4000) || (_updateFlags & 4))
+ return;
+
+ if (_compassDirection == -1) {
+ _compassStep = 0;
+ gui_drawCompass();
+ return;
+ }
+
+ if (_compassTimer >= _system->getMillis())
+ return;
+ if ((_currentDirection << 6) == _compassDirection && (!_compassStep))
+ return;
+
+ _compassTimer = _system->getMillis() + 3 * _tickLength;
+ int dir = _compassStep >= 0 ? 1 : -1;
+ if (_compassStep)
+ _compassStep -= (((ABS(_compassStep) >> 4) + 2) * dir);
+
+ int16 d = _compassBroken ? ((int8)getRandomNumberSpecial() - _compassDirection) : (_currentDirection << 6) - _compassDirection;
+ if (d <= -128)
+ d += 256;
+ if (d >= 128)
+ d -= 256;
+
+ d >>= 2;
+ _compassStep += d;
+ _compassStep = CLIP(_compassStep, -24, 24);
+ _compassDirection += _compassStep;
+
+ if (_compassDirection < 0)
+ _compassDirection += 256;
+ if (_compassDirection > 255)
+ _compassDirection -= 256;
+
+ if ((_compassDirection >> 6) == _currentDirection && _compassStep < 2) {
+ int16 d2 = d >> 16;
+ d ^= d2;
+ d -= d2;
+ if (d < 4) {
+ _compassDirection = _currentDirection << 6;
+ _compassStep = 0;
+ }
+ }
+
+ gui_drawCompass();
}
void LoLEngine::moveParty(uint16 direction, int unk1, int unk2, int buttonShape) {
@@ -642,7 +688,7 @@ void LoLEngine::moveParty(uint16 direction, int unk1, int unk2, int buttonShape)
if (_levelBlockProperties[npos].walls[0] == 0x1a)
memset(_levelBlockProperties[npos].walls, 0, 4);
- }
+ }
}
updateAutoMap(_currentBlock);
@@ -731,7 +777,7 @@ int LoLEngine::clickedWallShape(uint16 block, uint16 direction) {
snd_stopSpeech(true);
runLevelScript(block, 0x40);
-
+
return 1;
}
@@ -765,7 +811,7 @@ int LoLEngine::clickedLeverOff(uint16 block, uint16 direction) {
}
int LoLEngine::clickedWallOnlyScript(uint16 block) {
- runLevelScript(block, 0x40);
+ runLevelScript(block, 0x40);
return 1;
}
@@ -803,7 +849,7 @@ int LoLEngine::clickedNiche(uint16 block, uint16 direction) {
bool LoLEngine::clickedShape(int shapeIndex) {
while (shapeIndex) {
uint16 s = _levelShapeProperties[shapeIndex].shapeIndex[1];
-
+
if (s == 0xffff)
continue;
@@ -873,7 +919,7 @@ void LoLEngine::openCloseDoor(uint16 block, int openClose) {
_openDoorState[s1].wall = c;
flg = (-openClose == 1) ? 0x10 : (-openClose == -1 ? 0x20 : 0);
-
+
if (_wllWallFlags[v] & flg) {
_levelBlockProperties[block].walls[c] += openClose;
_levelBlockProperties[block].walls[c ^ 2] += openClose;
@@ -890,7 +936,7 @@ void LoLEngine::openCloseDoor(uint16 block, int openClose) {
} else {
while (!(flg & _wllWallFlags[v]))
v += openClose;
-
+
_levelBlockProperties[block].walls[c] = _levelBlockProperties[block].walls[c ^ 2] = v;
checkSceneUpdateNeed(block);
}
@@ -902,7 +948,7 @@ void LoLEngine::completeDoorOperations() {
continue;
uint16 b = _openDoorState[i].block;
-
+
do {
_levelBlockProperties[b].walls[_openDoorState[i].wall] += _openDoorState[i].state;
_levelBlockProperties[b].walls[_openDoorState[i].wall ^ 2] += _openDoorState[i].state;
@@ -1228,7 +1274,7 @@ void LoLEngine::setWallType(int block, int wall, int val) {
_levelBlockProperties[block].flags |= 0x20;
} else {
_levelBlockProperties[block].flags &= 0xdf;
- }
+ }
} else {
_levelBlockProperties[block].walls[wall] = val;
}
@@ -1256,7 +1302,7 @@ void LoLEngine::prepareSpecialScene(int fieldType, int hasDialogue, int suspendG
_screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
}
-
+
setSpecialSceneButtons(0, 0, 320, 130, controlMode);
} else {
@@ -1306,7 +1352,7 @@ int LoLEngine::restoreAfterSpecialScene(int fadeFlag, int redrawPlayField, int r
if (releaseTimScripts) {
for (int i = 0; i < TIM::kWSASlots; i++)
_tim->freeAnimStruct(i);
-
+
for (int i = 0; i < 10; i++)
_tim->unload(_activeTim[i]);
}
@@ -1319,8 +1365,8 @@ int LoLEngine::restoreAfterSpecialScene(int fadeFlag, int redrawPlayField, int r
_screen->fadeToBlack(10);
else
_screen->fadeClearSceneWindow(10);
- }
-
+ }
+
_currentControlMode = 0;
calcCharPortraitXpos();
@@ -1333,7 +1379,7 @@ int LoLEngine::restoreAfterSpecialScene(int fadeFlag, int redrawPlayField, int r
_currentControlMode = 0;
calcCharPortraitXpos();
- if (redrawPlayField)
+ if (redrawPlayField)
gui_drawPlayField();
}
@@ -1582,7 +1628,7 @@ void LoLEngine::drawVcnBlocks() {
uint16 vcnOffset = *bdb++;
if (vcnOffset & 0x8000) {
- // this renders a wall block over the transparent pixels of a floor/ceiling block
+ // this renders a wall block over the transparent pixels of a floor/ceiling block
remainder = vcnOffset - 0x8000;
vcnOffset = 0;
}
@@ -1899,9 +1945,9 @@ void LoLEngine::drawBlockEffects(int index, int type) {
// flags: 0x10 = ice wall, 0x20 = teleporter, 0x40 = blue slime spot, 0x80 = blood spot
if (!(flg & 0xf0))
return;
-
+
type = (type == 0) ? 2 : 0;
-
+
for (int i = 0; i < 2; i++, type++) {
if (!((0x10 << type) & flg))
continue;
@@ -1910,7 +1956,7 @@ void LoLEngine::drawBlockEffects(int index, int type) {
uint16 y = yOffs[type];
uint16 drawFlag = (type == 3) ? 0x80 : 0x20;
uint8 *ovl = (type == 3) ? _screen->_grayOverlay : 0;
-
+
calcCoordinatesAddDirectionOffset(x, y, _currentDirection);
x |= ((_visibleBlockIndex[index] & 0x1f) << 8);
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 94ccef3909..6ba210bcf5 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -575,7 +575,7 @@ int LoLEngine::olol_getGlobalVar(EMCState *script) {
case 10:
return _sceneDefaultUpdate;
case 11:
- return _unkBt1;
+ return _compassBroken;
case 12:
return _unkBt2;
case 13:
@@ -647,7 +647,7 @@ int LoLEngine::olol_setGlobalVar(EMCState *script) {
break;
case 11:
- _unkBt1 = a & 0xff;
+ _compassBroken = a & 0xff;
break;
case 12:
@@ -711,7 +711,7 @@ int LoLEngine::olol_initMonster(EMCState *script) {
if (l->might || l->mode == 13)
continue;
- memset(l, 0, sizeof(MonsterInPlay));
+ memset(l, 0, sizeof(MonsterInPlay));
l->id = i;
l->x = x;
l->y = y;
@@ -777,7 +777,7 @@ int LoLEngine::olol_loadNewLevel(EMCState *script) {
_screen->fadeClearSceneWindow(10);
_screen->fillRect(112, 0, 288, 120, 0);
disableSysTimer(2);
-
+
for (int i = 0; i < 8; i++) {
if (!_flyingObjects[i].enable || _flyingObjects[i].a)
continue;
@@ -943,7 +943,7 @@ int LoLEngine::olol_characterJoinsParty(EMCState *script) {
_characters[i].flags &= 0xfffe;
calcCharPortraitXpos();
-
+
if (!_updateFlags) {
gui_enableDefaultPlayfieldButtons();
gui_drawPlayField();
@@ -1100,7 +1100,7 @@ int LoLEngine::olol_update(EMCState *script) {
int LoLEngine::olol_drawExitButton(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_drawExitButton(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
-
+
static const uint8 printPara[] = { 0x90, 0x78, 0x0C, 0x9F, 0x80, 0x1E };
int cp = _screen->setCurPage(0);
@@ -1111,7 +1111,7 @@ int LoLEngine::olol_drawExitButton(EMCState *script) {
char *str = getLangString(0x4033);
int w = _screen->getTextWidth(str);
-
+
gui_drawBox(x - offs - w, y - 9, w + offs, 9, 136, 251, 252);
_screen->printText(str, x - (offs >> 1) - w, y - 7, 144, 0);
@@ -1119,7 +1119,7 @@ int LoLEngine::olol_drawExitButton(EMCState *script) {
_screen->drawGridBox(x - offs - w + 1, y - 8, w + offs - 2, 7, 1);
_screen->setFont(cf);
- _screen->setCurPage(cp);
+ _screen->setCurPage(cp);
return 1;
}