/* ScummVM - Scumm Interpreter
 * Copyright (C) 2002-2005 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /home9/user/studenten/dahms/c-source/cvs_root/tinsel/scnfile.h,v 1.4 2005/05/16 11:34:59 dahms Exp $
 */

#ifndef TINSEL_SCNFILE_H
#define TINSEL_SCNFILE_H

#include "common/array.h"
#include "common/file.h"

#include "tinsel/types.h"
#include "tinsel/bitmap.h"

namespace Tinsel {

struct SCNSection {
	uint16 type;
	uint32 offset;
	uint32 size;
};

struct SCNBitmap {
	uint16 offset;
	Bitmap *bitmap;
};

class SCNFile {
	Common::File _file;
	Common::Array<SCNSection> _sections;

	SCNPixelBlocks _blocks;
	Common::Array<SCNPalette> _palettes;
	Common::Array<SCNBitmap> _bitmaps;

	Bitmap *_background;
	uint32 _features;

	uint8 read_uint8();
	uint16 read_uint16();
	uint32 read_uint32();

	bool getSections();
	bool seekSection(uint16 section_id);
	uint32 getSectionSize(uint16 section_id);

	bool getBlocks();
	bool getPalettes();
	const SCNPalette *getPalette(uint32 offset);
	bool getBitmapList();

public:
	SCNFile(const char *filename, uint32 features = 0);
	virtual ~SCNFile();

	Bitmap *getBackgroundBitmap();
};

}

#endif // TINSEL_SCNFILE_H
