aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/animator_v2.cpp4
-rw-r--r--engines/kyra/chargen.cpp52
-rw-r--r--engines/kyra/eobcommon.cpp136
-rw-r--r--engines/kyra/gui.cpp14
-rw-r--r--engines/kyra/gui_v2.cpp10
-rw-r--r--engines/kyra/kyra_v2.cpp6
-rw-r--r--engines/kyra/saveload.cpp16
-rw-r--r--engines/kyra/scene_v2.cpp40
-rw-r--r--engines/kyra/screen_v2.cpp14
-rw-r--r--engines/kyra/script_v2.cpp22
10 files changed, 173 insertions, 141 deletions
diff --git a/engines/kyra/animator_v2.cpp b/engines/kyra/animator_v2.cpp
index 334356e261..f7ae6749cf 100644
--- a/engines/kyra/animator_v2.cpp
+++ b/engines/kyra/animator_v2.cpp
@@ -26,10 +26,10 @@
namespace Kyra {
void KyraEngine_v2::allocAnimObjects(int actors, int anims, int items) {
- _animObjects = new AnimObj[actors+anims+items];
+ _animObjects = new AnimObj[actors + anims + items];
assert(_animObjects);
- memset(_animObjects, 0, sizeof(AnimObj)*(actors+anims+items));
+ memset(_animObjects, 0, sizeof(AnimObj) * (actors + anims + items));
_animActor = _animObjects;
_animAnims = _animObjects + actors;
diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp
index e0f1ac37d9..e4b89c9a99 100644
--- a/engines/kyra/chargen.cpp
+++ b/engines/kyra/chargen.cpp
@@ -169,7 +169,7 @@ bool CharacterGenerator::start(EoBCharacter *characters, uint8 ***faceShapes) {
_vm->sound()->playTrack(_vm->game() == GI_EOB1 ? 20 : 13);
_activeBox = 0;
- for (bool loop = true; loop && (!_vm->shouldQuit()); ) {
+ for (bool loop = true; loop && (!_vm->shouldQuit());) {
_vm->_gui->updateBoxFrameHighLight(_activeBox + 6);
int inputFlag = getInput(_vm->_activeButtons);
_vm->removeInputTop();
@@ -260,7 +260,7 @@ void CharacterGenerator::init() {
for (int i = 0; i < 17; i++) {
const CreatePartyModButton *c = &_chargenModButtons[i];
- _chargenButtonLabels[i] = c->labelW? _screen->encodeShape(c->encodeLabelX, c->encodeLabelY, c->labelW, c->labelH, true) : 0;
+ _chargenButtonLabels[i] = c->labelW ? _screen->encodeShape(c->encodeLabelX, c->encodeLabelY, c->labelW, c->labelH, true) : 0;
}
_screen->copyPage(3, 2);
@@ -380,7 +380,7 @@ int CharacterGenerator::viewDeleteCharacter() {
printStats(_activeBox, 2);
int res = 0;
- for (bool loop = true; loop && _characters[_activeBox].name[0] && !_vm->shouldQuit(); ) {
+ for (bool loop = true; loop && _characters[_activeBox].name[0] && !_vm->shouldQuit();) {
_vm->_gui->updateBoxFrameHighLight(_activeBox + 6);
int inputFlag = getInput(_vm->_activeButtons);
int cbx = _activeBox;
@@ -467,7 +467,7 @@ void CharacterGenerator::createPartyMember() {
generateStats(_activeBox);
statsAndFacesMenu();
- for (_characters[_activeBox].name[0] = 0; _characters[_activeBox].name[0] == 0 && !_vm->shouldQuit(); ) {
+ for (_characters[_activeBox].name[0] = 0; _characters[_activeBox].name[0] == 0 && !_vm->shouldQuit();) {
processFaceMenuSelection(_chargenMinStats[6]);
printStats(_activeBox, 0);
_screen->printShadedText(_chargenStrings2[11], 149, 100, 9, 0);
@@ -594,10 +594,10 @@ int CharacterGenerator::getInput(Button *buttonList) {
if (_vm->game() == GI_EOB1 && _vm->sound()->checkTrigger()) {
_vm->sound()->resetTrigger();
_vm->sound()->playTrack(20);
- // WORKAROUND for EOB II: The original implements the same sound trigger check as in EOB I.
- // However, Westwood seems to have forgotten to set the trigger at the end of the AdLib song,
- // so that the music will not loop. We simply check whether the sound driver is still playing.
} else if (_vm->game() == GI_EOB2 && !_vm->sound()->isPlaying()) {
+ // WORKAROUND for EOB II: The original implements the same sound trigger check as in EOB I.
+ // However, Westwood seems to have forgotten to set the trigger at the end of the AdLib song,
+ // so that the music will not loop. We simply check whether the sound driver is still playing.
_vm->delay(3 * _vm->_tickLength);
_vm->sound()->playTrack(13);
}
@@ -678,7 +678,7 @@ void CharacterGenerator::modifyMenu() {
EoBCharacter *c = &_characters[_activeBox];
int8 hpLO = c->hitPointsCur;
- for (int i = 0; i >= 0 && i < 7; ) {
+ for (int i = 0; i >= 0 && i < 7;) {
switch (i) {
case 0:
i = modifyStat(i, &c->strengthCur, &c->strengthExtCur);
@@ -959,8 +959,8 @@ int CharacterGenerator::rollDice() {
}
int CharacterGenerator::modifyStat(int index, int8 *stat1, int8 *stat2) {
- uint8 *s1 = (uint8*) stat1;
- uint8 *s2 = (uint8*) stat2;
+ uint8 *s1 = (uint8 *)stat1;
+ uint8 *s2 = (uint8 *)stat2;
initButtonsFromList(31, 10);
Button *b = _vm->gui_getButton(_vm->_activeButtons, index + 1);
@@ -984,10 +984,10 @@ int CharacterGenerator::modifyStat(int index, int8 *stat1, int8 *stat2) {
_chargenMinStats[6] = getMinHp(c->cClass, c->constitutionCur, c->level[0], c->level[1], c->level[2]);
}
- for (bool loop = true; loop && !_vm->shouldQuit(); ) {
+ for (bool loop = true; loop && !_vm->shouldQuit();) {
uint8 v1 = *s1;
updateMagicShapes();
- int inputFlag = getInput(_vm->_activeButtons);
+ int inputFlag = getInput(_vm->_activeButtons);
_vm->removeInputTop();
if (inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP4] || inputFlag == _vm->_keyMap[Common::KEYCODE_MINUS] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP_MINUS] || inputFlag == 0x8009) {
@@ -1139,9 +1139,19 @@ void CharacterGenerator::finish() {
_screen->updateScreen();
if (_vm->game() == GI_EOB1) {
- static const int8 classDefaultItemsList[] = { 1, 17, 2, 17, 46, -1, 4, -1, 5, -1, 6, 2, 7, -1, 8, -1, 9, 21, 10, 2, 31, 2 };
- static const int8 classDefaultItemsListIndex[] = { 4, 8, 0, -1, 4, 3, 0, -1, 4, 10, 0, 8, 3, 6, 1, -1, 2, 7, 0, -1,
- 4, 5, 0, -1, 4, 7, 0, 8, 4, 5, 0, 8, 4, 6, 8, 8, 4, 6, 5, 8, 3, 6, 5, -1, 2, 7, 5, 0, 4, 6, 7, 0, 4, 3, 7, 0, 2, 6, 7, 1 };
+ static const int8 classDefaultItemsList[] = {
+ 1, 17, 2, 17, 46, -1, 4, -1, 5, -1, 6,
+ 2, 7, -1, 8, -1, 9, 21, 10, 2, 31, 2
+ };
+
+ static const int8 classDefaultItemsListIndex[] = {
+ 4, 8, 0, -1, 4, 3, 0, -1, 4, 10,
+ 0, 8, 3, 6, 1, -1, 2, 7, 0, -1,
+ 4, 5, 0, -1, 4, 7, 0, 8, 4, 5,
+ 0, 8, 4, 6, 8, 8, 4, 6, 5, 8,
+ 3, 6, 5, -1, 2, 7, 5, 0, 4, 6,
+ 7, 0, 4, 3, 7, 0, 2, 6, 7, 1
+ };
_characters[0].inventory[2] = _vm->duplicateItem(35);
@@ -1416,13 +1426,13 @@ const int32 CharacterGenerator::_classMenuMasks[] = {
};
const int32 CharacterGenerator::_alignmentMenuMasks[] = {
- 0x01FF, 0x0007, 0x0001, 0x01FF, 0x01FF, 0x01FE, 0x01FF, 0x01FE,
- 0x01FF, 0x01FE, 0x01FE, 0x01FE, 0x01FF, 0x0007, 0x01FF
+ 0x01FF, 0x0007, 0x0001, 0x01FF, 0x01FF, 0x01FE, 0x01FF, 0x01FE,
+ 0x01FF, 0x01FE, 0x01FE, 0x01FE, 0x01FF, 0x0007, 0x01FF
};
const int16 CharacterGenerator::_raceModifiers[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, -1, 0, 1, -1, 0, 0, 0, -1, 0, 0, 1, 0, 0
+ 0, 0, 0, 0, 1, -1, 0, 1, -1, 0, 0, 0, -1, 0, 0, 1, 0, 0
};
// Transfer Party
@@ -1627,7 +1637,7 @@ int TransferPartyWiz::selectCharactersMenu() {
int highlight = 0;
bool update = false;
- for (bool loop = true; loop && (!_vm->shouldQuit()); ) {
+ for (bool loop = true; loop && (!_vm->shouldQuit());) {
int inputFlag = _vm->checkInput(0, false, 0) & 0x8ff;
_vm->removeInputTop();
@@ -1843,7 +1853,7 @@ Item TransferPartyWiz::convertItem(Item eob1Item) {
itm2->type = itm1->type;
itm2->level = 0xff;
- switch(itm2->type) {
+ switch (itm2->type) {
case 35:
itm1->value += 25;
// fall through
@@ -1960,6 +1970,6 @@ bool EoBCoreEngine::startPartyTransfer() {
return TransferPartyWiz(this, _screen).start();
}
-} // End of namespace Kyra
+} // End of namespace Kyra
#endif // ENABLE_EOB
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index f3e644b89d..8e14b895a0 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -36,9 +36,12 @@
namespace Kyra {
-EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags) : KyraRpgEngine(system, flags), _numLargeItemShapes(flags.gameID == GI_EOB1 ? 14 : 11),
- _numSmallItemShapes(flags.gameID == GI_EOB1 ? 23 : 26), _numThrownItemShapes(flags.gameID == GI_EOB1 ? 12 : 9), _numItemIconShapes(flags.gameID == GI_EOB1 ? 89 : 112),
- _teleporterWallId(flags.gameID == GI_EOB1 ? 52 : 44) {
+EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
+ : KyraRpgEngine(system, flags), _numLargeItemShapes(flags.gameID == GI_EOB1 ? 14 : 11),
+ _numSmallItemShapes(flags.gameID == GI_EOB1 ? 23 : 26),
+ _numThrownItemShapes(flags.gameID == GI_EOB1 ? 12 : 9),
+ _numItemIconShapes(flags.gameID == GI_EOB1 ? 89 : 112),
+ _teleporterWallId(flags.gameID == GI_EOB1 ? 52 : 44) {
_screen = 0;
_gui = 0;
_debugger = 0;
@@ -52,10 +55,10 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags) : KyraRpgE
_flashShapeTimer = 0;
_drawSceneTimer = 0;
- _largeItemShapes = _smallItemShapes = _thrownItemShapes = _spellShapes = _firebeamShapes = _itemIconShapes =
- _wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0;
- _redSplatShape = _greenSplatShape = _deadCharShape = _disabledCharGrid = _blackBoxSmallGrid =
- _weaponSlotGrid = _blackBoxWideGrid = _lightningColumnShape = 0;
+ _largeItemShapes = _smallItemShapes = _thrownItemShapes = _spellShapes = _firebeamShapes = 0;
+ _itemIconShapes = _wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0;
+ _redSplatShape = _greenSplatShape = _deadCharShape = _disabledCharGrid = 0;
+ _blackBoxSmallGrid = _weaponSlotGrid = _blackBoxWideGrid = _lightningColumnShape = 0;
_tempIconShape = 0;
_monsterDustStrings = 0;
@@ -149,42 +152,62 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags) : KyraRpgE
_wallsOfForce = 0;
_rrCount = 0;
- memset(_rrNames, 0, 10 * sizeof(const char*));
+ memset(_rrNames, 0, 10 * sizeof(const char *));
memset(_rrId, 0, 10 * sizeof(int8));
- _mainMenuStrings = _levelGainStrings = _monsterSpecAttStrings = _characterGuiStringsHp = _characterGuiStringsWp = _characterGuiStringsWr = _characterGuiStringsSt =
- _characterGuiStringsIn = _characterStatusStrings7 = _characterStatusStrings8 = _characterStatusStrings9 = _characterStatusStrings12 = _characterStatusStrings13 = 0;
- _classModifierFlags = _saveThrowLevelIndex = _saveThrowModDiv = _saveThrowModExt = _wandTypes = _drawObjPosIndex = _flightObjFlipIndex = _expObjectTblIndex =
- _expObjectShpStart = _expObjectTlMode = _expObjectAnimTbl1 = _expObjectAnimTbl2 = _expObjectAnimTbl3 = 0;
- _monsterStepTable0 = _monsterStepTable1 = _monsterStepTable2 = _monsterStepTable3 = _projectileWeaponAmmoTypes = _flightObjShpMap = _flightObjSclIndex = 0;
- _monsterCloseAttPosTable1 = _monsterCloseAttPosTable2 = _monsterCloseAttChkTable1 = _monsterCloseAttChkTable2 = _monsterCloseAttDstTable1 = _monsterCloseAttDstTable2 = 0;
- _monsterProximityTable = _findBlockMonstersTable = _wallOfForceDsY = _wallOfForceDsNumW = _wallOfForceDsNumH = _wallOfForceShpId = _wllFlagPreset = _teleporterShapeCoords = 0;
- _monsterCloseAttUnkTable = _monsterFrmOffsTable1 = _monsterFrmOffsTable2 = _monsterDirChangeTable = _portalSeq = 0;
+ _mainMenuStrings = _levelGainStrings = _monsterSpecAttStrings = _characterGuiStringsHp = 0;
+ _characterGuiStringsWp = _characterGuiStringsWr = _characterGuiStringsSt = 0;
+ _characterGuiStringsIn = _characterStatusStrings7 = _characterStatusStrings8 = 0;
+ _characterStatusStrings9 = _characterStatusStrings12 = _characterStatusStrings13 = 0;
+ _classModifierFlags = _saveThrowLevelIndex = _saveThrowModDiv = _saveThrowModExt = 0;
+ _wandTypes = _drawObjPosIndex = _flightObjFlipIndex = _expObjectTblIndex = 0;
+ _expObjectShpStart = _expObjectTlMode = _expObjectAnimTbl1 = _expObjectAnimTbl2 = _expObjectAnimTbl3 = 0;
+ _monsterStepTable0 = _monsterStepTable1 = _monsterStepTable2 = _monsterStepTable3 = 0;
+ _projectileWeaponAmmoTypes = _flightObjShpMap = _flightObjSclIndex = 0;
+ _monsterCloseAttPosTable1 = _monsterCloseAttPosTable2 = _monsterCloseAttChkTable1 = 0;
+ _monsterCloseAttChkTable2 = _monsterCloseAttDstTable1 = _monsterCloseAttDstTable2 = 0;
+ _monsterProximityTable = _findBlockMonstersTable = _wallOfForceDsY = _wallOfForceDsNumW = 0;
+ _wallOfForceDsNumH = _wallOfForceShpId = _wllFlagPreset = _teleporterShapeCoords = 0;
+ _monsterCloseAttUnkTable = _monsterFrmOffsTable1 = _monsterFrmOffsTable2 = 0;
+ _monsterDirChangeTable = _portalSeq = 0;
_wallOfForceDsX = 0;
- _expObjectAnimTbl1Size = _expObjectAnimTbl2Size = _expObjectAnimTbl3Size = _wllFlagPresetSize = _scriptTimersCount = _buttonList1Size = _buttonList2Size =
- _buttonList3Size = _buttonList4Size = _buttonList5Size = _buttonList6Size = _buttonList7Size = _buttonList8Size = 0;
+ _expObjectAnimTbl1Size = _expObjectAnimTbl2Size = _expObjectAnimTbl3Size = 0;
+ _wllFlagPresetSize = _scriptTimersCount = _buttonList1Size = _buttonList2Size = 0;
+ _buttonList3Size = _buttonList4Size = _buttonList5Size = _buttonList6Size = 0;
+ _buttonList7Size = _buttonList8Size = 0;
_inventorySlotsY = _mnDef = 0;
_transferStringsScummVM = 0;
_buttonDefs = 0;
_npcPreset = 0;
- _chargenStatStrings = _chargenRaceSexStrings = _chargenClassStrings = _chargenAlignmentStrings = _pryDoorStrings = _warningStrings = _ripItemStrings =
- _cursedString = _enchantedString = _magicObjectStrings = _magicObjectString5 = _patternSuffix = _patternGrFix1 = _patternGrFix2 = _validateArmorString =
- _validateCursedString = _validateNoDropString = _potionStrings = _wandStrings = _itemMisuseStrings = _suffixStringsRings = _suffixStringsPotions =
- _suffixStringsWands = _takenStrings = _potionEffectStrings = _yesNoStrings = _npcMaxStrings = _okStrings = _npcJoinStrings = _cancelStrings =
- _abortStrings = _saveLoadStrings = _mnWord = _mnPrompt = _bookNumbers = _mageSpellList = _clericSpellList = _spellNames = _magicStrings1 = _magicStrings2 =
- _magicStrings3 = _magicStrings4 = _magicStrings6 = _magicStrings7 = _magicStrings8 = 0;
+ _chargenStatStrings = _chargenRaceSexStrings = _chargenClassStrings = 0;
+ _chargenAlignmentStrings = _pryDoorStrings = _warningStrings = _ripItemStrings = 0;
+ _cursedString = _enchantedString = _magicObjectStrings = _magicObjectString5 = 0;
+ _patternSuffix = _patternGrFix1 = _patternGrFix2 = _validateArmorString = 0;
+ _validateCursedString = _validateNoDropString = _potionStrings = _wandStrings = 0;
+ _itemMisuseStrings = _suffixStringsRings = _suffixStringsPotions = 0;
+ _suffixStringsWands = _takenStrings = _potionEffectStrings = _yesNoStrings = 0;
+ _npcMaxStrings = _okStrings = _npcJoinStrings = _cancelStrings = 0;
+ _abortStrings = _saveLoadStrings = _mnWord = _mnPrompt = _bookNumbers = 0;
+ _mageSpellList = _clericSpellList = _spellNames = _magicStrings1 = 0;
+ _magicStrings2 = _magicStrings3 = _magicStrings4 = _magicStrings6 = 0;
+ _magicStrings7 = _magicStrings8 = 0;
_spellAnimBuffer = 0;
- _sparkEffectDefSteps = _sparkEffectDefSubSteps = _sparkEffectDefShift = _sparkEffectDefAdd = _sparkEffectDefX = _sparkEffectDefY = _sparkEffectOfShift =
- _sparkEffectOfX = _sparkEffectOfY = _magicFlightObjectProperties = _turnUndeadEffect = _burningHandsDest = _coneOfColdGfxTbl = 0;
+ _sparkEffectDefSteps = _sparkEffectDefSubSteps = _sparkEffectDefShift = 0;
+ _sparkEffectDefAdd = _sparkEffectDefX = _sparkEffectDefY = _sparkEffectOfShift = 0;
+ _sparkEffectOfX = _sparkEffectOfY = _magicFlightObjectProperties = 0;
+ _turnUndeadEffect = _burningHandsDest = _coneOfColdGfxTbl = 0;
_sparkEffectOfFlags1 = _sparkEffectOfFlags2 = 0;
_coneOfColdDest1 = _coneOfColdDest2 = _coneOfColdDest3 = _coneOfColdDest4 = 0;
_coneOfColdGfxTblSize = 0;
_menuButtonDefs = 0;
- _menuStringsMain = _menuStringsSaveLoad = _menuStringsOnOff = _menuStringsSpells = _menuStringsRest = _menuStringsDrop = _menuStringsExit = _menuStringsStarve =
- _menuStringsScribe = _menuStringsDrop2 = _menuStringsHead = _menuStringsPoison = _menuStringsMgc = _menuStringsPrefs = _menuStringsRest2 = _menuStringsRest3 =
- _menuStringsRest4 = _menuStringsDefeat = _menuStringsTransfer = _menuStringsSpec = _menuStringsSpellNo = _menuYesNoStrings = 0;
+ _menuStringsMain = _menuStringsSaveLoad = _menuStringsOnOff = _menuStringsSpells = 0;
+ _menuStringsRest = _menuStringsDrop = _menuStringsExit = _menuStringsStarve = 0;
+ _menuStringsScribe = _menuStringsDrop2 = _menuStringsHead = _menuStringsPoison = 0;
+ _menuStringsMgc = _menuStringsPrefs = _menuStringsRest2 = _menuStringsRest3 = 0;
+ _menuStringsRest4 = _menuStringsDefeat = _menuStringsTransfer = _menuStringsSpec = 0;
+ _menuStringsSpellNo = _menuYesNoStrings = 0;
_errorSlotEmptyString = _errorSlotNoNameString = _menuOkString = 0;
- _spellLevelsMage = _spellLevelsCleric = _numSpellsCleric = _numSpellsWisAdj = _numSpellsPal = _numSpellsMage = 0;
+ _spellLevelsMage = _spellLevelsCleric = _numSpellsCleric = _numSpellsWisAdj = _numSpellsPal = _numSpellsMage = 0;
_mnNumWord = _numSpells = _mageSpellListSize = _spellLevelsMageSize = _spellLevelsClericSize = 0;
_inventorySlotsX = _slotValidationFlags = _encodeMonsterShpTable = 0;
memset(_expRequirementTables, 0, sizeof(_expRequirementTables));
@@ -197,15 +220,15 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags) : KyraRpgE
#define DWM0 _dscWallMapping.push_back(0)
#define DWM(x) _dscWallMapping.push_back(&_sceneDrawVar##x)
- DWM0; DWM0; DWM(Down); DWM(Right);
- DWM(Down); DWM(Right); DWM(Down); DWM0;
- DWM(Down); DWM(Left); DWM(Down); DWM(Left);
- DWM0; DWM0; DWM(Down); DWM(Right);
- DWM(Down); DWM(Right); DWM(Down); DWM0;
- DWM(Down); DWM(Left); DWM(Down); DWM(Left);
- DWM(Down); DWM(Right); DWM(Down); DWM0;
- DWM(Down); DWM(Left); DWM0; DWM(Right);
- DWM(Down); DWM0; DWM0; DWM(Left);
+ DWM0; DWM0; DWM(Down); DWM(Right);
+ DWM(Down); DWM(Right); DWM(Down); DWM0;
+ DWM(Down); DWM(Left); DWM(Down); DWM(Left);
+ DWM0; DWM0; DWM(Down); DWM(Right);
+ DWM(Down); DWM(Right); DWM(Down); DWM0;
+ DWM(Down); DWM(Left); DWM(Down); DWM(Left);
+ DWM(Down); DWM(Right); DWM(Down); DWM0;
+ DWM(Down); DWM(Left); DWM0; DWM(Right);
+ DWM(Down); DWM0; DWM0; DWM(Left);
#undef DWM
#undef DWM0
}
@@ -402,7 +425,7 @@ Common::Error EoBCoreEngine::init() {
memset(_noDoorSwitch, 0, sizeof(_noDoorSwitch));
_monsterShapes = new uint8*[36];
- memset(_monsterShapes, 0, 36 * sizeof(uint8*));
+ memset(_monsterShapes, 0, 36 * sizeof(uint8 *));
_monsterDecorations = new SpriteDecoration[36];
memset(_monsterDecorations, 0, 36 * sizeof(SpriteDecoration));
_monsterPalettes = new uint8*[24];
@@ -1153,7 +1176,7 @@ int EoBCoreEngine::prepareForNewPartyMember(int16 itemType, int16 itemValue) {
gui_drawDialogueBox();
_txt->printDialogueText(_npcMaxStrings[0]);
int r = runDialogue(-1, 7, _characters[0].name, _characters[1].name, _characters[2].name, _characters[3].name,
- _characters[4].name, _characters[5].name, _abortStrings[0]) - 1;
+ _characters[4].name, _characters[5].name, _abortStrings[0]) - 1;
if (r == 6)
return 0;
@@ -1187,12 +1210,12 @@ void EoBCoreEngine::removeCharacterFromParty(int charIndex) {
if (i == 16 || !c->inventory[i])
continue;
- setItemPosition((Item*)&_levelBlockProperties[_currentBlock & 0x3ff].drawObjects, _currentBlock, c->inventory[i], _dropItemDirIndex[(_currentDirection << 2) + rollDice(1, 2, -1)]);
+ setItemPosition((Item *)&_levelBlockProperties[_currentBlock & 0x3ff].drawObjects, _currentBlock, c->inventory[i], _dropItemDirIndex[(_currentDirection << 2) + rollDice(1, 2, -1)]);
c->inventory[i] = 0;
}
while (c->inventory[16])
- setItemPosition((Item*)&_levelBlockProperties[_currentBlock & 0x3ff].drawObjects, _currentBlock, getQueuedItem(&c->inventory[16], 0, -1), _dropItemDirIndex[(_currentDirection << 2) + rollDice(1, 2, -1)]);
+ setItemPosition((Item *)&_levelBlockProperties[_currentBlock & 0x3ff].drawObjects, _currentBlock, getQueuedItem(&c->inventory[16], 0, -1), _dropItemDirIndex[(_currentDirection << 2) + rollDice(1, 2, -1)]);
c->inventory[16] = 0;
@@ -1281,7 +1304,7 @@ void EoBCoreEngine::setupDialogueButtons(int presetfirst, int numStr, va_list &a
_dialogueHighlightedButton = 0;
for (int i = 0; i < numStr; i++) {
- const char *s = va_arg(args, const char*);
+ const char *s = va_arg(args, const char *);
if (s)
_dialogueButtonString[i] = s;
else
@@ -1549,7 +1572,7 @@ void EoBCoreEngine::displayParchment(int id) {
int EoBCoreEngine::countResurrectionCandidates() {
_rrCount = 0;
- memset(_rrNames, 0, 10 * sizeof(const char*));
+ memset(_rrNames, 0, 10 * sizeof(const char *));
for (int i = 0; i < 6; i++) {
if (!testCharacter(i, 1))
@@ -1617,7 +1640,7 @@ void EoBCoreEngine::seq_portal() {
_screen->copyRegion(24, 0, 24, 0, 144, 104, 5, 2, Screen::CR_NO_P_CHECK);
delay(30 * _tickLength);
- for (const int8 *pos = _portalSeq; *pos > -1 && !shouldQuit(); ) {
+ for (const int8 *pos = _portalSeq; *pos > -1 && !shouldQuit();) {
int s = *pos++;
_screen->drawShape(0, shapes3[s], 28, 9, 0);
_screen->drawShape(0, shapes1[s], 34, 28, 0);
@@ -1814,7 +1837,7 @@ int EoBCoreEngine::projectileWeaponAttack(int charIndex, Item item) {
} else {
for (int i = 0; i < 27; i++) {
if (_items[_characters[charIndex].inventory[i]].type == t) {
- SWAP(ammoItem, _characters[charIndex].inventory[i] );
+ SWAP(ammoItem, _characters[charIndex].inventory[i]);
if (i < 2)
gui_drawCharPortraitWithStats(charIndex);
break;
@@ -1954,7 +1977,7 @@ bool EoBCoreEngine::characterAttackHitTest(int charIndex, int monsterIndex, int
int d = (p < 1 || p > 3) ? 0 : _items[item].value;
if (_flags.gameID == GI_EOB2) {
- if ((p > 0 && p < 4) || !item ){
+ if ((p > 0 && p < 4) || !item) {
if (((_monsterProps[t].immunityFlags & 0x200) && (d <= 0)) || ((_monsterProps[t].immunityFlags & 0x1000) && (d <= 1)))
return false;
}
@@ -2006,7 +2029,7 @@ bool EoBCoreEngine::flyingObjectMonsterHit(EoBFlyingObject *fo, int monsterIndex
if (!characterAttackHitTest(fo->attackerId, monsterIndex, fo->item, 0))
return false;
}
- calcAndInflictMonsterDamage(&_monsters[monsterIndex], fo->attackerId, fo->item, 0, (fo->attackerId == -1) ? 0x110: 0x910, 5, 3);
+ calcAndInflictMonsterDamage(&_monsters[monsterIndex], fo->attackerId, fo->item, 0, (fo->attackerId == -1) ? 0x110 : 0x910, 5, 3);
return true;
}
@@ -2150,10 +2173,9 @@ int EoBCoreEngine::calcMonsterDamage(EoBMonsterInPlay *m, int times, int pips, i
s = 1;
}
- if ((flags & 0x100) && (!(_itemTypes[_items[pips].type].allowedClasses & 4 /* bug in original code ??*/)) &&
- ((_flags.gameID == GI_EOB2 && (p->immunityFlags & 0x100)) ||
- (_flags.gameID == GI_EOB1 && (p->capsFlags & 4))))
- s >>= 1;
+ if ((flags & 0x100) && (!(_itemTypes[_items[pips].type].allowedClasses & 4 /* bug in original code ??*/))
+ && ((_flags.gameID == GI_EOB2 && (p->immunityFlags & 0x100)) || (_flags.gameID == GI_EOB1 && (p->capsFlags & 4))))
+ s >>= 1;
if (p->immunityFlags & 0x2000) {
if (flags & 0x100) {
@@ -2191,8 +2213,8 @@ int EoBCoreEngine::calcDamageModifers(int charIndex, EoBMonsterInPlay *m, int it
if (item) {
EoBItemType *p = &_itemTypes[itemType];
int t = m ? m->type : 0;
- s += ((m && (_monsterProps[t].capsFlags & 1)) ? rollDice(p->dmgNumDiceL, p->dmgNumPipsL, p->dmgIncS /* bug in original code ? */) :
- rollDice(p->dmgNumDiceS, p->dmgNumPipsS, p->dmgIncS));
+ s += ((m && (_monsterProps[t].capsFlags & 1)) ? rollDice(p->dmgNumDiceL, p->dmgNumPipsL, p->dmgIncS /* bug in original code ? */) :
+ rollDice(p->dmgNumDiceS, p->dmgNumPipsS, p->dmgIncS));
s += _items[item].value;
} else {
s += rollDice(1, 2);
@@ -2209,7 +2231,7 @@ bool EoBCoreEngine::trySavingThrow(void *target, int hpModifier, int level, int
int s = getSaveThrowModifier(hpModifier, level, type);
if (((race == 3 || race == 5) && (type == 4 || type == 1 || type == 0)) || (race == 4 && (type == 4 || type == 1))) {
- EoBCharacter *c = (EoBCharacter*)target;
+ EoBCharacter *c = (EoBCharacter *)target;
s -= constMod[c->constitutionCur];
}
@@ -2319,6 +2341,6 @@ void EoBCoreEngine::snd_stopSound() {
_sound->playSoundEffect(0);
}
-} // End of namespace Kyra
+} // End of namespace Kyra
#endif // ENABLE_EOB
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index cc32a9785a..9e08ae0fb9 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -53,9 +53,9 @@ void GUI::updateSaveFileList(Common::String targetName, bool excludeQuickSaves)
for (Common::StringArray::const_iterator i = saveFileList.begin(); i != saveFileList.end(); ++i) {
char s1 = 0, s2 = 0, s3 = 0;
- s1 = (*i)[i->size()-3];
- s2 = (*i)[i->size()-2];
- s3 = (*i)[i->size()-1];
+ s1 = (*i)[i->size() - 3];
+ s2 = (*i)[i->size() - 2];
+ s3 = (*i)[i->size() - 1];
if (!isdigit(static_cast<unsigned char>(s1)) || !isdigit(static_cast<unsigned char>(s2)) || !isdigit(static_cast<unsigned char>(s3)))
continue;
s1 -= '0';
@@ -63,7 +63,7 @@ void GUI::updateSaveFileList(Common::String targetName, bool excludeQuickSaves)
s3 -= '0';
if (excludeQuickSaves && s1 == 9 && s2 == 9)
continue;
- _saveSlots.push_back(s1*100+s2*10+s3);
+ _saveSlots.push_back(s1 * 100 + s2 * 10 + s3);
}
if (_saveSlots.begin() == _saveSlots.end())
@@ -75,7 +75,7 @@ void GUI::updateSaveFileList(Common::String targetName, bool excludeQuickSaves)
void GUI::sortSaveSlots() {
Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Less<int>());
if (_saveSlots.size() > 2)
- Common::sort(_saveSlots.begin()+1, _saveSlots.end(), Common::Greater<int>());
+ Common::sort(_saveSlots.begin() + 1, _saveSlots.end(), Common::Greater<int>());
}
int GUI::getNextSavegameSlot() {
@@ -117,11 +117,11 @@ void GUI::updateSaveSlotsList(Common::String targetName, bool force) {
Common::InSaveFile *in;
_savegameList = new char*[_savegameListSize];
- memset(_savegameList, 0, _savegameListSize * sizeof(char*));
+ memset(_savegameList, 0, _savegameListSize * sizeof(char *));
for (int i = 0; i < numSaves; i++) {
in = _vm->openSaveForReading(_vm->getSavegameFilename(targetName, _saveSlots[i]).c_str(), header, targetName == _vm->_targetName);
- char **listEntry = &_savegameList[allowEmptySlots? _saveSlots[i] : i];
+ char **listEntry = &_savegameList[allowEmptySlots ? _saveSlots[i] : i];
if (in) {
*listEntry = new char[header.description.size() + 1];
Common::strlcpy(*listEntry, header.description.c_str(), header.description.size() + 1);
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index 0e19d48196..580adb0e5d 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -211,7 +211,7 @@ int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseWh
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;
@@ -425,7 +425,7 @@ void GUI_v2::renewHighlight(Menu &menu) {
int x = item.x + menu.x; int y = item.y + menu.y;
int x2 = x + item.width - 1; int y2 = y + item.height - 1;
redrawText(menu);
- _screen->fillRect(x+2, y+2, x2-2, y2-2, item.bkgdColor);
+ _screen->fillRect(x + 2, y + 2, x2 - 2, y2 - 2, item.bkgdColor);
redrawHighlight(menu);
_screen->updateScreen();
}
@@ -736,10 +736,10 @@ int GUI_v2::deleteMenu(Button *caller) {
break;
// We are only renaming all savefiles until we get some slots missing
// Also not rename quicksave slot filenames
- if (*(i-1) != *i || *i >= 990)
+ if (*(i - 1) != *i || *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);
}
_saveMenu.menuNameId = _vm->gameFlags().isTalkie ? 9 : 17;
@@ -845,7 +845,7 @@ int GUI_v2::getCharWidth(uint8 c) {
}
void GUI_v2::drawTextfieldBlock(int x, int y, uint8 c) {
- _screen->fillRect(x+1, y+1, x+7, y+8, c);
+ _screen->fillRect(x + 1, y + 1, x + 7, y + 8, c);
}
bool GUI_v2::choiceDialog(int name, bool type) {
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index e8cb9b4370..75b568a00a 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -121,7 +121,7 @@ KyraEngine_v2::~KyraEngine_v2() {
delete[] _animObjects;
- for (Common::Array<const Opcode*>::iterator i = _opcodesAnimation.begin(); i != _opcodesAnimation.end(); ++i)
+ for (Common::Array<const Opcode *>::iterator i = _opcodesAnimation.begin(); i != _opcodesAnimation.end(); ++i)
delete *i;
_opcodesAnimation.clear();
@@ -162,8 +162,8 @@ void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) {
}
bool KyraEngine_v2::checkSpecialSceneExit(int num, int x, int y) {
- if (_specialExitTable[0+num] > x || _specialExitTable[5+num] > y ||
- _specialExitTable[10+num] < x || _specialExitTable[15+num] < y)
+ if (_specialExitTable[0 + num] > x || _specialExitTable[5 + num] > y ||
+ _specialExitTable[10 + num] < x || _specialExitTable[15 + num] < y)
return false;
return true;
}
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index e9c61b0761..3bca6b0e3c 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -44,13 +44,13 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
header.flags = 0;
header.thumbnail = 0;
- if (type == MKTAG('K','Y','R','A') || type == MKTAG('A','R','Y','K')) { // old Kyra1 header ID
+ if (type == MKTAG('K', 'Y', 'R', 'A') || type == MKTAG('A', 'R', 'Y', 'K')) { // old Kyra1 header ID
header.gameID = GI_KYRA1;
header.oldHeader = true;
- } else if (type == MKTAG('H','O','F','S')) { // old Kyra2 header ID
+ } else if (type == MKTAG('H', 'O', 'F', 'S')) { // old Kyra2 header ID
header.gameID = GI_KYRA2;
header.oldHeader = true;
- } else if (type == MKTAG('W','W','S','V')) {
+ } else if (type == MKTAG('W', 'W', 'S', 'V')) {
header.gameID = in->readByte();
} else {
// try checking for original save header
@@ -68,12 +68,12 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
type = in->readUint32BE();
header.version = in->readUint16LE();
- if (type == MKTAG('M','B','L','3') && header.version == 100) {
+ if (type == MKTAG('M', 'B', 'L', '3') && header.version == 100) {
saveOk = true;
header.description = descriptionBuffer;
header.gameID = GI_KYRA2;
break;
- } else if (type == MKTAG('M','B','L','4') && header.version == 102) {
+ } else if (type == MKTAG('M', 'B', 'L', '4') && header.version == 102) {
saveOk = true;
header.description = descriptionBuffer;
header.gameID = GI_KYRA3;
@@ -91,7 +91,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
}
header.version = in->readUint32BE();
- if (header.version > CURRENT_SAVE_VERSION || (header.oldHeader && header.version > 8) || (type == MKTAG('A','R','Y','K') && header.version > 3))
+ if (header.version > CURRENT_SAVE_VERSION || (header.oldHeader && header.version > 8) || (type == MKTAG('A', 'R', 'Y', 'K') && header.version > 3))
return kRSHEInvalidVersion;
// Versions prior to 9 are using a fixed length description field
@@ -182,10 +182,10 @@ Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, con
}
// Savegame version
- out->writeUint32BE(MKTAG('W','W','S','V'));
+ out->writeUint32BE(MKTAG('W', 'W', 'S', 'V'));
out->writeByte(_flags.gameID);
out->writeUint32BE(CURRENT_SAVE_VERSION);
- out->write(saveName, strlen(saveName)+1);
+ out->write(saveName, strlen(saveName) + 1);
if (_flags.isTalkie)
out->writeUint32BE(GF_TALKIE);
else if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index 061ce4c21a..9b6897f2ab 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -42,7 +42,7 @@ void KyraEngine_v2::updateSpecialSceneScripts() {
while (_system->getMillis() <= nextTime) {
if (_sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis() &&
- !_specialSceneScriptState[_lastProcessedSceneScript]) {
+ !_specialSceneScriptState[_lastProcessedSceneScript]) {
_specialSceneScriptRunFlag = true;
while (_specialSceneScriptRunFlag && _sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis()) {
@@ -52,7 +52,7 @@ void KyraEngine_v2::updateSpecialSceneScripts() {
}
if (!_emc->isValid(&_sceneSpecialScripts[_lastProcessedSceneScript])) {
- _emc->start(&_sceneSpecialScripts[_lastProcessedSceneScript], _desc.firstAnimSceneScript+_lastProcessedSceneScript);
+ _emc->start(&_sceneSpecialScripts[_lastProcessedSceneScript], _desc.firstAnimSceneScript + _lastProcessedSceneScript);
_specialSceneScriptRunFlag = false;
}
@@ -155,14 +155,14 @@ int KyraEngine_v2::pathfinderInitPositionTable(int *moveTable) {
}
lastEntry = pathfinderAddToPositionTable(lastEntry, newX, newY);
- _pathfinderPositionTable[lastEntry*2+0] = -1;
- _pathfinderPositionTable[lastEntry*2+1] = -1;
+ _pathfinderPositionTable[lastEntry * 2 + 0] = -1;
+ _pathfinderPositionTable[lastEntry * 2 + 1] = -1;
return lastEntry;
}
int KyraEngine_v2::pathfinderAddToPositionTable(int index, int v1, int v2) {
- _pathfinderPositionTable[index<<1] = v1;
- _pathfinderPositionTable[(index<<1)+1] = v2;
+ _pathfinderPositionTable[index << 1] = v1;
+ _pathfinderPositionTable[(index << 1) + 1] = v2;
++index;
if (index >= 199)
--index;
@@ -173,23 +173,23 @@ int KyraEngine_v2::pathfinderInitPositionIndexTable(int tableLen, int x, int y)
int x1 = 0, y1 = 0;
int x2 = 0, y2 = 0;
int lastEntry = 0;
- int index2 = tableLen-1, index1 = 0;
+ int index2 = tableLen - 1, index1 = 0;
while (index2 > index1) {
- x1 = _pathfinderPositionTable[index1*2+0] + x;
- y1 = _pathfinderPositionTable[index1*2+1] + y;
- x2 = _pathfinderPositionTable[index2*2+0] + x;
- y2 = _pathfinderPositionTable[index2*2+1] + y;
+ x1 = _pathfinderPositionTable[index1 * 2 + 0] + x;
+ y1 = _pathfinderPositionTable[index1 * 2 + 1] + y;
+ x2 = _pathfinderPositionTable[index2 * 2 + 0] + x;
+ y2 = _pathfinderPositionTable[index2 * 2 + 1] + y;
if (directLinePassable(x1, y1, x2, y2)) {
lastEntry = pathfinderAddToPositionIndexTable(lastEntry, index2);
- if (tableLen-1 == index2)
+ if (tableLen - 1 == index2)
break;
index1 = index2;
- index2 = tableLen-1;
- } else if (index1+1 == index2) {
+ index2 = tableLen - 1;
+ } else if (index1 + 1 == index2) {
lastEntry = pathfinderAddToPositionIndexTable(lastEntry, index2);
index1 = index2;
- index2 = tableLen-1;
+ index2 = tableLen - 1;
} else {
--index2;
}
@@ -212,14 +212,14 @@ void KyraEngine_v2::pathfinderFinializePath(int *moveTable, int tableLen, int x,
int sizeLeft = moveTableSize;
for (int i = 0; i < tableLen; ++i) {
index2 = _pathfinderPositionIndexTable[i];
- x1 = _pathfinderPositionTable[index1*2+0] + x;
- y1 = _pathfinderPositionTable[index1*2+1] + y;
- x2 = _pathfinderPositionTable[index2*2+0] + x;
- y2 = _pathfinderPositionTable[index2*2+1] + y;
+ x1 = _pathfinderPositionTable[index1 * 2 + 0] + x;
+ y1 = _pathfinderPositionTable[index1 * 2 + 1] + y;
+ x2 = _pathfinderPositionTable[index2 * 2 + 0] + x;
+ y2 = _pathfinderPositionTable[index2 * 2 + 1] + y;
int wayLen = findWay(x1, y1, x2, y2, moveTable, sizeLeft);
moveTable += wayLen;
- sizeLeft -= wayLen; // unlike the original we want to be sure that the size left is correct
+ sizeLeft -= wayLen; // unlike the original we want to be sure that the size left is correct
index1 = index2;
}
}
diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp
index c608c6e683..dde22498eb 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -27,7 +27,7 @@
namespace Kyra {
Screen_v2::Screen_v2(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, const int dimTableSize)
- : Screen(vm, system, dimTable, dimTableSize), _wsaFrameAnimBuffer(0) {
+ : Screen(vm, system, dimTable, dimTableSize), _wsaFrameAnimBuffer(0) {
_wsaFrameAnimBuffer = new uint8[1024];
assert(_wsaFrameAnimBuffer);
}
@@ -187,7 +187,7 @@ uint8 *Screen_v2::getPtrToShape(uint8 *shpFile, int shape) {
int Screen_v2::getShapeScaledWidth(const uint8 *shpFile, int scale) {
if (!shpFile)
return 0;
- int width = READ_LE_UINT16(shpFile+3);
+ int width = READ_LE_UINT16(shpFile + 3);
return (width * scale) >> 8;
}
@@ -201,7 +201,7 @@ int Screen_v2::getShapeScaledHeight(const uint8 *shpFile, int scale) {
uint16 Screen_v2::getShapeSize(const uint8 *shp) {
if (!shp)
return 0;
- return READ_LE_UINT16(shp+6);
+ return READ_LE_UINT16(shp + 6);
}
uint8 *Screen_v2::makeShapeCopy(const uint8 *src, int index) {
@@ -242,7 +242,7 @@ int Screen_v2::getLayer(int x, int y) {
int Screen_v2::getRectSize(int w, int h) {
if (w > 320 || h > 200)
return 0;
- return w*h;
+ return w * h;
}
void Screen_v2::setTextColorMap(const uint8 *cmap) {
@@ -250,7 +250,7 @@ void Screen_v2::setTextColorMap(const uint8 *cmap) {
}
void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2,
- int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim) {
+ int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim) {
if (!(w1 || h1 || w2 || h2))
return;
@@ -281,7 +281,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2,
memcpy(dt, s, w2);
} else if (t > 0) {
if (w1 == 1) {
- memset(dt, *s, w2);
+ memset(dt, *s, w2);
} else {
t = ((((((w2 - w1 + 1) & 0xffff) << 8) / w1) + 0x100) & 0xffff) << 8;
int bp = 0;
@@ -353,7 +353,7 @@ bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, i
h1 = t;
y1 = 0;
}
- t = h0 - y1;
+ t = h0 - y1;
if (t < 1) {
w1 = h1 = -1;
} else {
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index e42cdf9ff4..c38a144537 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -57,7 +57,7 @@ int KyraEngine_v2::o2_setCharacterFacingOverwrite(EMCState *script) {
int KyraEngine_v2::o2_trySceneChange(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script,
- stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+ stackPos(0), stackPos(1), stackPos(2), stackPos(3));
_unkHandleSceneChangeFlag = 1;
int success = inputSceneChange(stackPos(0), stackPos(1), stackPos(2), stackPos(3));
@@ -87,7 +87,7 @@ int KyraEngine_v2::o2_checkForItem(EMCState *script) {
int KyraEngine_v2::o2_defineItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineItem(%p) (%d, %d, %d, %d)", (const void *)script,
- stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+ stackPos(0), stackPos(1), stackPos(2), stackPos(3));
int freeItem = findFreeItem();
if (freeItem >= 0) {
@@ -102,13 +102,13 @@ int KyraEngine_v2::o2_defineItem(EMCState *script) {
int KyraEngine_v2::o2_addSpecialExit(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addSpecialExit(%p) (%d, %d, %d, %d, %d)", (const void *)script,
- stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
+ stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
if (_specialExitCount < 5) {
- _specialExitTable[_specialExitCount+0] = stackPos(0);
- _specialExitTable[_specialExitCount+5] = stackPos(1);
- _specialExitTable[_specialExitCount+10] = stackPos(2) + stackPos(0) - 1;
- _specialExitTable[_specialExitCount+15] = stackPos(3) + stackPos(1) - 1;
- _specialExitTable[_specialExitCount+20] = stackPos(4);
+ _specialExitTable[_specialExitCount + 0] = stackPos(0);
+ _specialExitTable[_specialExitCount + 5] = stackPos(1);
+ _specialExitTable[_specialExitCount + 10] = stackPos(2) + stackPos(0) - 1;
+ _specialExitTable[_specialExitCount + 15] = stackPos(3) + stackPos(1) - 1;
+ _specialExitTable[_specialExitCount + 20] = stackPos(4);
++_specialExitCount;
}
return 0;
@@ -226,7 +226,7 @@ int KyraEngine_v2::o2_defineRoomEntrance(EMCState *script) {
int KyraEngine_v2::o2_runAnimationScript(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_runAnimationScript(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1),
- stackPos(2), stackPos(3));
+ stackPos(2), stackPos(3));
runAnimationScript(stackPosString(0), stackPos(3), stackPos(2) ? 1 : 0, stackPos(1), stackPos(2));
return 0;
@@ -241,7 +241,7 @@ int KyraEngine_v2::o2_setSpecialSceneScriptRunTime(EMCState *script) {
int KyraEngine_v2::o2_defineScene(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineScene(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)",
- (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
+ (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
const int scene = stackPos(0);
strcpy(_sceneList[scene].filename1, stackPosString(1));
strcpy(_sceneList[scene].filename2, stackPosString(1));
@@ -323,7 +323,7 @@ int KyraEngine_v2::o2_getVocHigh(EMCState *script) {
int KyraEngine_v2::o2a_setAnimationShapes(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2a_setAnimationShapes(%p) ('%s', %d, %d, %d, %d, %d)", (const void *)script,
- stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
+ stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
strcpy(_animShapeFilename, stackPosString(0));
_animShapeLastEntry = stackPos(1);
_animShapeWidth = stackPos(2);