aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorathrxx2012-02-15 18:11:18 +0100
committerathrxx2012-02-21 21:48:42 +0100
commita4223e9c2ba7d53097df95a3f640ffdba7d0fb20 (patch)
tree64c69966b4be6bdd7d798c102331babe76464164 /engines/kyra
parent151d314912b08d7d598a3995524d89c8b4ab0371 (diff)
downloadscummvm-rg350-a4223e9c2ba7d53097df95a3f640ffdba7d0fb20.tar.gz
scummvm-rg350-a4223e9c2ba7d53097df95a3f640ffdba7d0fb20.tar.bz2
scummvm-rg350-a4223e9c2ba7d53097df95a3f640ffdba7d0fb20.zip
KYRA: (EOB) - fix EOB1 door clipping
(this was done in the same way as in EOB2 and LOL, but it has to be slightly different)
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/eob.cpp2
-rw-r--r--engines/kyra/kyra_rpg.cpp4
-rw-r--r--engines/kyra/kyra_rpg.h6
-rw-r--r--engines/kyra/resource.h4
-rw-r--r--engines/kyra/scene_lol.cpp2
-rw-r--r--engines/kyra/scene_rpg.cpp21
-rw-r--r--engines/kyra/sprites_eob.cpp2
-rw-r--r--engines/kyra/staticres.cpp2
-rw-r--r--engines/kyra/staticres_rpg.cpp4
9 files changed, 33 insertions, 14 deletions
diff --git a/engines/kyra/eob.cpp b/engines/kyra/eob.cpp
index 769e77e63c..9e58affded 100644
--- a/engines/kyra/eob.cpp
+++ b/engines/kyra/eob.cpp
@@ -421,7 +421,7 @@ void EoBEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wal
d1 = x - (_doorShapes[shapeIndex + 3][2] << 2);
x -= (shp[2] << 2);
drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], d1, y, 5);
- scaleLevelShapesDim(index, y1, y2, 5);
+ setDoorShapeDim(index, y1, y2, 5);
y = _dscDoorY3[mDim] - ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult1[mDim] : _dscDoorScaleMult2[mDim]);
drawBlockObject(0, 2, shp, x, y, 5);
if (_wllShapeMap[wall] == -1)
diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index a885eb9e2d..1e3890b124 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -94,6 +94,10 @@ KyraRpgEngine::KyraRpgEngine(OSystem *system, const GameFlags &flags) : KyraEngi
_dscDimMap = 0;
_dscDoorShpIndex = 0;
_dscDoorY2 = 0;
+ _dscDoorFrameY1 = 0;
+ _dscDoorFrameY2 = 0;
+ _dscDoorFrameIndex1 = 0;
+ _dscDoorFrameIndex2 = 0;
_shpDmX1 = _shpDmX2 = 0;
diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h
index aec34fc3c9..f4678e302a 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -183,7 +183,7 @@ protected:
virtual const uint8 *getBlockFileData(int levelIndex) = 0;
void setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim);
- void scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim);
+ void setDoorShapeDim(int index, int16 &y1, int16 &y2, int dim);
void drawLevelModifyScreenDim(int dim, int16 x1, int16 y1, int16 x2, int16 y2);
void generateBlockDrawingBuffer();
void generateVmpTileData(int16 startBlockX, uint8 startBlockY, uint8 wllVmpIndex, int16 vmpOffset, uint8 numBlocksX, uint8 numBlocksY);
@@ -271,6 +271,10 @@ protected:
const uint8 *_dscDoorShpIndex;
int _dscDoorShpIndexSize;
const uint8 *_dscDoorY2;
+ const uint8 *_dscDoorFrameY1;
+ const uint8 *_dscDoorFrameY2;
+ const uint8 *_dscDoorFrameIndex1;
+ const uint8 *_dscDoorFrameIndex2;
// Script
virtual void runLevelScript(int block, int flags) = 0;
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index 84592880e1..f2bc4e8146 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -263,6 +263,10 @@ enum KyraResources {
kRpgCommonDscBlockMap,
kRpgCommonDscDimMap,
kRpgCommonDscDoorY2,
+ kRpgCommonDscDoorFrameY1,
+ kRpgCommonDscDoorFrameY2,
+ kRpgCommonDscDoorFrameIndex1,
+ kRpgCommonDscDoorFrameIndex2,
kRpgCommonDscBlockIndex,
kEoBBaseChargenStrings1,
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 79884718d7..628654f127 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -1436,7 +1436,7 @@ void LoLEngine::drawSceneShapes(int) {
if (v > 80)
v = 80;
- scaleLevelShapesDim(t, dimY1, dimY2, _sceneShpDim);
+ setDoorShapeDim(t, dimY1, dimY2, _sceneShpDim);
drawDoor(_doorShapes[(s < 23 ? _dscDoorShpIndex[s] : 0)], 0, t, 10, 0, -v, 2);
setLevelShapesDim(t, dimY1, dimY2, _sceneShpDim);
}
diff --git a/engines/kyra/scene_rpg.cpp b/engines/kyra/scene_rpg.cpp
index 269a5d3461..7f6b16bfc6 100644
--- a/engines/kyra/scene_rpg.cpp
+++ b/engines/kyra/scene_rpg.cpp
@@ -51,7 +51,7 @@ void KyraRpgEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim)
if (t > x1) {
x1 = t;
if (!(a & 0x10))
- scaleLevelShapesDim(index, y1, y2, -1);
+ setDoorShapeDim(index, y1, y2, -1);
}
t = _dscDim2[((m + i) << 1) + 1];
@@ -59,7 +59,7 @@ void KyraRpgEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim)
if (t < x2) {
x2 = t;
if (!(a & 0x10))
- scaleLevelShapesDim(index, y1, y2, -1);
+ setDoorShapeDim(index, y1, y2, -1);
}
} else {
int t = _dscDim1[m + i];
@@ -100,17 +100,20 @@ void KyraRpgEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim)
drawLevelModifyScreenDim(dim, x1, 0, x2, 15);
}
-void KyraRpgEngine::scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim) {
- static const int8 dscY1[] = { 0x1E, 0x18, 0x10, 0x00 };
- static const int8 dscY2[] = { 0x3B, 0x47, 0x56, 0x78 };
-
+void KyraRpgEngine::setDoorShapeDim(int index, int16 &y1, int16 &y2, int dim) {
uint8 a = _dscDimMap[index];
- if (dim == -1 && a != 3)
+ if (_flags.gameID != GI_EOB1 && dim == -1 && a != 3)
a++;
- y1 = dscY1[a];
- y2 = dscY2[a];
+ uint8 b = a;
+ if (_flags.gameID == GI_EOB1) {
+ a += _dscDoorFrameIndex1[_currentLevel - 1];
+ b += _dscDoorFrameIndex2[_currentLevel - 1];
+ }
+
+ y1 = _dscDoorFrameY1[a];
+ y2 = _dscDoorFrameY2[b];
if (dim == -1)
return;
diff --git a/engines/kyra/sprites_eob.cpp b/engines/kyra/sprites_eob.cpp
index 40fc7c14e9..068647aeec 100644
--- a/engines/kyra/sprites_eob.cpp
+++ b/engines/kyra/sprites_eob.cpp
@@ -462,7 +462,7 @@ void EoBCoreEngine::drawDoor(int index) {
int16 y1 = 0;
int16 y2 = 0;
- scaleLevelShapesDim(index, y1, y2, 5);
+ setDoorShapeDim(index, y1, y2, 5);
drawDoorIntern(type, index, x, y, w, s, d, y1, y2);
drawLevelModifyScreenDim(5, _shpDmX1, 0, _shpDmX2, 15);
}
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 2be25ce093..423b827092 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -38,7 +38,7 @@
namespace Kyra {
-#define RESFILE_VERSION 81
+#define RESFILE_VERSION 82
namespace {
bool checkKyraDat(Common::SeekableReadStream *file) {
diff --git a/engines/kyra/staticres_rpg.cpp b/engines/kyra/staticres_rpg.cpp
index cc75ae3442..a30cbf7d05 100644
--- a/engines/kyra/staticres_rpg.cpp
+++ b/engines/kyra/staticres_rpg.cpp
@@ -88,6 +88,10 @@ void KyraRpgEngine::initStaticResource() {
_dscDimMap = _staticres->loadRawData(kRpgCommonDscDimMap, temp);
_dscDoorShpIndex = _staticres->loadRawData(kRpgCommonDscDoorShapeIndex, _dscDoorShpIndexSize);
_dscDoorY2 = _staticres->loadRawData(kRpgCommonDscDoorY2, temp);
+ _dscDoorFrameY1 = _staticres->loadRawData(kRpgCommonDscDoorFrameY1, temp);
+ _dscDoorFrameY2 = _staticres->loadRawData(kRpgCommonDscDoorFrameY2, temp);
+ _dscDoorFrameIndex1 = _staticres->loadRawData(kRpgCommonDscDoorFrameIndex1, temp);
+ _dscDoorFrameIndex2 = _staticres->loadRawData(kRpgCommonDscDoorFrameIndex2, temp);
_moreStrings = _staticres->loadStrings(kRpgCommonMoreStrings, temp);
}