2007-03-02 21:50:36 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2006 The ScummVM project
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "parallaction/defs.h"
|
|
|
|
#include "parallaction/graphics.h"
|
|
|
|
#include "parallaction/parallaction.h"
|
|
|
|
#include "parallaction/disk.h"
|
2007-03-12 22:52:27 +00:00
|
|
|
#include "parallaction/walk.h"
|
2007-03-02 21:50:36 +00:00
|
|
|
|
|
|
|
namespace Parallaction {
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
|
|
|
|
Disk::Disk(Parallaction *vm) : _vm(vm) {
|
2007-03-04 13:27:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Disk::~Disk() {
|
2007-03-24 17:14:04 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Disk::selectArchive(const char *name) {
|
|
|
|
_archive.open(name);
|
2007-03-04 13:27:29 +00:00
|
|
|
}
|
|
|
|
|
2007-03-11 16:53:20 +00:00
|
|
|
void Disk::setLanguage(uint16 language) {
|
|
|
|
|
|
|
|
switch (language) {
|
|
|
|
case 0:
|
|
|
|
strcpy(_languageDir, "it/");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
strcpy(_languageDir, "fr/");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
strcpy(_languageDir, "en/");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
strcpy(_languageDir, "ge/");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
error("unknown language");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2007-03-04 13:27:29 +00:00
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DosDisk::DosDisk(Parallaction* vm) : Disk(vm) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DosDisk::~DosDisk() {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-04 09:20:03 +00:00
|
|
|
//
|
|
|
|
// decompress a graphics block
|
|
|
|
//
|
2007-03-24 17:14:04 +00:00
|
|
|
uint16 DosDisk::decompressChunk(byte *src, byte *dst, uint16 size) {
|
2007-03-04 09:20:03 +00:00
|
|
|
|
|
|
|
uint16 written = 0;
|
|
|
|
uint16 read = 0;
|
|
|
|
uint16 len = 0;
|
|
|
|
|
|
|
|
for (; written != size; written += len) {
|
|
|
|
|
|
|
|
len = src[read];
|
|
|
|
read++;
|
|
|
|
|
|
|
|
if (len <= 127) {
|
|
|
|
// copy run
|
|
|
|
|
|
|
|
len++;
|
|
|
|
memcpy(dst+written, src+read, len);
|
|
|
|
read += len;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// expand run
|
|
|
|
|
|
|
|
len = 257 - len;
|
|
|
|
memset(dst+written, src[read], len);
|
|
|
|
read++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return read;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// loads a cnv from an external file
|
|
|
|
//
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::loadExternalCnv(const char *filename, Cnv *cnv) {
|
2007-03-12 20:41:25 +00:00
|
|
|
// printf("Gfx::loadExternalCnv(%s)...", filename);
|
2007-03-04 09:20:03 +00:00
|
|
|
|
|
|
|
char path[PATH_LEN];
|
|
|
|
|
|
|
|
sprintf(path, "%s.cnv", filename);
|
|
|
|
|
|
|
|
Common::File stream;
|
|
|
|
|
|
|
|
if (!stream.open(path))
|
|
|
|
errorFileNotFound(path);
|
|
|
|
|
|
|
|
cnv->_count = stream.readByte();
|
|
|
|
cnv->_width = stream.readByte();
|
|
|
|
cnv->_height = stream.readByte();
|
|
|
|
|
|
|
|
cnv->_array = (byte**)malloc(cnv->_count * sizeof(byte*));
|
|
|
|
|
|
|
|
uint16 size = cnv->_width*cnv->_height;
|
|
|
|
for (uint16 i = 0; i < cnv->_count; i++) {
|
|
|
|
cnv->_array[i] = (byte*)malloc(size);
|
|
|
|
stream.read(cnv->_array[i], size);
|
|
|
|
}
|
|
|
|
|
|
|
|
// printf("done\n");
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::loadExternalStaticCnv(const char *filename, StaticCnv *cnv) {
|
2007-03-04 09:20:03 +00:00
|
|
|
|
|
|
|
char path[PATH_LEN];
|
|
|
|
|
|
|
|
sprintf(path, "%s.cnv", filename);
|
|
|
|
|
|
|
|
Common::File stream;
|
|
|
|
|
|
|
|
if (!stream.open(path))
|
|
|
|
errorFileNotFound(path);
|
|
|
|
|
|
|
|
cnv->_width = cnv->_height = 0;
|
|
|
|
|
|
|
|
stream.skip(1);
|
|
|
|
cnv->_width = stream.readByte();
|
|
|
|
cnv->_height = stream.readByte();
|
|
|
|
|
|
|
|
uint16 size = cnv->_width*cnv->_height;
|
|
|
|
|
|
|
|
cnv->_data0 = (byte*)malloc(size);
|
|
|
|
stream.read(cnv->_data0, size);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::loadCnv(const char *filename, Cnv *cnv) {
|
2007-03-12 20:41:25 +00:00
|
|
|
// printf("Gfx::loadCnv(%s)\n", filename);
|
2007-03-04 09:20:03 +00:00
|
|
|
|
|
|
|
char path[PATH_LEN];
|
|
|
|
|
|
|
|
strcpy(path, filename);
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(path)) {
|
2007-03-04 09:20:03 +00:00
|
|
|
sprintf(path, "%s.pp", filename);
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(path))
|
2007-03-04 09:20:03 +00:00
|
|
|
errorFileNotFound(path);
|
|
|
|
}
|
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
cnv->_count = _archive.readByte();
|
|
|
|
cnv->_width = _archive.readByte();
|
|
|
|
cnv->_height = _archive.readByte();
|
2007-03-04 09:20:03 +00:00
|
|
|
|
|
|
|
uint16 framesize = cnv->_width*cnv->_height;
|
|
|
|
|
|
|
|
cnv->_array = (byte**)malloc(cnv->_count * sizeof(byte*));
|
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
uint32 size = _archive.size() - 3;
|
2007-03-04 09:20:03 +00:00
|
|
|
|
|
|
|
byte *buf = (byte*)malloc(size);
|
2007-03-04 13:27:29 +00:00
|
|
|
_archive.read(buf, size);
|
2007-03-04 09:20:03 +00:00
|
|
|
|
|
|
|
byte *s = buf;
|
|
|
|
|
|
|
|
for (uint16 i = 0; i < cnv->_count; i++) {
|
|
|
|
cnv->_array[i] = (byte*)malloc(framesize);
|
|
|
|
uint16 read = decompressChunk(s, cnv->_array[i], framesize);
|
|
|
|
|
|
|
|
// printf("frame %i decompressed: %i --> %i\n", i, read, framesize);
|
|
|
|
|
|
|
|
s += read;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(buf);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
Cnv* DosDisk::loadTalk(const char *name) {
|
2007-03-18 10:20:38 +00:00
|
|
|
|
|
|
|
Cnv *cnv = new Cnv;
|
2007-03-02 21:50:36 +00:00
|
|
|
|
2007-03-10 15:02:39 +00:00
|
|
|
const char *ext = strstr(name, ".talk");
|
2007-03-02 21:50:36 +00:00
|
|
|
if (ext != NULL) {
|
|
|
|
// npc talk
|
2007-03-04 09:20:03 +00:00
|
|
|
loadCnv(name, cnv);
|
2007-03-02 21:50:36 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
// character talk
|
2007-03-10 22:55:09 +00:00
|
|
|
/*
|
2007-03-10 22:13:47 +00:00
|
|
|
if (scumm_stricmp(name, _doughName) &&
|
|
|
|
scumm_stricmp(name, _dinoName) &&
|
|
|
|
scumm_stricmp(name, _donnaName) &&
|
|
|
|
scumm_stricmp(name, _drkiName)) return;
|
2007-03-10 22:55:09 +00:00
|
|
|
*/
|
2007-03-02 21:50:36 +00:00
|
|
|
char v20[PATH_LEN];
|
|
|
|
char *v24 = const_cast<char*>(name);
|
2007-03-10 22:55:09 +00:00
|
|
|
if (IS_MINI_CHARACTER(v24)) {
|
2007-03-02 21:50:36 +00:00
|
|
|
v24+=4;
|
|
|
|
}
|
|
|
|
|
2007-03-10 22:56:32 +00:00
|
|
|
if (_engineFlags & kEngineTransformedDonna) {
|
2007-03-02 21:50:36 +00:00
|
|
|
sprintf(v20, "%stta", v24);
|
|
|
|
} else {
|
|
|
|
sprintf(v20, "%stal", v24);
|
|
|
|
}
|
|
|
|
|
2007-03-04 09:20:03 +00:00
|
|
|
loadExternalCnv(v20, cnv);
|
2007-03-02 21:50:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-03-18 10:20:38 +00:00
|
|
|
return cnv;
|
2007-03-02 21:50:36 +00:00
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
Script* DosDisk::loadLocation(const char *name) {
|
2007-03-02 22:02:19 +00:00
|
|
|
|
|
|
|
char archivefile[PATH_LEN];
|
|
|
|
|
2007-03-10 22:55:09 +00:00
|
|
|
if (IS_MINI_CHARACTER(_vm->_characterName)) {
|
2007-03-11 16:53:20 +00:00
|
|
|
sprintf(archivefile, "%s%s", _vm->_characterName+4, _languageDir);
|
2007-03-02 22:02:19 +00:00
|
|
|
} else {
|
2007-03-11 16:53:20 +00:00
|
|
|
if (IS_DUMMY_CHARACTER(_vm->_characterName)) strcpy(archivefile, _languageDir);
|
2007-03-02 22:02:19 +00:00
|
|
|
else {
|
2007-03-11 16:53:20 +00:00
|
|
|
sprintf(archivefile, "%s%s", _vm->_characterName, _languageDir);
|
2007-03-02 22:02:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
strcat(archivefile, name);
|
|
|
|
strcat(archivefile, ".loc");
|
|
|
|
|
2007-03-11 16:53:20 +00:00
|
|
|
_languageDir[2] = '\0';
|
|
|
|
_archive.open(_languageDir);
|
|
|
|
_languageDir[2] = '/';
|
2007-03-02 22:02:19 +00:00
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(archivefile)) {
|
2007-03-11 16:53:20 +00:00
|
|
|
sprintf(archivefile, "%s%s.loc", _languageDir, name);
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(archivefile))
|
2007-03-02 22:02:19 +00:00
|
|
|
error("can't find location file '%s'", name);
|
|
|
|
}
|
|
|
|
|
2007-03-04 15:09:45 +00:00
|
|
|
uint32 size = _archive.size();
|
|
|
|
char *buf = (char*)malloc(size+1);
|
|
|
|
_archive.read(buf, size);
|
|
|
|
buf[size] = '\0';
|
|
|
|
|
|
|
|
return new Script(buf, true);
|
2007-03-02 22:02:19 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
Script* DosDisk::loadScript(const char* name) {
|
2007-03-02 22:34:12 +00:00
|
|
|
|
|
|
|
char vC8[PATH_LEN];
|
|
|
|
|
|
|
|
sprintf(vC8, "%s.script", name);
|
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(vC8))
|
2007-03-02 22:34:12 +00:00
|
|
|
errorFileNotFound(vC8);
|
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
uint32 size = _archive.size();
|
2007-03-04 15:09:45 +00:00
|
|
|
char *buf = (char*)malloc(size+1);
|
|
|
|
_archive.read(buf, size);
|
|
|
|
buf[size] = '\0';
|
2007-03-02 22:34:12 +00:00
|
|
|
|
2007-03-04 15:09:45 +00:00
|
|
|
return new Script(buf, true);
|
2007-03-02 22:34:12 +00:00
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
StaticCnv* DosDisk::loadHead(const char* name) {
|
2007-03-02 22:12:57 +00:00
|
|
|
|
|
|
|
char path[PATH_LEN];
|
2007-03-10 22:55:09 +00:00
|
|
|
/*
|
2007-03-10 22:13:47 +00:00
|
|
|
if (scumm_stricmp(name, _doughName) &&
|
|
|
|
scumm_stricmp(name, _dinoName) &&
|
|
|
|
scumm_stricmp(name, _donnaName) &&
|
|
|
|
scumm_stricmp(name, _drkiName)) return;
|
2007-03-10 22:55:09 +00:00
|
|
|
*/
|
|
|
|
if (IS_MINI_CHARACTER(name)) {
|
2007-03-02 22:12:57 +00:00
|
|
|
name += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(path, 8, "%shead", name);
|
|
|
|
path[8] = '\0';
|
|
|
|
|
2007-03-18 10:25:46 +00:00
|
|
|
StaticCnv *cnv = new StaticCnv;
|
2007-03-04 09:20:03 +00:00
|
|
|
loadExternalStaticCnv(path, cnv);
|
2007-03-18 10:25:46 +00:00
|
|
|
return cnv;
|
2007-03-02 22:12:57 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
StaticCnv* DosDisk::loadPointer() {
|
2007-03-18 10:30:51 +00:00
|
|
|
StaticCnv* cnv = new StaticCnv;
|
2007-03-04 09:20:03 +00:00
|
|
|
loadExternalStaticCnv("pointer", cnv);
|
2007-03-18 10:30:51 +00:00
|
|
|
return cnv;
|
2007-03-02 22:12:57 +00:00
|
|
|
}
|
2007-03-02 21:50:36 +00:00
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
Cnv* DosDisk::loadFont(const char* name) {
|
2007-03-02 22:18:37 +00:00
|
|
|
char path[PATH_LEN];
|
|
|
|
|
|
|
|
sprintf(path, "%scnv", name);
|
2007-03-18 10:38:31 +00:00
|
|
|
|
|
|
|
Cnv* cnv = new Cnv;
|
2007-03-04 09:20:03 +00:00
|
|
|
loadExternalCnv(path, cnv);
|
2007-03-18 10:38:31 +00:00
|
|
|
return cnv;
|
2007-03-02 22:18:37 +00:00
|
|
|
}
|
|
|
|
|
2007-03-02 22:23:02 +00:00
|
|
|
// loads character's icons set
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
Cnv* DosDisk::loadObjects(const char *name) {
|
2007-03-02 22:23:02 +00:00
|
|
|
|
2007-03-10 22:55:09 +00:00
|
|
|
if (IS_MINI_CHARACTER(name)) {
|
2007-03-02 22:23:02 +00:00
|
|
|
name += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
char path[PATH_LEN];
|
|
|
|
sprintf(path, "%sobj", name);
|
|
|
|
|
2007-03-18 10:34:41 +00:00
|
|
|
Cnv* cnv = new Cnv;
|
2007-03-04 09:20:03 +00:00
|
|
|
loadExternalCnv(path, cnv);
|
2007-03-18 10:34:41 +00:00
|
|
|
return cnv;
|
2007-03-02 22:23:02 +00:00
|
|
|
}
|
|
|
|
|
2007-03-04 09:20:03 +00:00
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
StaticCnv* DosDisk::loadStatic(const char* name) {
|
2007-03-02 23:13:13 +00:00
|
|
|
|
2007-03-04 09:20:03 +00:00
|
|
|
char path[PATH_LEN];
|
|
|
|
|
|
|
|
strcpy(path, name);
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(path)) {
|
2007-03-04 09:20:03 +00:00
|
|
|
sprintf(path, "%s.pp", name);
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(path))
|
2007-03-04 09:20:03 +00:00
|
|
|
errorFileNotFound(path);
|
|
|
|
}
|
|
|
|
|
2007-03-18 21:15:39 +00:00
|
|
|
StaticCnv* cnv = new StaticCnv;
|
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
_archive.skip(1);
|
|
|
|
cnv->_width = _archive.readByte();
|
|
|
|
cnv->_height = _archive.readByte();
|
2007-03-04 09:20:03 +00:00
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
uint16 compressedsize = _archive.size() - 3;
|
2007-03-04 09:20:03 +00:00
|
|
|
byte *compressed = (byte*)malloc(compressedsize);
|
|
|
|
|
|
|
|
uint16 size = cnv->_width*cnv->_height;
|
|
|
|
cnv->_data0 = (byte*)malloc(size);
|
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
_archive.read(compressed, compressedsize);
|
2007-03-04 09:20:03 +00:00
|
|
|
|
|
|
|
decompressChunk(compressed, cnv->_data0, size);
|
|
|
|
free(compressed);
|
2007-03-02 23:13:13 +00:00
|
|
|
|
2007-03-18 21:15:39 +00:00
|
|
|
return cnv;
|
2007-03-02 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
Cnv* DosDisk::loadFrames(const char* name) {
|
2007-03-18 21:08:28 +00:00
|
|
|
Cnv* cnv = new Cnv;
|
2007-03-04 09:20:03 +00:00
|
|
|
loadCnv(name, cnv);
|
2007-03-18 21:08:28 +00:00
|
|
|
return cnv;
|
2007-03-02 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
2007-03-04 10:57:30 +00:00
|
|
|
//
|
|
|
|
// slides (background images) are stored compressed by scanline in a rle fashion
|
|
|
|
//
|
|
|
|
// the uncompressed data must then be unpacked to get:
|
|
|
|
// * color data [bits 0-5]
|
|
|
|
// * mask data [bits 6-7] (z buffer)
|
|
|
|
// * path data [bit 8] (walkable areas)
|
|
|
|
//
|
|
|
|
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *path) {
|
2007-03-04 10:57:30 +00:00
|
|
|
|
|
|
|
// update mask, path and screen
|
|
|
|
for (uint16 i = 0; i < SCREEN_WIDTH; i++) {
|
|
|
|
path[i/8] |= ((src[i] & 0x80) >> 7) << (i & 7);
|
|
|
|
mask[i/4] |= ((src[i] & 0x60) >> 5) << ((i & 3) << 1);
|
|
|
|
screen[i] = src[i] & 0x1F;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::parseDepths(Common::SeekableReadStream &stream) {
|
2007-03-15 21:56:21 +00:00
|
|
|
_vm->_gfx->_bgLayers[0] = stream.readByte();
|
|
|
|
_vm->_gfx->_bgLayers[1] = stream.readByte();
|
|
|
|
_vm->_gfx->_bgLayers[2] = stream.readByte();
|
|
|
|
_vm->_gfx->_bgLayers[3] = stream.readByte();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::parseBackground(Common::SeekableReadStream &stream) {
|
2007-03-15 21:56:21 +00:00
|
|
|
|
|
|
|
stream.read(_vm->_gfx->_palette, PALETTE_SIZE);
|
|
|
|
|
|
|
|
parseDepths(stream);
|
|
|
|
|
|
|
|
for (uint32 _si = 0; _si < 6; _si++) {
|
|
|
|
_vm->_gfx->_palettefx[_si]._timer = stream.readUint16BE();
|
|
|
|
_vm->_gfx->_palettefx[_si]._step = stream.readUint16BE();
|
|
|
|
_vm->_gfx->_palettefx[_si]._flags = stream.readUint16BE();
|
|
|
|
_vm->_gfx->_palettefx[_si]._first = stream.readByte();
|
|
|
|
_vm->_gfx->_palettefx[_si]._last = stream.readByte();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
uint16 v147;
|
|
|
|
for (v147 = 0; v147 < PALETTE_SIZE; v147++) {
|
|
|
|
byte _al = _vm->_gfx->_palette[v147];
|
|
|
|
_vm->_gfx->_palette[PALETTE_SIZE+v147] = _al / 2;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::loadBackground(const char *filename) {
|
2007-03-12 20:41:25 +00:00
|
|
|
// printf("Gfx::loadBackground(%s)\n", filename);
|
2007-03-04 10:57:30 +00:00
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(filename))
|
2007-03-04 10:57:30 +00:00
|
|
|
errorFileNotFound(filename);
|
|
|
|
|
2007-03-15 21:56:21 +00:00
|
|
|
parseBackground(_archive);
|
2007-03-04 10:57:30 +00:00
|
|
|
|
|
|
|
byte *bg = (byte*)calloc(1, SCREEN_WIDTH*SCREEN_HEIGHT);
|
|
|
|
byte *mask = (byte*)calloc(1, SCREENMASK_WIDTH*SCREEN_HEIGHT);
|
|
|
|
byte *path = (byte*)calloc(1, SCREENPATH_WIDTH*SCREEN_HEIGHT);
|
|
|
|
|
|
|
|
byte *v4 = (byte*)malloc(SCREEN_SIZE);
|
2007-03-04 13:27:29 +00:00
|
|
|
_archive.read(v4, SCREEN_SIZE);
|
2007-03-04 10:57:30 +00:00
|
|
|
|
|
|
|
byte v144[SCREEN_WIDTH];
|
|
|
|
|
|
|
|
byte *s = v4;
|
|
|
|
for (uint16 i = 0; i < SCREEN_HEIGHT; i++) {
|
|
|
|
s += decompressChunk(s, v144, SCREEN_WIDTH);
|
|
|
|
unpackBackgroundScanline(v144, bg+SCREEN_WIDTH*i, mask+SCREENMASK_WIDTH*i, path+SCREENPATH_WIDTH*i);
|
|
|
|
}
|
|
|
|
|
2007-03-12 20:41:25 +00:00
|
|
|
_vm->_gfx->setBackground(bg);
|
|
|
|
_vm->_gfx->setMask(mask);
|
2007-03-12 22:52:27 +00:00
|
|
|
setPath(path);
|
2007-03-04 10:57:30 +00:00
|
|
|
|
|
|
|
free(v4);
|
|
|
|
|
|
|
|
free(bg);
|
|
|
|
free(mask);
|
|
|
|
free(path);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// read background path and mask from a file
|
|
|
|
//
|
|
|
|
// mask and path are normally combined (via OR) into the background picture itself
|
|
|
|
// read the comment on the top of this file for more
|
|
|
|
//
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::loadMaskAndPath(const char *name) {
|
2007-03-04 10:57:30 +00:00
|
|
|
char path[PATH_LEN];
|
|
|
|
sprintf(path, "%s.msk", name);
|
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
if (!_archive.openArchivedFile(path))
|
2007-03-04 10:57:30 +00:00
|
|
|
errorFileNotFound(name);
|
|
|
|
|
|
|
|
byte *maskBuf = (byte*)calloc(1, SCREENMASK_WIDTH*SCREEN_HEIGHT);
|
|
|
|
byte *pathBuf = (byte*)calloc(1, SCREENPATH_WIDTH*SCREEN_HEIGHT);
|
|
|
|
|
2007-03-15 21:56:21 +00:00
|
|
|
parseDepths(_archive);
|
2007-03-04 10:57:30 +00:00
|
|
|
|
2007-03-04 13:27:29 +00:00
|
|
|
_archive.read(pathBuf, SCREENPATH_WIDTH*SCREEN_HEIGHT);
|
|
|
|
_archive.read(maskBuf, SCREENMASK_WIDTH*SCREEN_HEIGHT);
|
2007-03-04 10:57:30 +00:00
|
|
|
|
2007-03-12 20:41:25 +00:00
|
|
|
_vm->_gfx->setMask(maskBuf);
|
2007-03-12 22:52:27 +00:00
|
|
|
setPath(pathBuf);
|
2007-03-04 10:57:30 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2007-03-02 23:13:13 +00:00
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::loadSlide(const char *filename) {
|
2007-03-04 11:03:27 +00:00
|
|
|
char path[PATH_LEN];
|
|
|
|
sprintf(path, "%s.slide", filename);
|
|
|
|
loadBackground(path);
|
|
|
|
}
|
|
|
|
|
2007-03-24 17:14:04 +00:00
|
|
|
void DosDisk::loadScenery(const char *name, const char *mask) {
|
2007-03-04 11:03:27 +00:00
|
|
|
char path[PATH_LEN];
|
2007-03-04 12:55:25 +00:00
|
|
|
sprintf(path, "%s.dyn", name);
|
2007-03-04 11:03:27 +00:00
|
|
|
loadBackground(path);
|
2007-03-04 11:10:55 +00:00
|
|
|
|
2007-03-04 12:55:25 +00:00
|
|
|
if (mask != NULL) {
|
2007-03-04 11:10:55 +00:00
|
|
|
// load external masks and paths only for certain locations
|
|
|
|
loadMaskAndPath(mask);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-03-24 21:18:08 +00:00
|
|
|
Table* DosDisk::loadTable(const char* name) {
|
|
|
|
char path[PATH_LEN];
|
|
|
|
sprintf(path, "%s.tab", name);
|
|
|
|
|
|
|
|
Common::File stream;
|
|
|
|
if (!stream.open(path))
|
|
|
|
errorFileNotFound(path);
|
|
|
|
|
|
|
|
Table *t = new Table(100);
|
|
|
|
|
|
|
|
fillBuffers(stream);
|
|
|
|
while (scumm_stricmp(_tokens[0], "ENDTABLE")) {
|
|
|
|
t->addData(_tokens[0]);
|
|
|
|
fillBuffers(stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
stream.close();
|
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
2007-03-24 17:14:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AmigaDisk::AmigaDisk(Parallaction *vm) : Disk(vm) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AmigaDisk::~AmigaDisk() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Script* AmigaDisk::loadLocation(const char *name) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Script* AmigaDisk::loadScript(const char* name) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cnv* AmigaDisk::loadTalk(const char *name) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cnv* AmigaDisk::loadObjects(const char *name) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
StaticCnv* AmigaDisk::loadPointer() {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
StaticCnv* AmigaDisk::loadHead(const char* name) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cnv* AmigaDisk::loadFont(const char* name) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
StaticCnv* AmigaDisk::loadStatic(const char* name) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cnv* AmigaDisk::loadFrames(const char* name) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AmigaDisk::loadSlide(const char *filename) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AmigaDisk::loadScenery(const char* background, const char* mask) {
|
|
|
|
return;
|
2007-03-04 13:27:29 +00:00
|
|
|
}
|
|
|
|
|
2007-03-24 21:18:08 +00:00
|
|
|
Table* AmigaDisk::loadTable(const char* name) {
|
|
|
|
|
|
|
|
char path[PATH_LEN];
|
|
|
|
sprintf(path, "%s.table", name);
|
|
|
|
|
|
|
|
_archive.openArchivedFile(path);
|
2007-03-24 17:14:04 +00:00
|
|
|
|
2007-03-24 21:18:08 +00:00
|
|
|
Table *t = new Table(100);
|
|
|
|
|
|
|
|
fillBuffers(_archive);
|
|
|
|
while (scumm_stricmp(_tokens[0], "ENDTABLE")) {
|
|
|
|
t->addData(_tokens[0]);
|
|
|
|
fillBuffers(_archive);
|
|
|
|
}
|
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
2007-03-24 17:14:04 +00:00
|
|
|
|
|
|
|
|
2007-03-02 21:50:36 +00:00
|
|
|
} // namespace Parallaction
|