diff options
author | Gregory Montoir | 2004-01-09 13:36:37 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-01-09 13:36:37 +0000 |
commit | 634df6923d644a5de603beb14c5f9720b5ff44fb (patch) | |
tree | b44aebd45f697dfe1c448ee460f204e2fa7945ac /queen | |
parent | 93f3c0df348b77d284d66309e36d775df4765c99 (diff) | |
download | scummvm-rg350-634df6923d644a5de603beb14c5f9720b5ff44fb.tar.gz scummvm-rg350-634df6923d644a5de603beb14c5f9720b5ff44fb.tar.bz2 scummvm-rg350-634df6923d644a5de603beb14c5f9720b5ff44fb.zip |
renamed some methods and moved some code to Display
svn-id: r12276
Diffstat (limited to 'queen')
-rw-r--r-- | queen/bankman.cpp | 4 | ||||
-rw-r--r-- | queen/bankman.h | 2 | ||||
-rw-r--r-- | queen/command.cpp | 26 | ||||
-rw-r--r-- | queen/credits.cpp | 16 | ||||
-rw-r--r-- | queen/cutaway.cpp | 16 | ||||
-rw-r--r-- | queen/debug.cpp | 2 | ||||
-rw-r--r-- | queen/display.cpp | 45 | ||||
-rw-r--r-- | queen/display.h | 18 | ||||
-rw-r--r-- | queen/graphics.cpp | 244 | ||||
-rw-r--r-- | queen/graphics.h | 47 | ||||
-rw-r--r-- | queen/grid.cpp | 12 | ||||
-rw-r--r-- | queen/grid.h | 8 | ||||
-rw-r--r-- | queen/journal.cpp | 56 | ||||
-rw-r--r-- | queen/logic.cpp | 47 | ||||
-rw-r--r-- | queen/logic.h | 6 | ||||
-rw-r--r-- | queen/queen.cpp | 2 | ||||
-rw-r--r-- | queen/talk.cpp | 22 | ||||
-rw-r--r-- | queen/xref.txt | 46 |
18 files changed, 308 insertions, 311 deletions
diff --git a/queen/bankman.cpp b/queen/bankman.cpp index 6e77307498..827a273c01 100644 --- a/queen/bankman.cpp +++ b/queen/bankman.cpp @@ -38,7 +38,7 @@ BankManager::~BankManager() { for(uint32 i = 0; i < MAX_BANKS_NUMBER; ++i) { close(i); } - eraseAllFrames(true); + eraseFrames(true); } @@ -131,7 +131,7 @@ void BankManager::eraseFrame(uint32 index) { } -void BankManager::eraseAllFrames(bool joe) { +void BankManager::eraseFrames(bool joe) { uint32 i = 0; if (!joe) { i = FRAMES_JOE + FRAMES_JOE_XTRA; diff --git a/queen/bankman.h b/queen/bankman.h index 55c78eb4fa..58ac3cf686 100644 --- a/queen/bankman.h +++ b/queen/bankman.h @@ -42,7 +42,7 @@ public: BobFrame *fetchFrame(uint32 index); void eraseFrame(uint32 index); - void eraseAllFrames(bool joe); + void eraseFrames(bool joe); enum { MAX_BANK_SIZE = 110, diff --git a/queen/command.cpp b/queen/command.cpp index da1b9b0697..76b27a0793 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -42,8 +42,8 @@ void CmdText::clear() { void CmdText::display(uint8 color) { - _vm->graphics()->textCurrentColor(color); - _vm->graphics()->textSetCentered(COMMAND_Y_POS, _command, false); + _vm->display()->textCurrentColor(color); + _vm->display()->setTextCentered(COMMAND_Y_POS, _command, false); } @@ -58,16 +58,16 @@ void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) { strcat(temp, " "); strcat(temp, name); } - _vm->graphics()->textCurrentColor(color); - _vm->graphics()->textSetCentered(COMMAND_Y_POS, temp, false); + _vm->display()->textCurrentColor(color); + _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false); } void CmdText::displayTemp(uint8 color, const char *name) { char temp[MAX_COMMAND_LEN]; sprintf(temp, "%s %s", _command, name); - _vm->graphics()->textCurrentColor(color); - _vm->graphics()->textSetCentered(COMMAND_Y_POS, temp, false); + _vm->display()->textCurrentColor(color); + _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false); } @@ -113,7 +113,7 @@ Command::Command(QueenEngine *vm) void Command::clear(bool clearTexts) { _cmdText.clear(); if (clearTexts) { - _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); + _vm->display()->clearTexts(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); } _parse = false; _state.init(); @@ -736,7 +736,7 @@ bool Command::executeIfCutaway(const char *description) { if (strlen(description) > 4 && scumm_stricmp(description + strlen(description) - 4, ".cut") == 0) { - _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); + _vm->display()->clearTexts(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); char nextCutaway[20]; memset(nextCutaway, 0, sizeof(nextCutaway)); @@ -754,7 +754,7 @@ bool Command::executeIfDialog(const char *description) { if (strlen(description) > 4 && scumm_stricmp(description + strlen(description) - 4, ".dog") == 0) { - _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); + _vm->display()->clearTexts(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); char cutaway[20]; memset(cutaway, 0, sizeof(cutaway)); @@ -780,7 +780,7 @@ bool Command::handleWrongAction() { if ((_state.selAction == VERB_WALK_TO || _state.selAction == VERB_NONE) && (_state.selNoun > objMax || _state.selNoun == 0)) { if (_state.selAction == VERB_NONE) { - _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); + _vm->display()->clearTexts(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); } _vm->walk()->moveJoe(0, _selPosX, _selPosY, false); return true; @@ -1136,7 +1136,7 @@ void Command::setObjects(uint16 command) { if (image1 != 0 && image2 == 0 && objData->room == _vm->logic()->currentRoom()) { uint16 bobNum = _vm->logic()->findBob(dstObj); if (bobNum != 0) { - _vm->graphics()->bobClear(bobNum); + _vm->graphics()->clearBob(bobNum); } } } @@ -1324,7 +1324,7 @@ void Command::lookForCurrentObject(int16 cx, int16 cy) { ObjectData *od = findObjectData(_state.noun); if (od == NULL || od->name <= 0) { _state.oldNoun = _state.noun; - _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); + _vm->display()->clearTexts(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); if (_state.defaultVerb != VERB_NONE) { _cmdText.displayTemp(INK_CMD_LOCK, true, _state.defaultVerb); } else if (_state.action != VERB_NONE) { @@ -1358,7 +1358,7 @@ void Command::lookForCurrentIcon(int16 cx, int16 cy) { if (_state.action == VERB_NONE) { _cmdText.clear(); } - _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); + _vm->display()->clearTexts(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); if (isVerbInv(_state.verb)) { ItemData *id = findItemData(_state.verb); diff --git a/queen/credits.cpp b/queen/credits.cpp index f1b698f645..dcb78fb90a 100644 --- a/queen/credits.cpp +++ b/queen/credits.cpp @@ -22,7 +22,7 @@ #include "stdafx.h" #include "queen/credits.h" -#include "queen/graphics.h" +#include "queen/display.h" #include "queen/queen.h" #include "queen/resource.h" @@ -35,14 +35,14 @@ Credits::Credits(QueenEngine *vm, const char* filename) : } Credits::~Credits() { - _vm->graphics()->textClear(0, 199); + _vm->display()->clearTexts(0, 199); delete _credits; } void Credits::nextRoom() { if (-1 == _pause) { _pause = 0; - _vm->graphics()->textClear(0, 199); + _vm->display()->clearTexts(0, 199); } } @@ -53,7 +53,7 @@ void Credits::update() { if (_pause > 0) { _pause--; if (!_pause) - _vm->graphics()->textClear(0, 199); + _vm->display()->clearTexts(0, 199); return; } @@ -102,8 +102,8 @@ void Credits::update() { for(i = 0; i < _count; i++) { - _vm->graphics()->textCurrentColor(_list[i].color); - _vm->graphics()->textSet(_list[i].x, _list[i].y, _list[i].text); + _vm->display()->textCurrentColor(_list[i].color); + _vm->display()->setText(_list[i].x, _list[i].y, _list[i].text); } _count = 0; @@ -137,12 +137,12 @@ void Credits::update() { _list[_count].x = (_zone % 3) * (320 / 3) + 8; break; case 1: - _list[_count].x = (_zone % 3) * (320 / 3) + 54 - _vm->graphics()->textWidth(line) / 2; + _list[_count].x = (_zone % 3) * (320 / 3) + 54 - _vm->display()->textWidth(line) / 2; if (_list[_count].x < 8) _list[_count].x = 8; break; case 2: - _list[_count].x = (_zone % 3) * (320 / 3) + 100 - _vm->graphics()->textWidth(line); + _list[_count].x = (_zone % 3) * (320 / 3) + 100 - _vm->display()->textWidth(line); break; } diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index 213a43d641..1b3d498f86 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -418,7 +418,7 @@ void Cutaway::changeRooms(CutawayObject &object) { mode = RDM_FADE_JOE_XY; } - _vm->logic()->roomDisplay(_vm->logic()->currentRoom(), mode, object.scale, comPanel, true); + _vm->logic()->displayRoom(_vm->logic()->currentRoom(), mode, object.scale, comPanel, true); _currentImage = _vm->graphics()->numFrames(); @@ -1078,7 +1078,7 @@ void Cutaway::stop() { _vm->logic()->joePos(joeX, joeY); _vm->logic()->currentRoom(joeRoom); _vm->logic()->oldRoom(_initialRoom); - _vm->logic()->roomDisplay(_vm->logic()->currentRoom(), RDM_FADE_JOE_XY, 0, _comPanel, true); + _vm->logic()->displayRoom(_vm->logic()->currentRoom(), RDM_FADE_JOE_XY, 0, _comPanel, true); } if (_vm->input()->cutawayQuit()) { @@ -1088,7 +1088,7 @@ void Cutaway::stop() { // Stop the credits from running _vm->logic()->stopCredits(); - _vm->graphics()->bobStopAll(); + _vm->graphics()->stopBobs(); for (i = 1; i <= _personFaceCount; i++) { int index = _personFace[i].index; @@ -1124,7 +1124,7 @@ void Cutaway::stop() { ObjectData *from = _vm->logic()->objectData(fromIndex); if (object->image && !from->image && bobIndex && _vm->logic()->currentRoom() == object->room) - _vm->graphics()->bobClear(bobIndex); + _vm->graphics()->clearBob(bobIndex); } if (_vm->logic()->currentRoom() == room) @@ -1155,7 +1155,7 @@ void Cutaway::stop() { int objectFrame = _vm->logic()->findFrame(objectIndex); if (objectFrame == 1000) { - _vm->graphics()->bobClear(bobIndex); + _vm->graphics()->clearBob(bobIndex); } else if (objectFrame) { _vm->bankMan()->unpack(ABS(frame), objectFrame, bank); @@ -1341,7 +1341,7 @@ void Cutaway::handleText( int flags; if (OBJECT_TYPE_TEXT_DISPLAY == type) { - x = _vm->graphics()->textCenterX(sentence); + x = _vm->display()->textCenterX(sentence); flags = 2; } else { @@ -1352,7 +1352,7 @@ void Cutaway::handleText( BobSlot *bob = _vm->graphics()->bob( _vm->logic()->findBob(ABS(object.objectNumber)) ); - _vm->graphics()->bobSetText(bob, sentence, x, object.bobStartY, object.specialMove, flags); + _vm->graphics()->setBobText(bob, sentence, x, object.bobStartY, object.specialMove, flags); if (OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) { char voiceFileName[MAX_STRING_SIZE]; @@ -1378,7 +1378,7 @@ void Cutaway::handleText( } } - _vm->graphics()->textClear(0,198); + _vm->display()->clearTexts(0,198); _vm->update(); } diff --git a/queen/debug.cpp b/queen/debug.cpp index b29f936baa..81e75ba194 100644 --- a/queen/debug.cpp +++ b/queen/debug.cpp @@ -60,7 +60,7 @@ void Debugger::preEnter() { void Debugger::postEnter() { // XXX un-mute all sounds - _vm->graphics()->bobSetupControl(); // re-init mouse cursor + _vm->graphics()->setupMouseCursor(); } diff --git a/queen/display.cpp b/queen/display.cpp index 6268353343..4941218e77 100644 --- a/queen/display.cpp +++ b/queen/display.cpp @@ -591,6 +591,7 @@ void Display::prepareUpdate() { void Display::update(bool dynalum, int16 dynaX, int16 dynaY) { + drawTexts(); if (_pal.scrollable && dynalum) { dynalumUpdate(dynaX, dynaY); } @@ -848,6 +849,50 @@ void Display::initFont() { } +void Display::setText(uint16 x, uint16 y, const char *text, bool outlined) { + if (y < GAME_SCREEN_HEIGHT) { + if (x == 0) x = 1; + if (y == 0) y = 1; + TextSlot *pts = &_texts[y]; + + pts->x = x; + pts->color = _curTextColor; + pts->outlined = outlined; + pts->text = text; + } +} + + +void Display::setTextCentered(uint16 y, const char *text, bool outlined) { + uint16 x = (GAME_SCREEN_WIDTH - textWidth(text)) / 2; + setText(x, y, text, outlined); +} + + +void Display::drawTexts() { + int y; + for (y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) { + const TextSlot *pts = &_texts[y]; + if (!pts->text.isEmpty()) { + _vm->display()->drawText(pts->x, y, pts->color, pts->text.c_str(), pts->outlined); + } + } +} + + +void Display::clearTexts(uint16 y1, uint16 y2) { + while (y1 <= y2) { + _texts[y1].text.clear(); + ++y1; + } +} + + +int Display::textCenterX(const char *text) const { + return 160 - textWidth(text) / 2; +} + + uint16 Display::textWidth(const char *text) const { uint16 len = 0; while (*text) { diff --git a/queen/display.h b/queen/display.h index aef8b0db72..a22dd4e355 100644 --- a/queen/display.h +++ b/queen/display.h @@ -22,6 +22,7 @@ #ifndef QUEENDISPLAY_H #define QUEENDISPLAY_H +#include "common/str.h" #include "common/util.h" #include "queen/defs.h" @@ -89,6 +90,13 @@ public: void initFont(); + void setText(uint16 x, uint16 y, const char *text, bool outlined = true); + void setTextCentered(uint16 y, const char *text, bool outlined = true); + void drawTexts(); + void clearTexts(uint16 y1, uint16 y2); + void textCurrentColor(uint8 color) { _curTextColor = color; } + void textColor(uint16 y, uint8 color) { _texts[y].color = color; } + int textCenterX(const char *text) const; uint16 textWidth(const char *text) const; void drawChar(uint16 x, uint16 y, uint8 color, const uint8 *chr); void drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined = true); @@ -132,6 +140,13 @@ private: uint8 prevColMask; }; + struct TextSlot { + uint16 x; + uint8 color; + Common::String text; + bool outlined; + }; + uint8 *_screenBuf; uint8 *_panelBuf; uint8 *_backdropBuf; @@ -145,6 +160,9 @@ private: uint16 _horizontalScroll; uint16 _bdWidth, _bdHeight; + TextSlot _texts[GAME_SCREEN_HEIGHT]; + uint8 _curTextColor; + uint8 _charWidth[256]; bool _gotTick; diff --git a/queen/graphics.cpp b/queen/graphics.cpp index 56f4813caa..14c56a00d8 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -196,25 +196,28 @@ Graphics::~Graphics() { } -void Graphics::bobSetupControl() { +void Graphics::unpackControlBank() { _vm->bankMan()->load("control.BBK",17); _vm->bankMan()->unpack(1, 1, 17); // Mouse pointer _vm->bankMan()->unpack(3, 3, 17); // Up arrow dialogue _vm->bankMan()->unpack(4, 4, 17); // Down arrow dialogue _vm->bankMan()->close(17); +} + +void Graphics::setupMouseCursor() { BobFrame *bf = _vm->bankMan()->fetchFrame(1); _vm->display()->setMouseCursor(bf->data, bf->width, bf->height, bf->xhotspot, bf->yhotspot); } -void Graphics::bobDraw(const BobSlot *bs, int16 x, int16 y) { - debug(9, "Graphics::bobDraw(%d, %d, %d)", bs->frameNum, x, y); +void Graphics::drawBob(const BobSlot *bs, int16 x, int16 y) { + debug(9, "Graphics::drawBob(%d, %d, %d)", bs->frameNum, x, y); uint16 w, h; BobFrame *pbf = _vm->bankMan()->fetchFrame(bs->frameNum); if (bs->scale < 100) { - bobShrink(pbf, bs->scale); + shrinkFrame(pbf, bs->scale); pbf = &_shrinkBuffer; } w = pbf->width; @@ -262,7 +265,7 @@ void Graphics::bobDraw(const BobSlot *bs, int16 x, int16 y) { } -void Graphics::bobDrawInventoryItem(uint32 frameNum, uint16 x, uint16 y) { +void Graphics::drawInventoryItem(uint32 frameNum, uint16 x, uint16 y) { if (frameNum != 0) { BobFrame *bf = _vm->bankMan()->fetchFrame(frameNum); _vm->display()->drawInventoryItem(bf->data, x, y, bf->width, bf->height); @@ -272,7 +275,7 @@ void Graphics::bobDrawInventoryItem(uint32 frameNum, uint16 x, uint16 y) { } -void Graphics::bobPaste(uint16 objNum, uint16 image) { +void Graphics::pasteBob(uint16 objNum, uint16 image) { GraphicData *pgd = _vm->logic()->graphicData(objNum); _vm->bankMan()->unpack(pgd->firstFrame, image, 15); BobFrame *bf = _vm->bankMan()->fetchFrame(image); @@ -281,12 +284,12 @@ void Graphics::bobPaste(uint16 objNum, uint16 image) { } -void Graphics::bobShrink(const BobFrame *bf, uint16 percentage) { +void Graphics::shrinkFrame(const BobFrame *bf, uint16 percentage) { // computing new size, rounding to upper value uint16 new_w = (bf->width * percentage + 50) / 100; uint16 new_h = (bf->height * percentage + 50) / 100; - debug(9, "Graphics::bobShrink() - scale = %d, bufsize = %d", percentage, new_w * new_h); + debug(9, "Graphics::shrinkFrame() - scale = %d, bufsize = %d", percentage, new_w * new_h); if (new_w != 0 && new_h != 0) { @@ -326,7 +329,7 @@ void Graphics::bobShrink(const BobFrame *bf, uint16 percentage) { } -void Graphics::bobClear(uint32 bobNum) { +void Graphics::clearBob(uint32 bobNum) { BobSlot *pbs = bob(bobNum); pbs->clear(); if (_vm->display()->fullscreen()) { @@ -335,7 +338,7 @@ void Graphics::bobClear(uint32 bobNum) { } -void Graphics::bobSortAll() { +void Graphics::sortBobs() { _sortedBobsCount = 0; // animate/move the bobs @@ -378,7 +381,7 @@ void Graphics::bobSortAll() { } -void Graphics::bobDrawAll() { +void Graphics::drawBobs() { int i; for (i = 0; i < _sortedBobsCount; ++i) { BobSlot *pbs = _sortedBobs[i]; @@ -404,20 +407,20 @@ void Graphics::bobDrawAll() { x = pbs->x - xh - _vm->display()->horizontalScroll(); y = pbs->y - yh; - bobDraw(pbs, x, y); + drawBob(pbs, x, y); } } } -void Graphics::bobClearAll() { +void Graphics::clearBobs() { for(int32 i = 0; i < ARRAYSIZE(_bobs); ++i) { - bobClear(i); + clearBob(i); } } -void Graphics::bobStopAll() { +void Graphics::stopBobs() { for(int32 i = 0; i < ARRAYSIZE(_bobs); ++i) { _bobs[i].moving = false; } @@ -434,75 +437,7 @@ BobSlot *Graphics::bob(int index) { } -void Graphics::bobCustomParallax(uint16 roomNum) { - int i; - uint16 screenScroll = _vm->display()->horizontalScroll(); - switch (roomNum) { - case ROOM_AMAZON_HIDEOUT: - _bobs[8].x = 250 - screenScroll / 2; - break; - case ROOM_TEMPLE_MAZE_5: - _bobs[5].x = 410 - screenScroll / 2; - _bobs[6].x = 790 - screenScroll / 2; - break; - case ROOM_TEMPLE_OUTSIDE: - _bobs[5].x = 320 - screenScroll / 2; - break; - case ROOM_TEMPLE_TREE: - _bobs[5].x = 280 - screenScroll / 2; - break; - case ROOM_VALLEY_CARCASS: - _bobs[5].x = 600 - screenScroll / 2; - break; - case ROOM_HOTEL_LOBBY: - if(_vm->display()->fullscreen()) { - for(i = 1; i <= 3; ++i) { - _bobs[i].box.y2 = 199; - } - _bobs[24].box.y2 = 199; - } - break; - case ROOM_UNUSED_INTRO_1: - _bobs[5].x = 340 - screenScroll / 2; - _bobs[6].x = 50 - screenScroll / 2; - _bobs[7].x = 79 - screenScroll / 2; - for(i = 1; i <= 8; ++i) { - _bobs[i].box.y2 = 199; - } - _bobs[20].box.y2 = 199; - break; - case ROOM_UNUSED_INTRO_5: - for(i = 0; i < 3; ++i) { - _bobs[i].box.y2 = 199; - } - break; - case ROOM_CAR_CHASE: - _vm->bam()->updateCarAnimation(); - break; - case ROOM_FINAL_FIGHT: - _vm->bam()->updateFightAnimation(); - break; - case ROOM_INTRO_RITA_JOE_HEADS: // CR 2 - CD-Rom pan right while Rita talks... - _cameraBob = -1; - if (screenScroll < 80) { - _vm->display()->horizontalScroll(screenScroll + 4); - // Joe's body and head - _bobs[ 1].x += 4; - _bobs[20].x += 4; - // Rita's body and head - _bobs[ 2].x -= 2; - _bobs[21].x -= 2; - } - break; - case ROOM_INTRO_EXPLOSION: // CR 2 - CD-Rom the guys move off screen - _bobs[21].x += 2; - _bobs[21].y += 2; - break; - } -} - - -void Graphics::bobSetText( +void Graphics::setBobText( BobSlot *pbs, const char *text, int textX, int textY, @@ -559,7 +494,7 @@ void Graphics::bobSetText( int maxLineWidth = 0; for (i = 0; i < lineCount; i++) { - int width = textWidth(lines[i]); + int width = _vm->display()->textWidth(lines[i]); if (maxLineWidth < width) maxLineWidth = width; } @@ -606,69 +541,88 @@ void Graphics::bobSetText( else if ((x + maxLineWidth) > 320) x = 320 - maxLineWidth - 4; - textCurrentColor(color); + _vm->display()->textCurrentColor(color); for (i = 0; i < lineCount; i++) { - int lineX = x + (maxLineWidth - textWidth(lines[i])) / 2; + int lineX = x + (maxLineWidth - _vm->display()->textWidth(lines[i])) / 2; //debug(0, "Setting text '%s' at (%i, %i)", lines[i], lineX, y + 9 * i); - textSet(lineX, y + 9 * i, lines[i]); + _vm->display()->setText(lineX, y + 9 * i, lines[i]); } } -void Graphics::textSet(uint16 x, uint16 y, const char *text, bool outlined) { - if (y < GAME_SCREEN_HEIGHT) { - if (x == 0) x = 1; - if (y == 0) y = 1; - TextSlot *pts = &_texts[y]; - - pts->x = x; - pts->color = _curTextColor; - pts->outlined = outlined; - pts->text = text; - } -} - - -void Graphics::textSetCentered(uint16 y, const char *text, bool outlined) { - uint16 x = (GAME_SCREEN_WIDTH - textWidth(text)) / 2; - textSet(x, y, text, outlined); -} - - -void Graphics::textDrawAll() { - int y; - for (y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) { - const TextSlot *pts = &_texts[y]; - if (!pts->text.isEmpty()) { - _vm->display()->drawText(pts->x, y, pts->color, pts->text.c_str(), pts->outlined); +void Graphics::handleParallax(uint16 roomNum) { + int i; + uint16 screenScroll = _vm->display()->horizontalScroll(); + switch (roomNum) { + case ROOM_AMAZON_HIDEOUT: + _bobs[8].x = 250 - screenScroll / 2; + break; + case ROOM_TEMPLE_MAZE_5: + _bobs[5].x = 410 - screenScroll / 2; + _bobs[6].x = 790 - screenScroll / 2; + break; + case ROOM_TEMPLE_OUTSIDE: + _bobs[5].x = 320 - screenScroll / 2; + break; + case ROOM_TEMPLE_TREE: + _bobs[5].x = 280 - screenScroll / 2; + break; + case ROOM_VALLEY_CARCASS: + _bobs[5].x = 600 - screenScroll / 2; + break; + case ROOM_HOTEL_LOBBY: + if(_vm->display()->fullscreen()) { + for(i = 1; i <= 3; ++i) { + _bobs[i].box.y2 = 199; + } + _bobs[24].box.y2 = 199; } + break; + case ROOM_UNUSED_INTRO_1: + _bobs[5].x = 340 - screenScroll / 2; + _bobs[6].x = 50 - screenScroll / 2; + _bobs[7].x = 79 - screenScroll / 2; + for(i = 1; i <= 8; ++i) { + _bobs[i].box.y2 = 199; + } + _bobs[20].box.y2 = 199; + break; + case ROOM_UNUSED_INTRO_5: + for(i = 0; i < 3; ++i) { + _bobs[i].box.y2 = 199; + } + break; + case ROOM_CAR_CHASE: + _vm->bam()->updateCarAnimation(); + break; + case ROOM_FINAL_FIGHT: + _vm->bam()->updateFightAnimation(); + break; + case ROOM_INTRO_RITA_JOE_HEADS: // CR 2 - CD-Rom pan right while Rita talks... + _cameraBob = -1; + if (screenScroll < 80) { + _vm->display()->horizontalScroll(screenScroll + 4); + // Joe's body and head + _bobs[ 1].x += 4; + _bobs[20].x += 4; + // Rita's body and head + _bobs[ 2].x -= 2; + _bobs[21].x -= 2; + } + break; + case ROOM_INTRO_EXPLOSION: // CR 2 - CD-Rom the guys move off screen + _bobs[21].x += 2; + _bobs[21].y += 2; + break; } } -void Graphics::textClear(uint16 y1, uint16 y2) { - while (y1 <= y2) { - _texts[y1].text.clear(); - ++y1; - } -} - - -uint16 Graphics::textWidth(const char* text) const { - return _vm->display()->textWidth(text); -} - - -int Graphics::textCenterX(const char *text) const { - return 160 - textWidth(text) / 2; -} - - void Graphics::setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, uint16 furnitureCount) { // reset sprites table (bounding box...) - bobClearAll(); + clearBobs(); // load/setup objects associated to this room char filename[20]; @@ -885,7 +839,7 @@ uint16 Graphics::refreshObject(uint16 obj) { if (pod->image == -3 || pod->image == -4) { // a person object if (pod->name <= 0) { - bobClear(curBob); + clearBob(curBob); } else { // find person number uint16 pNum = _vm->logic()->findPersonNumber(obj); @@ -903,7 +857,7 @@ uint16 Graphics::refreshObject(uint16 obj) { if (pod->name < 0 || pod->image < 0) { // object is hidden or disabled - bobClear(curBob); + clearBob(curBob); return curImage; } @@ -1015,7 +969,7 @@ void Graphics::setupRoomFurniture(int16 *furniture, uint16 furnitureCount) { // unpack the paste downs for (i = 1; i <= furnitureCount; ++i) { if (furniture[i] > 5000) {; - bobPaste(furniture[i] - 5000, curImage + 1); + pasteBob(furniture[i] - 5000, curImage + 1); } } } @@ -1090,7 +1044,7 @@ void Graphics::setupRoomObjects() { // static objects curBob = 20 + _numFurnitureStatic + numObjectStatic; ++curImage; - bobClear(curBob); + clearBob(curBob); // XXX if((COMPANEL==2) && (FULLSCREEN==1)) bobs[CURRBOB].y2=199; @@ -1126,7 +1080,7 @@ void Graphics::setupRoomObjects() { for (i = firstRoomObj; i <= lastRoomObj; ++i) { ObjectData *pod = _vm->logic()->objectData(i); if (pod->name > 0 && pod->image > 5000) { - bobPaste(pod->image - 5000, curImage); + pasteBob(pod->image - 5000, curImage); } } } @@ -1173,7 +1127,6 @@ uint16 Graphics::setupPerson(uint16 noun, uint16 curImage) { uint16 Graphics::allocPerson(uint16 noun, uint16 curImage) { Person p; if (_vm->logic()->initPerson(noun, "", false, &p) && p.anim != NULL) { - debug(0, "allocPerson() : anim=%s", p.anim); curImage += countAnimFrames(p.anim); _personFrames[p.actor->bobNum] = curImage + 1; } @@ -1182,14 +1135,13 @@ uint16 Graphics::allocPerson(uint16 noun, uint16 curImage) { void Graphics::update(uint16 room) { - bobSortAll(); + sortBobs(); if (_cameraBob >= 0) { _vm->display()->horizontalScrollUpdate(_bobs[_cameraBob].x); } - bobCustomParallax(room); + handleParallax(room); _vm->display()->prepareUpdate(); - bobDrawAll(); - textDrawAll(); + drawBobs(); } @@ -1201,15 +1153,15 @@ BamScene::BamScene(QueenEngine *vm) void BamScene::prepareAnimation() { _obj1 = _vm->graphics()->bob(BOB_OBJ1); - _vm->graphics()->bobClear(BOB_OBJ1); + _obj1->clear(); _obj1->active = true; _obj2 = _vm->graphics()->bob(BOB_OBJ2); - _vm->graphics()->bobClear(BOB_OBJ2); + _obj2->clear(); _obj2->active = true; _objfx = _vm->graphics()->bob(BOB_FX); - _vm->graphics()->bobClear(BOB_FX); + _objfx->clear(); _objfx->active = true; _index = 0; diff --git a/queen/graphics.h b/queen/graphics.h index 007d1af81c..bb1bf5716b 100644 --- a/queen/graphics.h +++ b/queen/graphics.h @@ -22,7 +22,6 @@ #ifndef QUEENGRAPHICS_H #define QUEENGRAPHICS_H -#include "common/str.h" #include "common/util.h" #include "queen/defs.h" #include "queen/structs.h" @@ -85,13 +84,6 @@ struct BobSlot { void clear(); }; -struct TextSlot { - uint16 x; - uint8 color; - Common::String text; - bool outlined; -}; - class QueenEngine; class Graphics { @@ -100,30 +92,22 @@ public: Graphics(QueenEngine *vm); ~Graphics(); - void bobSetupControl(); - void bobDraw(const BobSlot *bs, int16 x, int16 y); - void bobDrawInventoryItem(uint32 frameNum, uint16 x, uint16 y); - void bobPaste(uint16 objNum, uint16 image); - void bobShrink(const BobFrame *bf, uint16 percentage); - void bobClear(uint32 bobNum); - void bobSortAll(); - void bobDrawAll(); - void bobClearAll(); - void bobStopAll(); + void unpackControlBank(); + void setupMouseCursor(); + + void drawBob(const BobSlot *bs, int16 x, int16 y); + void drawInventoryItem(uint32 frameNum, uint16 x, uint16 y); + void pasteBob(uint16 objNum, uint16 image); + void shrinkFrame(const BobFrame *bf, uint16 percentage); + void clearBob(uint32 bobNum); + void sortBobs(); + void drawBobs(); + void clearBobs(); + void stopBobs(); BobSlot *bob(int index); + void setBobText(BobSlot *bob, const char *text, int textX, int textY, int color, int flags); - void bobCustomParallax(uint16 roomNum); // CHECK_PARALLAX() - - void bobSetText(BobSlot *bob, const char *text, int textX, int textY, int color, int flags); - - void textCurrentColor(uint8 color) { _curTextColor = color; } - void textSet(uint16 x, uint16 y, const char *text, bool outlined = true); // text() - void textSetCentered(uint16 y, const char *text, bool outlined = true); - void textDrawAll(); // drawtext() - void textClear(uint16 y1, uint16 y2); // blanktexts() - uint16 textWidth(const char *text) const; // textlen() - int textCenterX(const char *text) const; // MIDDLE() - void textColor(uint16 y, uint8 color) { _texts[y].color = color; } + void handleParallax(uint16 roomNum); void setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, uint16 furnitureCount); @@ -176,9 +160,6 @@ private: //! used to scale a BobFrame BobFrame _shrinkBuffer; - TextSlot _texts[GAME_SCREEN_HEIGHT]; - uint8 _curTextColor; - AnimFrame _newAnim[17][30]; uint16 _personFrames[4]; diff --git a/queen/grid.cpp b/queen/grid.cpp index 46d26c553c..97a0efe47c 100644 --- a/queen/grid.cpp +++ b/queen/grid.cpp @@ -41,17 +41,17 @@ void Grid::readDataFrom(uint16 numObjects, uint16 numRooms, byte *&ptr) { _objMax = new int16[numRooms + 1]; _areaMax = new int16[numRooms + 1]; - _area = new Area[numRooms + 1][MAX_AREAS]; + _area = new Area[numRooms + 1][MAX_AREAS_NUMBER]; _objMax[0] = 0; _areaMax[0] = 0; - memset(&_area[0], 0, sizeof(Area) * MAX_AREAS); + memset(&_area[0], 0, sizeof(Area) * MAX_AREAS_NUMBER); for (i = 1; i <= numRooms; i++) { _objMax[i] = (int16)READ_BE_UINT16(ptr); ptr += 2; _areaMax[i] = (int16)READ_BE_UINT16(ptr); ptr += 2; memset(&_area[i][0], 0, sizeof(Area)); for (j = 1; j <= _areaMax[i]; j++) { - assert(j < MAX_AREAS); + assert(j < MAX_AREAS_NUMBER); _area[i][j].readFromBE(ptr); } } @@ -89,7 +89,7 @@ uint16 Grid::findZoneForPos(GridScreen screen, uint16 x, uint16 y) const { if (screen == GS_PANEL) { y -= ROOM_ZONE_HEIGHT; } - for(i = 1; i < MAX_ZONES; ++i) { + for(i = 1; i < MAX_ZONES_NUMBER; ++i) { const ZoneSlot *pzs = &_zones[screen][i]; if (pzs->valid && pzs->box.contains(x, y)) { return i; @@ -113,7 +113,7 @@ uint16 Grid::findAreaForPos(GridScreen screen, uint16 x, uint16 y) const { void Grid::clear(GridScreen screen) { debug(9, "Grid::clear(%d)", screen); - for(int i = 1; i < MAX_ZONES; ++i) { + for(int i = 1; i < MAX_ZONES_NUMBER; ++i) { _zones[screen][i].valid = false; } } @@ -163,7 +163,7 @@ void Grid::setupPanel() { void Grid::drawZones() { - for(int i = 1; i < MAX_ZONES; ++i) { + for(int i = 1; i < MAX_ZONES_NUMBER; ++i) { const ZoneSlot *pzs = &_zones[GS_ROOM][i]; if (pzs->valid) { const Box *b = &pzs->box; diff --git a/queen/grid.h b/queen/grid.h index b81e5b5148..2b32b6ad32 100644 --- a/queen/grid.h +++ b/queen/grid.h @@ -62,8 +62,8 @@ public: uint16 objMax(int room) const { return _objMax[room]; } enum { - MAX_ZONES = 32, - MAX_AREAS = 11 + MAX_ZONES_NUMBER = 32, + MAX_AREAS_NUMBER = 11 }; @@ -74,13 +74,13 @@ private: Box box; }; - ZoneSlot _zones[GS_COUNT][MAX_ZONES]; + ZoneSlot _zones[GS_COUNT][MAX_ZONES_NUMBER]; int16 *_objMax; int16 *_areaMax; - Area (*_area)[MAX_AREAS]; + Area (*_area)[MAX_AREAS_NUMBER]; Box *_objectBox; diff --git a/queen/journal.cpp b/queen/journal.cpp index badd891df3..9cf619945d 100644 --- a/queen/journal.cpp +++ b/queen/journal.cpp @@ -89,7 +89,7 @@ void Journal::use() { _vm->writeOptionSettings(); - _vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1); + _vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1); _vm->graphics()->putCameraOnBob(0); if (_quitCleanly) { restore(); @@ -102,10 +102,10 @@ void Journal::prepare() { _vm->display()->fullscreen(true); _vm->graphics()->putCameraOnBob(-1); - _vm->graphics()->bobClearAll(); - _vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1); - _vm->bankMan()->eraseAllFrames(false); - _vm->graphics()->textCurrentColor(INK_JOURNAL); + _vm->graphics()->clearBobs(); + _vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1); + _vm->bankMan()->eraseFrames(false); + _vm->display()->textCurrentColor(INK_JOURNAL); int i; _vm->grid()->clear(GS_ROOM); @@ -148,7 +148,7 @@ void Journal::restore() { _vm->logic()->joeCutFacing(_vm->logic()->joeFacing()); _vm->logic()->oldRoom(_vm->logic()->currentRoom()); - _vm->logic()->roomDisplay(_vm->logic()->currentRoom(), RDM_FADE_JOE, 0, 0, false); + _vm->logic()->displayRoom(_vm->logic()->currentRoom(), RDM_FADE_JOE, 0, 0, false); } @@ -214,8 +214,8 @@ void Journal::drawSaveDescriptions() { char nb[4]; sprintf(nb, "%d", n + 1); int y = 9 + i * 13; - _vm->graphics()->textSet(136, y, _saveDescriptions[n], false); - _vm->graphics()->textSet(109, y + 1, nb, false); + _vm->display()->setText(136, y, _saveDescriptions[n], false); + _vm->display()->setText(109, y + 1, nb, false); } // hightlight current page showBob(BOB_SAVE_PAGE, 300, 3 + _currentSavePage * 15, 6 + _currentSavePage); @@ -306,7 +306,7 @@ void Journal::handleYesNoMode(int16 zoneNum) { if (_saveDescriptions[currentSlot][0]) { _vm->display()->palFadeOut(0, 223, JOURNAL_ROOM); loadState(currentSlot); - _vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1); + _vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1); // XXX panelflag=1; // XXX walkgameload=1; _quit = true; @@ -376,7 +376,7 @@ void Journal::handleKeyDown(uint16 ascii, int keycode) { void Journal::clearPanelTexts() { int i; for (i = 0; i < _panelTextCount; ++i) { - _vm->graphics()->textClear(_panelTextY[i], _panelTextY[i]); + _vm->display()->clearTexts(_panelTextY[i], _panelTextY[i]); } } @@ -386,8 +386,8 @@ void Journal::drawPanelText(int y, const char *text) { strcpy(s, text); char *p = strchr(s, ' '); if (p == NULL) { - int x = (128 - _vm->graphics()->textWidth(s)) / 2; - _vm->graphics()->textSet(x, y, s, false); + int x = (128 - _vm->display()->textWidth(s)) / 2; + _vm->display()->setText(x, y, s, false); _panelTextY[_panelTextCount++] = y; } else { *p++ = '\0'; @@ -461,49 +461,49 @@ void Journal::drawConfigPanel() { void Journal::showInformationBox() { - _vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1); + _vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1); showBob(BOB_INFO_BOX, 72, 221, FRAME_INFO_BOX); const char *ver = _vm->resource()->JASVersion(); switch (ver[0]) { case 'P': - _vm->graphics()->textSetCentered(132, "PC Hard Drive", false); + _vm->display()->setTextCentered(132, "PC Hard Drive", false); break; case 'C': - _vm->graphics()->textSetCentered(132, "PC CD-ROM", false); + _vm->display()->setTextCentered(132, "PC CD-ROM", false); break; case 'a': - _vm->graphics()->textSetCentered(132, "Amiga A500/600", false); + _vm->display()->setTextCentered(132, "Amiga A500/600", false); break; case 'A': - _vm->graphics()->textSetCentered(132, "Amiga A1200", false); + _vm->display()->setTextCentered(132, "Amiga A1200", false); break; case 'c': - _vm->graphics()->textSetCentered(132, "Amiga CD-32", false); + _vm->display()->setTextCentered(132, "Amiga CD-32", false); break; } switch (ver[1]) { case 'E': - _vm->graphics()->textSetCentered(144, "English", false); + _vm->display()->setTextCentered(144, "English", false); break; case 'G': - _vm->graphics()->textSetCentered(144, "Deutsch", false); + _vm->display()->setTextCentered(144, "Deutsch", false); break; case 'I': - _vm->graphics()->textSetCentered(144, "Italiano", false); + _vm->display()->setTextCentered(144, "Italiano", false); break; case 'F' : - _vm->graphics()->textSetCentered(144, "Fran\x87""ais", false); + _vm->display()->setTextCentered(144, "Fran\x87""ais", false); break; } char versionId[13]; sprintf(versionId, "Version %c.%c%c", ver[2], ver[3], ver[4]); - _vm->graphics()->textSetCentered(156, versionId, false); + _vm->display()->setTextCentered(156, versionId, false); } void Journal::hideInformationBox() { - _vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1); + _vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1); hideBob(BOB_INFO_BOX); redraw(); } @@ -511,7 +511,7 @@ void Journal::hideInformationBox() { void Journal::initEditBuffer(const char *desc) { _edit.enable = true; - _edit.posCursor = _vm->graphics()->textWidth(desc); + _edit.posCursor = _vm->display()->textWidth(desc); _edit.textCharsCount = strlen(desc); memset(_edit.text, 0, sizeof(_edit.text)); strcpy(_edit.text, desc); @@ -535,7 +535,7 @@ void Journal::updateEditBuffer(uint16 ascii, int keycode) { default: if (isprint((char)ascii) && _edit.textCharsCount < (sizeof(_edit.text) - 1) && - _vm->graphics()->textWidth(_edit.text) < 146) { + _vm->display()->textWidth(_edit.text) < 146) { _edit.text[_edit.textCharsCount] = (char)ascii; ++_edit.textCharsCount; dirty = true; @@ -543,8 +543,8 @@ void Journal::updateEditBuffer(uint16 ascii, int keycode) { break; } if (dirty) { - _vm->graphics()->textSet(136, 9 + _currentSaveSlot * 13, _edit.text, false); - _edit.posCursor = _vm->graphics()->textWidth(_edit.text); + _vm->display()->setText(136, 9 + _currentSaveSlot * 13, _edit.text, false); + _edit.posCursor = _vm->display()->textWidth(_edit.text); update(); } } diff --git a/queen/logic.cpp b/queen/logic.cpp index 72ec87b807..2f0803ced8 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -242,7 +242,8 @@ void Logic::initialise() { _scene = 0; memset(_gameState, 0, sizeof(_gameState)); _vm->display()->setupPanel(); - _vm->graphics()->bobSetupControl(); + _vm->graphics()->unpackControlBank(); + _vm->graphics()->setupMouseCursor(); setupJoe(); _vm->grid()->setupPanel(); @@ -458,8 +459,8 @@ void Logic::gameState(int index, int16 newValue) { } -void Logic::roomErase() { - _vm->bankMan()->eraseAllFrames(false); +void Logic::eraseRoom() { + _vm->bankMan()->eraseFrames(false); _vm->bankMan()->close(15); _vm->bankMan()->close(11); _vm->bankMan()->close(10); @@ -496,7 +497,7 @@ void Logic::roomErase() { } -void Logic::roomSetup(const char *room, int comPanel, bool inCutaway) { +void Logic::setupRoom(const char *room, int comPanel, bool inCutaway) { // load backdrop image, init dynalum, setup colors _vm->display()->setupNewRoom(room, _currentRoom); @@ -520,15 +521,15 @@ void Logic::roomSetup(const char *room, int comPanel, bool inCutaway) { } -void Logic::roomDisplay(uint16 room, RoomDisplayMode mode, uint16 scale, int comPanel, bool inCutaway) { - debug(6, "Logic::roomDisplay(%d, %d, %d, %d, %d)", room, mode, scale, comPanel, inCutaway); +void Logic::displayRoom(uint16 room, RoomDisplayMode mode, uint16 scale, int comPanel, bool inCutaway) { + debug(6, "Logic::displayRoom(%d, %d, %d, %d, %d)", room, mode, scale, comPanel, inCutaway); - roomErase(); + eraseRoom(); if (_credits) _credits->nextRoom(); - roomSetup(roomName(room), comPanel, inCutaway); + setupRoom(roomName(room), comPanel, inCutaway); ObjectData *pod = NULL; if (mode != RDM_FADE_NOJOE) { pod = setupJoeInRoom(mode != RDM_FADE_JOE_XY, scale); @@ -588,7 +589,7 @@ bool Logic::initPerson(int16 noun, const char *actorName, bool loadBank, Person if (loadBank && pad->file != 0) { _vm->bankMan()->load(_aFile[pad->file], pad->bankNum); // if there is no valid actor file (ie pad->file is 0), the person - // data is already loaded as it is contained in objects room bank (.bbk) + // data is already loaded as it is included in objects room bank (.bbk) } pp->bobFrame = 29 + FRAMES_JOE_XTRA + pp->actor->bobNum; } @@ -890,7 +891,7 @@ void Logic::playCutaway(const char *cutFile, char *next) { if (next == NULL) { next = nextFile; } - _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); + _vm->display()->clearTexts(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); Cutaway::run(cutFile, next, _vm); } @@ -943,10 +944,10 @@ void Logic::inventoryRefresh() { uint16 dstFrame = (itemNum != 0) ? 8 : 9; // unpack frame for object and draw it _vm->bankMan()->unpack(_itemData[itemNum].frame, dstFrame, 14); - _vm->graphics()->bobDrawInventoryItem(dstFrame, x, 14); + _vm->graphics()->drawInventoryItem(dstFrame, x, 14); } else { // no object, clear the panel - _vm->graphics()->bobDrawInventoryItem(0, x, 14); + _vm->graphics()->drawInventoryItem(0, x, 14); } x += 35; } @@ -1231,7 +1232,7 @@ void Logic::handleSpecialArea(Direction facing, uint16 areaNum, uint16 walkDataN void Logic::handlePinnacleRoom() { // camera does not follow Joe anymore _vm->graphics()->putCameraOnBob(-1); - roomDisplay(ROOM_JUNGLE_PINNACLE, RDM_NOFADE_JOE, 100, 2, true); + displayRoom(ROOM_JUNGLE_PINNACLE, RDM_NOFADE_JOE, 100, 2, true); BobSlot *joe = _vm->graphics()->bob(6); BobSlot *piton = _vm->graphics()->bob(7); @@ -1252,7 +1253,7 @@ void Logic::handlePinnacleRoom() { _vm->update(); _vm->display()->palFadeIn(0, 223, ROOM_JUNGLE_PINNACLE, joe->active, joe->x, joe->y); - _vm->graphics()->textCurrentColor(INK_PINNACLE_ROOM); + _vm->display()->textCurrentColor(INK_PINNACLE_ROOM); _entryObj = 0; uint16 prevObj = 0; @@ -1269,7 +1270,7 @@ void Logic::handlePinnacleRoom() { joe->x = piton->x = 3 * mx / 4 + 200; joe->frameNum = mx / 36 + 43 + FRAMES_JOE_XTRA; - _vm->graphics()->textClear(5, 5); + _vm->display()->clearTexts(5, 5); uint16 curObj = _vm->grid()->findObjectUnderCursor(mx, my); if (curObj != 0 && curObj != prevObj) { @@ -1280,7 +1281,7 @@ void Logic::handlePinnacleRoom() { _entryObj = objData->entryObj; char textCmd[CmdText::MAX_COMMAND_LEN]; sprintf(textCmd, "%s %s", verbName(VERB_WALK_TO), objectName(objData->name)); - _vm->graphics()->textSetCentered(5, textCmd); + _vm->display()->setTextCentered(5, textCmd); } prevObj = curObj; } @@ -1319,7 +1320,7 @@ void Logic::handlePinnacleRoom() { } joe->active = piton->active = false; - _vm->graphics()->textClear(5, 5); + _vm->display()->clearTexts(5, 5); // camera follows Joe again _vm->graphics()->putCameraOnBob(0); @@ -1533,7 +1534,7 @@ void Logic::sceneStop() { void Logic::changeRoom() { if (!preChangeRoom()) - roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 1, false); + displayRoom(currentRoom(), RDM_FADE_JOE, 100, 1, false); _vm->display()->showMouseCursor(true); } @@ -2200,12 +2201,12 @@ void Logic::stopCredits() { bool LogicDemo::preChangeRoom() { if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) { currentRoom(79); - roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); + displayRoom(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); playCutaway("clogo.cut"); sceneReset(); currentRoom(ROOM_HOTEL_LOBBY); entryObj(584); - roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 2, true); + displayRoom(currentRoom(), RDM_FADE_JOE, 100, 2, true); playCutaway("c70d.cut"); gameState(VAR_INTRO_PLAYED, 1); inventorySetup(); @@ -2219,7 +2220,7 @@ bool LogicDemo::preChangeRoom() { bool LogicInterview::preChangeRoom() { if (currentRoom() == 2 && gameState(2) == 0) { currentRoom(6); - roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); + displayRoom(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); playCutaway("start.cut"); gameState(2, 1); inventorySetup(); @@ -2235,7 +2236,7 @@ bool LogicGame::preChangeRoom() { handlePinnacleRoom(); return true; } else if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) { - roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); + displayRoom(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); playCutaway("copy.cut"); playCutaway("clogo.cut"); @@ -2252,7 +2253,7 @@ bool LogicGame::preChangeRoom() { sceneReset(); currentRoom(ROOM_HOTEL_LOBBY); entryObj(584); - roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 2, true); + displayRoom(currentRoom(), RDM_FADE_JOE, 100, 2, true); playCutaway("c70d.cut"); gameState(VAR_INTRO_PLAYED, 1); inventorySetup(); diff --git a/queen/logic.h b/queen/logic.h index e14c66269f..d9d929e6ec 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -138,9 +138,9 @@ public: const char *objectName(uint16 objNum) const { return _objName[objNum]; } const char *objectTextualDescription(uint16 objNum) const { return _objDescription[objNum]; } - void roomErase(); - void roomSetup(const char *room, int comPanel, bool inCutaway); - void roomDisplay(uint16 room, RoomDisplayMode mode, uint16 joeScale, int comPanel, bool inCutaway); + void eraseRoom(); + void setupRoom(const char *room, int comPanel, bool inCutaway); + void displayRoom(uint16 room, RoomDisplayMode mode, uint16 joeScale, int comPanel, bool inCutaway); int16 entryObj() const { return _entryObj; } void entryObj(int16 obj) { _entryObj = obj; } diff --git a/queen/queen.cpp b/queen/queen.cpp index 5d98730ae3..3133aecf24 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -233,7 +233,7 @@ void QueenEngine::go() { for (;;) { // queen.c lines 4080-4104 if (_logic->newRoom() > 0) { - _graphics->textClear(151, 151); + _display->clearTexts(151, 151); _logic->update(); _logic->oldRoom(_logic->currentRoom()); _logic->currentRoom(_logic->newRoom()); diff --git a/queen/talk.cpp b/queen/talk.cpp index 8688f6328d..3ce3a354bc 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -323,7 +323,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { if (_oldSelectedSentenceIndex > 0) selectedValue(_oldSelectedSentenceIndex, _oldSelectedSentenceValue); _vm->input()->talkQuitReset(); - _vm->graphics()->textClear(0, 198); + _vm->display()->clearTexts(0, 198); speak(_talkString[15], NULL, "JOE0015"); } else { @@ -1011,7 +1011,7 @@ void Talk::speakSegment( int startFrame = 0; if (_talkHead && isJoe) { - _vm->graphics()->bobSetText(bob, segment, textX, textY, color, true); + _vm->graphics()->setBobText(bob, segment, textX, textY, color, true); defaultAnimation(segment, isJoe, parameters, startFrame, bankNum); } else { @@ -1066,7 +1066,7 @@ void Talk::speakSegment( headStringAnimation(parameters, bobNum, bankNum); } - _vm->graphics()->bobSetText(bob, segment, textX, textY, color, _talkHead); + _vm->graphics()->setBobText(bob, segment, textX, textY, color, _talkHead); if (parameters->animation[0] != '\0' && parameters->animation[0] != 'E') { stringAnimation(parameters, startFrame, bankNum); @@ -1108,7 +1108,7 @@ void Talk::speakSegment( } // Moved here so that Text is cleared when a Torso command done! - _vm->graphics()->textClear(0,198); + _vm->display()->clearTexts(0,198); if (oracle) { uint16 frameNum = _vm->graphics()->personFrames(bobNum); @@ -1242,7 +1242,7 @@ int16 Talk::selectSentence() { // Change NORMAL_INK -> TALK_NORMAL_INK - _vm->graphics()->textCurrentColor(INK_TALK_NORMAL); + _vm->display()->textCurrentColor(INK_TALK_NORMAL); // These bobs are up and down arrows @@ -1275,7 +1275,7 @@ int16 Talk::selectSentence() { _vm->grid()->setZone(GS_PANEL, ARROW_ZONE_DOWN, MAX_TEXT_WIDTH + 1, 25, 319, 49); } - _vm->graphics()->textClear(151,199); + _vm->display()->clearTexts(151,199); int sentenceCount = 0; int yOffset = 1; @@ -1304,7 +1304,7 @@ int16 Talk::selectSentence() { for (j = 0; j < optionLines; j++) { if (yOffset < 5) { //debug(6, "Draw text '%s'", optionText[j]); - _vm->graphics()->textSet( + _vm->display()->setText( (j == 0) ? 0 : 24, 150 - PUSHUP + yOffset * LINE_HEIGHT, optionText[j]); @@ -1355,13 +1355,13 @@ int16 Talk::selectSentence() { if (zone > 0) { const Box *b = _vm->grid()->zone(GS_PANEL, zone); for (y = b->y1; y < b->y2; y += 10) - _vm->graphics()->textColor(150 + y, INK_JOE); + _vm->display()->textColor(150 + y, INK_JOE); } if (oldZone > 0) { const Box *b = _vm->grid()->zone(GS_PANEL, oldZone); for (y = b->y1; y < b->y2; y += 10) - _vm->graphics()->textColor(150 + y, INK_TALK_NORMAL); + _vm->display()->textColor(150 + y, INK_TALK_NORMAL); } oldZone = zone; @@ -1412,12 +1412,12 @@ int16 Talk::selectSentence() { arrowBobDown->active = false; if (selectedSentence > 0) { - _vm->graphics()->textClear(0,198); + _vm->display()->clearTexts(0, 198); speak(_talkString[selectedSentence], NULL, _joeVoiceFilePrefix[selectedSentence]); } - _vm->graphics()->textClear(151,151); + _vm->display()->clearTexts(151, 151); return selectedSentence; } diff --git a/queen/xref.txt b/queen/xref.txt index 22fb6eb9a0..610a863917 100644 --- a/queen/xref.txt +++ b/queen/xref.txt @@ -7,8 +7,8 @@ the ScummVM implementation. BANKS ===== erase() BankManager::close -freeallframes() BankManager::eraseAllFrames(true) -freeframes() BankManager::eraseAllFrames(false) +freeallframes() BankManager::eraseFrames(true) +freeframes() BankManager::eraseFrames(false) loadbank() BankManager::load overpack() BankManager::overpack unpack() BankManager::unpack @@ -119,24 +119,23 @@ VOLUME ? / ConfMan.("master_volume") GRAPHICS ======== -bob() Graphics::bobDraw -Box() Display::drawBox -CHECK_PARALLAX() Graphics::bobCustomParallax -clearallbobs() Graphics::bobClearAll -clearbob() Graphics::bobClear +bob() Graphics::drawBob +CHECK_PARALLAX() Graphics::handleParallax +clearallbobs() Graphics::clearBobs +clearbob() Graphics::clearBob DISP_OBJECTS() Graphics::setupRoomObjects -drawbobs() Graphics::bobDrawAll -invbob() Graphics::bobDrawInventoryItem +drawbobs() Graphics::drawBobs +invbob() Graphics::drawInventoryItem loadbackdrop() *not needed* (included in Display::setupNewRoom) loadpanel() Display::setupPanel -MAKE_SPEAK_BOB() Graphics::bobSetText +MAKE_SPEAK_BOB() Graphics::setBobText makeanim() BobSlot::animNormal movebob() BobSlot::move -pastebob() Graphics::bobPaste +pastebob() Graphics::pasteBob REDISP_OBJECT() Graphics::refreshObject requestor() -shrinkbob() Graphics::bobShrink -sortbobs() Graphics::bobSortAll +shrinkbob() Graphics::shrinkFrame +sortbobs() Graphics::sortBobs stringanim() BobSlot::animString - bobs Graphics::_bobs @@ -208,14 +207,14 @@ LOGIC ===== CHECK_PLAYER() QueenEngine::update CUTAWAY_SPECIAL() Logic::removeHotelItemsFromInventory -DISP_ROOM() Logic::roomDisplay +DISP_ROOM() Logic::displayRoom FIND_BOB() Logic::findBob FIND_FRAME() Logic::findFrame FIND_GRAPHIC() Logic::graphicData P3_COPY_FROM() Logic::objectCopy R_MAP() Logic::handlePinnacleRoom restart_game() -SETUP_BOBS() Graphics::bobSetupControl +SETUP_BOBS() Graphics::unpackControlBank / Graphics::setupMouseCursor SETUP_FURNITURE() Graphics::setupRoomFurniture SETUP_ROOM() Logic::changeRoom SETUP_SCREENS() *not needed* (only calls Display::setupPanel) @@ -290,6 +289,7 @@ tseek() *not needed* SCREEN ====== +Box() Display::drawBox calc_screen_scroll() Display::horizontalScrollUpdate changejoepal() Display::palSetJoe* check_colors() Display::palCustomColors @@ -377,15 +377,15 @@ TALK_SELECTED Logic::_talkSelected TEXTS ===== -blanktexts() Graphics::textClear -drawtext() Graphics::textDrawAll -Ink() Graphics::textCurrentColor -MIDDLE() Graphics::textCenterX / Graphics::textSetCentered -text() Graphics::textSet -textlen() Graphics::textWidth +blanktexts() Display::clearTexts +drawtext() Display::drawTexts +Ink() Display::textCurrentColor +MIDDLE() Display::textCenterX / Display::textSetCentered +text() Display::setText +textlen() Display::textWidth - -textcol Graphics::_curTextColor -texts Graphics::_texts +textcol Display::_curTextColor +texts Display::_texts WALK |