aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/avalanche/graphics.cpp3
-rw-r--r--engines/avalanche/graphics.h5
-rw-r--r--engines/avalanche/lucerna2.cpp37
-rw-r--r--engines/avalanche/trip6.cpp11
4 files changed, 50 insertions, 6 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 0574705044..737147b734 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -58,10 +58,13 @@ void Graphics::init() {
g_system->getPaletteManager()->setPalette(_egaPalette[_egaPaletteIndex[i]], i, 1);
_surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8());
+
+ _magics.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8());
}
Graphics::~Graphics() {
_surface.free();
+ _magics.free();
_background.free();
}
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index d0adb17767..074031f55d 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -59,6 +59,11 @@ public:
::Graphics::Surface _background;
+ ::Graphics::Surface _magics;
+ // Lucerna::draw_also_lines() draws the "magical" lines here.
+ // Further information: https://github.com/urukgit/avalot/wiki/Also
+
+
Graphics(AvalancheEngine *vm);
diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp
index 3c3ad35d32..fa1e3db908 100644
--- a/engines/avalanche/lucerna2.cpp
+++ b/engines/avalanche/lucerna2.cpp
@@ -44,6 +44,7 @@
#include "avalanche/acci2.h"
#include "avalanche/roomnums.h"
+#include "common/rect.h"
#include "common/system.h"
#include "graphics/palette.h"
@@ -83,7 +84,41 @@ void Lucerna::draw_also_lines() {
byte ff;
byte squeaky_code;
- warning("STUB: Lucerna::draw_also_lines()");
+ switch (_vm->_gyro->visible) {
+ case _vm->_gyro->m_virtual: {
+ squeaky_code = 1;
+ _vm->_gyro->off_virtual();
+ }
+ break;
+ case _vm->_gyro->m_no:
+ squeaky_code = 2;
+ break;
+ case _vm->_gyro->m_yes: {
+ squeaky_code = 3;
+ _vm->_gyro->off();
+ }
+ break;
+ }
+
+ _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0);
+ _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 639, 160), 15);
+
+ for (ff = 0; ff < 50; ff++) {
+ if (_vm->_gyro->lines[ff].x1 != 32767 /*maxint*/) {
+ _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col);
+ }
+ }
+
+ switch (squeaky_code) {
+ case 1 :
+ _vm->_gyro->on_virtual();
+ break;
+ case 2 :
+ break; // Zzz... it was off anyway.
+ case 3 :
+ _vm->_gyro->on();
+ break;
+ }
}
diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp
index 47f60751a1..2c73bf112d 100644
--- a/engines/avalanche/trip6.cpp
+++ b/engines/avalanche/trip6.cpp
@@ -216,7 +216,8 @@ void triptype::walk() {
return;
}
- tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl);
+ tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl) - 1;
+ // -1 is becouse the modified array indexes of magics[] compared to Pascal .
if ((tc != 0) & (!_tr->_vm->_gyro->doing_sprite_run)) {
switch (_tr->_vm->_gyro->magics[tc].op) {
@@ -498,15 +499,15 @@ byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) {
x2 = 639;
if (oy < y)
for (fv = x1; fv <= x2; fv ++)
- for (ff = oy + yl; ff <= y + yl; ff ++) {
- c = *_vm->_graphics->getPixel(fv, ff);
+ for (ff = oy + yl; ff <= y + yl; ff++) {
+ c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff);
if (c > a)
a = c;
}
else
for (fv = x1; fv <= x2; fv ++)
- for (ff = y + yl; ff <= oy + yl; ff ++) {
- c = *_vm->_graphics->getPixel(fv, ff);
+ for (ff = y + yl; ff <= oy + yl; ff++) {
+ c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff);
if (c > a)
a = c;
}