aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorFlorian Kagerer2009-04-04 00:19:34 +0000
committerFlorian Kagerer2009-04-04 00:19:34 +0000
commit3d608dda3e63da9159c38d9a41960dea1cc16e24 (patch)
treea77a4b6b4d0bb88b003c596802a5ac9b88a9de6b /engines/kyra
parent121f174d611ba99c5f809696b87bc3cec1f53f31 (diff)
downloadscummvm-rg350-3d608dda3e63da9159c38d9a41960dea1cc16e24.tar.gz
scummvm-rg350-3d608dda3e63da9159c38d9a41960dea1cc16e24.tar.bz2
scummvm-rg350-3d608dda3e63da9159c38d9a41960dea1cc16e24.zip
LOL: - reverted last commit which would break map shape drawing (I have now changed the map shape coordinates to decimal numbers though since some compiler seems to complain about signed hex numbers)
- added support for placing items in wall niches (like that one in the thugs' cave) svn-id: r39823
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/lol.cpp4
-rw-r--r--engines/kyra/lol.h6
-rw-r--r--engines/kyra/scene_lol.cpp36
-rw-r--r--engines/kyra/staticres.cpp10
4 files changed, 36 insertions, 20 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 106feafae1..efa17305e7 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1916,8 +1916,8 @@ uint16 LoLEngine::getClosestPartyMember(int x, int y) {
if (!(_characters[i].flags & 1) || _characters[i].hitPointsCur <= 0)
continue;
- int16 charX = 0;
- int16 charY = 0;
+ uint16 charX = 0;
+ uint16 charY = 0;
calcCoordinatesForSingleCharacter(i, charX, charY);
int d = ABS(x - charX) + ABS(y - charY);
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 2674575ca8..f717ece3bf 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -851,8 +851,8 @@ private:
uint16 calcNewBlockPosition(uint16 curBlock, uint16 direction);
uint16 calcBlockIndex(uint16 x, uint16 y);
void calcCoordinates(uint16 &x, uint16 &y, int block, uint16 xOffs, uint16 yOffs);
- void calcCoordinatesForSingleCharacter(int charNum, int16 &x, int16 &y);
- void calcCoordinatesAddDirectionOffset(int16 &x, int16 &y, int direction);
+ void calcCoordinatesForSingleCharacter(int charNum, uint16 &x, uint16 &y);
+ void calcCoordinatesAddDirectionOffset(uint16 &x, uint16 &y, int direction);
int clickedWallShape(uint16 block, uint16 direction);
int clickedLeverOn(uint16 block, uint16 direction);
@@ -1205,7 +1205,7 @@ private:
uint8 *_mapCursorOverlay;
uint8 _automapTopLeftX;
uint8 _automapTopLeftY;
- static const uint8 _mapCoords[12][4];
+ static const int8 _mapCoords[12][4];
bool _mapUpdateNeeded;
};
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 5674dba761..e591a5cc91 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -662,7 +662,7 @@ void LoLEngine::calcCoordinates(uint16 &x, uint16 &y, int block, uint16 xOffs, u
y = ((block & 0xffe0) << 3) | yOffs;
}
-void LoLEngine::calcCoordinatesForSingleCharacter(int charNum, int16 &x, int16 &y) {
+void LoLEngine::calcCoordinatesForSingleCharacter(int charNum, uint16 &x, uint16 &y) {
static const uint8 xOffsets[] = { 0x80, 0x00, 0x00, 0x40, 0xC0, 0x00, 0x40, 0x80, 0xC0 };
int c = countActiveCharacters();
if (!c)
@@ -679,19 +679,25 @@ void LoLEngine::calcCoordinatesForSingleCharacter(int charNum, int16 &x, int16 &
y |= (_partyPosY & 0xff00);
}
-void LoLEngine::calcCoordinatesAddDirectionOffset(int16 &x, int16 &y, int direction) {
+void LoLEngine::calcCoordinatesAddDirectionOffset(uint16 &x, uint16 &y, int direction) {
if (!direction)
return;
+ int tx = x;
+ int ty = y;
+
if (direction & 1)
- SWAP(x, y);
+ SWAP(tx, ty);
- if (direction == 1)
- y = (y - 256) * -1;
+ if (direction != 1)
+ ty = (ty - 256) * -1;
- if (direction == 3) {
- x = (x - 256) * -1;
+ if (direction != 3) {
+ tx = (tx - 256) * -1;
}
+
+ x = tx;
+ y = ty;
}
bool LoLEngine::checkBlockPassability(uint16 block, uint16 direction) {
@@ -781,6 +787,16 @@ int LoLEngine::clickedDoorSwitch(uint16 block, uint16 direction) {
}
int LoLEngine::clickedNiche(uint16 block, uint16 direction) {
+ uint8 v = _wllShapeMap[_levelBlockProperties[block].walls[direction]];
+ if (!clickedShape(v) || !_itemInHand)
+ return 0;
+
+ uint16 x = 0x80;
+ uint16 y = 0xff;
+ calcCoordinatesAddDirectionOffset(x, y, _currentDirection);
+ calcCoordinates(x, y, block, x, y);
+ setItemPosition(_itemInHand, x, y, 8, 1);
+ setHandItem(0);
return 1;
}
@@ -1878,7 +1894,7 @@ void LoLEngine::drawDecorations(int index) {
}
void LoLEngine::drawBlockEffects(int index, int type) {
- static const int16 yOffs[] = { 0xff, 0xff, 0x80, 0x80 };
+ static const uint16 yOffs[] = { 0xff, 0xff, 0x80, 0x80 };
uint8 flg = _visibleBlocks[index]->flags;
// flags: 0x10 = ice wall, 0x20 = teleporter, 0x40 = blue slime spot, 0x80 = blood spot
if (!(flg & 0xf0))
@@ -1890,8 +1906,8 @@ void LoLEngine::drawBlockEffects(int index, int type) {
if (!((0x10 << type) & flg))
continue;
- int16 x = 0x80;
- int16 y = yOffs[type];
+ uint16 x = 0x80;
+ uint16 y = yOffs[type];
uint16 drawFlag = (type == 3) ? 0x80 : 0x20;
uint8 *ovl = (type == 3) ? _screen->_grayOverlay : 0;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index fc37b2d9cd..87aae17f0e 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -3063,11 +3063,11 @@ const uint8 LoLEngine::_clock2Timers[] = {
0x51, 0x52, 0x08, 0x09, 0x0A
};
-const uint8 LoLEngine::_mapCoords[12][4] = {
- { 0x00, 0x07, 0x00, 0xFB }, { 0xFB, 0x00, 0x06, 0x00 }, { 0x07, 0x05, 0x07, 0x01 },
- { 0x05, 0x06, 0x04, 0x06 }, { 0x00, 0x07, 0x00, 0xFF }, { 0xFD, 0x00, 0x06, 0x00 },
- { 0x06, 0x07, 0x06, 0xFD }, { 0xFD, 0x05, 0x06, 0x05 }, { 0x01, 0x05, 0x01, 0x01 },
- { 0x03, 0x01, 0x03, 0x01 }, { 0xFF, 0x06, 0xFF, 0xF8 }, { 0xF9, 0xFF, 0x05, 0xFF }
+const int8 LoLEngine::_mapCoords[12][4] = {
+ { 0, 7, 0, -5 }, { -5, 0, 6, 0 }, { 7, 5, 7, 1 },
+ { 5, 6, 4, 6 }, { 0, 7, 0, -1 }, { -3, 0, 6, 0 },
+ { 6, 7, 6, -3 }, { -3, 5, 6, 5 }, { 1, 5, 1, 1 },
+ { 3, 1, 3, 1 }, { -1, 6, -1, -8 }, { -7, -1, 5, -1 }
};
const uint8 LoLEngine::_numClock2Timers = ARRAYSIZE(LoLEngine::_clock2Timers);