#pragma once
//===========================================================================//
// File:	 GAF.hpp														 //
// Project:  GameOS					                                         //
// Contents: Script control													 //
//---------------------------------------------------------------------------//
// Date      Who    Modification                                             //
// 07/06/98  JTR	Created													 //
//					Currently only supports 16 bit storage					 //
//---------------------------------------------------------------------------//
// Copyright (C) 2000, Microsoft, Inc.										//
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//


// Setup define for SPEW regarding GAFs
#define GROUP_GAF "GameOS_GAF"

// The latest iteration of GAFs
#define LATEST_GAF_VERSION 5


typedef struct _gafheader
{
	BYTE	m_hdr[4];
	BYTE	m_version;
	unsigned long m_width;
	unsigned long m_height;
	unsigned long m_totalImages;
	BYTE	m_pixelFormat;
} GAFHEADER;

class gos_GAF
{
	public:
		GAFHEADER * m_gafHeader;
		HGOSSURFACE m_primarySurface;
		BYTE * m_fileData;
		DWORD m_tableOffset;
		int m_lastFrame;
	public:
		gos_GAF(char * file);
		void GetFrame(int num, HGOSSURFACE *targ);
		static void Squish(char * dst, char * src, DWORD p, DWORD x, DWORD y);
		~gos_GAF();
		static int CompressGAFFrameFromFirst(HGOSFILE dst_file, char * path, int frame, DWORD * lpOriginalData, DWORD * lpFlippedFrameData, DWORD * lpDeltaFrameData, int size);
		static int CompressGAFFrameFromLast(HGOSFILE dst_file, char * path, int frame, DWORD * lpOriginalData, DWORD * lpFlippedFrameData, DWORD * lpDeltaFrameData, int size);
		static void MirrorVertical(char * dst, char * src, DWORD p, DWORD x, DWORD y);
};


