diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/gui_lol.cpp | 18 | ||||
-rw-r--r-- | engines/kyra/items_lol.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/lol.cpp | 42 | ||||
-rw-r--r-- | engines/kyra/saveload_lol.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/scene_lol.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 58 | ||||
-rw-r--r-- | engines/kyra/sequences_lol.cpp | 60 | ||||
-rw-r--r-- | engines/kyra/sprites_lol.cpp | 14 | ||||
-rw-r--r-- | engines/kyra/staticres_lol.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/timer_lol.cpp | 2 |
11 files changed, 114 insertions, 112 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 249471315d..80052c70f2 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -378,9 +378,9 @@ void LoLEngine::gui_drawCharPortraitWithStats(int charNum) { int spellLevels = 0; if (_availableSpells[_selectedSpell] != -1) { for (int i = 0; i < 4; i++) { - if (_spellProperties[_availableSpells[_selectedSpell]].mpRequired[i] <= _characters[charNum].magicPointsCur && - _spellProperties[_availableSpells[_selectedSpell]].hpRequired[i] <= _characters[charNum].hitPointsCur) - spellLevels++; + if (_spellProperties[_availableSpells[_selectedSpell]].mpRequired[i] <= _characters[charNum].magicPointsCur + && _spellProperties[_availableSpells[_selectedSpell]].hpRequired[i] <= _characters[charNum].hitPointsCur) + spellLevels++; } } @@ -1160,7 +1160,7 @@ int LoLEngine::clickedPortraitLeft(Button *button) { int LoLEngine::clickedLiveMagicBarsLeft(Button *button) { gui_highlightPortraitFrame(button->arg); _txt->printMessage(0, getLangString(0x4047), _characters[button->arg].name, _characters[button->arg].hitPointsCur, - _characters[button->arg].hitPointsMax, _characters[button->arg].magicPointsCur, _characters[button->arg].magicPointsMax); + _characters[button->arg].hitPointsMax, _characters[button->arg].magicPointsCur, _characters[button->arg].magicPointsMax); return 1; } @@ -1334,7 +1334,7 @@ int LoLEngine::clickedInventorySlot(Button *button) { int hItem = _itemInHand; if ((_itemsInPlay[hItem].itemPropertyIndex == 281 || _itemsInPlay[slotItem].itemPropertyIndex == 281) && - (_itemsInPlay[hItem].itemPropertyIndex == 220 || _itemsInPlay[slotItem].itemPropertyIndex == 220)) { + (_itemsInPlay[hItem].itemPropertyIndex == 220 || _itemsInPlay[slotItem].itemPropertyIndex == 220)) { // merge ruby of truth WSAMovie_v2 *wsa = new WSAMovie_v2(this); @@ -2014,7 +2014,7 @@ int GUI_LoL::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseW bool progress = false; - if (mouseX >= x && mouseY >= y && mouseX <= x+buttonList->width && mouseY <= y+buttonList->height) + if (mouseX >= x && mouseY >= y && mouseX <= x + buttonList->width && mouseY <= y + buttonList->height) progress = true; buttonList->flags2 &= ~0x80; @@ -2564,7 +2564,7 @@ int GUI_LoL::getInput() { int inputFlag = _vm->checkInput(_menuButtonList); - if (_currentMenu == &_savenameMenu && _keyPressed.ascii){ + if (_currentMenu == &_savenameMenu && _keyPressed.ascii) { char inputKey = _keyPressed.ascii; Util::convertISOToDOS(inputKey); @@ -2714,7 +2714,7 @@ int GUI_LoL::clickedOptionsMenu(Button *button) { delete[] _vm->_landsFile; _vm->_landsFile = _vm->resource()->fileData(filename.c_str(), 0); _newMenu = _lastMenu; - } break; + } break; default: // TODO: Is there anything we should do if we hit this case? break; @@ -2833,7 +2833,7 @@ int GUI_LoL::clickedChoiceMenu(Button *button) { if (*i >= 990) break; Common::String oldName = _vm->getSavegameFilename(*i); - Common::String newName = _vm->getSavegameFilename(*i-1); + Common::String newName = _vm->getSavegameFilename(*i - 1); _vm->_saveFileMan->renameSavefile(oldName, newName); } _newMenu = &_mainMenu; diff --git a/engines/kyra/items_lol.cpp b/engines/kyra/items_lol.cpp index e6cd9355fc..ea2acaf64d 100644 --- a/engines/kyra/items_lol.cpp +++ b/engines/kyra/items_lol.cpp @@ -397,7 +397,7 @@ bool LoLEngine::launchObject(int objectType, Item item, int startX, int startY, } int csp = checkDrawObjectSpace(_partyPosX, _partyPosY, t->x, t->y); - if (csp > sp){ + if (csp > sp) { sp = csp; slot = i; } @@ -528,7 +528,7 @@ void LoLEngine::updateFlyingObject(FlyingObject *t) { getNextStepCoords(t->x, t->y, x, y, t->direction); /* WORKAROUND: Large fireballs cast by the "birds" in white tower level 2 and by the "wraith knights" in castle cimmeria - level 1 (or possible other objects with flag 0x4000) could not fly through corridors in ScummVM and would + level 1 (or possible other objects with flag 0x4000) could not fly through corridors in ScummVM and would be terminated prematurely. The original code (all versions) involuntarily circumvents this via a bug in the next line of code. The original checks for _itemProperties[t->item].flags instead of _itemProperties[_itemsInPlay[t->item].itemPropertyIndex].flags. @@ -539,7 +539,7 @@ void LoLEngine::updateFlyingObject(FlyingObject *t) { at least. Other methods of working around this issue don't make too much sense. An object with a width of 256 - could never fly through corridors, since 256 is also the width of a block. Aligning the fireballs to the + could never fly through corridors, since 256 is also the width of a block. Aligning the fireballs to the middle of a block (or making the monsters align to the middle before casting them) wouldn't help here (and wouldn't be faithful to the original either). */ @@ -563,7 +563,7 @@ void LoLEngine::assignItemToBlock(uint16 *assignedBlockObjects, int id) { LoLObject *newObject = findObject(id); newObject->nextAssignedObject = *assignedBlockObjects; - ((LoLItem*)newObject)->level = -1; + ((LoLItem *)newObject)->level = -1; *assignedBlockObjects = id; } diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index b24ab4fca8..258f53c602 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -300,15 +300,15 @@ LoLEngine::~LoLEngine() { delete[] _automapShapes; - for (Common::Array<const TIMOpcode*>::iterator i = _timIntroOpcodes.begin(); i != _timIntroOpcodes.end(); ++i) + for (Common::Array<const TIMOpcode *>::iterator i = _timIntroOpcodes.begin(); i != _timIntroOpcodes.end(); ++i) delete *i; _timIntroOpcodes.clear(); - for (Common::Array<const TIMOpcode*>::iterator i = _timOutroOpcodes.begin(); i != _timOutroOpcodes.end(); ++i) + for (Common::Array<const TIMOpcode *>::iterator i = _timOutroOpcodes.begin(); i != _timOutroOpcodes.end(); ++i) delete *i; _timOutroOpcodes.clear(); - for (Common::Array<const TIMOpcode*>::iterator i = _timIngameOpcodes.begin(); i != _timIngameOpcodes.end(); ++i) + for (Common::Array<const TIMOpcode *>::iterator i = _timIngameOpcodes.begin(); i != _timIngameOpcodes.end(); ++i) delete *i; _timIngameOpcodes.clear(); @@ -341,7 +341,7 @@ LoLEngine::~LoLEngine() { delete[] _mapCursorOverlay; delete[] _mapOverlay; - for (Common::Array<const SpellProc*>::iterator i = _spellProcs.begin(); i != _spellProcs.end(); ++i) + for (Common::Array<const SpellProc *>::iterator i = _spellProcs.begin(); i != _spellProcs.end(); ++i) delete *i; _spellProcs.clear(); @@ -425,11 +425,11 @@ Common::Error LoLEngine::init() { _clickedSpecialFlag = 0x40; _monsterShapes = new uint8*[48]; - memset(_monsterShapes, 0, 48 * sizeof(uint8*)); + memset(_monsterShapes, 0, 48 * sizeof(uint8 *)); _monsterPalettes = new uint8*[48]; - memset(_monsterPalettes, 0, 48 * sizeof(uint8*)); + memset(_monsterPalettes, 0, 48 * sizeof(uint8 *)); _monsterDecorationShapes = new uint8*[576]; - memset(_monsterDecorationShapes, 0, 576 * sizeof(uint8*)); + memset(_monsterDecorationShapes, 0, 576 * sizeof(uint8 *)); memset(&_scriptData, 0, sizeof(EMCData)); _activeMagicMenu = -1; @@ -1013,7 +1013,7 @@ uint8 *LoLEngine::getTableEntry(uint8 *buffer, uint16 id) { if (!buffer) return 0; - return buffer + READ_LE_UINT16(buffer + (id<<1)); + return buffer + READ_LE_UINT16(buffer + (id << 1)); } void LoLEngine::decodeSjis(const char *src, char *dst) { @@ -1041,7 +1041,7 @@ void LoLEngine::decodeSjis(const char *src, char *dst) { int LoLEngine::decodeCyrillic(const char *src, char *dst) { static const uint8 decodeTable1[] = { - 0x20, 0xAE, 0xA5, 0xA0, 0xE2, 0xAD, 0xA8, 0xE0, 0xE1, 0xAB, 0xA2, + 0x20, 0xAE, 0xA5, 0xA0, 0xE2, 0xAD, 0xA8, 0xE0, 0xE1, 0xAB, 0xA2, 0xA4, 0xAC, 0xAA, 0xE3, 0x2E }; @@ -1088,8 +1088,10 @@ int LoLEngine::decodeCyrillic(const char *src, char *dst) { } bool LoLEngine::addCharacter(int id) { - const uint16 *cdf[] = { _charDefsMan, _charDefsMan, _charDefsMan, _charDefsWoman, - _charDefsMan, _charDefsMan, _charDefsWoman, _charDefsKieran, _charDefsAkshel }; + const uint16 *cdf[] = { + _charDefsMan, _charDefsMan, _charDefsMan, _charDefsWoman, + _charDefsMan, _charDefsMan, _charDefsWoman, _charDefsKieran, _charDefsAkshel + }; int numChars = countActiveCharacters(); if (numChars == 4) @@ -1803,7 +1805,7 @@ int LoLEngine::characterSays(int track, int charId, bool redraw) { charId = 0; } else { int i = 0; - for (;i < 4; i++) { + for (; i < 4; i++) { if (charId != _characters[i].id || !(_characters[i].flags & 1)) continue; charId = i; @@ -1946,7 +1948,7 @@ void LoLEngine::giveItemToMonster(LoLMonster *monster, Item item) { } const uint16 *LoLEngine::getCharacterOrMonsterStats(int id) { - return (id & 0x8000) ? (const uint16*)_monsters[id & 0x7fff].properties->fightingStats : _characters[id].defaultModifiers; + return (id & 0x8000) ? (const uint16 *)_monsters[id & 0x7fff].properties->fightingStats : _characters[id].defaultModifiers; } uint16 *LoLEngine::getCharacterOrMonsterItemsMight(int id) { @@ -2204,7 +2206,7 @@ int LoLEngine::processMagicHeal(int charNum, int spellLevel) { int ch = 0; int n = 4; - if (charNum != -1){ + if (charNum != -1) { ch = charNum; n = charNum + 1; } @@ -2865,7 +2867,7 @@ int LoLEngine::processMagicVaelansCube() { uint16 a = sp1[i * 3 + 1] + 16; tmpPal2[i * 3 + 1] = (a > 58) ? 58 : a; tmpPal2[i * 3] = sp1[i * 3]; - a = sp1[i * 3 + 2] + 16; + a = sp1[i * 3 + 2] + 16; tmpPal2[i * 3 + 2] = (a > 63) ? 63 : a; } } else { @@ -2873,7 +2875,7 @@ int LoLEngine::processMagicVaelansCube() { uint16 a = sp1[i * 3] + 16; tmpPal2[i * 3] = (a > 60) ? 60 : a; tmpPal2[i * 3 + 1] = sp1[i * 3 + 1]; - a = sp1[i * 3 + 2] + 19; + a = sp1[i * 3 + 2] + 19; tmpPal2[i * 3 + 2] = (a > 60) ? 60 : a; } } @@ -4057,7 +4059,7 @@ void LoLEngine::displayAutomap() { if (f == 0x30) { for (int i = 0; i < 1024; i++) - _levelBlockProperties[i].flags |= 7; + _levelBlockProperties[i].flags |= 7; _mapUpdateNeeded = true; } else if (f == _keyMap[Common::KEYCODE_ESCAPE]) { exitAutomap = true; @@ -4138,7 +4140,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; @@ -4192,7 +4194,7 @@ void LoLEngine::drawMapPage(int pageNum) { for (; bl < 1024; bl++) { uint8 *w = _levelBlockProperties[bl].walls; - if ((_levelBlockProperties[bl].flags & 7) == 7 && (!(_wllAutomapData[w[0]] & 0xc0)) && (!(_wllAutomapData[w[2]] & 0xc0)) && (!(_wllAutomapData[w[1]] & 0xc0))&& (!(_wllAutomapData[w[3]] & 0xc0))) { + if ((_levelBlockProperties[bl].flags & 7) == 7 && (!(_wllAutomapData[w[0]] & 0xc0)) && (!(_wllAutomapData[w[2]] & 0xc0)) && (!(_wllAutomapData[w[1]] & 0xc0)) && (!(_wllAutomapData[w[3]] & 0xc0))) { uint16 b0 = calcNewBlockPosition(bl, 0); uint16 b2 = calcNewBlockPosition(bl, 2); uint16 b1 = calcNewBlockPosition(bl, 1); @@ -4248,7 +4250,7 @@ void LoLEngine::drawMapPage(int pageNum) { sx = mapGetStartPosX(); sy = mapGetStartPosY(); - uint16 *legendData = (uint16*)_tempBuffer5120; + uint16 *legendData = (uint16 *)_tempBuffer5120; uint8 yOffset = _flags.use16ColorMode ? 4 : 0; for (int ii = 0; ii < 32; ii++) { diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp index 7736d45540..b6840663e9 100644 --- a/engines/kyra/saveload_lol.cpp +++ b/engines/kyra/saveload_lol.cpp @@ -439,8 +439,8 @@ Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, con for (int ii = 0; ii < 1024; ii++) out->writeByte(l->flags[ii] & 0xff); - LoLMonster *lm = (LoLMonster*)_lvlTempData[i]->monsters; - FlyingObject *lf = (FlyingObject*)_lvlTempData[i]->flyingObjects; + LoLMonster *lm = (LoLMonster *)_lvlTempData[i]->monsters; + FlyingObject *lf = (FlyingObject *)_lvlTempData[i]->flyingObjects; for (int ii = 0; ii < 30; ii++) { LoLMonster *m = &lm[ii]; @@ -574,7 +574,7 @@ void LoLEngine::restoreMonsterTempData(LevelTempData *tmp) { } void LoLEngine::releaseMonsterTempData(LevelTempData *tmp) { - LoLMonster *p = (LoLMonster*)tmp->monsters; + LoLMonster *p = (LoLMonster *)tmp->monsters; delete[] p; } diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index fea9b27bd1..796db9a340 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -122,7 +122,7 @@ void LoLEngine::assignBlockItem(LevelBlockProperty *l, uint16 item) { } tmp = findObject(item); - ((LoLItem*)tmp)->level = -1; + ((LoLItem *)tmp)->level = -1; uint16 ix = *index; @@ -277,7 +277,7 @@ void LoLEngine::loadLevelShpDat(const char *shpFile, const char *datFile, bool f delete[] _levelDecorationData; _levelDecorationData = new LevelDecorationProperty[_levelDecorationDataSize]; for (int i = 0; i < _levelDecorationDataSize; i++) { - LevelDecorationProperty * l = &_levelDecorationData[i]; + LevelDecorationProperty *l = &_levelDecorationData[i]; for (int ii = 0; ii < 10; ii++) l->shapeIndex[ii] = s->readUint16LE(); for (int ii = 0; ii < 10; ii++) @@ -1511,7 +1511,7 @@ void LoLEngine::drawDecorations(int index) { x = _dscShapeX[s] + xOffs + ((_levelDecorationProperties[l].shapeX[shpIx] * scaleW) >> 8); if (ix == _dscShapeIndex[s]) { x = _dscShapeX[s] - ((_levelDecorationProperties[l].shapeX[shpIx] * scaleW) >> 8) - - _screen->getShapeScaledWidth(shapeData, scaleW) - xOffs; + _screen->getShapeScaledWidth(shapeData, scaleW) - xOffs; } flags = 0x105; } else { diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 4b8b443bd9..08b232f400 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -104,8 +104,8 @@ void Screen_LoL::fprintStringIntro(const char *format, int x, int y, uint8 c1, u x -= getTextWidth(buffer); if ((flags & 0x00F0) == 0x20) { - printText(buffer, x-1, y, c3, c2); - printText(buffer, x, y+1, c3, c2); + printText(buffer, x - 1, y, c3, c2); + printText(buffer, x, y + 1, c3, c2); } printText(buffer, x, y, c1, c2); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index f81961a08b..c5d1d49030 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -792,7 +792,7 @@ int LoLEngine::olol_resetBlockShapeAssignment(EMCState *script) { int LoLEngine::olol_copyRegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_copyRegion(%p) (%d, %d, %d, %d, %d, %d, %d, %d)", - (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7)); + (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7)); _screen->copyRegion(stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), Screen::CR_NO_P_CHECK); if (!stackPos(7)) _screen->updateScreen(); @@ -801,7 +801,7 @@ int LoLEngine::olol_copyRegion(EMCState *script) { int LoLEngine::olol_initMonster(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_initMonster(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script, - stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10)); + stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10)); uint16 x = 0; uint16 y = 0; calcCoordinates(x, y, stackPos(0), stackPos(1), stackPos(2)); @@ -919,12 +919,12 @@ int LoLEngine::olol_dummy0(EMCState *script) { int LoLEngine::olol_loadMonsterProperties(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadMonsterProperties(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", - (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), - stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPos(12), stackPos(13), - stackPos(14), stackPos(15), stackPos(16), stackPos(17), stackPos(18), stackPos(19), stackPos(20), - stackPos(21), stackPos(22), stackPos(23), stackPos(24), stackPos(25), stackPos(26), stackPos(27), - stackPos(28), stackPos(29), stackPos(30), stackPos(31), stackPos(32), stackPos(33), stackPos(34), - stackPos(35), stackPos(36), stackPos(37), stackPos(38), stackPos(39), stackPos(40), stackPos(41)); + (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), + stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPos(12), stackPos(13), + stackPos(14), stackPos(15), stackPos(16), stackPos(17), stackPos(18), stackPos(19), stackPos(20), + stackPos(21), stackPos(22), stackPos(23), stackPos(24), stackPos(25), stackPos(26), stackPos(27), + stackPos(28), stackPos(29), stackPos(30), stackPos(31), stackPos(32), stackPos(33), stackPos(34), + stackPos(35), stackPos(36), stackPos(37), stackPos(38), stackPos(39), stackPos(40), stackPos(41)); LoLMonsterProperty *l = &_monsterProperties[stackPos(0)]; l->shapeIndex = stackPos(1) & 0xff; @@ -939,14 +939,14 @@ int LoLEngine::olol_loadMonsterProperties(EMCState *script) { l->maxWidth = shpWidthMax; - l->fightingStats[0] = (stackPos(2) << 8) / 100; // hit chance - l->fightingStats[1] = 256; // - l->fightingStats[2] = (stackPos(3) << 8) / 100; // protection - l->fightingStats[3] = stackPos(4); // evade chance - l->fightingStats[4] = (stackPos(5) << 8) / 100; // speed - l->fightingStats[5] = (stackPos(6) << 8) / 100; // - l->fightingStats[6] = (stackPos(7) << 8) / 100; // - l->fightingStats[7] = (stackPos(8) << 8) / 100; // + l->fightingStats[0] = (stackPos(2) << 8) / 100; // hit chance + l->fightingStats[1] = 256; // + l->fightingStats[2] = (stackPos(3) << 8) / 100; // protection + l->fightingStats[3] = stackPos(4); // evade chance + l->fightingStats[4] = (stackPos(5) << 8) / 100; // speed + l->fightingStats[5] = (stackPos(6) << 8) / 100; // + l->fightingStats[6] = (stackPos(7) << 8) / 100; // + l->fightingStats[7] = (stackPos(8) << 8) / 100; // l->fightingStats[8] = 0; for (int i = 0; i < 8; i++) { @@ -1365,14 +1365,14 @@ int LoLEngine::olol_countBlockItems(EMCState *script) { return res; } -int LoLEngine::olol_characterSkillTest(EMCState *script){ +int LoLEngine::olol_characterSkillTest(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_characterSkillTest(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int skill = stackPos(0); int n = countActiveCharacters(); int m = 0; int c = 0; - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { int v = _characters[i].skillModifiers[skill] + _characters[i].skillLevels[skill] + 25; if (v > m) { m = v; @@ -1383,7 +1383,7 @@ int LoLEngine::olol_characterSkillTest(EMCState *script){ return (rollDice(1, 100) > m) ? -1 : c; } -int LoLEngine::olol_countAllMonsters(EMCState *script){ +int LoLEngine::olol_countAllMonsters(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_countAllMonsters(%p)", (const void *)script); int res = 0; @@ -1395,7 +1395,7 @@ int LoLEngine::olol_countAllMonsters(EMCState *script){ return res; } -int LoLEngine::olol_playEndSequence(EMCState *script){ +int LoLEngine::olol_playEndSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playEndSequence(%p)", (const void *)script); int c = 0; @@ -1685,7 +1685,7 @@ int LoLEngine::olol_countSpecificMonsters(EMCState *script) { int LoLEngine::olol_updateBlockAnimations2(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_updateBlockAnimations2(%p) (%d, %d, %d, %d, ...)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int numFrames = stackPos(3); - assert (numFrames <= 97); + assert(numFrames <= 97); int curFrame = stackPos(2) % numFrames; setWallType(stackPos(0), stackPos(1), stackPos(4 + curFrame)); return 0; @@ -1992,7 +1992,7 @@ int LoLEngine::olol_findInventoryItem(EMCState *script) { cur = 0; last = 4; } - for (;cur < last; cur++) { + for (; cur < last; cur++) { if (!(_characters[cur].flags & 1)) continue; for (int i = 0; i < 11; i++) { @@ -2356,7 +2356,7 @@ int LoLEngine::tlol_setupPaletteFade(const TIM *tim, const uint16 *param) { int LoLEngine::tlol_loadPalette(const TIM *tim, const uint16 *param) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_loadPalette(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]); - const char *palFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0]<<1))); + const char *palFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0] << 1))); _screen->loadPalette(palFile, _screen->getPalette(0)); return 1; } @@ -2372,7 +2372,7 @@ int LoLEngine::tlol_setupPaletteFadeEx(const TIM *tim, const uint16 *param) { int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_processWsaFrame(%p, %p) (%d, %d, %d, %d, %d)", - (const void *)tim, (const void *)param, param[0], param[1], param[2], param[3], param[4]); + (const void *)tim, (const void *)param, param[0], param[1], param[2], param[3], param[4]); const int animIndex = tim->wsa[param[0]].anim - 1; const int frame = param[1]; @@ -2570,8 +2570,8 @@ int LoLEngine::tlol_stopBackgroundAnimation(const TIM *tim, const uint16 *param) int LoLEngine::tlol_fadeInScene(const TIM *tim, const uint16 *param) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_fadeInScene(%p, %p) (%d, %d)", (const void *)tim, (const void *)param, param[0], param[1]); - const char *sceneFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0]<<1))); - const char *overlayFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[1]<<1))); + const char *sceneFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0] << 1))); + const char *overlayFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[1] << 1))); _screen->copyRegion(0, 0, 0, 0, 320, 200, 0, 2, Screen::CR_NO_P_CHECK); @@ -2622,7 +2622,7 @@ int LoLEngine::tlol_unusedResourceFunc(const TIM *tim, const uint16 *param) { int LoLEngine::tlol_fadeInPalette(const TIM *tim, const uint16 *param) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_fadeInPalette(%p, %p) (%d, %d)", (const void *)tim, (const void *)param, param[0], param[1]); - const char *bitmap = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0]<<1))); + const char *bitmap = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0] << 1))); Palette pal(_screen->getPalette(0).getNumColors()); _screen->loadBitmap(bitmap, 3, 3, &pal); @@ -2680,7 +2680,7 @@ typedef Common::Functor2Mem<const TIM *, const uint16 *, int, LoLEngine> TIMOpco #define OpcodeTimUnImpl() timTable->push_back(new TIMOpcodeLoL(this, 0)) void LoLEngine::setupOpcodeTable() { - Common::Array<const Opcode*> *table = 0; + Common::Array<const Opcode *> *table = 0; _opcodes.reserve(192); SetOpcodeTable(_opcodes); @@ -2972,7 +2972,7 @@ void LoLEngine::setupOpcodeTable() { Opcode(olol_getLanguage); Opcode(olol_dummy0); - Common::Array<const TIMOpcode*> *timTable = 0; + Common::Array<const TIMOpcode *> *timTable = 0; _timIntroOpcodes.reserve(8); SetTimOpcodeTable(_timIntroOpcodes); diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index 512d28f084..a06f2077ba 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -90,25 +90,25 @@ int LoLEngine::processPrologue() { // quit instantly. break; - case 0: // New game + case 0: // New game processSelection = 0; break; - case 1: // Show intro + case 1: // Show intro showIntro(); break; - case 2: { // "Lore of the Lands" (only CD version) + case 2: { // "Lore of the Lands" (only CD version) HistoryPlayer history(this); history.play(); - } break; + } break; - case 3: // Load game + case 3: // Load game if (_gui->runMenu(_gui->_loadMenu)) processSelection = 3; break; - case 4: // Quit game + case 4: // Quit game default: quitGame(); updateInput(); @@ -129,17 +129,17 @@ int LoLEngine::processPrologue() { } void LoLEngine::setupPrologueData(bool load) { - static const char * const fileListCD[] = { + static const char *const fileListCD[] = { "GENERAL.PAK", "INTROVOC.PAK", "STARTUP.PAK", "INTRO1.PAK", "INTRO2.PAK", "INTRO3.PAK", "INTRO4.PAK", "INTRO5.PAK", "INTRO6.PAK", "INTRO7.PAK", "INTRO8.PAK", "INTRO9.PAK", "HISTORY.PAK", 0 }; - static const char * const fileListFloppy[] = { + static const char *const fileListFloppy[] = { "INTRO.PAK", "INTROVOC.PAK", 0 }; - const char * const *fileList = _flags.isTalkie ? fileListCD : fileListFloppy; + const char *const *fileList = _flags.isTalkie ? fileListCD : fileListFloppy; char filename[32]; for (uint i = 0; fileList[i]; ++i) { @@ -410,10 +410,10 @@ void LoLEngine::kingSelectionIntro() { index = MAX(index, 4); _chargenWSA->displayFrame(_chargenFrameTable[index], 0, 113, 0, 0, 0, 0); - _screen->copyRegion(_selectionPosTable[_selectionChar1IdxTable[index]*2+0], _selectionPosTable[_selectionChar1IdxTable[index]*2+1], _charPreviews[0].x, _charPreviews[0].y, 32, 32, 4, 0); - _screen->copyRegion(_selectionPosTable[_selectionChar2IdxTable[index]*2+0], _selectionPosTable[_selectionChar2IdxTable[index]*2+1], _charPreviews[1].x, _charPreviews[1].y, 32, 32, 4, 0); - _screen->copyRegion(_selectionPosTable[_selectionChar3IdxTable[index]*2+0], _selectionPosTable[_selectionChar3IdxTable[index]*2+1], _charPreviews[2].x, _charPreviews[2].y, 32, 32, 4, 0); - _screen->copyRegion(_selectionPosTable[_selectionChar4IdxTable[index]*2+0], _selectionPosTable[_selectionChar4IdxTable[index]*2+1], _charPreviews[3].x, _charPreviews[3].y, 32, 32, 4, 0); + _screen->copyRegion(_selectionPosTable[_selectionChar1IdxTable[index] * 2 + 0], _selectionPosTable[_selectionChar1IdxTable[index] * 2 + 1], _charPreviews[0].x, _charPreviews[0].y, 32, 32, 4, 0); + _screen->copyRegion(_selectionPosTable[_selectionChar2IdxTable[index] * 2 + 0], _selectionPosTable[_selectionChar2IdxTable[index] * 2 + 1], _charPreviews[1].x, _charPreviews[1].y, 32, 32, 4, 0); + _screen->copyRegion(_selectionPosTable[_selectionChar3IdxTable[index] * 2 + 0], _selectionPosTable[_selectionChar3IdxTable[index] * 2 + 1], _charPreviews[2].x, _charPreviews[2].y, 32, 32, 4, 0); + _screen->copyRegion(_selectionPosTable[_selectionChar4IdxTable[index] * 2 + 0], _selectionPosTable[_selectionChar4IdxTable[index] * 2 + 1], _charPreviews[3].x, _charPreviews[3].y, 32, 32, 4, 0); _screen->updateScreen(); uint32 waitEnd = _system->getMillis() + 7 * _tickLength; @@ -430,7 +430,7 @@ void LoLEngine::kingSelectionIntro() { resetSkipFlag(); - _chargenWSA->displayFrame(0x10, 0,113, 0, 0, 0, 0); + _chargenWSA->displayFrame(0x10, 0, 113, 0, 0, 0, 0); _screen->updateScreen(); _sound->voiceStop(&_speechHandle); } @@ -452,11 +452,11 @@ void LoLEngine::kingSelectionReminder() { int index = 0; while ((!speechEnabled() || (speechEnabled() && _sound->voiceIsPlaying(&_speechHandle))) && _charSelection == -1 && !shouldQuit() && index < 15) { - _chargenWSA->displayFrame(_chargenFrameTable[index+9], 0, 113, 0, 0, 0, 0); - _screen->copyRegion(_selectionPosTable[_reminderChar1IdxTable[index]*2+0], _selectionPosTable[_reminderChar1IdxTable[index]*2+1], _charPreviews[0].x, _charPreviews[0].y, 32, 32, 4, 0); - _screen->copyRegion(_selectionPosTable[_reminderChar2IdxTable[index]*2+0], _selectionPosTable[_reminderChar2IdxTable[index]*2+1], _charPreviews[1].x, _charPreviews[1].y, 32, 32, 4, 0); - _screen->copyRegion(_selectionPosTable[_reminderChar3IdxTable[index]*2+0], _selectionPosTable[_reminderChar3IdxTable[index]*2+1], _charPreviews[2].x, _charPreviews[2].y, 32, 32, 4, 0); - _screen->copyRegion(_selectionPosTable[_reminderChar4IdxTable[index]*2+0], _selectionPosTable[_reminderChar4IdxTable[index]*2+1], _charPreviews[3].x, _charPreviews[3].y, 32, 32, 4, 0); + _chargenWSA->displayFrame(_chargenFrameTable[index + 9], 0, 113, 0, 0, 0, 0); + _screen->copyRegion(_selectionPosTable[_reminderChar1IdxTable[index] * 2 + 0], _selectionPosTable[_reminderChar1IdxTable[index] * 2 + 1], _charPreviews[0].x, _charPreviews[0].y, 32, 32, 4, 0); + _screen->copyRegion(_selectionPosTable[_reminderChar2IdxTable[index] * 2 + 0], _selectionPosTable[_reminderChar2IdxTable[index] * 2 + 1], _charPreviews[1].x, _charPreviews[1].y, 32, 32, 4, 0); + _screen->copyRegion(_selectionPosTable[_reminderChar3IdxTable[index] * 2 + 0], _selectionPosTable[_reminderChar3IdxTable[index] * 2 + 1], _charPreviews[2].x, _charPreviews[2].y, 32, 32, 4, 0); + _screen->copyRegion(_selectionPosTable[_reminderChar4IdxTable[index] * 2 + 0], _selectionPosTable[_reminderChar4IdxTable[index] * 2 + 1], _charPreviews[3].x, _charPreviews[3].y, 32, 32, 4, 0); _screen->updateScreen(); uint32 waitEnd = _system->getMillis() + 8 * _tickLength; @@ -526,7 +526,7 @@ void LoLEngine::updateSelectionAnims() { continue; const int index = _selectionAnimIndexTable[_selectionAnimFrames[i] + i * 2]; - _screen->copyRegion(_selectionPosTable[index*2+0], _selectionPosTable[index*2+1], _charPreviews[i].x, _charPreviews[i].y, 32, 32, 4, 0); + _screen->copyRegion(_selectionPosTable[index * 2 + 0], _selectionPosTable[index * 2 + 1], _charPreviews[i].x, _charPreviews[i].y, 32, 32, 4, 0); int delayTime = 0; if (_selectionAnimFrames[i] == 1) @@ -583,12 +583,12 @@ int LoLEngine::selectionCharInfo(int character) { if (_flags.platform == Common::kPlatformPC98) { for (int i = 0; i < 5; ++i) - _screen->printText(_tim->getCTableEntry(idx+i), 60, 128 + i * 8, 0x41, 0x00); + _screen->printText(_tim->getCTableEntry(idx + i), 60, 128 + i * 8, 0x41, 0x00); _screen->printText(_tim->getCTableEntry(69), 112, 168, 0x01, 0x00); } else { for (int i = 0; i < 5; ++i) - _screen->fprintStringIntro("%s", 50, 127 + i * 10, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+i)); + _screen->fprintStringIntro("%s", 50, 127 + i * 10, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx + i)); _screen->fprintStringIntro("%s", 100, 168, 0x32, 0x00, 0xCF, 0x20, _tim->getCTableEntry(69)); } @@ -615,10 +615,10 @@ int LoLEngine::selectionCharInfo(int character) { if (_flags.platform == Common::kPlatformPC98) { for (int i = 0; i < 5; ++i) - _screen->printText(_tim->getCTableEntry(64+i), 16, 32 + i * 8, 0xC1, 0x00); + _screen->printText(_tim->getCTableEntry(64 + i), 16, 32 + i * 8, 0xC1, 0x00); } else { for (int i = 0; i < 5; ++i) - _screen->fprintStringIntro("%s", 3, 28 + i * 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(64+i)); + _screen->fprintStringIntro("%s", 3, 28 + i * 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(64 + i)); } resetSkipFlag(); @@ -670,7 +670,7 @@ int LoLEngine::getCharSelection() { if (inputFlag == 200) { for (int i = 0; i < 4; ++i) { if (_charPreviews[i].x <= _mouseX && _mouseX <= _charPreviews[i].x + 31 && - _charPreviews[i].y <= _mouseY && _mouseY <= _charPreviews[i].y + 31) + _charPreviews[i].y <= _mouseY && _mouseY <= _charPreviews[i].y + 31) return i; } } @@ -1000,16 +1000,16 @@ void HistoryPlayer::updateFire() { // outro void LoLEngine::setupEpilogueData(bool load) { - static const char * const fileListCD[] = { + static const char *const fileListCD[] = { "GENERAL.PAK", "INTROVOC.PAK", "STARTUP.PAK", "FINALE.PAK", "FINALE1.PAK", "FINALE2.PAK", 0 }; - static const char * const fileListFloppy[] = { + static const char *const fileListFloppy[] = { "GENERAL.PAK", "INTRO.PAK", "FINALE1.PAK", "FINALE2.PAK", 0 }; - const char * const *fileList = _flags.isTalkie ? fileListCD : fileListFloppy; + const char *const *fileList = _flags.isTalkie ? fileListCD : fileListFloppy; assert(fileList); char filename[32]; @@ -1448,7 +1448,7 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) { } for (int i = 0; i < countStrings; ++i) { - CreditsString &s = strings[i+1]; + CreditsString &s = strings[i + 1]; int x = s.x, y = s.y; if (y < _screen->_curDim->h) { @@ -1514,7 +1514,7 @@ void LoLEngine::loadOutroShapes(int file, uint8 **storage) { if (i < 8) storage[i] = _screen->makeShapeCopy(_screen->getCPagePtr(5), i); else - storage[i] = _screen->makeShapeCopy(_screen->getCPagePtr(5), i+4); + storage[i] = _screen->makeShapeCopy(_screen->getCPagePtr(5), i + 4); } } diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index 2fe896b085..5a05d81a22 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -97,7 +97,7 @@ void LoLEngine::loadMonsterShapes(const char *file, int monsterIndex, int animTy uint8 *cl = (uint8 *)memchr(tmpPal1, tmpPal2[1 + ii], 64); if (!cl) continue; - tmpPal3[ii] = (uint16) (cl - tmpPal1); + tmpPal3[ii] = (uint16)(cl - tmpPal1); } for (int ii = 0; ii < 8; ii++) { @@ -594,7 +594,7 @@ void LoLEngine::drawBlockObjects(int blockArrayIndex) { } else { shp = (_itemProperties[i->itemPropertyIndex].flags & 0x40) ? _gameShapes[_itemProperties[i->itemPropertyIndex].shpIndex] : - _itemShapes[_gameShapeMap[_itemProperties[i->itemPropertyIndex].shpIndex << 1]]; + _itemShapes[_gameShapeMap[_itemProperties[i->itemPropertyIndex].shpIndex << 1]]; } if (shp) @@ -625,7 +625,7 @@ void LoLEngine::drawMonster(uint16 id) { 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++) { + for (int i = 0; i < 4; i++) { int v = m->equipmentShapes[i] - 1; if (v == -1) break; @@ -808,7 +808,7 @@ void LoLEngine::redrawSceneItem() { fy -= ((item->flyingHeight - 1) * 6); uint8 *shp = (_itemProperties[item->itemPropertyIndex].flags & 0x40) ? _gameShapes[_itemProperties[item->itemPropertyIndex].shpIndex] : - _itemShapes[_gameShapeMap[_itemProperties[item->itemPropertyIndex].shpIndex << 1]]; + _itemShapes[_gameShapeMap[_itemProperties[item->itemPropertyIndex].shpIndex << 1]]; drawItemOrMonster(shp, 0, item->x, item->y, fx, fy, 0, t, 0); _screen->updateScreen(); @@ -855,7 +855,7 @@ void LoLEngine::drawDoor(uint8 *shape, uint8 *doorPalette, int index, int unk2, if (flags & 1) { // TODO / UNUSED - flags |=1; + flags |= 1; } int u = 0; @@ -1127,7 +1127,7 @@ void LoLEngine::updateMonster(LoLMonster *monster) { // first recovery phase after delivering an attack if (++monster->fightCurTick > 2) { setMonsterMode(monster, 5); - monster->fightCurTick = (int8) ((((8 << 8) / monster->properties->fightingStats[4]) * _monsterModifiers[6 + _monsterDifficulty]) >> 8); + monster->fightCurTick = (int8)((((8 << 8) / monster->properties->fightingStats[4]) * _monsterModifiers[6 + _monsterDifficulty]) >> 8); } checkSceneUpdateNeed(monster->block); break; @@ -1310,7 +1310,7 @@ void LoLEngine::chasePartyWithCloseAttacks(LoLMonster *monster) { if (hit) { int mx = calcInflictableDamage(m, dst, hit); - int dmg = rollDice(2, mx ); + int dmg = rollDice(2, mx); inflictDamage(dst, dmg, m, 0, 0); applyMonsterAttackSkill(monster, dst, dmg); } diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp index deb6355384..63bc7fa99b 100644 --- a/engines/kyra/staticres_lol.cpp +++ b/engines/kyra/staticres_lol.cpp @@ -351,7 +351,7 @@ void LoLEngine::initStaticResource() { _staticres->unloadId(kLoLLightningDefs); } - _fireBallCoords = (const int16*)_staticres->loadRawDataBe16(kLoLFireballCoords, tempSize); + _fireBallCoords = (const int16 *)_staticres->loadRawDataBe16(kLoLFireballCoords, tempSize); _buttonCallbacks.clear(); _buttonCallbacks.reserve(95); @@ -465,7 +465,7 @@ void GUI_LoL::initStaticData() { if (_vm->gameFlags().isTalkie) GUI_LOL_MENU(_mainMenu, 9, 0x4000, 0, 7, -1, -1, -1, -1); - else + else GUI_LOL_MENU(_mainMenu, 17, 0x4000, 0, 6, -1, -1, -1, -1); GUI_LOL_MENU_ITEM(_mainMenu.item[0], 0x4001, 16, 23, 176, 15, 0, 0); @@ -627,7 +627,7 @@ const ScreenDim Screen_LoL::_screenDimTable16C[] = { const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable256C); -const char * const LoLEngine::_languageExt[] = { +const char *const LoLEngine::_languageExt[] = { "ENG", "FRE", "GER" @@ -777,7 +777,7 @@ const MistOfDoomAnimData LoLEngine::_mistAnimData[] = { { 0, 16, 16, 17, 175 }, }; -const char * const LoLEngine::_outroShapeFileTable[] = { +const char *const LoLEngine::_outroShapeFileTable[] = { "AMAZON.SHP", "ARCHRSLG.SHP", "AVIANWRM.SHP", "BANDIT.SHP", "BOAR.SHP", "CABAL.SHP", "GUARD.SHP", "HAG.SHP", "HORNET.SHP", "HURZELL.SHP", "IRONGRZR.SHP", "KNOWLES.SHP", "LIZARD.SHP", "MANTHA.SHP", "MINOTAUR.SHP", "MORIBUND.SHP", "ORC.SHP", "ORCLDR.SHP", diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp index d0b4062a65..a3df8dbe00 100644 --- a/engines/kyra/timer_lol.cpp +++ b/engines/kyra/timer_lol.cpp @@ -158,7 +158,7 @@ void LoLEngine::timerRegeneratePoints(int timerNum) { int hInc = (_characters[i].flags & 8) ? 0 : (itemEquipped(i, 228) ? 4 : 1); // check for Talba ring int mInc = _drainMagic ? ((_characters[i].magicPointsMax >> 5) * -1) : - ((_characters[i].flags & 8) ? 0 : (itemEquipped(i, 227) ? (_characters[i].magicPointsMax / 10) : 1)); + ((_characters[i].flags & 8) ? 0 : (itemEquipped(i, 227) ? (_characters[i].magicPointsMax / 10) : 1)); _characters[i].magicPointsCur = CLIP<int16>(_characters[i].magicPointsCur + mInc, 0, _characters[i].magicPointsMax); |