diff options
-rw-r--r-- | engines/parallaction/disk.h | 1 | ||||
-rw-r--r-- | engines/parallaction/disk_br.cpp | 63 | ||||
-rw-r--r-- | engines/parallaction/exec_br.cpp | 24 |
3 files changed, 60 insertions, 28 deletions
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 77fc7764c9..6dbf6150df 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -209,6 +209,7 @@ protected: void errorFileNotFound(const char *s); Font *createFont(const char *name, Common::ReadStream &stream); Sprites* createSprites(const char *name); + void loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette); public: DosDisk_br(Parallaction *vm); diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index 69d28d57c2..b9e85b5ca9 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -180,6 +180,21 @@ Frames* DosDisk_br::loadHead(const char* name) { return 0; } +void DosDisk_br::loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette) { + stream.skip(4); + uint width = stream.readUint32BE(); + uint height = stream.readUint32BE(); + stream.skip(20); + + if (palette) { + stream.read(palette, 768); + } else { + stream.skip(768); + } + + surf.create(width, height, 1); + stream.read(surf.pixels, width * height); +} Frames* DosDisk_br::loadPointer(const char *name) { debugC(5, kDebugDisk, "DosDisk_br::loadPointer"); @@ -191,17 +206,8 @@ Frames* DosDisk_br::loadPointer(const char *name) { if (!stream.open(path)) errorFileNotFound(path); - stream.skip(4); - uint width = stream.readUint32BE(); - uint height = stream.readUint32BE(); - stream.skip(20); - stream.skip(768); - Graphics::Surface *surf = new Graphics::Surface; - - surf->create(width, height, 1); - stream.read(surf->pixels, width * height); - + loadBitmap(stream, *surf, 0); return new SurfaceToFrames(surf); } @@ -231,7 +237,17 @@ void genSlidePath(char *path, const char* name) { Frames* DosDisk_br::loadStatic(const char* name) { debugC(5, kDebugDisk, "DosDisk_br::loadStatic"); - return 0; + + char path[PATH_LEN]; + sprintf(path, "%s/ras/%s", _partPath, name); + Common::File stream; + if (!stream.open(path)) { + errorFileNotFound(path); + } + + Graphics::Surface *surf = new Graphics::Surface; + loadBitmap(stream, *surf, 0); + return new SurfaceToFrames(surf); } Sprites* DosDisk_br::createSprites(const char *path) { @@ -284,21 +300,16 @@ void DosDisk_br::loadSlide(BackgroundInfo& info, const char *name) { if (!stream.open(path)) errorFileNotFound(path); - stream.skip(4); - info.width = stream.readUint32BE(); - info.height = stream.readUint32BE(); - stream.skip(20); - byte rgb[768]; - stream.read(rgb, 768); + + loadBitmap(stream, info.bg, rgb); + info.width = info.bg.w; + info.height = info.bg.h; for (uint i = 0; i < 256; i++) { info.palette.setEntry(i, rgb[i] >> 2, rgb[i+256] >> 2, rgb[i+512] >> 2); } - info.bg.create(info.width, info.height, 1); - stream.read(info.bg.pixels, info.width * info.height); - return; } @@ -313,20 +324,16 @@ void DosDisk_br::loadScenery(BackgroundInfo& info, const char *name, const char if (!stream.open(filename)) errorFileNotFound(filename); - stream.skip(4); - info.width = stream.readUint32BE(); - info.height = stream.readUint32BE(); - stream.skip(20); - byte rgb[768]; - stream.read(rgb, 768); + + loadBitmap(stream, info.bg, rgb); + info.width = info.bg.w; + info.height = info.bg.h; for (uint i = 0; i < 256; i++) { info.palette.setEntry(i, rgb[i] >> 2, rgb[i+256] >> 2, rgb[i+512] >> 2); } - info.bg.create(info.width, info.height, 1); - stream.read(info.bg.pixels, info.width * info.height); stream.close(); } diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index 325fb97f67..b4aa25a57d 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -294,11 +294,35 @@ DECLARE_COMMAND_OPCODE(offsave) { DECLARE_INSTRUCTION_OPCODE(on) { warning("Parallaction_br::instOp_on not yet implemented"); + + Instruction *inst = *_instRunCtxt.inst; + Zone *z = inst->_z; + + if (z) { + z->_flags |= kFlagsActive; + z->_flags &= ~kFlagsRemove; + + if ((z->_type & 0xFFFF) & kZoneGet) { + _gfx->showGfxObj(z->u.get->gfxobj, true); + } + } + } DECLARE_INSTRUCTION_OPCODE(off) { warning("Parallaction_br::instOp_off not yet implemented"); + + Instruction *inst = *_instRunCtxt.inst; + Zone *z = inst->_z; + + if (z) { + z->_flags |= kFlagsRemove; + + if ((z->_type & 0xFFFF) & kZoneGet) { + _gfx->showGfxObj(z->u.get->gfxobj, false); + } + } } |