diff options
author | Paul Gilbert | 2014-08-16 20:26:17 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-16 20:26:17 -0400 |
commit | 8d6c8ed452bc60a963774ea7a26ff92472752d63 (patch) | |
tree | 478cd959643b4ba728089cf6346f9d9130b76177 | |
parent | a42e52fb5baa2d9ed9e2d726cfdf0365acd15472 (diff) | |
download | scummvm-rg350-8d6c8ed452bc60a963774ea7a26ff92472752d63.tar.gz scummvm-rg350-8d6c8ed452bc60a963774ea7a26ff92472752d63.tar.bz2 scummvm-rg350-8d6c8ed452bc60a963774ea7a26ff92472752d63.zip |
ACCESS: Beginnings of code for text bubble drawing
-rw-r--r-- | engines/access/access.h | 1 | ||||
-rw-r--r-- | engines/access/asurface.cpp | 21 | ||||
-rw-r--r-- | engines/access/asurface.h | 12 | ||||
-rw-r--r-- | engines/access/data.h | 13 | ||||
-rw-r--r-- | engines/access/events.cpp | 3 | ||||
-rw-r--r-- | engines/access/events.h | 2 | ||||
-rw-r--r-- | engines/access/room.cpp | 54 | ||||
-rw-r--r-- | engines/access/room.h | 24 | ||||
-rw-r--r-- | engines/access/scripts.cpp | 27 | ||||
-rw-r--r-- | engines/access/scripts.h | 2 |
10 files changed, 154 insertions, 5 deletions
diff --git a/engines/access/access.h b/engines/access/access.h index 32be053089..511cce835c 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -125,6 +125,7 @@ public: int _establishGroup; int _numAnimTimers; TimerList _timers; + Font _font; Common::Array<Common::Rect> _newRects; Common::Array<Common::Rect> _oldRects; Common::Array<ExtraCell> _extraCells; diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index 4abd1aab26..32e54036ad 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -127,6 +127,7 @@ void ASurface::init() { ASurface::~ASurface() { free(); + _savedBlock.free(); } void ASurface::clearBuffer() { @@ -309,4 +310,24 @@ void ASurface::copyBlock(ASurface *src, const Common::Rect &bounds) { copyRectToSurface(*src, bounds.left, bounds.top, bounds); } +void ASurface::saveBlock(const Common::Rect &bounds) { + _savedBounds = bounds; + _savedBounds.clip(Common::Rect(0, 0, this->w, this->h)); + + _savedBlock.free(); + _savedBlock.create(bounds.width(), bounds.height(), + Graphics::PixelFormat::createFormatCLUT8()); + _savedBlock.copyRectToSurface(*this, 0, 0, _savedBounds); +} + +void ASurface::restoreBlock() { + if (!_savedBounds.isEmpty()) { + copyRectToSurface(_savedBlock, _savedBounds.left, _savedBounds.top, + Common::Rect(0, 0, _savedBlock.w, _savedBlock.h)); + + _savedBlock.free(); + _savedBounds = Common::Rect(0, 0, 0, 0); + } +} + } // End of namespace Access diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 365852dadf..1efee28494 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -36,6 +36,9 @@ class SpriteResource; class SpriteFrame; class ASurface : public Graphics::Surface { +private: + Graphics::Surface _savedBlock; + Common::Rect _savedBounds; public: static int _leftSkip, _rightSkip; static int _topSkip, _bottomSkip; @@ -46,7 +49,8 @@ public: static void init(); public: - virtual void plotFrame(SpriteFrame *frame, const Common::Point &pt); + Common::Point _printOrg; + Common::Point _printStart; public: virtual ~ASurface(); @@ -69,6 +73,12 @@ public: void copyTo(ASurface *dest, const Common::Point &destPos); void copyTo(ASurface *dest, const Common::Rect &bounds); + + void saveBlock(const Common::Rect &bounds); + + void restoreBlock(); + + virtual void plotFrame(SpriteFrame *frame, const Common::Point &pt); }; class SpriteFrame : public ASurface { diff --git a/engines/access/data.h b/engines/access/data.h index 67b9cfe9fd..93184563c4 100644 --- a/engines/access/data.h +++ b/engines/access/data.h @@ -78,6 +78,19 @@ public: int _vidSTable1; }; +struct FontVal { +public: + int _lo, _hi; + + FontVal() { _lo = _hi = 0; } +}; + +class Font { +public: + FontVal _charSet; + FontVal _charFor; +}; + } // End of namespace Access #endif /* ACCESS_DATA_H */ diff --git a/engines/access/events.cpp b/engines/access/events.cpp index 765d57cf35..521e8895c8 100644 --- a/engines/access/events.cpp +++ b/engines/access/events.cpp @@ -204,5 +204,8 @@ void EventsManager::debounceLeft() { } } +void EventsManager::waitKeyMouse() { + error("TODO: waitKeyPress"); +} } // End of namespace Access diff --git a/engines/access/events.h b/engines/access/events.h index b442b1507b..dc89829312 100644 --- a/engines/access/events.h +++ b/engines/access/events.h @@ -104,6 +104,8 @@ public: void delay(int time); void debounceLeft(); + + void waitKeyMouse(); }; } // End of namespace Access diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 4da207b290..9969f336fd 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -584,6 +584,34 @@ int Room::validateBox(int boxId) { return _vm->_scripts->executeScript(); } +void Room::placeBubble() { + _bubbleBox._maxChars = 27; + placeBubble1(); +} + +void Room::placeBubble1() { + _bubbleBox.clearBubbles(); + _vm->_font._charSet._lo = 1; + _vm->_font._charSet._hi = 8; + _vm->_font._charFor._lo = 29; + _vm->_font._charFor._hi = 32; + + calcBubble(); + + Common::Rect r = _bubbleBox._bubbles[0]; + r.translate(-2, 0); + _vm->_screen->saveBlock(r); + printBubble(); +} + +void Room::calcBubble() { + error("TODO: calcBubble"); +} + +void Room::printBubble() { + error("TODO: printBubble"); +} + /*------------------------------------------------------------------------*/ RoomInfo::RoomInfo(const byte *data) { @@ -642,4 +670,30 @@ RoomInfo::RoomInfo(const byte *data) { } } +/*------------------------------------------------------------------------*/ + +BubbleBox::BubbleBox() { + _field0 = 2; + _bounds = Common::Rect(64, 32, 130, 122); + _bubblePtr = -1; + _maxChars = 0; +} + +void BubbleBox::load(Common::SeekableReadStream *stream) { + _bubbleTit.clear(); + + byte v; + do { + v = stream->readByte(); + _bubbleTit.push_back(v); + } while (v != 0); + + _bubblePtr = 0; +} + +void BubbleBox::clearBubbles() { + _bubbles.clear(); +} + + } // End of namespace Access diff --git a/engines/access/room.h b/engines/access/room.h index 19c3cc423b..9b26ed24e8 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -58,6 +58,22 @@ public: } }; +class BubbleBox { +public: + int _field0; + Common::Rect _bounds; + Common::Array<int> _bubbleTit; + int _bubblePtr; + int _maxChars; + Common::Array<Common::Rect> _bubbles; +public: + BubbleBox(); + + void load(Common::SeekableReadStream *stream); + + void clearBubbles(); +}; + class Room: public Manager { private: void roomLoop(); @@ -114,6 +130,7 @@ protected: public: Plotter _plotter; Common::Array<JetFrame> _jetFrame; + BubbleBox _bubbleBox; int _function; int _roomFlag; byte *_playField; @@ -141,6 +158,13 @@ public: void buildRow(int playY, int screenY); void init4Quads(); + + void placeBubble(); + void placeBubble1(); + + void calcBubble(); + + void printBubble(); }; diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 0cfce787a9..0c3cd2e92a 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -87,7 +87,7 @@ void Scripts::executeCommand(int commandIndex) { &Scripts::CMDOBJECT, &Scripts::CMDENDOBJECT, &Scripts::cmdJumpLook, &Scripts::cmdJumpHelp, &Scripts::cmdJumpGet, &Scripts::cmdJumpMove, &Scripts::cmdJumpUse, &Scripts::cmdJumpTalk, &Scripts::cmdNull, - &Scripts::CMDPRINT, &Scripts::cmdRetPos, &Scripts::cmdAnim, + &Scripts::cmdPrint, &Scripts::cmdRetPos, &Scripts::cmdAnim, &Scripts::cmdSetFlag, &Scripts::cmdCheckFlag, &Scripts::cmdGoto, &Scripts::cmdSetInventory, &Scripts::cmdSetInventory, &Scripts::cmdCheckInventory, &Scripts::CMDSETTEX, &Scripts::CMDNEWROOM, &Scripts::CMDCONVERSE, @@ -116,7 +116,11 @@ void Scripts::executeCommand(int commandIndex) { (this->*COMMAND_LIST[commandIndex])(); } -void Scripts::CMDOBJECT() { error("TODO CMDOBJECT"); } +void Scripts::CMDOBJECT() { + byte id; + + _vm->_room->_bubbleBox.load(_data); +} void Scripts::CMDENDOBJECT() { error("TODO ENDOBJECT"); } @@ -165,7 +169,24 @@ void Scripts::cmdJumpTalk() { void Scripts::cmdNull() { } -void Scripts::CMDPRINT() { error("TODO CMDPRINT"); } +#define PRINT_TIMER 25 + +void Scripts::cmdPrint() { + _vm->_screen->_printOrg = Common::Point(20, 42); + _vm->_screen->_printStart = Common::Point(20, 42); + _vm->_timers[PRINT_TIMER]._timer = 50; + _vm->_timers[PRINT_TIMER]._initTm = 50; + _vm->_timers[PRINT_TIMER]._flag = true; + + _vm->_room->placeBubble(); + _vm->_events->waitKeyMouse(); + + while (_vm->_timers[PRINT_TIMER]._flag) { + _vm->_events->pollEvents(); + } + + _vm->_screen->restoreBlock(); +} void Scripts::cmdRetPos() { _endFlag = true; diff --git a/engines/access/scripts.h b/engines/access/scripts.h index 0916b9e9b1..78e54f56c6 100644 --- a/engines/access/scripts.h +++ b/engines/access/scripts.h @@ -52,7 +52,7 @@ protected: void cmdJumpUse(); void cmdJumpTalk(); void cmdNull(); - void CMDPRINT(); + void cmdPrint(); void cmdRetPos(); void cmdAnim(); void cmdSetFlag(); |