diff options
author | Gregory Montoir | 2010-04-25 21:53:09 +0000 |
---|---|---|
committer | Gregory Montoir | 2010-04-25 21:53:09 +0000 |
commit | 8260919bad48eb35ed0634df0d21d5d63d5c09b6 (patch) | |
tree | 698551cad396078493f2dfd962976e4f5ebd25fb /engines/queen | |
parent | f334ecfa34cf6425a40453672c4a3267b0913f2b (diff) | |
download | scummvm-rg350-8260919bad48eb35ed0634df0d21d5d63d5c09b6.tar.gz scummvm-rg350-8260919bad48eb35ed0634df0d21d5d63d5c09b6.tar.bz2 scummvm-rg350-8260919bad48eb35ed0634df0d21d5d63d5c09b6.zip |
get rid of global Box objects and remove obsoleted PALMOS_ARM defines.
svn-id: r48800
Diffstat (limited to 'engines/queen')
-rw-r--r-- | engines/queen/command.cpp | 2 | ||||
-rw-r--r-- | engines/queen/cutaway.cpp | 4 | ||||
-rw-r--r-- | engines/queen/graphics.cpp | 56 | ||||
-rw-r--r-- | engines/queen/graphics.h | 11 |
4 files changed, 23 insertions, 50 deletions
diff --git a/engines/queen/command.cpp b/engines/queen/command.cpp index 5a12aeffa1..543cd15772 100644 --- a/engines/queen/command.cpp +++ b/engines/queen/command.cpp @@ -1131,7 +1131,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()->bob(bobNum)->clear(); + _vm->graphics()->clearBob(bobNum); } } } diff --git a/engines/queen/cutaway.cpp b/engines/queen/cutaway.cpp index 541fb34127..6b08dd8d63 100644 --- a/engines/queen/cutaway.cpp +++ b/engines/queen/cutaway.cpp @@ -1048,7 +1048,7 @@ void Cutaway::stop() { ObjectData *from = _vm->logic()->objectData(fromIndex); if (object->image && !from->image && bobIndex && _vm->logic()->currentRoom() == object->room) - _vm->graphics()->bob(bobIndex)->clear(); + _vm->graphics()->clearBob(bobIndex); } if (_vm->logic()->currentRoom() == room) @@ -1076,7 +1076,7 @@ void Cutaway::stop() { int objectFrame = _vm->logic()->findFrame(objectIndex); if (objectFrame == 1000) { - _vm->graphics()->bob(bobIndex)->clear(); + _vm->graphics()->clearBob(bobIndex); } else if (objectFrame) { _vm->bankMan()->unpack(ABS(frame), objectFrame, bank); pbs->frameNum = objectFrame; diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp index c4f25d815d..17e36b1d90 100644 --- a/engines/queen/graphics.cpp +++ b/engines/queen/graphics.cpp @@ -36,8 +36,6 @@ namespace Queen { -const Box BobSlot::_defaultBox(-1, -1, -1, -1); - void BobSlot::curPos(int16 xx, int16 yy) { active = true; x = xx; @@ -177,22 +175,14 @@ void BobSlot::scaleWalkSpeed(uint16 ms) { } } -void BobSlot::clear() { +void BobSlot::clear(const Box *defaultBox) { active = false; xflip = false; animating = false; anim.string.buffer = NULL; moving = false; scale = 100; - -#ifdef PALMOS_ARM - Box *tmp = (Box *)&_defaultBox; - tmp->x1 = -1; - tmp->y1 = -1; - tmp->x2 = -1; - tmp->y2 = -1; -#endif - box = _defaultBox; + box = *defaultBox; } static int compareBobDrawOrder(const void *a, const void *b) { @@ -208,33 +198,15 @@ static int compareBobDrawOrder(const void *a, const void *b) { return d; } -const Box Graphics::_gameScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, ROOM_ZONE_HEIGHT - 1); -const Box Graphics::_fullScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, GAME_SCREEN_HEIGHT - 1); - Graphics::Graphics(QueenEngine *vm) - : _cameraBob(0), _vm(vm) { + : _cameraBob(0), _vm(vm), + _defaultBox(-1, -1, -1, -1), + _gameScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, ROOM_ZONE_HEIGHT - 1), + _fullScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, GAME_SCREEN_HEIGHT - 1) { memset(_bobs, 0, sizeof(_bobs)); memset(_sortedBobs, 0, sizeof(_sortedBobs)); _sortedBobsCount = 0; _shrinkBuffer.data = new uint8[ BOB_SHRINK_BUF_SIZE ]; - -#ifdef PALMOS_ARM - Box *tmp1 = (Box *)&BobSlot::_defaultBox; - tmp1->x1 = -1; - tmp1->y1 = -1; - tmp1->x2 = -1; - tmp1->y2 = -1; - Box *tmp2 = (Box *)&_gameScreenBox; - tmp2->x1 = 0; - tmp2->y1 = 0; - tmp2->x2 = GAME_SCREEN_WIDTH - 1; - tmp2->y2 = ROOM_ZONE_HEIGHT - 1; - Box *tmp3 = (Box *)&_fullScreenBox; - tmp3->x1 = 0; - tmp3->y1 = 0; - tmp3->x2 = GAME_SCREEN_WIDTH - 1; - tmp3->y2 = GAME_SCREEN_HEIGHT - 1; -#endif } Graphics::~Graphics() { @@ -329,7 +301,7 @@ void Graphics::drawBob(const BobSlot *bs, const BobFrame *bf, const Box *bbox, i w = bf->width; h = bf->height; - const Box *box = (bs->box == BobSlot::_defaultBox) ? bbox : &bs->box; + const Box *box = (bs->box == _defaultBox) ? bbox : &bs->box; if (w != 0 && h != 0 && box->intersects(x, y, w, h)) { uint8 *src = bf->data; @@ -473,7 +445,7 @@ void Graphics::drawBobs() { void Graphics::clearBobs() { for (int32 i = 0; i < ARRAYSIZE(_bobs); ++i) { - _bobs[i].clear(); + _bobs[i].clear(&_defaultBox); } } @@ -879,7 +851,7 @@ uint16 Graphics::refreshObject(uint16 obj) { if (pod->image == -3 || pod->image == -4) { // a person object if (pod->name <= 0) { - pbs->clear(); + pbs->clear(&_defaultBox); } else { // find person number uint16 pNum = _vm->logic()->findPersonNumber(obj, _vm->logic()->currentRoom()); @@ -897,7 +869,7 @@ uint16 Graphics::refreshObject(uint16 obj) { if (pod->name < 0 || pod->image < 0) { // object is hidden or disabled - pbs->clear(); + pbs->clear(&_defaultBox); return curImage; } @@ -1072,7 +1044,7 @@ void Graphics::setupRoomObjects() { // static objects curBob = 20 + _numFurnitureStatic + numObjectStatic; ++curImage; - bob(curBob)->clear(); + bob(curBob)->clear(&_defaultBox); _vm->bankMan()->unpack(pgd->firstFrame, curImage, 15); ++_numFrames; if (pod->name > 0) { @@ -1180,16 +1152,16 @@ void BamScene::playSfx() { } void BamScene::prepareAnimation() { + _vm->graphics()->clearBob(BOB_OBJ1); _obj1 = _vm->graphics()->bob(BOB_OBJ1); - _obj1->clear(); _obj1->active = true; + _vm->graphics()->clearBob(BOB_OBJ2); _obj2 = _vm->graphics()->bob(BOB_OBJ2); - _obj2->clear(); _obj2->active = true; + _vm->graphics()->clearBob(BOB_FX); _objfx = _vm->graphics()->bob(BOB_FX); - _objfx->clear(); _objfx->active = true; _index = 0; diff --git a/engines/queen/graphics.h b/engines/queen/graphics.h index 7eadf9a191..ad9a728cfe 100644 --- a/engines/queen/graphics.h +++ b/engines/queen/graphics.h @@ -86,9 +86,7 @@ struct BobSlot { void scaleWalkSpeed(uint16 ms); - void clear(); - - static const Box _defaultBox; + void clear(const Box *defaultBox); }; class QueenEngine; @@ -135,6 +133,8 @@ public: //! returns a reference to the specified bob BobSlot *bob(int index); + void clearBob(int index) { bob(index)->clear(&_defaultBox); } + //! display a text 'near' the specified bob void setBobText(const BobSlot *bob, const char *text, int textX, int textY, int color, int flags); @@ -219,8 +219,9 @@ private: QueenEngine *_vm; - static const Box _gameScreenBox; - static const Box _fullScreenBox; + const Box _defaultBox; + const Box _gameScreenBox; + const Box _fullScreenBox; }; class BamScene { |