diff options
author | Nicola Mettifogo | 2007-03-18 21:15:39 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-18 21:15:39 +0000 |
commit | 0bc056aee3a32de9df83d1e12417a2ae7d854651 (patch) | |
tree | cc6113782d972955497d3ef1c53c4176440a9337 /engines/parallaction | |
parent | 992f5357243a8ff80316ca2efbfa2e7dab31b7b0 (diff) | |
download | scummvm-rg350-0bc056aee3a32de9df83d1e12417a2ae7d854651.tar.gz scummvm-rg350-0bc056aee3a32de9df83d1e12417a2ae7d854651.tar.bz2 scummvm-rg350-0bc056aee3a32de9df83d1e12417a2ae7d854651.zip |
Made loadStatic return a new StaticCnv instead of accepting a parameter. All disk functions now accept only a resource name as their parameter.
svn-id: r26232
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/disk.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/disk.h | 2 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/zone.cpp | 30 | ||||
-rw-r--r-- | engines/parallaction/zone.h | 6 |
5 files changed, 29 insertions, 23 deletions
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index 752590bf0a..d5701f179e 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -340,7 +340,7 @@ Cnv* Disk::loadObjects(const char *name) { } -void Disk::loadStatic(const char* name, StaticCnv* cnv) { +StaticCnv* Disk::loadStatic(const char* name) { char path[PATH_LEN]; @@ -351,6 +351,8 @@ void Disk::loadStatic(const char* name, StaticCnv* cnv) { errorFileNotFound(path); } + StaticCnv* cnv = new StaticCnv; + _archive.skip(1); cnv->_width = _archive.readByte(); cnv->_height = _archive.readByte(); @@ -366,7 +368,7 @@ void Disk::loadStatic(const char* name, StaticCnv* cnv) { decompressChunk(compressed, cnv->_data0, size); free(compressed); - return; + return cnv; } Cnv* Disk::loadFrames(const char* name) { diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 43b68317dc..ea342fa190 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -110,7 +110,7 @@ public: StaticCnv* loadPointer(); StaticCnv* loadHead(const char* name); Cnv* loadFont(const char* name); - void loadStatic(const char* name, StaticCnv* cnv); + StaticCnv* loadStatic(const char* name); Cnv* loadFrames(const char* name); void loadSlide(const char *filename); void loadScenery(const char* background, const char* mask); diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index afafa46897..ba4954d163 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -533,12 +533,12 @@ void Gfx::backupDoorBackground(DoorData *data, int16 x, int16 y) { void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) { - byte *t = data->_cnv._data0; + byte *t = data->_cnv->_data0; byte *s = _buffers[kBitBack] + x + y * SCREEN_WIDTH; byte *d = data->_backup; - for (uint16 i = 0; i < data->_cnv._height ; i++) { - for (uint16 j = 0; j < data->_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++; @@ -546,7 +546,7 @@ void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) { s++; } - s += (SCREEN_WIDTH - data->_cnv._width); + s += (SCREEN_WIDTH - data->_cnv->_width); } return; diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index 78182360cd..b81edaa56f 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -165,7 +165,9 @@ void Parallaction::freeZones(Node *list) { case kZoneGet: free(z->u.get->_backup); - _vm->_gfx->freeStaticCnv(&z->u.get->_cnv); + _vm->_gfx->freeStaticCnv(z->u.get->_cnv); + if (z->u.get->_cnv) + delete z->u.get->_cnv; delete z->u.get; break; @@ -296,14 +298,13 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) { case kZoneGet: // get Zone init if (!scumm_stricmp(_tokens[0], "file")) { - StaticCnv *vE4 = &u->get->_cnv; strcpy(vC8, _tokens[1]); - _disk->loadStatic(vC8, vE4); - u->get->_backup = (byte*)malloc(vE4->_width*vE4->_height); + u->get->_cnv = _disk->loadStatic(vC8); + u->get->_backup = (byte*)malloc(u->get->_cnv->_width*u->get->_cnv->_height); if ((z->_flags & kFlagsRemove) == 0) { _gfx->backupGetBackground(u->get, z->_left, z->_top); - _gfx->flatBlitCnv(vE4, z->_left, z->_top, Gfx::kBitBack); + _gfx->flatBlitCnv(u->get->_cnv, z->_left, z->_top, Gfx::kBitBack); } } @@ -392,9 +393,10 @@ void displayItemComment(ExamineData *data) { char v68[PATH_LEN]; strcpy(v68, data->_filename); - _vm->_disk->loadStatic(v68, &data->_cnv); - _vm->_gfx->flatBlitCnv(&data->_cnv, 140, (SCREEN_HEIGHT - data->_cnv._height)/2, Gfx::kBitFront); - _vm->_gfx->freeStaticCnv(&data->_cnv); + data->_cnv = _vm->_disk->loadStatic(v68); + _vm->_gfx->flatBlitCnv(data->_cnv, 140, (SCREEN_HEIGHT - data->_cnv->_height)/2, Gfx::kBitFront); + _vm->_gfx->freeStaticCnv(data->_cnv); + delete data->_cnv; int16 v6A = 0, v6C = 0; @@ -514,8 +516,8 @@ void jobRemovePickedItem(void *parm, Job *j) { static uint16 count = 0; - if (z->u.get->_cnv._width != 0) { - Common::Rect r(z->_left, z->_top, z->_left + z->u.get->_cnv._width, z->_top + z->u.get->_cnv._height); + if (z->u.get->_cnv) { + Common::Rect r(z->_left, z->_top, z->_left + z->u.get->_cnv->_width, z->_top + z->u.get->_cnv->_height); _vm->_gfx->restoreZoneBackground(r, z->u.get->_backup); } @@ -534,13 +536,13 @@ void jobDisplayDroppedItem(void *parm, Job *j) { Zone *z = (Zone*)parm; - if (&z->u.get->_cnv != NULL) { - if (z->u.get->_cnv._data0 != NULL) { + if (z->u.get->_cnv) { + if (z->u.get->_cnv->_data0 != NULL) { _vm->_gfx->backupGetBackground(z->u.get, z->_left, z->_top); } - _vm->_gfx->flatBlitCnv(&z->u.get->_cnv, z->_left, z->_top, Gfx::kBitBack); - _vm->_gfx->flatBlitCnv(&z->u.get->_cnv, z->_left, z->_top, Gfx::kBit2); + _vm->_gfx->flatBlitCnv(z->u.get->_cnv, z->_left, z->_top, Gfx::kBitBack); + _vm->_gfx->flatBlitCnv(z->u.get->_cnv, z->_left, z->_top, Gfx::kBit2); } j->_count++; diff --git a/engines/parallaction/zone.h b/engines/parallaction/zone.h index c9d53d2f20..87b421a9b3 100644 --- a/engines/parallaction/zone.h +++ b/engines/parallaction/zone.h @@ -91,7 +91,7 @@ struct Question { struct GetData { // size = 24 uint32 _icon; - StaticCnv _cnv; + StaticCnv *_cnv; byte *_backup; uint16 field_14; // unused uint16 field_16; // unused @@ -99,6 +99,7 @@ struct GetData { // size = 24 GetData() { _icon = 0; _backup = NULL; + _cnv = NULL; } }; struct SpeakData { // size = 36 @@ -111,7 +112,7 @@ struct SpeakData { // size = 36 } }; struct ExamineData { // size = 28 - StaticCnv _cnv; + StaticCnv *_cnv; uint16 _opBase; // unused uint16 field_12; // unused char* _description; @@ -121,6 +122,7 @@ struct ExamineData { // size = 28 _opBase = 0; _description = NULL; _filename = NULL; + _cnv = NULL; } }; struct DoorData { // size = 28 |