ACCESS: MM - Implement printBubble_v1

This commit is contained in:
Strangerke 2015-01-19 00:11:05 +01:00
parent b1477438bb
commit 6ba81a9749
5 changed files with 57 additions and 14 deletions

View File

@ -74,7 +74,7 @@ void BubbleBox::clearBubbles() {
}
void BubbleBox::placeBubble(const Common::String &msg) {
_vm->_screen->_maxChars = 27;
_vm->_screen->_maxChars = (_vm->getGameID() == GType_MartianMemorandum) ? 30 : 27;
placeBubble1(msg);
}
@ -82,15 +82,18 @@ void BubbleBox::placeBubble1(const Common::String &msg) {
_bubbles.clear();
_vm->_fonts._charSet._lo = 1;
_vm->_fonts._charSet._hi = 8;
_vm->_fonts._charFor._lo = 29;
_vm->_fonts._charFor._hi = 32;
_vm->_fonts._charFor._lo = (_vm->getGameID() == GType_MartianMemorandum) ? 247 : 29;
_vm->_fonts._charFor._hi = (_vm->getGameID() == GType_MartianMemorandum) ? 255 : 32;
calcBubble(msg);
Common::Rect r = _bubbles[0];
r.translate(-2, 0);
_vm->_screen->saveBlock(r);
printBubble(msg);
if (_vm->getGameID() == GType_MartianMemorandum)
printBubble_v1(msg);
else
printBubble_v2(msg);
}
void BubbleBox::calcBubble(const Common::String &msg) {
@ -149,7 +152,29 @@ void BubbleBox::calcBubble(const Common::String &msg) {
_vm->_screen->_printStart = printStart;
}
void BubbleBox::printBubble(const Common::String &msg) {
void BubbleBox::printBubble_v1(const Common::String &msg) {
drawBubble(_bubbles.size() - 1);
// Loop through drawing the lines
Common::String s = msg;
Common::String line;
int width = 0;
bool lastLine;
do {
// Get next line
Font &font2 = _vm->_fonts._font2;
lastLine = font2.getLine(s, _vm->_screen->_maxChars * 6, line, width);
// Draw the text
font2.drawString(_vm->_screen, line, _vm->_screen->_printOrg);
// Move print position
_vm->_screen->_printOrg.y += 6;
_vm->_screen->_printOrg.x = _vm->_screen->_printStart.x;
} while (!lastLine);
}
void BubbleBox::printBubble_v2(const Common::String &msg) {
drawBubble(_bubbles.size() - 1);
// Loop through drawing the lines
@ -183,7 +208,11 @@ void BubbleBox::printBubble(const Common::String &msg) {
void BubbleBox::drawBubble(int index) {
_bounds = _bubbles[index];
doBox(0, 0);
if (_vm->getGameID() == GType_MartianMemorandum) {
int btnSelected = 0;
doBox_v1(0, 0, btnSelected);
} else
doBox(0, 0);
}
void BubbleBox::doBox(int item, int box) {

View File

@ -87,7 +87,8 @@ public:
/**
* Prints a text bubble and it's contents
*/
void printBubble(const Common::String &msg);
void printBubble_v1(const Common::String &msg);
void printBubble_v2(const Common::String &msg);
/*
* Draws the background for a text bubble

View File

@ -230,7 +230,6 @@ int InventoryManager::displayInv() {
else
_vm->_useItem = -1;
free(inv);
return 0;
}

View File

@ -54,7 +54,7 @@ void Scripts::setOpcodes() {
COMMAND_LIST[6] = &Scripts::cmdJumpUse;
COMMAND_LIST[7] = &Scripts::cmdJumpTalk;
COMMAND_LIST[8] = &Scripts::cmdNull;
COMMAND_LIST[9] = &Scripts::cmdPrint;
COMMAND_LIST[9] = &Scripts::cmdPrint_v1;
COMMAND_LIST[10] = &Scripts::cmdRetPos;
COMMAND_LIST[11] = &Scripts::cmdAnim;
COMMAND_LIST[12] = &Scripts::cmdSetFlag;
@ -121,6 +121,7 @@ void Scripts::setOpcodes() {
}
void Scripts::setOpcodes_v2() {
COMMAND_LIST[9] = &Scripts::cmdPrint_v2;
COMMAND_LIST[15] = &Scripts::cmdSetInventory;
COMMAND_LIST[28] = &Scripts::cmdDispInv_v2;
COMMAND_LIST[29] = &Scripts::cmdSetTimer;
@ -257,12 +258,24 @@ void Scripts::cmdNull() {
#define PRINT_TIMER 25
void Scripts::cmdPrint() {
void Scripts::cmdPrint_v2() {
// Get a text line for display
Common::String msg = readString();
printString(msg);
}
void Scripts::cmdPrint_v1() {
_vm->_screen->_printOrg = Common::Point(20, 42);
_vm->_screen->_printStart = Common::Point(20, 32);
Common::String msg = readString();
_vm->_bubbleBox->placeBubble(msg);
_vm->_events->waitKeyMouse();
_vm->_events->hideCursor();
_vm->_screen->restoreBlock();
_vm->_events->showCursor();
findNull();
}
void Scripts::printString(const Common::String &msg) {
_vm->_screen->_printOrg = Common::Point(20, 42);
_vm->_screen->_printStart = Common::Point(20, 42);
@ -751,7 +764,7 @@ void Scripts::cmdTexChoice() {
tmpStr += (char)v;
_vm->_bubbleBox->calcBubble(tmpStr);
_vm->_bubbleBox->printBubble(tmpStr);
_vm->_bubbleBox->printBubble_v2(tmpStr);
Common::Array<Common::Rect> responseCoords;
responseCoords.push_back(_vm->_bubbleBox->_bounds);
@ -766,7 +779,7 @@ void Scripts::cmdTexChoice() {
if (tmpStr.size() != 0) {
_vm->_bubbleBox->_bubbleDisplStr = Common::String("RESPONSE 2");
_vm->_bubbleBox->calcBubble(tmpStr);
_vm->_bubbleBox->printBubble(tmpStr);
_vm->_bubbleBox->printBubble_v2(tmpStr);
responseCoords.push_back(_vm->_bubbleBox->_bounds);
_vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + 11;
}
@ -781,7 +794,7 @@ void Scripts::cmdTexChoice() {
if (tmpStr.size() != 0) {
_vm->_bubbleBox->_bubbleDisplStr = Common::String("RESPONSE 3");
_vm->_bubbleBox->calcBubble(tmpStr);
_vm->_bubbleBox->printBubble(tmpStr);
_vm->_bubbleBox->printBubble_v2(tmpStr);
responseCoords.push_back(_vm->_bubbleBox->_bounds);
_vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + 11;
}

View File

@ -66,7 +66,8 @@ protected:
void cmdJumpUse();
void cmdJumpTalk();
void cmdNull();
void cmdPrint();
void cmdPrint_v1();
void cmdPrint_v2();
void cmdAnim();
void cmdSetFlag();
void cmdCheckFlag();