aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorathrxx2011-09-29 22:51:36 +0200
committerJohannes Schickel2011-12-26 16:18:15 +0100
commit1cbd56693086afa8ce93092c3638e1052e31a5d9 (patch)
tree688d790cc5372ca9d2718ebc46c7a852bd6ac673 /engines/kyra
parentac1aa43ca8b2ad9f2743006a5e40a7967a40fec5 (diff)
downloadscummvm-rg350-1cbd56693086afa8ce93092c3638e1052e31a5d9.tar.gz
scummvm-rg350-1cbd56693086afa8ce93092c3638e1052e31a5d9.tar.bz2
scummvm-rg350-1cbd56693086afa8ce93092c3638e1052e31a5d9.zip
KYRA: (EOB) - fix invalid string access
(also fix several cpp-check warnings)
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/chargen.cpp2
-rw-r--r--engines/kyra/eob1.cpp37
-rw-r--r--engines/kyra/eob1.h3
-rw-r--r--engines/kyra/eob2.cpp6
-rw-r--r--engines/kyra/eob2.h4
-rw-r--r--engines/kyra/eobcommon.cpp58
-rw-r--r--engines/kyra/gui.h2
-rw-r--r--engines/kyra/gui_eob.cpp6
-rw-r--r--engines/kyra/items_eob.cpp16
-rw-r--r--engines/kyra/magic_eob.cpp2
-rw-r--r--engines/kyra/saveload_eob.cpp2
-rw-r--r--engines/kyra/saveload_lol.cpp1
-rw-r--r--engines/kyra/screen.cpp1
-rw-r--r--engines/kyra/screen_eob.cpp10
-rw-r--r--engines/kyra/screen_lol.cpp4
-rw-r--r--engines/kyra/sprites_eob.cpp4
-rw-r--r--engines/kyra/staticres_eob.cpp2
-rw-r--r--engines/kyra/text_eob.cpp5
18 files changed, 108 insertions, 57 deletions
diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp
index 92d1b15ec3..5231093133 100644
--- a/engines/kyra/chargen.cpp
+++ b/engines/kyra/chargen.cpp
@@ -1317,7 +1317,7 @@ void CharacterGenerator::finish() {
}
if (_chargenButtonLabels) {
- for (int i = 0; i < 10; i++)
+ for (int i = 0; i < 17; i++)
delete[] _chargenButtonLabels[i];
delete[] _chargenButtonLabels;
_chargenButtonLabels = 0;
diff --git a/engines/kyra/eob1.cpp b/engines/kyra/eob1.cpp
index d67cda529d..c345b4710a 100644
--- a/engines/kyra/eob1.cpp
+++ b/engines/kyra/eob1.cpp
@@ -31,6 +31,15 @@ namespace Kyra {
EobEngine::EobEngine(OSystem *system, const GameFlags &flags) : EobCoreEngine(system, flags) {
_numSpells = 53;
_menuChoiceInit = 4;
+
+ _turnUndeadString = _introFilesOpening = _introFilesTower = _introFilesOrb = _introFilesWdEntry = _introFilesKing = _introFilesHands = _introFilesWdExit =
+ _introFilesTunnel = _finBonusStrings = _npc11Strings = _npc12Strings = _npc21Strings = _npc22Strings = _npc31Strings = _npc32Strings = _npc4Strings =
+ _npc5Strings = _npc6Strings = _npc7Strings = 0;
+ _introOpeningFrmDelay = _introWdEncodeX = _introWdEncodeY = _introWdEncodeWH = _npcShpData = _npcSubShpIndex1 = _npcSubShpIndex2 = _npcSubShpY = _introWdDsY =
+ _introTvlX1 = _introTvlY1 = _introTvlX2 = _introTvlY2 = _introTvlW = _introTvlH = _dscDoorScaleMult4 = _dscDoorScaleMult5 = _dscDoorScaleMult6 =
+ _dscDoorY3 = _dscDoorY4 = _dscDoorY5 = _dscDoorY6 = _dscDoorY7 = _doorShapeEncodeDefs = _doorSwitchShapeEncodeDefs = _doorSwitchCoords = 0;
+ _introWdDsX = 0;
+ _dscDoorCoordsExt = 0;
}
EobEngine::~EobEngine() {
@@ -558,34 +567,6 @@ void EobEngine::healParty() {
}
}
-uint32 EobEngine::convertSpellFlagToEob2Format(uint32 flag, int ignoreInvisibility) {
- uint32 res = 0;
- if (flag & 0x01)
- res |= 0x20;
- if (flag & 0x02)
- res |= 0x400;
- if (flag & 0x04)
- res |= 0x80;
- if (flag & 0x08)
- res |= 0x40;
- if (ignoreInvisibility)
- res |= 0x100;
- return res;
-}
-
-uint32 EobEngine::convertCharacterEffectFlagToEob2Format(uint32 flag) {
- uint32 res = 0;
- if (flag & 0x02)
- res |= 0x08;
- if (flag & 0x04)
- res |= 0x40;
- if (flag & 0x80)
- res |= 0x2000;
- if (flag & 0x100)
- res |= 0x4000;
- return res;
-}
-
} // End of namespace Kyra
#endif // ENABLE_EOB
diff --git a/engines/kyra/eob1.h b/engines/kyra/eob1.h
index 8811d7d92a..3eade85e6f 100644
--- a/engines/kyra/eob1.h
+++ b/engines/kyra/eob1.h
@@ -149,9 +149,6 @@ private:
bool checkPartyStatusExtra();
int resurrectionSelectDialogue();
void healParty();
-
- uint32 convertSpellFlagToEob2Format(uint32 flag, int ignoreInvisibility);
- uint32 convertCharacterEffectFlagToEob2Format(uint32 flag);
};
diff --git a/engines/kyra/eob2.cpp b/engines/kyra/eob2.cpp
index f309fae2aa..afaef0b43a 100644
--- a/engines/kyra/eob2.cpp
+++ b/engines/kyra/eob2.cpp
@@ -34,6 +34,12 @@ DarkMoonEngine::DarkMoonEngine(OSystem *system, const GameFlags &flags) : EobCor
_dscDoorType5Offs = 0;
_numSpells = 70;
_menuChoiceInit = 4;
+
+ _introStrings = _cpsFilesIntro = _cpsFilesFinale = _finaleStrings = _kheldranStrings = _npc1Strings = _npc2Strings = _hornStrings = 0;
+ _seqIntro = _seqFinale = 0;
+ _shapesIntro = _shapesFinale = 0;
+ _creditsData = _npcShpData = _dscDoorType5Offs = _hornSounds = 0;
+ _dreamSteps = 0;
}
DarkMoonEngine::~DarkMoonEngine() {
diff --git a/engines/kyra/eob2.h b/engines/kyra/eob2.h
index 6da09010b4..8c9b6dd9fa 100644
--- a/engines/kyra/eob2.h
+++ b/engines/kyra/eob2.h
@@ -72,12 +72,12 @@ private:
void seq_playFinale();
void seq_playCredits(DarkmoonSequenceHelper *sq, const uint8 *data, int sd, int backupPage, int tempPage, int speed);
- const char * const*_introStrings;
+ const char * const *_introStrings;
const char * const *_cpsFilesIntro;
const EobSequenceStep **_seqIntro;
const EobShapeDef **_shapesIntro;
- const char * const*_finaleStrings;
+ const char * const *_finaleStrings;
const uint8 *_creditsData;
const char * const *_cpsFilesFinale;
const EobSequenceStep **_seqFinale;
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index 3bc145a398..9e75be017c 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -110,6 +110,7 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_color9 = 17;
_color10 = 23;
_color11 = 20;
+ _color4 = _color5 = _color6 = _color7 = _color8 = _color12 = _color13 = _color14 = 0;
_menuDefs = 0;
@@ -153,6 +154,48 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_rrCount = 0;
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 = _constModLevelIndex = _constModDiv = _constModExt = _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;
+ _wallOfForceDsX = 0;
+ _expObjectAnimTbl1Size = _expObjectAnimTbl2Size = _expObjectAnimTbl3Size = _wllFlagPresetSize = _scriptTimersCount = _buttonList1Size = _buttonList2Size =
+ _buttonList3Size = _buttonList4Size = _buttonList5Size = _buttonList6Size = _buttonList7Size = _buttonList8Size = 0;
+ _inventorySlotsY = _mnDef = 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;
+ _spellAnimBuffer = 0;
+ _sparkEffectDefSteps = _sparkEffectDefSubSteps = _sparkEffectDefShift = _sparkEffectDefAdd = _sparkEffectDefX = _sparkEffectDefY = _sparkEffectOfShift =
+ _sparkEffectOfX = _sparkEffectOfY = _magicFlightObjectProperties = _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;
+ _errorSlotEmptyString = _errorSlotNoNameString = _menuOkString = 0;
+ _spellLevelsMage = _spellLevelsCleric = _numSpellsCleric = _numSpellsWisAdj = _numSpellsPal = _numSpellsMage = 0;
+ _mnNumWord = _numSpells = _mageSpellListSize = _spellLevelsMageSize = _spellLevelsClericSize = 0;
+ _inventorySlotsX = _slotValidationFlags = _encodeMonsterShpTable = 0;
+ memset(_expRequirementTables, 0, sizeof(_expRequirementTables));
+ memset(_constModTables, 0, sizeof(_constModTables));
+ memset(_doorType, 0, sizeof(_doorType));
+ memset(_noDoorSwitch, 0, sizeof(_noDoorSwitch));
+ memset(_scriptTimers, 0, sizeof(_scriptTimers));
+ memset(_monsterBlockPosArray, 0, sizeof(_monsterBlockPosArray));
+ memset(_foundMonstersArray, 0, sizeof(_foundMonstersArray));
}
EobCoreEngine::~EobCoreEngine() {
@@ -251,11 +294,10 @@ Common::Error EobCoreEngine::init() {
//MidiDriverType midiDriver = MidiDriver::detectDevice(MDT_PCSPK | MDT_ADLIB);
_sound = new SoundAdLibPC(this, _mixer);
- _sound->init();
assert(_sound);
+ _sound->init();
- if (_sound)
- _sound->updateVolumeSettings();
+ syncSoundSettings();
_res = new Resource(this);
assert(_res);
@@ -288,8 +330,6 @@ Common::Error EobCoreEngine::init() {
_screen->loadFont(Screen::FID_6_FNT, "FONT6.FNT");
_screen->loadFont(Screen::FID_8_FNT, "FONT8.FNT");
- readSettings();
-
Common::Error err = LolEobBaseEngine::init();
if (err.getCode() != Common::kNoError)
return err;
@@ -365,6 +405,9 @@ Common::Error EobCoreEngine::init() {
memset(_monsterOvl2, 13, 16 * sizeof(uint8));
_monsterOvl1[0] = _monsterOvl2[0] = 0;
+ // Prevent autosave on game startup
+ _lastAutosave = _system->getMillis();
+
return Common::kNoError;
}
@@ -701,7 +744,7 @@ void EobCoreEngine::setHandItem(Item itemIndex) {
const uint8 *shp = _itemIconShapes[icon];
if (icon && (_items[_itemInHand].flags & 0x80) && (_partyEffectFlags & 2)) {
- memcpy(_tempIconShape, shp, 300);
+ memcpy(_tempIconShape, shp, shp[1] * shp[2] * 4 + 20);
if (_flags.gameID == GI_EOB1)
_screen->replaceShapePalette(_tempIconShape, &_itemsOverlay[icon << 4]);
else
@@ -1225,9 +1268,10 @@ void EobCoreEngine::setupDialogueButtons(int presetfirst, int numStr, const char
_dialogueNumButtons = numStr;
_dialogueButtonString[0] = str1;
_dialogueHighlightedButton = 0;
+ const char *tmp = 0;
for (int i = 1; i < numStr; i++) {
- const char *tmp = va_arg(args, const char*);
+ tmp = va_arg(args, const char*);
if (tmp)
_dialogueButtonString[i] = tmp;
else
diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h
index 4991707744..2b32bf38f6 100644
--- a/engines/kyra/gui.h
+++ b/engines/kyra/gui.h
@@ -43,7 +43,7 @@ struct Button {
Button() : nextButton(0), index(0), keyCode(0), keyCode2(0), data0Val1(0), data1Val1(0), data2Val1(0), data3Val1(0), flags(0),
data0ShapePtr(0), data1ShapePtr(0), data2ShapePtr(0), data0Callback(), data1Callback(), data2Callback(),
dimTableIndex(0), x(0), y(0), width(0), height(0), data0Val2(0), data0Val3(0), data1Val2(0), data1Val3(0),
- data2Val2(0), data2Val3(0), data3Val2(0), data3Val3(0), flags2(0), mouseWheel(0), buttonCallback(), arg(0) {}
+ data2Val2(0), data2Val3(0), data3Val2(0), data3Val3(0), flags2(0), mouseWheel(0), buttonCallback(), extButtonDef(0), arg(0) {}
Button *nextButton;
uint16 index;
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index d333528ab2..af97d487cb 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -85,6 +85,7 @@ void LolEobBaseEngine::gui_drawHorizontalBarGraph(int x, int y, int w, int h, in
}
void LolEobBaseEngine::gui_initButtonsFromList(const int16 *list) {
+ return;
while (*list != -1)
gui_initButton(*list++);
}
@@ -1480,7 +1481,7 @@ GUI_Eob::GUI_Eob(EobCoreEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {
GUI_Eob::~GUI_Eob() {
if (_menuStringsPrefsTemp) {
for (int i = 0; i < 4; i++)
- delete _menuStringsPrefsTemp[i];
+ delete[] _menuStringsPrefsTemp[i];
delete[] _menuStringsPrefsTemp;
}
@@ -1600,6 +1601,7 @@ void GUI_Eob::processButton(Button *button) {
}
int GUI_Eob::processButtonList(Kyra::Button *buttonList, uint16 inputFlags, int8 mouseWheel) {
+ return 0;
_progress = 0;
uint16 in = inputFlags & 0xff;
uint16 buttonReleaseFlag = 0;
@@ -3897,7 +3899,7 @@ void GUI_Eob::memorizePrayMenuPrintString(int spellId, int bookPageIndex, int sp
void GUI_Eob::updateOptionsStrings() {
for (int i = 0; i < 4; i++) {
- delete _menuStringsPrefsTemp[i];
+ delete[] _menuStringsPrefsTemp[i];
_menuStringsPrefsTemp[i] = new char[strlen(_vm->_menuStringsPrefs[i]) + 8];
}
diff --git a/engines/kyra/items_eob.cpp b/engines/kyra/items_eob.cpp
index 96b19a9f93..44f3a7ef3d 100644
--- a/engines/kyra/items_eob.cpp
+++ b/engines/kyra/items_eob.cpp
@@ -461,12 +461,18 @@ void EobCoreEngine::drawItemIconShape(int pageNum, Item itemId, int x, int y) {
int icn = _items[itemId].icon;
bool applyBluePal = ((_partyEffectFlags & 2) && (_items[itemId].flags & 0x80)) ? true : false;
+ memcpy(_tempIconShape, _itemIconShapes[icn], _itemIconShapes[icn][1] * _itemIconShapes[icn][2] * 4 + 20);
+
if (applyBluePal) {
- _screen->setFadeTableIndex(3);
- _screen->setShapeFadeMode(1, true);
+ if (_flags.gameID == GI_EOB1) {
+ _screen->replaceShapePalette(_tempIconShape, &_itemsOverlay[icn << 4]);
+ } else {
+ _screen->setFadeTableIndex(3);
+ _screen->setShapeFadeMode(1, true);
+ }
}
- _screen->drawShape(pageNum, _itemIconShapes[icn], x, y, 0);
+ _screen->drawShape(pageNum, _tempIconShape, x, y, 0);
if (applyBluePal) {
_screen->setFadeTableIndex(4);
@@ -491,8 +497,8 @@ void EobCoreEngine::eatItemInHand(int charIndex) {
EobCharacter *c = &_characters[charIndex];
if (!testCharacter(charIndex, 5)) {
_txt->printMessage(_warningStrings[1], -1, c->name);
- } else if (_itemInHand && _items[_itemInHand].type != 31) {
- _txt->printMessage(_warningStrings[3]);
+ } else if (_itemInHand && _items[_itemInHand].type != 31 && !(_flags.gameID == GI_EOB1 && _items[_itemInHand].type == 49)) {
+ _txt->printMessage(_warningStrings[_flags.gameID == GI_EOB1 ? 2 : 3]);
} else if (_items[_itemInHand].value == -1) {
printWarning(_warningStrings[2]);
} else {
diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp
index 9063d512f0..b70058d7ff 100644
--- a/engines/kyra/magic_eob.cpp
+++ b/engines/kyra/magic_eob.cpp
@@ -542,7 +542,7 @@ bool EobCoreEngine::magicObjectDamageHit(EobFlyingObject *fo, int dcTimes, int d
}
} else {
int c = _dscItemPosIndex[(_currentDirection << 2) + (fo->curPos & 3)];
- if ((c > 2) && (testCharacter(5, 1) || testCharacter(6, 1)) && rollDice(1, 2, -1))
+ if ((c > 2) && (testCharacter(4, 1) || testCharacter(5, 1)) && rollDice(1, 2, -1))
c += 2;
if (!fo->item && (_characters[c].effectFlags & 8)) {
diff --git a/engines/kyra/saveload_eob.cpp b/engines/kyra/saveload_eob.cpp
index 07841be1e4..ec89fca5e2 100644
--- a/engines/kyra/saveload_eob.cpp
+++ b/engines/kyra/saveload_eob.cpp
@@ -39,6 +39,7 @@ void LolEobBaseEngine::generateTempData() {
delete[] _lvlTempData[l]->flags;
releaseMonsterTempData(_lvlTempData[l]);
releaseFlyingObjectTempData(_lvlTempData[l]);
+ releaseWallOfForceTempData(_lvlTempData[l]);
delete _lvlTempData[l];
}
@@ -280,6 +281,7 @@ Common::Error EobCoreEngine::loadGameState(int slot) {
delete[] _lvlTempData[i]->flags;
releaseMonsterTempData(_lvlTempData[i]);
releaseFlyingObjectTempData(_lvlTempData[i]);
+ releaseWallOfForceTempData(_lvlTempData[i]);
delete _lvlTempData[i];
}
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index 33097a86a3..e5977dd915 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -187,6 +187,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
delete[] _lvlTempData[i]->flags;
releaseMonsterTempData(_lvlTempData[i]);
releaseFlyingObjectTempData(_lvlTempData[i]);
+ releaseWallOfForceTempData(_lvlTempData[i]);
delete _lvlTempData[i];
}
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index f9a49e7a7b..c0d05dc851 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -51,6 +51,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system)
_currentFont = FID_8_FNT;
_paletteChanged = true;
+ _curDim = 0;
}
Screen::~Screen() {
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index 8562e25480..0b877b7247 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -47,10 +47,18 @@ Screen_Eob::Screen_Eob(EobCoreEngine *vm, OSystem *system) : Screen(vm, system)
_customDimTable = 0;
_dsTempPage = 0;
_curDimIndex = 0;
+ _dsDiv = 0;
+ _dsRem = 0;
+ _dsScaleTmp = 0;
+ _gfxMaxY = 0;
}
Screen_Eob::~Screen_Eob() {
delete[] _fadeData;
+ if (_customDimTable) {
+ for (int i = 0; i < _screenDimTableCount; i++)
+ delete _customDimTable[i];
+ }
delete[] _customDimTable;
delete[] _dsTempPage;
}
@@ -58,7 +66,7 @@ Screen_Eob::~Screen_Eob() {
bool Screen_Eob::init() {
if (Screen::init()) {
_customDimTable = new ScreenDim*[_screenDimTableCount];
- memset(_customDimTable, 0, sizeof(ScreenDim *)* _screenDimTableCount);
+ memset(_customDimTable, 0, sizeof(ScreenDim*) * _screenDimTableCount);
int temp;
_gfxMaxY = _vm->staticres()->loadRawData(kEobBaseExpObjectY, temp);
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index 6d0460e0a1..0f02165ac5 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -42,8 +42,10 @@ Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system),
for (int i = 0; i < 8; i++)
_levelOverlays[i] = new uint8[256];
- _fadeFlag = 2;
+ _screenDimTable = 0;
+ _customDimTable = 0;
_curDimIndex = 0;
+ _fadeFlag = 2;
}
Screen_LoL::~Screen_LoL() {
diff --git a/engines/kyra/sprites_eob.cpp b/engines/kyra/sprites_eob.cpp
index 2dc9405f72..6d8776f3b0 100644
--- a/engines/kyra/sprites_eob.cpp
+++ b/engines/kyra/sprites_eob.cpp
@@ -657,13 +657,13 @@ void EobCoreEngine::drawFlyingObjects(int index) {
flipped = fo->direction == ((_currentDirection + 1) & 3) ? 1 : 0;
} else {
shp = (_flightObjShpMap[shpIx] + dirOffs) < _numThrownItemShapes ? _thrownItemShapes[_flightObjShpMap[shpIx] + dirOffs] : _spellShapes[_flightObjShpMap[shpIx - _numThrownItemShapes] + dirOffs];
- flipped = _flightObjFlipIndex[(fo->direction << 2) + fo->curPos];
+ flipped = _flightObjFlipIndex[(fo->direction << 2) + (fo->curPos & 3)];
}
} else {
rstFade = true;
shp = (fo->objectType < _numThrownItemShapes) ? _thrownItemShapes[fo->objectType] : _spellShapes[fo->objectType - _numThrownItemShapes];
- flipped = _flightObjFlipIndex[(fo->direction << 2) + fo->curPos];
+ flipped = _flightObjFlipIndex[(fo->direction << 2) + (fo->curPos & 3)];
if (fo->flags & 0x40) {
x = _dscShapeCoords[(index * 5 + 4) << 1] + 88;
diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp
index 4ff879c69c..6f7dfc15ef 100644
--- a/engines/kyra/staticres_eob.cpp
+++ b/engines/kyra/staticres_eob.cpp
@@ -1230,7 +1230,7 @@ void EobEngine::initSpells() {
for (int i = 0; i < _numSpells; i++) {
EobSpell *s = &_spells[i];
src += 4;
- s->flags = flagTable[i].typeFlag;/*convertSpellFlagToEob2Format(src[0], src[14]);*/
+ s->flags = flagTable[i].typeFlag;
s->damageFlags = flagTable[i].damageFlag;
s->effectFlags = flagTable[i].effectFlag;
s->sound = src[13];
diff --git a/engines/kyra/text_eob.cpp b/engines/kyra/text_eob.cpp
index e4e9b37379..1c0c7e5d41 100644
--- a/engines/kyra/text_eob.cpp
+++ b/engines/kyra/text_eob.cpp
@@ -287,8 +287,9 @@ void TextDisplayer_Eob::readNextPara() {
d &= 0x7f;
c = d & 7;
d = (d & 0x78) >> 3;
- c = _table1[(d << 3) + c];
- d = _table2[d];
+ uint8 l = d;
+ c = _table1[(l << 3) + c];
+ d = _table2[l];
}
_ctrl[1] = d;