mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-12 22:51:11 +00:00
wrapped loader routines into a new class named Disk. The new class is also responsible for handling Archives in place of the Parallaction engine.
svn-id: r25972
This commit is contained in:
parent
826b16ef71
commit
b440bc1a03
@ -128,7 +128,7 @@ Animation *Parallaction::parseAnimation(Script& script, Node *list, char *name)
|
||||
}
|
||||
}
|
||||
|
||||
loadFrames(vC8, &vD0->_cnv);
|
||||
_disk->loadFrames(vC8, &vD0->_cnv);
|
||||
// int16 _ax = _vm->_graphics->loadCnv(vC8, &vD0->_cnv);
|
||||
// if (_ax == -1) exit(-1);
|
||||
}
|
||||
@ -253,7 +253,7 @@ void Parallaction::loadProgram(Animation *a, char *filename) {
|
||||
|
||||
// the largest script in Nippon Safes is 3,668 bytes, so 4 kb is well enough
|
||||
char* src = (char*)malloc(0x1000);
|
||||
loadScript(filename, src);
|
||||
_disk->loadScript(filename, src);
|
||||
|
||||
_numLocals = 0;
|
||||
|
||||
|
@ -353,7 +353,6 @@ void _c_ridux(void *parm) {
|
||||
void _c_testResult(void *parm) {
|
||||
_vm->_graphics->swapBuffers();
|
||||
_vm->parseLocation("common");
|
||||
_vm->_archive.close();
|
||||
|
||||
_vm->_graphics->setFont("slide");
|
||||
_vm->_graphics->_proportionalFont = false;
|
||||
|
@ -229,7 +229,7 @@ void runDialogue(SpeakData *data) {
|
||||
debugC(1, kDebugDialogue, "runDialogue: special trick for 'museum' location");
|
||||
}
|
||||
|
||||
loadTalk(_vm->_characterName, &_characterFace);
|
||||
_vm->_disk->loadTalk(_vm->_characterName, &_characterFace);
|
||||
|
||||
_vm->_graphics->setFont("comic");
|
||||
|
||||
@ -241,7 +241,7 @@ void runDialogue(SpeakData *data) {
|
||||
debugC(1, kDebugDialogue, "runDialogue: using default character head");
|
||||
} else {
|
||||
debugC(1, kDebugDialogue, "runDialogue: loading 2nd character head '%s'", _vm->_characterName);
|
||||
loadTalk(data->_name, &v6E);
|
||||
_vm->_disk->loadTalk(data->_name, &v6E);
|
||||
debugC(1, kDebugDialogue, "runDialogue: 2nd character head loaded");
|
||||
}
|
||||
|
||||
@ -509,11 +509,8 @@ void runDialogue(SpeakData *data) {
|
||||
debugC(1, kDebugDialogue, "runDialogue: exit dialogue ok");
|
||||
|
||||
if (!scumm_stricmp(_location, "museum")) {
|
||||
|
||||
_vm->_archive.close();
|
||||
strcpy(_vm->_disk, "disk1");
|
||||
_vm->_archive.open(_vm->_disk);
|
||||
loadFrames("dino", &_tempFrames);
|
||||
_vm->_disk->selectArchive("disk1");
|
||||
_vm->_disk->loadFrames("dino", &_tempFrames);
|
||||
|
||||
memcpy(&_yourself._cnv, &_tempFrames, sizeof(Cnv));
|
||||
|
||||
|
@ -27,10 +27,19 @@
|
||||
|
||||
namespace Parallaction {
|
||||
|
||||
Disk::Disk(Parallaction* vm) : _vm(vm) {
|
||||
|
||||
}
|
||||
|
||||
Disk::~Disk() {
|
||||
_archive.close();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// decompress a graphics block
|
||||
//
|
||||
uint16 decompressChunk(byte *src, byte *dst, uint16 size) {
|
||||
uint16 Disk::decompressChunk(byte *src, byte *dst, uint16 size) {
|
||||
|
||||
uint16 written = 0;
|
||||
uint16 read = 0;
|
||||
@ -66,7 +75,7 @@ uint16 decompressChunk(byte *src, byte *dst, uint16 size) {
|
||||
//
|
||||
// loads a cnv from an external file
|
||||
//
|
||||
void loadExternalCnv(const char *filename, Cnv *cnv) {
|
||||
void Disk::loadExternalCnv(const char *filename, Cnv *cnv) {
|
||||
// printf("Graphics::loadExternalCnv(%s)...", filename);
|
||||
|
||||
char path[PATH_LEN];
|
||||
@ -98,7 +107,7 @@ void loadExternalCnv(const char *filename, Cnv *cnv) {
|
||||
return;
|
||||
}
|
||||
|
||||
void loadExternalStaticCnv(const char *filename, StaticCnv *cnv) {
|
||||
void Disk::loadExternalStaticCnv(const char *filename, StaticCnv *cnv) {
|
||||
|
||||
char path[PATH_LEN];
|
||||
|
||||
@ -125,30 +134,30 @@ void loadExternalStaticCnv(const char *filename, StaticCnv *cnv) {
|
||||
return;
|
||||
}
|
||||
|
||||
void loadCnv(const char *filename, Cnv *cnv) {
|
||||
void Disk::loadCnv(const char *filename, Cnv *cnv) {
|
||||
// printf("Graphics::loadCnv(%s)\n", filename);
|
||||
|
||||
char path[PATH_LEN];
|
||||
|
||||
strcpy(path, filename);
|
||||
if (!_vm->_archive.openArchivedFile(path)) {
|
||||
if (!_archive.openArchivedFile(path)) {
|
||||
sprintf(path, "%s.pp", filename);
|
||||
if (!_vm->_archive.openArchivedFile(path))
|
||||
if (!_archive.openArchivedFile(path))
|
||||
errorFileNotFound(path);
|
||||
}
|
||||
|
||||
cnv->_count = _vm->_archive.readByte();
|
||||
cnv->_width = _vm->_archive.readByte();
|
||||
cnv->_height = _vm->_archive.readByte();
|
||||
cnv->_count = _archive.readByte();
|
||||
cnv->_width = _archive.readByte();
|
||||
cnv->_height = _archive.readByte();
|
||||
|
||||
uint16 framesize = cnv->_width*cnv->_height;
|
||||
|
||||
cnv->_array = (byte**)malloc(cnv->_count * sizeof(byte*));
|
||||
|
||||
uint32 size = _vm->_archive.size() - 3;
|
||||
uint32 size = _archive.size() - 3;
|
||||
|
||||
byte *buf = (byte*)malloc(size);
|
||||
_vm->_archive.read(buf, size);
|
||||
_archive.read(buf, size);
|
||||
|
||||
byte *s = buf;
|
||||
|
||||
@ -161,14 +170,14 @@ void loadCnv(const char *filename, Cnv *cnv) {
|
||||
s += read;
|
||||
}
|
||||
|
||||
_vm->_archive.closeArchivedFile();
|
||||
_archive.closeArchivedFile();
|
||||
|
||||
free(buf);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void loadTalk(const char *name, Cnv *cnv) {
|
||||
void Disk::loadTalk(const char *name, Cnv *cnv) {
|
||||
|
||||
char* ext = strstr(name, ".talk");
|
||||
if (ext != NULL) {
|
||||
@ -196,7 +205,7 @@ void loadTalk(const char *name, Cnv *cnv) {
|
||||
|
||||
}
|
||||
|
||||
void loadLocation(const char *name, char* script) {
|
||||
void Disk::loadLocation(const char *name, char* script) {
|
||||
|
||||
char archivefile[PATH_LEN];
|
||||
|
||||
@ -211,44 +220,44 @@ void loadLocation(const char *name, char* script) {
|
||||
strcat(archivefile, name);
|
||||
strcat(archivefile, ".loc");
|
||||
|
||||
_vm->_archive.close();
|
||||
_archive.close();
|
||||
|
||||
_vm->_languageDir[2] = '\0';
|
||||
_vm->_archive.open(_vm->_languageDir);
|
||||
_archive.open(_vm->_languageDir);
|
||||
_vm->_languageDir[2] = '/';
|
||||
|
||||
if (!_vm->_archive.openArchivedFile(archivefile)) {
|
||||
if (!_archive.openArchivedFile(archivefile)) {
|
||||
sprintf(archivefile, "%s%s.loc", _vm->_languageDir, name);
|
||||
if (!_vm->_archive.openArchivedFile(archivefile))
|
||||
if (!_archive.openArchivedFile(archivefile))
|
||||
error("can't find location file '%s'", name);
|
||||
}
|
||||
|
||||
uint32 count = _vm->_archive.size();
|
||||
_vm->_archive.read(script, count);
|
||||
_vm->_archive.closeArchivedFile();
|
||||
_vm->_archive.close();
|
||||
uint32 count = _archive.size();
|
||||
_archive.read(script, count);
|
||||
_archive.closeArchivedFile();
|
||||
_archive.close();
|
||||
|
||||
}
|
||||
|
||||
void loadScript(const char* name, char *script) {
|
||||
void Disk::loadScript(const char* name, char *script) {
|
||||
|
||||
char vC8[PATH_LEN];
|
||||
|
||||
sprintf(vC8, "%s.script", name);
|
||||
|
||||
if (!_vm->_archive.openArchivedFile(vC8))
|
||||
if (!_archive.openArchivedFile(vC8))
|
||||
errorFileNotFound(vC8);
|
||||
|
||||
uint32 size = _vm->_archive.size();
|
||||
uint32 size = _archive.size();
|
||||
|
||||
_vm->_archive.read(script, size);
|
||||
_archive.read(script, size);
|
||||
script[size] = '\0';
|
||||
|
||||
_vm->_archive.closeArchivedFile();
|
||||
_archive.closeArchivedFile();
|
||||
|
||||
}
|
||||
|
||||
void loadHead(const char* name, StaticCnv* cnv) {
|
||||
void Disk::loadHead(const char* name, StaticCnv* cnv) {
|
||||
|
||||
char path[PATH_LEN];
|
||||
|
||||
@ -264,11 +273,11 @@ void loadHead(const char* name, StaticCnv* cnv) {
|
||||
}
|
||||
|
||||
|
||||
void loadPointer(StaticCnv* cnv) {
|
||||
void Disk::loadPointer(StaticCnv* cnv) {
|
||||
loadExternalStaticCnv("pointer", cnv);
|
||||
}
|
||||
|
||||
void loadFont(const char* name, Cnv* cnv) {
|
||||
void Disk::loadFont(const char* name, Cnv* cnv) {
|
||||
char path[PATH_LEN];
|
||||
|
||||
sprintf(path, "%scnv", name);
|
||||
@ -277,7 +286,7 @@ void loadFont(const char* name, Cnv* cnv) {
|
||||
|
||||
// loads character's icons set
|
||||
|
||||
void loadObjects(const char *name, Cnv* cnv) {
|
||||
void Disk::loadObjects(const char *name, Cnv* cnv) {
|
||||
|
||||
if (!scumm_strnicmp("mini", name, 4)) {
|
||||
name += 4;
|
||||
@ -292,29 +301,29 @@ void loadObjects(const char *name, Cnv* cnv) {
|
||||
}
|
||||
|
||||
|
||||
void loadStatic(const char* name, StaticCnv* cnv) {
|
||||
void Disk::loadStatic(const char* name, StaticCnv* cnv) {
|
||||
|
||||
char path[PATH_LEN];
|
||||
|
||||
strcpy(path, name);
|
||||
if (!_vm->_archive.openArchivedFile(path)) {
|
||||
if (!_archive.openArchivedFile(path)) {
|
||||
sprintf(path, "%s.pp", name);
|
||||
if (!_vm->_archive.openArchivedFile(path))
|
||||
if (!_archive.openArchivedFile(path))
|
||||
errorFileNotFound(path);
|
||||
}
|
||||
|
||||
_vm->_archive.skip(1);
|
||||
cnv->_width = _vm->_archive.readByte();
|
||||
cnv->_height = _vm->_archive.readByte();
|
||||
_archive.skip(1);
|
||||
cnv->_width = _archive.readByte();
|
||||
cnv->_height = _archive.readByte();
|
||||
|
||||
uint16 compressedsize = _vm->_archive.size() - 3;
|
||||
uint16 compressedsize = _archive.size() - 3;
|
||||
byte *compressed = (byte*)malloc(compressedsize);
|
||||
|
||||
uint16 size = cnv->_width*cnv->_height;
|
||||
cnv->_data0 = (byte*)malloc(size);
|
||||
|
||||
_vm->_archive.read(compressed, compressedsize);
|
||||
_vm->_archive.closeArchivedFile();
|
||||
_archive.read(compressed, compressedsize);
|
||||
_archive.closeArchivedFile();
|
||||
|
||||
decompressChunk(compressed, cnv->_data0, size);
|
||||
free(compressed);
|
||||
@ -322,7 +331,7 @@ void loadStatic(const char* name, StaticCnv* cnv) {
|
||||
return;
|
||||
}
|
||||
|
||||
void loadFrames(const char* name, Cnv* cnv) {
|
||||
void Disk::loadFrames(const char* name, Cnv* cnv) {
|
||||
|
||||
loadCnv(name, cnv);
|
||||
|
||||
@ -339,7 +348,7 @@ void loadFrames(const char* name, Cnv* cnv) {
|
||||
//
|
||||
|
||||
|
||||
void unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *path) {
|
||||
void Disk::unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *path) {
|
||||
|
||||
// update mask, path and screen
|
||||
for (uint16 i = 0; i < SCREEN_WIDTH; i++) {
|
||||
@ -351,20 +360,20 @@ void unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *path) {
|
||||
return;
|
||||
}
|
||||
|
||||
void loadBackground(const char *filename) {
|
||||
void Disk::loadBackground(const char *filename) {
|
||||
// printf("Graphics::loadBackground(%s)\n", filename);
|
||||
|
||||
if (!_vm->_archive.openArchivedFile(filename))
|
||||
if (!_archive.openArchivedFile(filename))
|
||||
errorFileNotFound(filename);
|
||||
|
||||
_vm->_graphics->parseBackground(_vm->_archive);
|
||||
_vm->_graphics->parseBackground(_archive);
|
||||
|
||||
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);
|
||||
_vm->_archive.read(v4, SCREEN_SIZE);
|
||||
_archive.read(v4, SCREEN_SIZE);
|
||||
|
||||
byte v144[SCREEN_WIDTH];
|
||||
|
||||
@ -393,20 +402,20 @@ void loadBackground(const char *filename) {
|
||||
// mask and path are normally combined (via OR) into the background picture itself
|
||||
// read the comment on the top of this file for more
|
||||
//
|
||||
void loadMaskAndPath(const char *name) {
|
||||
void Disk::loadMaskAndPath(const char *name) {
|
||||
char path[PATH_LEN];
|
||||
sprintf(path, "%s.msk", name);
|
||||
|
||||
if (!_vm->_archive.openArchivedFile(path))
|
||||
if (!_archive.openArchivedFile(path))
|
||||
errorFileNotFound(name);
|
||||
|
||||
byte *maskBuf = (byte*)calloc(1, SCREENMASK_WIDTH*SCREEN_HEIGHT);
|
||||
byte *pathBuf = (byte*)calloc(1, SCREENPATH_WIDTH*SCREEN_HEIGHT);
|
||||
|
||||
_vm->_graphics->parseDepths(_vm->_archive);
|
||||
_vm->_graphics->parseDepths(_archive);
|
||||
|
||||
_vm->_archive.read(pathBuf, SCREENPATH_WIDTH*SCREEN_HEIGHT);
|
||||
_vm->_archive.read(maskBuf, SCREENMASK_WIDTH*SCREEN_HEIGHT);
|
||||
_archive.read(pathBuf, SCREENPATH_WIDTH*SCREEN_HEIGHT);
|
||||
_archive.read(maskBuf, SCREENMASK_WIDTH*SCREEN_HEIGHT);
|
||||
|
||||
_vm->_graphics->setMask(maskBuf);
|
||||
_vm->_graphics->setPath(pathBuf);
|
||||
@ -414,13 +423,13 @@ void loadMaskAndPath(const char *name) {
|
||||
return;
|
||||
}
|
||||
|
||||
void loadSlide(const char *filename) {
|
||||
void Disk::loadSlide(const char *filename) {
|
||||
char path[PATH_LEN];
|
||||
sprintf(path, "%s.slide", filename);
|
||||
loadBackground(path);
|
||||
}
|
||||
|
||||
void loadScenery(const char *name, const char *mask) {
|
||||
void Disk::loadScenery(const char *name, const char *mask) {
|
||||
char path[PATH_LEN];
|
||||
sprintf(path, "%s.dyn", name);
|
||||
loadBackground(path);
|
||||
@ -432,4 +441,9 @@ void loadScenery(const char *name, const char *mask) {
|
||||
|
||||
}
|
||||
|
||||
void Disk::selectArchive(const char *name) {
|
||||
_archive.close();
|
||||
_archive.open(name);
|
||||
}
|
||||
|
||||
} // namespace Parallaction
|
||||
|
@ -37,6 +37,9 @@ namespace Parallaction {
|
||||
|
||||
#define DIRECTORY_OFFSET_IN_FILE 0x4000
|
||||
|
||||
class Parallaction;
|
||||
class Graphics;
|
||||
|
||||
class Archive : public Common::SeekableReadStream {
|
||||
|
||||
protected:
|
||||
@ -72,17 +75,41 @@ public:
|
||||
uint32 read(void *dataPtr, uint32 dataSize);
|
||||
};
|
||||
|
||||
void loadLocation(const char *name, char* script);
|
||||
void loadScript(const char* name, char *script);
|
||||
void loadTalk(const char *name, Cnv *cnv);
|
||||
void loadObjects(const char *name, Cnv *cnv);
|
||||
void loadPointer(StaticCnv* cnv);
|
||||
void loadHead(const char* name, StaticCnv* cnv);
|
||||
void loadFont(const char* name, Cnv* cnv);
|
||||
void loadStatic(const char* name, StaticCnv* cnv);
|
||||
void loadFrames(const char* name, Cnv* cnv);
|
||||
void loadSlide(const char *filename);
|
||||
void loadScenery(const char* background, const char* mask);
|
||||
class Disk {
|
||||
|
||||
private:
|
||||
uint16 decompressChunk(byte *src, byte *dst, uint16 size);
|
||||
void unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *path);
|
||||
void loadExternalCnv(const char *filename, Cnv *cnv);
|
||||
void loadCnv(const char *filename, Cnv *cnv);
|
||||
void loadExternalStaticCnv(const char *filename, StaticCnv *cnv);
|
||||
void loadBackground(const char *filename);
|
||||
void loadMaskAndPath(const char *name);
|
||||
|
||||
protected:
|
||||
Archive _archive;
|
||||
|
||||
Parallaction *_vm;
|
||||
Graphics *_gfx;
|
||||
|
||||
public:
|
||||
Disk(Parallaction *vm);
|
||||
virtual ~Disk();
|
||||
|
||||
void selectArchive(const char *name);
|
||||
|
||||
void loadLocation(const char *name, char* script);
|
||||
void loadScript(const char* name, char *script);
|
||||
void loadTalk(const char *name, Cnv *cnv);
|
||||
void loadObjects(const char *name, Cnv *cnv);
|
||||
void loadPointer(StaticCnv* cnv);
|
||||
void loadHead(const char* name, StaticCnv* cnv);
|
||||
void loadFont(const char* name, Cnv* cnv);
|
||||
void loadStatic(const char* name, StaticCnv* cnv);
|
||||
void loadFrames(const char* name, Cnv* cnv);
|
||||
void loadSlide(const char *filename);
|
||||
void loadScenery(const char* background, const char* mask);
|
||||
};
|
||||
|
||||
} // namespace Parallaction
|
||||
|
||||
|
@ -509,7 +509,7 @@ void jobEraseLabel(void *parm, Job *j) {
|
||||
|
||||
void Graphics::initMouse(uint16 arg_0) {
|
||||
|
||||
loadPointer(&_mouseComposedArrow);
|
||||
_vm->_disk->loadPointer(&_mouseComposedArrow);
|
||||
|
||||
byte temp[16*16];
|
||||
memcpy(temp, _mouseArrow, 16*16);
|
||||
@ -800,7 +800,7 @@ void Graphics::setFont(const char* name) {
|
||||
if (_font._array != NULL)
|
||||
freeCnv(&_font);
|
||||
|
||||
loadFont(name, &_font);
|
||||
_vm->_disk->loadFont(name, &_font);
|
||||
}
|
||||
|
||||
|
||||
|
@ -372,7 +372,7 @@ void cleanInventory() {
|
||||
|
||||
|
||||
void refreshInventory(const char *character) {
|
||||
loadObjects(character, &_characterInventory);
|
||||
_vm->_disk->loadObjects(character, &_characterInventory);
|
||||
redrawInventory();
|
||||
_vm->_graphics->freeCnv(&_characterInventory);
|
||||
|
||||
@ -381,7 +381,7 @@ void refreshInventory(const char *character) {
|
||||
|
||||
|
||||
void refreshInventoryItem(const char *character, uint16 index) {
|
||||
loadObjects(character, &_characterInventory);
|
||||
_vm->_disk->loadObjects(character, &_characterInventory);
|
||||
drawInventoryItem(index, &_inventory[index]);
|
||||
_vm->_graphics->freeCnv(&_characterInventory);
|
||||
|
||||
|
@ -48,7 +48,7 @@ void Parallaction::parseLocation(const char *filename) {
|
||||
_vm->_graphics->setFont("topaz");
|
||||
|
||||
location_src = (char*)malloc(0x4000);
|
||||
loadLocation(filename, location_src);
|
||||
_disk->loadLocation(filename, location_src);
|
||||
_locationScript = new Script(location_src);
|
||||
|
||||
fillBuffers(*_locationScript, true);
|
||||
@ -105,8 +105,7 @@ void Parallaction::parseLocation(const char *filename) {
|
||||
}
|
||||
}
|
||||
if (!scumm_stricmp(_tokens[0], "DISK")) {
|
||||
strcpy(_disk, _tokens[1]);
|
||||
_archive.open(_disk);
|
||||
_disk->selectArchive(_tokens[1]);
|
||||
}
|
||||
if (!scumm_stricmp(_tokens[0], "LOCALFLAGS")) {
|
||||
_si = 1; // _localFlagNames[0] = 'visited'
|
||||
@ -277,7 +276,7 @@ void switchBackground(const char* background, const char* mask) {
|
||||
_vm->_graphics->palUnk0(palette);
|
||||
}
|
||||
|
||||
loadScenery(background, mask);
|
||||
_vm->_disk->loadScenery(background, mask);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -355,19 +354,19 @@ void Parallaction::changeLocation(char *location) {
|
||||
*tmp = '\0';
|
||||
|
||||
if (!scumm_strnicmp(tmp+1, "slide", 5)) {
|
||||
loadSlide(_newLocation);
|
||||
_vm->_graphics->palUnk0(_palette);
|
||||
_vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront);
|
||||
_disk->loadSlide(_newLocation);
|
||||
_graphics->palUnk0(_palette);
|
||||
_graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront);
|
||||
|
||||
debugC(1, kDebugLocation, "changeLocation: new background set");
|
||||
|
||||
_vm->_graphics->_proportionalFont = false;
|
||||
_vm->_graphics->setFont("slide");
|
||||
_graphics->_proportionalFont = false;
|
||||
_graphics->setFont("slide");
|
||||
|
||||
uint16 _ax = strlen(_slideText[0]);
|
||||
_ax <<= 3; // text width
|
||||
uint16 _dx = (SCREEN_WIDTH - _ax) >> 1; // center text
|
||||
_vm->_graphics->displayString(_dx, 14, _slideText[0]); // displays text on screen
|
||||
_graphics->displayString(_dx, 14, _slideText[0]); // displays text on screen
|
||||
|
||||
waitUntilLeftClick();
|
||||
|
||||
@ -397,7 +396,7 @@ void Parallaction::changeLocation(char *location) {
|
||||
strcpy(_saveData1, _newLocation);
|
||||
|
||||
parseLocation(_newLocation);
|
||||
_vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBit2);
|
||||
_graphics->copyScreen(Graphics::kBitBack, Graphics::kBit2);
|
||||
debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _newLocation);
|
||||
|
||||
_yourself._zone.pos._oldposition._x = -1000;
|
||||
@ -416,14 +415,14 @@ void Parallaction::changeLocation(char *location) {
|
||||
|
||||
byte palette[PALETTE_SIZE];
|
||||
for (uint16 _si = 0; _si < PALETTE_SIZE; _si++) palette[_si] = 0;
|
||||
_vm->_graphics->palUnk0(palette);
|
||||
_vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront);
|
||||
_graphics->palUnk0(palette);
|
||||
_graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront);
|
||||
if (_locationCommands) {
|
||||
runCommands(_locationCommands);
|
||||
runJobs();
|
||||
_vm->_graphics->swapBuffers();
|
||||
_graphics->swapBuffers();
|
||||
runJobs();
|
||||
_vm->_graphics->swapBuffers();
|
||||
_graphics->swapBuffers();
|
||||
}
|
||||
|
||||
if (_locationComment) {
|
||||
@ -432,9 +431,9 @@ void Parallaction::changeLocation(char *location) {
|
||||
}
|
||||
|
||||
runJobs();
|
||||
_vm->_graphics->swapBuffers();
|
||||
_graphics->swapBuffers();
|
||||
|
||||
_vm->_graphics->palUnk0(_palette);
|
||||
_graphics->palUnk0(_palette);
|
||||
if (_locationACommands) {
|
||||
runCommands(_locationACommands);
|
||||
debugC(1, kDebugLocation, "changeLocation: location acommands run");
|
||||
|
@ -101,24 +101,24 @@ Menu::~Menu() {
|
||||
|
||||
void Menu::start() {
|
||||
|
||||
_vm->_archive.open("disk1");
|
||||
_vm->_disk->selectArchive("disk1");
|
||||
_vm->_graphics->_proportionalFont = false;
|
||||
|
||||
_vm->_graphics->setFont("slide");
|
||||
|
||||
loadSlide("intro");
|
||||
_vm->_disk->loadSlide("intro");
|
||||
_vm->_graphics->palUnk0(_palette);
|
||||
_vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront);
|
||||
|
||||
g_system->delayMillis(2000);
|
||||
|
||||
loadSlide("minintro");
|
||||
_vm->_disk->loadSlide("minintro");
|
||||
_vm->_graphics->palUnk0(_palette);
|
||||
_vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront);
|
||||
|
||||
g_system->delayMillis(2000);
|
||||
|
||||
loadSlide("lingua");
|
||||
_vm->_disk->loadSlide("lingua");
|
||||
_vm->_graphics->palUnk0(_palette);
|
||||
_vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront);
|
||||
|
||||
@ -146,7 +146,7 @@ void Menu::start() {
|
||||
break;
|
||||
}
|
||||
|
||||
loadSlide("restore");
|
||||
_vm->_disk->loadSlide("restore");
|
||||
_vm->_graphics->palUnk0(_palette);
|
||||
_vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront);
|
||||
|
||||
@ -157,8 +157,6 @@ void Menu::start() {
|
||||
newGame();
|
||||
}
|
||||
|
||||
_vm->_archive.close();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -167,7 +165,7 @@ void Menu::newGame() {
|
||||
|
||||
const char **v14 = introMsg3;
|
||||
|
||||
loadScenery("test", NULL);
|
||||
_vm->_disk->loadScenery("test", NULL);
|
||||
_vm->_graphics->palUnk0(_palette);
|
||||
_vm->_graphics->swapBuffers();
|
||||
|
||||
@ -196,8 +194,6 @@ void Menu::newGame() {
|
||||
if (_mouseButtons != kMouseRightUp)
|
||||
return; // show intro
|
||||
|
||||
_vm->_archive.close();
|
||||
|
||||
selectCharacter();
|
||||
|
||||
char *v4 = strchr(_location, '.') + 1;
|
||||
@ -284,7 +280,6 @@ uint16 Menu::selectGame() {
|
||||
strcpy(_engine->_characterName, "dough");
|
||||
|
||||
_vm->loadGame();
|
||||
_vm->_archive.close();
|
||||
|
||||
return 1; // load game
|
||||
}
|
||||
@ -315,9 +310,9 @@ void Menu::selectCharacter() {
|
||||
_vm->_graphics->_proportionalFont = false;
|
||||
|
||||
_vm->_graphics->setFont("slide");
|
||||
_vm->_archive.open("disk1");
|
||||
_vm->_disk->selectArchive("disk1");
|
||||
|
||||
loadSlide("password");
|
||||
_vm->_disk->loadSlide("password");
|
||||
_vm->_graphics->copyScreen(Graphics::kBitBack, Graphics::kBit2);
|
||||
_vm->_graphics->palUnk0(_palette);
|
||||
|
||||
@ -411,7 +406,6 @@ void Menu::selectCharacter() {
|
||||
_vm->_graphics->setPalette(palette);
|
||||
|
||||
_engineFlags |= kEngineChangeLocation;
|
||||
_vm->_archive.close();
|
||||
|
||||
free(v14._data0);
|
||||
|
||||
|
@ -162,6 +162,7 @@ Parallaction::Parallaction(OSystem *syst) :
|
||||
|
||||
// FIXME
|
||||
_vm = this;
|
||||
_disk = new Disk(this);
|
||||
|
||||
_skipMenu = false;
|
||||
|
||||
@ -203,6 +204,7 @@ Parallaction::Parallaction(OSystem *syst) :
|
||||
|
||||
Parallaction::~Parallaction() {
|
||||
delete _midiPlayer;
|
||||
delete _disk;
|
||||
}
|
||||
|
||||
|
||||
@ -850,18 +852,15 @@ void Parallaction::changeCharacter(const char *name) {
|
||||
freeCharacterFrames();
|
||||
}
|
||||
|
||||
_archive.close();
|
||||
|
||||
strcpy(_disk, "disk1");
|
||||
_archive.open("disk1");
|
||||
_disk->selectArchive("disk1");
|
||||
|
||||
char path[PATH_LEN];
|
||||
strcpy(path, v32);
|
||||
loadFrames(path, &_tempFrames);
|
||||
_disk->loadFrames(path, &_tempFrames);
|
||||
|
||||
if (name[0] != 'D') {
|
||||
sprintf(path, "mini%s", v32);
|
||||
loadFrames(path, &_miniCharacterFrames);
|
||||
_disk->loadFrames(path, &_miniCharacterFrames);
|
||||
|
||||
sprintf(path, "%s.tab", name);
|
||||
initTable(path, _objectsNames);
|
||||
|
@ -264,7 +264,7 @@ public:
|
||||
Menu* _menu;
|
||||
char _characterName[30];
|
||||
char _languageDir[6];
|
||||
char _disk[6];
|
||||
Disk* _disk;
|
||||
|
||||
char _locationNames[120][32];
|
||||
int16 _currentLocationIndex;
|
||||
@ -274,8 +274,6 @@ public:
|
||||
|
||||
Script *_locationScript;
|
||||
|
||||
Archive _archive;
|
||||
|
||||
protected: // data
|
||||
|
||||
struct InputData {
|
||||
|
@ -134,7 +134,6 @@ void Parallaction::doLoadGame(uint16 slot) {
|
||||
refreshInventory(_vm->_characterName);
|
||||
|
||||
parseLocation("common");
|
||||
_archive.close();
|
||||
|
||||
strcat(_location, _vm->_characterName);
|
||||
_engineFlags |= kEngineChangeLocation;
|
||||
|
@ -279,7 +279,7 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
|
||||
strcpy(vC8, _tokens[1]);
|
||||
|
||||
StaticCnv vE0;
|
||||
loadFrames(vC8, doorcnv);
|
||||
_disk->loadFrames(vC8, doorcnv);
|
||||
|
||||
// printf("door width: %i, height: %i", doorcnv->_width, doorcnv->_height );
|
||||
|
||||
@ -293,9 +293,9 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
|
||||
// vE0._data1 = doorcnv->field_8[_ax];
|
||||
|
||||
vE0._data2 = u->door->_background = (byte*)malloc(vE0._width*vE0._height);
|
||||
_vm->_graphics->backupCnvBackground(&vE0, z->_limits._left, z->_limits._top);
|
||||
_graphics->backupCnvBackground(&vE0, z->_limits._left, z->_limits._top);
|
||||
|
||||
_vm->_graphics->flatBlitCnv(&vE0, z->_limits._left, z->_limits._top, Graphics::kBitBack, vE0._data1);
|
||||
_graphics->flatBlitCnv(&vE0, z->_limits._left, z->_limits._top, Graphics::kBitBack, vE0._data1);
|
||||
}
|
||||
|
||||
if (!scumm_stricmp(_tokens[0], "startpos")) {
|
||||
@ -309,12 +309,12 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
|
||||
if (!scumm_stricmp(_tokens[0], "file")) {
|
||||
StaticCnv *vE4 = &u->get->_cnv;
|
||||
strcpy(vC8, _tokens[1]);
|
||||
loadStatic(vC8, vE4);
|
||||
_disk->loadStatic(vC8, vE4);
|
||||
vE4->_data2 = (byte*)malloc(vE4->_width*vE4->_height);
|
||||
|
||||
if ((z->_flags & kFlagsRemove) == 0) {
|
||||
_vm->_graphics->backupCnvBackgroundTransparent(vE4, z->_limits._left, z->_limits._top);
|
||||
_vm->_graphics->flatBlitCnv(vE4, z->_limits._left, z->_limits._top, Graphics::kBitBack, vE4->_data1);
|
||||
_graphics->backupCnvBackgroundTransparent(vE4, z->_limits._left, z->_limits._top);
|
||||
_graphics->flatBlitCnv(vE4, z->_limits._left, z->_limits._top, Graphics::kBitBack, vE4->_data1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
|
||||
void displayCharacterComment(ExamineData *data) {
|
||||
if (data->_description == NULL) return;
|
||||
|
||||
loadTalk(_vm->_characterName, &_characterFace);
|
||||
_vm->_disk->loadTalk(_vm->_characterName, &_characterFace);
|
||||
|
||||
StaticCnv v3C;
|
||||
v3C._width = _characterFace._width;
|
||||
@ -412,12 +412,12 @@ void displayItemComment(ExamineData *data) {
|
||||
|
||||
char v68[PATH_LEN];
|
||||
strcpy(v68, data->_filename);
|
||||
loadStatic(v68, &data->_cnv);
|
||||
_vm->_disk->loadStatic(v68, &data->_cnv);
|
||||
_vm->_graphics->flatBlitCnv(&data->_cnv, 140, (SCREEN_HEIGHT - data->_cnv._height)/2, Graphics::kBitFront, data->_cnv._data1);
|
||||
_vm->_graphics->freeStaticCnv(&data->_cnv);
|
||||
|
||||
StaticCnv cnv;
|
||||
loadHead(_vm->_characterName, &cnv);
|
||||
_vm->_disk->loadHead(_vm->_characterName, &cnv);
|
||||
|
||||
int16 v6A = 0, v6C = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user