ACCESS: Fixes for drawing bubble box backgrounds

This commit is contained in:
Paul Gilbert 2014-08-17 20:17:38 -04:00
parent 9393f6d755
commit 483bca3d96
4 changed files with 35 additions and 21 deletions

View File

@ -94,7 +94,7 @@ void BubbleBox::calcBubble(const Common::String &msg) {
bool lastLine;
do {
lastLine = _vm->_fonts._font2.getLine(s, _maxChars * 6, line, width);
width = MAX(width, _vm->_fonts._printMaxX);
_vm->_fonts._printMaxX = MAX(width, _vm->_fonts._printMaxX);
_vm->_fonts._printOrg.y += 6;
_vm->_fonts._printOrg.x = _vm->_fonts._printStart.x;
@ -150,10 +150,10 @@ void BubbleBox::printBubble(const Common::String &msg) {
int xp = _vm->_fonts._printOrg.x;
if (_type == TYPE_4)
xp = (_bounds.width() - width) / 2 + _bounds.left - 4;
// Draw the text
font2.drawString(_vm->_screen, line, Common::Point(xp, _vm->_fonts._printOrg.y));
// Move print position
_vm->_fonts._printOrg.y += 6;
_vm->_fonts._printOrg.x = _vm->_fonts._printStart.x;
@ -221,7 +221,7 @@ void BubbleBox::doBox(int item, int box) {
screen.plotImage(icons, 21, Common::Point(xp, screen._orgY1));
// Draw images to form the bottom border
yp = screen._orgY2 - (_type == TYPE_4) ? 18 : 12;
yp = screen._orgY2 - (_type == TYPE_4 ? 18 : 12);
screen.plotImage(icons, (_type == TYPE_4) ? 72 : 22,
Common::Point(screen._orgX1, yp));
xp = screen._orgX1 + 12;
@ -232,16 +232,21 @@ void BubbleBox::doBox(int item, int box) {
Common::Point(xp, yp));
}
yp -= (_type == TYPE_4) ? 18 : 12;
screen.plotImage(icons, (_type == TYPE_4) ? 73 : 23,
Common::Point(screen._orgX1, yp));
yp = screen._orgY2 - (_type == TYPE_4 ? 18 : 12);
screen.plotImage(icons, (_type == TYPE_4) ? 73 : 23, Common::Point(xp, yp));
if (_type == TYPE_4) {
// Further stuff
warning("YSIZE not yet used %d", ySize);
error("TODO: Box type 4");
}
// Draw images to form the sides
yp = screen._orgY1 + 12;
for (int y = 0; y < ySize; ++y) {
screen.plotImage(icons, 44 + y, Common::Point(screen._orgX1, yp));
screen.plotImage(icons, 53 + y, Common::Point(screen._orgX2 - 4, yp));
}
// Handle drawing title
int titleWidth = _vm->_fonts._font2.stringWidth(_bubblePtr);
Font &font2 = _vm->_fonts._font2;

View File

@ -112,9 +112,10 @@ bool EventsManager::isCursorVisible() {
return CursorMan.isVisible();
}
void EventsManager::pollEvents(bool suppressFrames) {
if (!suppressFrames)
checkForNextFrameCounter();
void EventsManager::pollEvents() {
if (checkForNextFrameCounter()) {
nextFrame();
}
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
@ -158,24 +159,26 @@ void EventsManager::pollEvents(bool suppressFrames) {
}
}
void EventsManager::checkForNextFrameCounter() {
bool EventsManager::checkForNextFrameCounter() {
// Check for next game frame
uint32 milli = g_system->getMillis();
if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
++_frameCounter;
_priorFrameTime = milli;
nextFrame();
return true;
}
return false;
}
void EventsManager::nextFrame() {
// Give time to the debugger
_vm->_debugger->onFrame();
// Update timers
_vm->_animation->updateTimers();
// Give time to the debugger
_vm->_debugger->onFrame();
// TODO: Refactor for dirty rects
_vm->_screen->updateScreen();
}
@ -199,13 +202,19 @@ bool EventsManager::getKey(Common::KeyState &key) {
void EventsManager::debounceLeft() {
while (_leftButton && !_vm->shouldQuit()) {
pollEvents(true);
pollEvents();
g_system->delayMillis(10);
}
}
void EventsManager::waitKeyMouse() {
error("TODO: waitKeyPress");
while (!_vm->shouldQuit() && !_leftButton && _keypresses.size() == 0) {
pollEvents();
g_system->delayMillis(10);
}
zeroKeys();
debounceLeft();
}
} // End of namespace Access

View File

@ -46,7 +46,7 @@ private:
uint32 _frameCounter;
uint32 _priorFrameTime;
void checkForNextFrameCounter();
bool checkForNextFrameCounter();
void nextFrame();
public:
@ -95,7 +95,7 @@ public:
*/
bool isCursorVisible();
void pollEvents(bool suppressFrames = false);
void pollEvents();
void zeroKeys();

View File

@ -193,7 +193,7 @@ void Scripts::cmdPrint() {
_vm->_events->waitKeyMouse();
// Wait until the bubble display is expired
while (_vm->_timers[PRINT_TIMER]._flag) {
while (!_vm->shouldQuit() && _vm->_timers[PRINT_TIMER]._flag) {
_vm->_events->pollEvents();
}