aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-12-17 11:45:07 -0500
committerPaul Gilbert2017-12-17 11:45:07 -0500
commitf8bc19159be06e0bdfa4cfda9be0eadd29208906 (patch)
tree4842c80c621225448bd1c09f10e00cd30c688da8 /engines
parent9ff4159a7960a71b65625ce48ab710611dae2bf9 (diff)
downloadscummvm-rg350-f8bc19159be06e0bdfa4cfda9be0eadd29208906.tar.gz
scummvm-rg350-f8bc19159be06e0bdfa4cfda9be0eadd29208906.tar.bz2
scummvm-rg350-f8bc19159be06e0bdfa4cfda9be0eadd29208906.zip
XEEN: Correct usage of enlarging scaled drawing
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/interface_scene.cpp10
-rw-r--r--engines/xeen/sprites.cpp8
-rw-r--r--engines/xeen/sprites.h19
3 files changed, 19 insertions, 18 deletions
diff --git a/engines/xeen/interface_scene.cpp b/engines/xeen/interface_scene.cpp
index d495d4626f..35b1ff24e2 100644
--- a/engines/xeen/interface_scene.cpp
+++ b/engines/xeen/interface_scene.cpp
@@ -145,7 +145,7 @@ OutdoorDrawList::OutdoorDrawList() : _sky1(_data[0]), _sky2(_data[1]),
_data[107] = DrawStruct(0, 200, 40, 0, SPRFLAG_HORIZ_FLIPPED | SPRFLAG_SCENE_CLIPPED);
_data[108] = DrawStruct(0, 8, 47);
_data[109] = DrawStruct(0, 169, 47, 0, SPRFLAG_HORIZ_FLIPPED);
- _data[110] = DrawStruct(1, -56, -4, 0x8000, SPRFLAG_4000 | SPRFLAG_SCENE_CLIPPED);
+ _data[110] = DrawStruct(1, -56, -4, SCALE_ENLARGE, SPRFLAG_4000 | SPRFLAG_SCENE_CLIPPED);
_data[111] = DrawStruct(0, -5, 2, 0, SPRFLAG_4000 | SPRFLAG_SCENE_CLIPPED);
_data[112] = DrawStruct(0, -67, 2, 0, SPRFLAG_4000 | SPRFLAG_SCENE_CLIPPED);
_data[113] = DrawStruct(0, 44, 73);
@@ -477,7 +477,7 @@ void InterfaceScene::drawOutdoorsScene() {
ds2._frame = 0;
ds2._scale = combat._monsterScale[idx];
- if (ds2._scale == 0x8000) {
+ if (ds2._scale == SCALE_ENLARGE) {
ds2._x /= 3;
ds2._y = 60;
} else {
@@ -493,7 +493,7 @@ void InterfaceScene::drawOutdoorsScene() {
ds1._frame = combat._elemPow[idx];
ds1._scale = combat._elemScale[idx];
- if (ds1._scale == 0x8000)
+ if (ds1._scale == SCALE_ENLARGE)
ds1._x /= 3;
ds1._flags = SPRFLAG_4000 | SPRFLAG_SCENE_CLIPPED;
ds1._sprites = &_charPowSprites;
@@ -614,7 +614,7 @@ void InterfaceScene::drawIndoorsScene() {
ds1._x = COMBAT_POS_X[idx][posIndex];
ds1._frame = 0;
ds1._scale = combat._monsterScale[idx];
- if (ds1._scale == 0x8000) {
+ if (ds1._scale == SCALE_ENLARGE) {
ds1._x /= 3;
ds1._y = 60;
} else {
@@ -629,7 +629,7 @@ void InterfaceScene::drawIndoorsScene() {
ds2._x = COMBAT_POS_X[idx][posIndex] + COMBAT_OFFSET_X[idx];
ds2._frame = combat._elemPow[idx];
ds2._scale = combat._elemScale[idx];
- if (ds2._scale == 0x8000)
+ if (ds2._scale == SCALE_ENLARGE)
ds2._x /= 3;
ds2._flags = SPRFLAG_4000 | SPRFLAG_SCENE_CLIPPED;
ds2._sprites = &_charPowSprites;
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index 5a217e05d9..dac7949164 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -106,12 +106,12 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
};
static const int PATTERN_STEPS[] = { 0, 1, 1, 1, 2, 2, 3, 3, 0, -1, -1, -1, -2, -2, -3, -3 };
- assert(ABS(scale) < 16);
- uint16 scaleMask = SCALE_TABLE[ABS(scale)];
+ assert((scale & SCALE_MASK) < 16);
+ uint16 scaleMask = SCALE_TABLE[scale & SCALE_MASK];
uint16 scaleMaskX = scaleMask, scaleMaskY = scaleMask;
bool flipped = (flags & SPRFLAG_HORIZ_FLIPPED) != 0;
int xInc = flipped ? -1 : 1;
- bool enlarge = scale < 0;
+ bool enlarge = (scale & SCALE_ENLARGE) != 0;
// Get cell header
Common::MemoryReadStream f(_data, _filesize);
@@ -269,7 +269,7 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
if (bit) {
// Check whether there's a pixel to write, and we're within the allowable bounds. Note that for
- // the SPRFLAG_SCENE_CLIPPED or when scale == 0x8000, we also have an extra horizontal bounds check
+ // the SPRFLAG_SCENE_CLIPPED or when enlarging, we also have an extra horizontal bounds check
if (*lineP != -1 && xp >= bounds.left && xp < bounds.right &&
((!(flags & SPRFLAG_SCENE_CLIPPED) && !enlarge) || (xp >= SCENE_CLIP_LEFT && xp < SCENE_CLIP_RIGHT))) {
drawBounds.left = MIN(drawBounds.left, xp);
diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h
index 1970f35ef8..a370ceea83 100644
--- a/engines/xeen/sprites.h
+++ b/engines/xeen/sprites.h
@@ -35,6 +35,10 @@ namespace Xeen {
class XeenEngine;
class Window;
+enum {
+ SCALE_MASK = 0x7FFF, SCALE_ENLARGE = 0x8000
+};
+
enum SpriteFlags {
SPRFLAG_800 = 0x800, SPRFLAG_SCENE_CLIPPED = 0x2000,
SPRFLAG_4000 = 0x4000, SPRFLAG_HORIZ_FLIPPED = 0x8000,
@@ -110,9 +114,8 @@ public:
* @param frame Frame number
* @param destPos Destination position
* @param flags Flags
- * @param scale Scale: 0=No scale
- * 1..15 -> reduces the sprite: the higher, the smaller it'll be.
- * -1..-15 -> enlarges the sprite
+ * @param scale Scale: 0=No scale, SCALE_ENLARGE=Enlarge it
+ * 1..15 -> reduces the sprite: the higher, the smaller it'll be
*/
void draw(XSurface &dest, int frame, const Common::Point &destPos,
uint flags = 0, int scale = 0);
@@ -123,9 +126,8 @@ public:
* @param frame Frame number
* @param destPos Destination position
* @param flags Flags
- * @param scale Scale: 0=No scale
- * 1..15 -> reduces the sprite: the higher, the smaller it'll be.
- * -1..-15 -> enlarges the sprite
+ * @param scale Scale: 0=No scale, SCALE_ENLARGE=Enlarge it
+ * 1..15 -> reduces the sprite: the higher, the smaller it'll be
*/
void draw(Window &dest, int frame, const Common::Point &destPos,
uint flags = 0, int scale = 0);
@@ -136,9 +138,8 @@ public:
* @param frame Frame number
* @param destPos Destination position
* @param flags Flags
- * @param scale Scale: 0=No scale
- * 1..15 -> reduces the sprite: the higher, the smaller it'll be.
- * -1..-15 -> enlarges the sprite
+ * @param scale Scale: 0=No scale, SCALE_ENLARGE=Enlarge it
+ * 1..15 -> reduces the sprite: the higher, the smaller it'll be
*/
void draw(int windowIndex, int frame, const Common::Point &destPos,
uint flags = 0, int scale = 0);