mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
CHEWY: Convert get_tafinfo to use ScummVM File
This commit is contained in:
+23
-20
@@ -34,7 +34,9 @@
|
||||
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/file.h"
|
||||
#include "chewy/datei.h"
|
||||
|
||||
#define GRAFIK 1
|
||||
#define SPEICHER 2
|
||||
#define DATEI 3
|
||||
@@ -1580,28 +1582,24 @@ uint32 datei::get_poolsize(const char *fname, int16 chunk_start, int16 chunk_anz
|
||||
}
|
||||
|
||||
uint32 datei::get_tafinfo(const char *fname, taf_dateiheader **tafheader) {
|
||||
FILE *tafhandle;
|
||||
Common::File tafFile;
|
||||
uint32 size = 0;
|
||||
int16 id, i;
|
||||
int16 id;
|
||||
taf_dateiheader *tdh;
|
||||
tdh = (taf_dateiheader *)tmp;
|
||||
*tafheader = tdh;
|
||||
for (i = 0; (i < MAXPATH - 4) && (fname[i] != 0); i++)
|
||||
filename[i] = fname[i];
|
||||
filename[i] = 0;
|
||||
i = 0;
|
||||
if ((filename[i]) == 0)
|
||||
|
||||
strncpy(filename, fname, MAXPATH - 4);
|
||||
filename[MAXPATH - 4] = '\0';
|
||||
|
||||
if (!filename[0])
|
||||
get_filename(filename, MAXPATH);
|
||||
|
||||
if (!strchr(filename, '.'))
|
||||
strcat(filename, ".TAF\0");
|
||||
correct_fname(filename);
|
||||
tafhandle = 0;
|
||||
tafhandle = fopen(filename, "rb");
|
||||
if (tafhandle) {
|
||||
if (!(fread(tdh, sizeof(taf_dateiheader), 1, tafhandle))) {
|
||||
fcode = READFEHLER;
|
||||
modul = DATEI;
|
||||
} else {
|
||||
strcat(filename, ".taf");
|
||||
|
||||
if (tafFile.open(filename)) {
|
||||
if (tdh->load(&tafFile)) {
|
||||
id = get_id(tdh->id);
|
||||
if ((id == TAFDATEI) && (tdh->mode == 19)) {
|
||||
size = tdh->allsize + (((uint32)tdh->count) * 8l);
|
||||
@@ -1612,15 +1610,20 @@ uint32 datei::get_tafinfo(const char *fname, taf_dateiheader **tafheader) {
|
||||
modul = DATEI;
|
||||
size = 0;
|
||||
}
|
||||
} else {
|
||||
fcode = NOTTBF;
|
||||
modul = DATEI;
|
||||
size = 0;
|
||||
}
|
||||
fclose(tafhandle);
|
||||
}
|
||||
else {
|
||||
|
||||
tafFile.close();
|
||||
} else {
|
||||
fcode = OPENFEHLER;
|
||||
modul = DATEI;
|
||||
size = 0;
|
||||
}
|
||||
return (size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
void datei::load_palette(const char *fname, char *palette, int16 typ) {
|
||||
|
||||
@@ -30,6 +30,7 @@ MODULE_OBJS = \
|
||||
menus.o \
|
||||
metaengine.o \
|
||||
movclass.o \
|
||||
ngstypes.o \
|
||||
objekte.o \
|
||||
r_event.o \
|
||||
room.o \
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "chewy/ngstypes.h"
|
||||
|
||||
bool taf_dateiheader::load(Common::ReadStream *src) {
|
||||
src->read(id, 4);
|
||||
mode = src->readSint16LE();
|
||||
count = src->readSint16LE();
|
||||
allsize = src->readUint32LE();
|
||||
src->read(palette, 768);
|
||||
next = src->readUint32LE();
|
||||
korrekt = src->readSint16LE();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
#define CHEWY_NGSTYPES_H
|
||||
|
||||
#include "chewy/ngsdefs.h"
|
||||
#include "common/scummsys.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
typedef struct {
|
||||
uint32 Len;
|
||||
@@ -68,7 +68,7 @@ typedef struct {
|
||||
char palette [768];
|
||||
} tbf_dateiheader;
|
||||
|
||||
typedef struct {
|
||||
struct taf_dateiheader {
|
||||
char id[4];
|
||||
int16 mode;
|
||||
int16 count;
|
||||
@@ -76,7 +76,9 @@ typedef struct {
|
||||
char palette[768];
|
||||
uint32 next;
|
||||
int16 korrekt;
|
||||
} taf_dateiheader;
|
||||
|
||||
bool load(Common::ReadStream *src);
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int16 komp;
|
||||
|
||||
Reference in New Issue
Block a user