From 7f99a190cbc82ae05d1a4ab6cd6227144c417f85 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sun, 15 Mar 2009 09:29:25 +0000 Subject: Fix loading objects in the Amiga version of BRA. svn-id: r39413 --- engines/parallaction/disk.h | 10 +++++----- engines/parallaction/disk_br.cpp | 27 ++++++++++++++++++++++++--- engines/parallaction/disk_ns.cpp | 4 ++-- engines/parallaction/inventory.cpp | 12 ++++++------ engines/parallaction/parallaction_br.cpp | 2 +- 5 files changed, 38 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 9c82fd958c..70680f783a 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -66,7 +66,7 @@ public: virtual Script* loadLocation(const char *name) = 0; virtual Script* loadScript(const char* name) = 0; virtual GfxObj* loadTalk(const char *name) = 0; - virtual GfxObj* loadObjects(const char *name) = 0; + virtual GfxObj* loadObjects(const char *name, uint8 part = 0) = 0; virtual Frames* loadPointer(const char *name) = 0; virtual GfxObj* loadHead(const char* name) = 0; virtual Font* loadFont(const char* name) = 0; @@ -130,7 +130,7 @@ public: Script* loadLocation(const char *name); Script* loadScript(const char* name); GfxObj* loadTalk(const char *name); - GfxObj* loadObjects(const char *name); + GfxObj* loadObjects(const char *name, uint8 part = 0); Frames* loadPointer(const char *name); GfxObj* loadHead(const char* name); Font* loadFont(const char* name); @@ -166,7 +166,7 @@ public: Script* loadLocation(const char *name); Script* loadScript(const char* name); GfxObj* loadTalk(const char *name); - GfxObj* loadObjects(const char *name); + GfxObj* loadObjects(const char *name, uint8 part = 0); Frames* loadPointer(const char *name); GfxObj* loadHead(const char* name); Font* loadFont(const char* name); @@ -222,7 +222,7 @@ public: Script* loadLocation(const char *name); Script* loadScript(const char* name); GfxObj* loadTalk(const char *name); - GfxObj* loadObjects(const char *name); + GfxObj* loadObjects(const char *name, uint8 part = 0); Frames* loadPointer(const char *name); GfxObj* loadHead(const char* name); Font* loadFont(const char* name); @@ -264,7 +264,7 @@ public: Frames* loadFrames(const char* name); void loadSlide(BackgroundInfo& info, const char *filename); void loadScenery(BackgroundInfo& info, const char* name, const char* mask, const char* path); - GfxObj* loadObjects(const char *name); + GfxObj* loadObjects(const char *name, uint8 part = 0); Common::SeekableReadStream* loadMusic(const char* name); Common::ReadStream* loadSound(const char* name); Common::String selectArchive(const Common::String& name); diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index 6ed57f0f50..6915c63c27 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -249,7 +249,7 @@ Font* DosDisk_br::loadFont(const char* name) { } -GfxObj* DosDisk_br::loadObjects(const char *name) { +GfxObj* DosDisk_br::loadObjects(const char *name, uint8 part) { debugC(5, kDebugDisk, "DosDisk_br::loadObjects"); Common::SeekableReadStream *stream = openFile(name); GfxObj *obj = createInventoryObjects(*stream); @@ -607,7 +607,11 @@ Common::ReadStream* AmigaDisk_br::loadSound(const char* name) { return openFile("sfx/" + Common::String(name), ".sfx"); } -GfxObj* AmigaDisk_br::loadObjects(const char *name) { +static const uint16 objectsMax[5] = { + 5, 73, 71, 19, 48 +}; + +GfxObj* AmigaDisk_br::loadObjects(const char *name, uint8 part) { debugC(5, kDebugDisk, "AmigaDisk_br::loadObjects"); Common::SeekableReadStream *stream = openFile(name); @@ -621,7 +625,24 @@ GfxObj* AmigaDisk_br::loadObjects(const char *name) { delete stream; free(pal); - return new GfxObj(0, new SurfaceToFrames(surf)); + uint16 max = objectsMax[part]; + byte *data = new byte[max * 2601]; + + // Convert to the expected display format + for (int i = 0; i < max; i++) { + uint16 x = (i % 8) * 51; + uint16 y = (i / 8) * 51; + + byte *src = (byte *)surf->getBasePtr(x, y); + byte *dst = data + i * 2601; + for (int h = 0; h < 51; h++) { + memcpy(dst, src, 51); + src += surf->w; + dst += 51; + } + } + + return new GfxObj(0, new Cnv(max, 51, 51, data, true)); } Common::String AmigaDisk_br::selectArchive(const Common::String& name) { diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index beb0db4f22..5c27e6c488 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -371,7 +371,7 @@ Font* DosDisk_ns::loadFont(const char* name) { } -GfxObj* DosDisk_ns::loadObjects(const char *name) { +GfxObj* DosDisk_ns::loadObjects(const char *name, uint8 part) { char path[PATH_LEN]; sprintf(path, "%sobj", name); return new GfxObj(0, loadExternalCnv(path), name); @@ -1154,7 +1154,7 @@ GfxObj* AmigaDisk_ns::loadHead(const char* name) { } -GfxObj* AmigaDisk_ns::loadObjects(const char *name) { +GfxObj* AmigaDisk_ns::loadObjects(const char *name, uint8 part) { debugC(1, kDebugDisk, "AmigaDisk_ns::loadObjects"); char path[PATH_LEN]; diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index 6b1579fa8d..b701f12ac1 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -66,9 +66,9 @@ InventoryProperties _invProps_NS = { 24, // INVENTORYITEM_WIDTH 24, // INVENTORYITEM_HEIGHT 30, // INVENTORY_MAX_ITEMS - 5, // INVENTORY_ITEMS_PER_LINE - 6, // INVENTORY_LINES - 5 * 24, // INVENTORY_WIDTH =(INVENTORY_ITEMS_PER_LINE*INVENTORYITEM_WIDTH) + 5, // INVENTORY_ITEMS_PER_LINE + 6, // INVENTORY_LINES + 5 * 24, // INVENTORY_WIDTH =(INVENTORY_ITEMS_PER_LINE*INVENTORYITEM_WIDTH) 6 * 24 // INVENTORY_HEIGHT = (INVENTORY_LINES*INVENTORYITEM_HEIGHT) }; @@ -77,10 +77,10 @@ InventoryProperties _invProps_BR = { 51, // INVENTORYITEM_WIDTH 51, // INVENTORYITEM_HEIGHT 48, // INVENTORY_MAX_ITEMS - 6, // INVENTORY_ITEMS_PER_LINE - 8, // INVENTORY_LINES + 6, // INVENTORY_ITEMS_PER_LINE + 8, // INVENTORY_LINES 6 * 51, // INVENTORY_WIDTH =(INVENTORY_ITEMS_PER_LINE*INVENTORYITEM_WIDTH) - 8 * 51 // INVENTORY_HEIGHT = (INVENTORY_LINES*INVENTORYITEM_HEIGHT) + 8 * 51 // INVENTORY_HEIGHT = (INVENTORY_LINES*INVENTORYITEM_HEIGHT) }; int16 Parallaction::getHoverInventoryItem(int16 x, int16 y) { diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index 190df55466..54b91896d3 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -261,7 +261,7 @@ void Parallaction_br::changeLocation() { if (getPlatform() == Common::kPlatformPC) { _objects = _disk->loadObjects("icone.ico"); } else { - _objects = _disk->loadObjects("icons.ico"); + _objects = _disk->loadObjects("icons.ico", _part); } parseLocation("common.slf"); -- cgit v1.2.3