aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/access/access.cpp2
-rw-r--r--engines/access/access.h1
-rw-r--r--engines/access/asurface.cpp11
-rw-r--r--engines/access/asurface.h4
-rw-r--r--engines/access/bubble_box.cpp124
-rw-r--r--engines/access/bubble_box.h8
-rw-r--r--engines/access/screen.cpp5
-rw-r--r--engines/access/screen.h2
8 files changed, 155 insertions, 2 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 1daba74d5d..944f921444 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -99,6 +99,8 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
ASK[i];
_startAboutItem = _startAboutBox = 0;
_byte26CB5 = 0;
+ BCNT = 0;
+
_vidEnd = false;
}
diff --git a/engines/access/access.h b/engines/access/access.h
index 7882833bd9..0080673d50 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -219,6 +219,7 @@ public:
int BOXDATASTART;
int BOXSELECTY;
byte _byte26CB5;
+ int BCNT;
//
bool _vidEnd;
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index 793e6e9718..1417b0e5f1 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -316,6 +316,17 @@ void ASurface::drawRect() {
Graphics::Surface::fillRect(Common::Rect(_orgX1, _orgY1, _orgX2, _orgY2), _lColor);
}
+void ASurface::drawLine(int x1, int y1, int x2, int y2, int col) {
+ Graphics::Surface::drawLine(x1, y1, x2, y2, col);
+}
+
+void ASurface::drawBox() {
+ Graphics::Surface::drawLine(_orgX1, _orgY1, _orgX2, _orgY1, _lColor);
+ Graphics::Surface::drawLine(_orgX1, _orgY2, _orgX2, _orgY2, _lColor);
+ Graphics::Surface::drawLine(_orgX2, _orgY1, _orgX2, _orgY1, _lColor);
+ Graphics::Surface::drawLine(_orgX2, _orgY2, _orgX2, _orgY2, _lColor);
+}
+
void ASurface::flipHorizontal(ASurface &dest) {
dest.create(this->w, this->h);
for (int y = 0; y < h; ++y) {
diff --git a/engines/access/asurface.h b/engines/access/asurface.h
index 763e3e629e..3b7104c4af 100644
--- a/engines/access/asurface.h
+++ b/engines/access/asurface.h
@@ -95,6 +95,10 @@ public:
virtual void drawRect();
+ virtual void drawLine(int x1, int y1, int x2, int y2, int col);
+
+ virtual void drawBox();
+
virtual void transCopyFrom(ASurface *src, const Common::Point &destPos);
virtual void transCopyFrom(ASurface *src, const Common::Rect &bounds);
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index ec6a3b18a3..8ac3adb393 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -34,6 +34,10 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w
_fieldE = val2;
_fieldF = val3;
_field10 = val4;
+ BOXSTARTX = BOXSTARTY = 0;
+ BICONSTARTX = 0;
+ BOXENDY = 0;
+ BOXPSTARTX = BOXPSTARTY = 0;
}
void BubbleBox::load(Common::SeekableReadStream *stream) {
@@ -280,7 +284,125 @@ void BubbleBox::doBox(int item, int box) {
}
int BubbleBox::doBox_v1(int item, int box, int &type) {
- warning("TODO: dobox_v1");
+ FontManager &fonts = _vm->_fonts;
+
+ _startItem = item;
+ _startBox = box;
+
+ // Save state information
+ _vm->_screen->saveScreen();
+ _vm->_screen->setDisplayScan();
+
+ fonts._charFor._hi = 0xff;
+ fonts._charSet._lo = 1;
+ fonts._charSet._hi = 0;
+
+ _vm->_destIn = _vm->_screen; // TODO: Redundant
+
+ if (_type != TYPE_2) {
+ Common::Rect r = _bounds;
+ r.left -= 2;
+ _vm->_screen->saveBlock(r);
+ }
+
+ // Set the up boundaries and color to use for the box background
+ _vm->_screen->_orgX1 = _bounds.left - 2;
+ _vm->_screen->_orgY1 = _bounds.top;
+ _vm->_screen->_orgX2 = _bounds.right - 2;
+ _vm->_screen->_orgY2 = _bounds.bottom;
+ _vm->_screen->_lColor = 0xFB;
+
+ // Draw a background for the entire area
+ _vm->_screen->drawRect();
+
+ // Draw the inner box;
+ ++_vm->_screen->_orgX1;
+ ++_vm->_screen->_orgY1;
+ --_vm->_screen->_orgX2;
+ --_vm->_screen->_orgY2;
+ _vm->_screen->_lColor = 0xF9;
+
+ // Draw the inner border
+ _vm->_screen->drawBox();
+
+ // Get icons data
+ Resource *iconData = _vm->_files->loadFile("ICONS.LZ");
+ SpriteResource *icons = new SpriteResource(_vm, iconData);
+ delete iconData;
+
+ // Draw upper border
+ _vm->BCNT = (_vm->_screen->_orgX2 - _vm->_screen->_orgX1) >> 4;
+ int oldX = _vm->_screen->_orgX1;
+ for ( ;_vm->BCNT > 0; --_vm->BCNT) {
+ _vm->_screen->plotImage(icons, 16, Common::Point(_vm->_screen->_orgX1, _vm->_screen->_orgY1));
+ _vm->_screen->_orgX1 += 16;
+ }
+
+ _vm->_screen->_orgX1 = oldX;
+ int oldY = _vm->_screen->_orgY2;
+ _vm->_screen->_orgY2 = _vm->_screen->_orgY1 + 8;
+ _vm->_screen->_lColor = 0xF9;
+
+ BOXSTARTY = _vm->_screen->_orgY2 + 1;
+ _vm->_screen->_orgY2 = oldY;
+
+ if (_type != TYPE_2) {
+ oldY = _vm->_screen->_orgY1;
+ --_vm->_screen->_orgY2;
+ _vm->_screen->_orgY2 -= 8;
+ if (_type == TYPE_3)
+ _vm->_screen->_orgY2 -= 8;
+ _vm->_screen->drawRect();
+
+ int tmpX = BICONSTARTX = _vm->_screen->_orgX1;
+ BOXSTARTX = tmpX + 1;
+ int tmpY = BOXENDY = _vm->_screen->_orgY1;
+
+ if (_type == TYPE_3)
+ BOXSTARTY = tmpY - 7;
+ else
+ BOXSTARTY = tmpY + 1;
+
+ if (_type == TYPE_3)
+ warning("TODO: Implement more of TYPE_3");
+
+ _vm->_screen->_orgY1 = oldY;
+ }
+
+ if ((_type == TYPE_0) || (_type == TYPE_3))
+ warning("TODO: Implement more of TYPE_0 or TYPE_3");
+
+ int len = _bubbleDisplStr.size();
+ int ax = _bounds.top >> 3;
+ ax -= len;
+ ax /= 2;
+ int cx = _bounds.left >> 3;
+ BOXPSTARTX = cx;
+ ax += cx << 16;
+
+ cx = _bounds.right >> 3;
+ int bp = _bounds.right - (cx << 3) + 1;
+ if (bp == 8) {
+ ++cx;
+ bp = 0;
+ }
+
+ _rowOff = bp;
+ BOXPSTARTY = cx;
+ ax += cx;
+
+ _vm->_fonts._charFor._lo = -1;
+ _vm->_events->setCursor(CURSOR_ARROW);
+
+ _vm->_fonts._font1.drawString(_vm->_screen, _bubbleDisplStr, _vm->_screen->_printOrg);
+
+ if (_type == TYPE_2) {
+ _vm->_events->showCursor();
+ warning("TODO: pop values");
+ _vm->_screen->restoreScreen();
+ }
+
+ warning("TODO: more dobox_v1");
return -1;
}
diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h
index f2ec3a27ac..36826db36b 100644
--- a/engines/access/bubble_box.h
+++ b/engines/access/bubble_box.h
@@ -36,13 +36,19 @@ namespace Access {
class AccessEngine;
-enum BoxType { TYPE_1 = 1, TYPE_2 = 2, TYPE_4 = 4 };
+enum BoxType { TYPE_0 = 0, TYPE_1 = 1, TYPE_2 = 2, TYPE_3 = 3, TYPE_4 = 4 };
class BubbleBox : public Manager {
private:
int _startItem, _startBox;
int _charCol, _rowOff;
Common::Point _fileStart;
+ int BOXSTARTX;
+ int BOXSTARTY;
+ int BOXENDY;
+ int BICONSTARTX;
+ int BOXPSTARTX;
+ int BOXPSTARTY;
public:
BoxType _type;
Common::Rect _bounds;
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index b7a2d3d1db..2b535b64d0 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -276,6 +276,11 @@ void Screen::drawRect() {
ASurface::drawRect();
}
+void Screen::drawBox() {
+ addDirtyRect(Common::Rect(_orgX1, _orgY1, _orgX2, _orgY2));
+ ASurface::drawBox();
+}
+
void Screen::transCopyFrom(ASurface *src, const Common::Point &destPos) {
addDirtyRect(Common::Rect(destPos.x, destPos.y, destPos.x + src->w, destPos.y + src->h));
ASurface::transCopyFrom(src, destPos);
diff --git a/engines/access/screen.h b/engines/access/screen.h
index a3b55855e7..a5431bcfcb 100644
--- a/engines/access/screen.h
+++ b/engines/access/screen.h
@@ -92,6 +92,8 @@ public:
virtual void drawRect();
+ virtual void drawBox();
+
virtual void transCopyFrom(ASurface *src, const Common::Point &destPos);
virtual void transCopyFrom(ASurface *src, const Common::Rect &bounds);