aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/gfxbase.cpp7
-rw-r--r--engines/parallaction/graphics.cpp20
-rw-r--r--engines/parallaction/graphics.h4
-rw-r--r--engines/parallaction/input.cpp6
-rw-r--r--engines/parallaction/inventory.cpp4
5 files changed, 27 insertions, 14 deletions
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
index 5ed5c7a109..d24bfa9cfe 100644
--- a/engines/parallaction/gfxbase.cpp
+++ b/engines/parallaction/gfxbase.cpp
@@ -174,7 +174,12 @@ void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf, bool scene) {
byte *data;
obj->getRect(obj->frame, rect);
- rect.translate(obj->x, obj->y);
+
+ int x = obj->x;
+ if (_overlayMode) {
+ x += _scrollPos;
+ }
+ rect.translate(x, obj->y);
data = obj->getData(obj->frame);
if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 74a936bb77..c72c0b7851 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -393,7 +393,6 @@ void Gfx::beginFrame() {
}
_varAnimRenderMode = getRenderMode("anim_render_mode");
- _varMiscRenderMode = getRenderMode("misc_render_mode");
}
int32 Gfx::getRenderMode(const char *type) {
@@ -410,6 +409,9 @@ int32 Gfx::getRenderMode(const char *type) {
void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
if (_doubleBuffering) {
+ if (_overlayMode)
+ x += _scrollPos;
+
byte *dst = (byte*)_backBuffer.getBasePtr(x, y);
for (int i = 0; i < h; i++) {
memcpy(dst, buf, w);
@@ -465,6 +467,10 @@ void Gfx::setScrollPos(int scrollX) {
void Gfx::updateScreen() {
+ // the scene is calculated in game coordinates, so no translation
+ // is needed
+ _overlayMode = false;
+
if (!_skipBackground) {
// background may not cover the whole screen, so adjust bulk update size
uint w = _backgroundInfo->width;
@@ -527,8 +533,9 @@ void Gfx::updateScreen() {
unlockScreen();
- _varRenderMode = _varMiscRenderMode;
-
+ // the following items are handled in screen coordinates, so they need translation before
+ // being drawn
+ _overlayMode = true;
drawInventory();
drawItems();
drawBalloons();
@@ -660,7 +667,7 @@ void Gfx::updateFloatingLabel() {
FloatingLabelTraits traits_NS = {
Common::Point(16 - r.width()/2, 34),
Common::Point(8 - r.width()/2, 21),
- 0, 0, _backgroundInfo->width - r.width(), 190
+ 0, 0, _vm->_screenWidth - r.width(), 190
};
traits = &traits_NS;
} else {
@@ -668,13 +675,13 @@ void Gfx::updateFloatingLabel() {
FloatingLabelTraits traits_BR = {
Common::Point(34 - r.width()/2, 70),
Common::Point(16 - r.width()/2, 37),
- 0, 0, _backgroundInfo->width - r.width(), 390
+ 0, 0, _vm->_screenWidth - r.width(), 390
};
traits = &traits_BR;
}
Common::Point cursor;
- _vm->_input->getAbsoluteCursorPos(cursor);
+ _vm->_input->getCursorPos(cursor);
Common::Point offset = (_vm->_input->_activeItem._id) ? traits->_offsetWithItem : traits->_offsetWithoutItem;
_labels[_floatingLabel]->x = CLIP(cursor.x + offset.x, traits->_minX, traits->_maxX);
@@ -816,7 +823,6 @@ Gfx::Gfx(Parallaction* vm) :
_varBackgroundMode = 1;
registerVar("anim_render_mode", 1);
- registerVar("misc_render_mode", 1);
registerVar("draw_path_zones", 0);
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 662bfc6b59..9b2cfdf479 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -573,7 +573,6 @@ protected:
// frame data stored in programmable variables
int32 _varBackgroundMode; // 1 = normal, 2 = only mask
int32 _varAnimRenderMode; // 1 = normal, 2 = flat
- int32 _varMiscRenderMode; // 1 = normal, 2 = flat
int32 _varRenderMode;
int32 _varDrawPathZones; // 0 = don't draw, 1 = draw
Graphics::Surface _bitmapMask;
@@ -591,6 +590,9 @@ protected:
int _scrollPos;
int _minScroll, _maxScroll;
+ // overlay mode enables drawing of graphics with automatic screen-to-game coordinate translation
+ bool _overlayMode;
+
public:
struct Item {
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index 8690c4b433..fca1ea790b 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -325,7 +325,7 @@ bool Input::translateGameInput() {
void Input::enterInventoryMode() {
Common::Point mousePos;
- getAbsoluteCursorPos(mousePos);
+ getCursorPos(mousePos);
bool hitCharacter = _vm->hitZone(kZoneYou, mousePos.x, mousePos.y);
if (hitCharacter) {
@@ -349,7 +349,7 @@ void Input::enterInventoryMode() {
void Input::exitInventoryMode() {
// right up hides inventory
Common::Point mousePos;
- getAbsoluteCursorPos(mousePos);
+ getCursorPos(mousePos);
int pos = _vm->getHoverInventoryItem(mousePos.x, mousePos.y);
_vm->highlightInventoryItem(-1); // disable
@@ -390,7 +390,7 @@ bool Input::updateInventoryInput() {
}
Common::Point mousePos;
- getAbsoluteCursorPos(mousePos);
+ getCursorPos(mousePos);
int16 _si = _vm->getHoverInventoryItem(mousePos.x, mousePos.y);
if (_si != _transCurrentHoverItem) {
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index e1ba5bce34..7b92974205 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -180,9 +180,9 @@ void InventoryRenderer::showInventory() {
uint16 lines = getNumLines();
Common::Point p;
- _vm->_input->getAbsoluteCursorPos(p);
+ _vm->_input->getCursorPos(p);
- _pos.x = CLIP((int)(p.x - (_props->_width / 2)), 0, (int)(_vm->_gfx->_backgroundInfo->width - _props->_width));
+ _pos.x = CLIP((int)(p.x - (_props->_width / 2)), 0, (int)(_vm->_screenWidth - _props->_width));
_pos.y = CLIP((int)(p.y - 2 - (lines * _props->_itemHeight)), 0, (int)(_vm->_screenHeight - lines * _props->_itemHeight));
refresh();