diff options
author | Nicola Mettifogo | 2007-03-12 19:58:10 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-12 19:58:10 +0000 |
commit | afc35317f743aa3e092a21619278afa99062fe3d (patch) | |
tree | f2da77991b244b0b12a63b06f0c84c41fbe460b4 /engines/parallaction | |
parent | 4c82e3ac239d946db9eac80a2736f88094062d35 (diff) | |
download | scummvm-rg350-afc35317f743aa3e092a21619278afa99062fe3d.tar.gz scummvm-rg350-afc35317f743aa3e092a21619278afa99062fe3d.tar.bz2 scummvm-rg350-afc35317f743aa3e092a21619278afa99062fe3d.zip |
The only uses for StaticCnv::_data2 were by Get and Door zones, so a new field has been added to those structure and _data2 has been deleted. Some graphic routines has been renamed to better reflect this change, too.
svn-id: r26107
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/defs.h | 1 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 41 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 9 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 1 | ||||
-rw-r--r-- | engines/parallaction/walk.cpp | 1 | ||||
-rw-r--r-- | engines/parallaction/zone.cpp | 21 | ||||
-rw-r--r-- | engines/parallaction/zone.h | 1 |
7 files changed, 36 insertions, 39 deletions
diff --git a/engines/parallaction/defs.h b/engines/parallaction/defs.h index f7ab9af1a4..6faad6ebd6 100644 --- a/engines/parallaction/defs.h +++ b/engines/parallaction/defs.h @@ -67,7 +67,6 @@ struct StaticCnv { uint16 _height; // byte* _data0; // bitmap byte* _data1; // unused - byte* _data2; // backup of underlying background }; diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 0596fe9321..8730bc30bb 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -571,31 +571,29 @@ void Graphics::blitCnv(StaticCnv *cnv, int16 x, int16 y, uint16 z, Graphics::Buf return; } - -void Graphics::backupCnvBackground(StaticCnv *cnv, int16 x, int16 y) { +void Graphics::backupDoorBackground(DoorData *data, int16 x, int16 y) { byte *s = _buffers[kBit2] + x + y * SCREEN_WIDTH; - byte *d = cnv->_data2; + byte *d = data->_background; - for (uint16 i = 0; i < cnv->_height ; i++) { - memcpy(d, s, cnv->_width); + for (uint16 i = 0; i < data->_cnv._height ; i++) { + memcpy(d, s, data->_cnv._width); s += SCREEN_WIDTH; - d += cnv->_width; + d += data->_cnv._width; } return; } +void Graphics::backupGetBackground(GetData *data, int16 x, int16 y) { -void Graphics::backupCnvBackgroundTransparent(StaticCnv *cnv, int16 x, int16 y) { - - byte *t = cnv->_data0; + byte *t = data->_cnv._data0; byte *s = _buffers[kBitBack] + x + y * SCREEN_WIDTH; - byte *d = cnv->_data2; + byte *d = data->_backup; - for (uint16 i = 0; i < cnv->_height ; i++) { - for (uint16 j = 0; j < cnv->_width ; j++) { + for (uint16 i = 0; i < data->_cnv._height ; i++) { + for (uint16 j = 0; j < data->_cnv._width ; j++) { *d = (*t) ? *s : 0; d++; @@ -603,25 +601,26 @@ void Graphics::backupCnvBackgroundTransparent(StaticCnv *cnv, int16 x, int16 y) s++; } - s += (SCREEN_WIDTH - cnv->_width); + s += (SCREEN_WIDTH - data->_cnv._width); } return; } - -// restores a cnv backup on the background // +// copies a rectangular bitmap on the background // -void Graphics::restoreCnvBackground(StaticCnv *cnv, int16 x, int16 y) { +void Graphics::restoreZoneBackground(byte *data, int16 x, int16 y, uint16 w, uint16 h) { - byte *temp = cnv->_data0; - cnv->_data0 = cnv->_data2; + StaticCnv cnv; - flatBlitCnv(cnv, x, y, kBitBack, cnv->_data1); - flatBlitCnv(cnv, x, y, kBit2, cnv->_data1); + cnv._data0 = data; + cnv._data1 = NULL; + cnv._width = w; + cnv._height = h; - cnv->_data0 = temp; + flatBlitCnv(&cnv, x, y, kBitBack, cnv._data1); + flatBlitCnv(&cnv, x, y, kBit2, cnv._data1); return; } diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index f338c91ccf..a2e248af0b 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -61,6 +61,9 @@ extern byte _palette[]; class Parallaction; +struct DoorData; +struct GetData; + class Graphics { public: @@ -90,9 +93,9 @@ public: void makeCnvFromString(StaticCnv *cnv, char *text); void freeCnv(Cnv *cnv); void freeStaticCnv(StaticCnv *cnv); - void backupCnvBackground(StaticCnv *cnv, int16 x, int16 y); - void backupCnvBackgroundTransparent(StaticCnv *cnv, int16 x, int16 y); - void restoreCnvBackground(StaticCnv *cnv, int16 x, int16 y); + void backupDoorBackground(DoorData *data, int16 x, int16 y); + void backupGetBackground(GetData *data, int16 x, int16 y); + void restoreZoneBackground(byte *data, int16 x, int16 y, uint16 w, uint16 h); // location void setBackground(byte *background); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index f122ea0d3f..020b143e44 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -236,7 +236,6 @@ int Parallaction::init() { _yourHead._height = 0; _yourHead._data0 = NULL; _yourHead._data1 = NULL; - _yourHead._data2 = NULL; _yourself._zone.pos._position._x = 150; _yourself._zone.pos._position._y = 100; diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index e994806728..03910bdc55 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -392,7 +392,6 @@ void jobWalk(void *parm, Job *j) { // v14._height = _yourself._cnv._height; // v14._data0 = _yourself._cnv._array[_yourself._frame]; // v14._data1 = _yourself._cnv.field_8[_yourself._frame]; -// v14._data2 = &_yourself.field_54; if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_yourself._cnv._width/2 + _si + 2, _yourself._cnv._height + _di) != 0)) { // printf("walk right\n"); diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index bfb730b856..b537ad7c1e 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -169,7 +169,7 @@ void freeZones(Node *list) { break; case kZoneGet: - free(z->u.get->_cnv._data2); + free(z->u.get->_backup); _vm->_graphics->freeStaticCnv(&z->u.get->_cnv); free(z->u.get); break; @@ -293,8 +293,8 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) { // _ax = (z->_flags & kFlagsClosed ? 0 : 1); // vE0._data1 = doorcnv->field_8[_ax]; - vE0._data2 = u->door->_background = (byte*)malloc(vE0._width*vE0._height); - _graphics->backupCnvBackground(&vE0, z->_limits._left, z->_limits._top); + u->door->_background = (byte*)malloc(vE0._width*vE0._height); + _graphics->backupDoorBackground(u->door, z->_limits._left, z->_limits._top); _graphics->flatBlitCnv(&vE0, z->_limits._left, z->_limits._top, Graphics::kBitBack, vE0._data1); } @@ -311,10 +311,10 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) { StaticCnv *vE4 = &u->get->_cnv; strcpy(vC8, _tokens[1]); _disk->loadStatic(vC8, vE4); - vE4->_data2 = (byte*)malloc(vE4->_width*vE4->_height); + u->get->_backup = (byte*)malloc(vE4->_width*vE4->_height); if ((z->_flags & kFlagsRemove) == 0) { - _graphics->backupCnvBackgroundTransparent(vE4, z->_limits._left, z->_limits._top); + _graphics->backupGetBackground(u->get, z->_limits._left, z->_limits._top); _graphics->flatBlitCnv(vE4, z->_limits._left, z->_limits._top, Graphics::kBitBack, vE4->_data1); } } @@ -371,7 +371,6 @@ void displayCharacterComment(ExamineData *data) { v3C._height = _yourTalk._height; v3C._data0 = _yourTalk._array[0]; v3C._data1 = NULL; //_yourTalk.field_8[0]; - v3C._data2 = NULL; _vm->_graphics->setFont("comic"); _vm->_graphics->flatBlitCnv(&v3C, 190, 80, Graphics::kBitFront, v3C._data1); @@ -485,12 +484,10 @@ void jobToggleDoor(void *parm, Job *j) { StaticCnv v14; if (v18) { - v14._data2 = z->u.door->_background; -// v4 = &z->u.door._background; - v14._width = v18->_width; v14._height = v18->_height; - _vm->_graphics->restoreCnvBackground(&v14, z->_limits._left, z->_limits._top); + + _vm->_graphics->restoreZoneBackground(z->u.door->_background, z->_limits._left, z->_limits._top, v18->_width, v18->_height); uint16 _ax = (z->_flags & kFlagsClosed ? 0 : 1); @@ -525,7 +522,7 @@ void jobRemovePickedItem(void *parm, Job *j) { static uint16 count = 0; if (z->u.get->_cnv._width != 0) { - _vm->_graphics->restoreCnvBackground(&z->u.get->_cnv, z->_limits._left, z->_limits._top); + _vm->_graphics->restoreZoneBackground(z->u.get->_backup, z->_limits._left, z->_limits._top, z->u.get->_cnv._width, z->u.get->_cnv._height); } count++; @@ -544,7 +541,7 @@ void jobDisplayDroppedItem(void *parm, Job *j) { if (&z->u.get->_cnv != NULL) { if (z->u.get->_cnv._data0 != NULL) { - _vm->_graphics->backupCnvBackgroundTransparent(&z->u.get->_cnv, z->_limits._left, z->_limits._top); + _vm->_graphics->backupGetBackground(z->u.get, z->_limits._left, z->_limits._top); } _vm->_graphics->flatBlitCnv(&z->u.get->_cnv, z->_limits._left, z->_limits._top, Graphics::kBitBack, z->u.get->_cnv._data1); diff --git a/engines/parallaction/zone.h b/engines/parallaction/zone.h index a3bb372b81..c7158e1821 100644 --- a/engines/parallaction/zone.h +++ b/engines/parallaction/zone.h @@ -78,6 +78,7 @@ struct Question { struct GetData { // size = 24 uint32 _icon; StaticCnv _cnv; + byte *_backup; uint16 field_14; // unused uint16 field_16; // unused }; |