aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFlorian Kagerer2009-01-18 18:20:33 +0000
committerFlorian Kagerer2009-01-18 18:20:33 +0000
commit35c8fd4dadd9243f73034e9855a88e227a6100ad (patch)
tree6be2e0c9c068ad03b8fd4b1a2fb6f1baaf34c4e1 /engines
parent66228f77e9e405402515de984cc6062d60cedb70 (diff)
downloadscummvm-rg350-35c8fd4dadd9243f73034e9855a88e227a6100ad.tar.gz
scummvm-rg350-35c8fd4dadd9243f73034e9855a88e227a6100ad.tar.bz2
scummvm-rg350-35c8fd4dadd9243f73034e9855a88e227a6100ad.zip
LOL: fix some valgrind warnings
svn-id: r35910
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/gui_lol.cpp10
-rw-r--r--engines/kyra/lol.cpp2
-rw-r--r--engines/kyra/lol.h2
-rw-r--r--engines/kyra/resource.h1
-rw-r--r--engines/kyra/scene_lol.cpp4
-rw-r--r--engines/kyra/staticres.cpp4
6 files changed, 10 insertions, 13 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 8497e2f561..6d7acc28e3 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -150,10 +150,12 @@ void LoLEngine::gui_drawCharPortraitWithStats(int charNum) {
_screen->printText(getLangString(0x4254), 39, 1, 152, 0);
int spellLevels = 0;
- for (int i = 0; i < 4; i++) {
- if (_spellProperties[_availableSpells[_selectedSpell]].mpRequired[i] <= _characters[charNum].magicPointsCur &&
- _spellProperties[_availableSpells[_selectedSpell] + 1].unkArr[i] <= _characters[charNum].hitPointsCur)
- spellLevels++;
+ if (_availableSpells[_selectedSpell] != -1) {
+ for (int i = 0; i < 4; i++) {
+ if (_spellProperties[_availableSpells[_selectedSpell]].mpRequired[i] <= _characters[charNum].magicPointsCur &&
+ _spellProperties[_availableSpells[_selectedSpell] + 1].unkArr[i] <= _characters[charNum].hitPointsCur)
+ spellLevels++;
+ }
}
if (_characters[charNum].flags & 0x10) {
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 23a3307142..0217be6d3f 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -137,7 +137,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
_dscDoorShpIndex = 0;
_dscDim1 = 0;
_dscDim2 = 0;
- _dscBlockMap = _dscDoor1 = _dscDoor2 = _dscShapeOvlIndex = 0;
+ _dscBlockMap = _dscDoor1 = _dscShapeOvlIndex = 0;
_dscBlockIndex = 0;
_dscDimMap = 0;
_dscDoorX = _dscDoorY = 0;
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 194d24ddf8..764363874b 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -575,8 +575,6 @@ private:
int _dscBlockMapSize;
const uint8 *_dscDimMap;
int _dscDimMapSize;
- const uint8 *_dscDoor2;
- int _dscDoor2Size;
const uint16 *_dscDoorScaleTable;
int _dscDoorScaleTableSize;
const uint16 *_dscDoor4;
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index 1f865e855f..b79a949e3f 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -237,7 +237,6 @@ enum kKyraResources {
lolDscBlockMap,
lolDscDimMap,
lolDscDoor1,
- lolDscDoor2,
lolDscDoorScale,
lolDscDoor4,
lolDscDoorX,
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 0fa984b522..9a13073060 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -1209,7 +1209,7 @@ void LoLEngine::drawDecorations(int index) {
uint16 scaleH = _dscShapeScaleH[s];
int8 ix = _dscShapeIndex[s];
uint8 shpIx = ABS(ix);
- uint8 ovlIndex = _dscShapeOvlIndex[_dscDimMap[index] * 5] + 2;
+ uint8 ovlIndex = _dscShapeOvlIndex[4 + _dscDimMap[index] * 5] + 2;
if (ovlIndex > 7)
ovlIndex = 7;
@@ -1290,7 +1290,7 @@ void LoLEngine::drawIceShapes(int index, int iceShapeIndex) {
void LoLEngine::drawDoor(uint8 *shape, uint8 *table, int index, int unk2, int w, int h, int flags) {
uint8 c = _dscDoor1[(_unkPara2 << 5) + unk2];
int r = (c / 5) + 5 * _dscDimMap[index];
- uint16 d = _dscDoor2[r];
+ uint16 d = _dscShapeOvlIndex[r];
uint16 t = (index << 5) + c;
_shpDoorY = _dscDoorY[t] + 120;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 8882bed10c..45af54caea 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -43,7 +43,7 @@
namespace Kyra {
-#define RESFILE_VERSION 33
+#define RESFILE_VERSION 34
namespace {
bool checkKyraDat(Common::SeekableReadStream *file) {
@@ -394,7 +394,6 @@ bool StaticResource::init() {
{ lolDscBlockMap, kRawData, "DSCBLOCK1.DEF" },
{ lolDscDimMap, kRawData, "DSCDIM.DEF" },
{ lolDscDoorScale, lolRawDataBe16, "DSCDOOR3.DEF" },
- { lolDscDoor2, kRawData, "DSCDOOR2.DEF" },
{ lolDscDoor4, lolRawDataBe16, "DSCDOOR4.DEF" },
{ lolDscOvlIndex, kRawData, "DSCBLOCK2.DEF" },
{ lolDscBlockIndex, kRawData, "DSCBLOCKX.DEF" },
@@ -1652,7 +1651,6 @@ void LoLEngine::initStaticResource() {
_dscBlockMap = _staticres->loadRawData(lolDscBlockMap, _dscBlockMapSize);
_dscDimMap = _staticres->loadRawData(lolDscDimMap, _dscDimMapSize);
_dscDoorScaleTable = (const uint16 *)_staticres->loadRawDataBe16(lolDscDoorScale, _dscDoorScaleTableSize);
- _dscDoor2 = _staticres->loadRawData(lolDscDoor2, _dscDoor2Size);
_dscShapeOvlIndex = _staticres->loadRawData(lolDscOvlIndex, _dscShapeOvlIndexSize);
_dscDoor4 = (const uint16 *)_staticres->loadRawDataBe16(lolDscDoor4, _dscDoor4Size);
_dscBlockIndex = (const int8 *)_staticres->loadRawData(lolDscBlockIndex, _dscBlockIndexSize);