iohandler.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Mike Polan                                      *
00003  *   kanadakid@gmail.com                                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 // iohandler.h: various I/O functions
00021 
00022 #ifndef IOHANDLER_H
00023 #define IOHANDLER_H
00024 
00025 #include <iostream>
00026 
00027 #include "case.h"
00028 #include "sprite.h"
00029 #include "texture.h"
00030 #include "theme.h"
00031 
00033 namespace IO {
00034 
00036 struct _PWTHeader {
00037         int ident; // magic number
00038         int version; // file version
00039 
00040         // byte offsets in data (relative to start of file)
00041         int overviewOffset;
00042         int overridesOffset;
00043         int charOffset;
00044         int imgOffset;
00045         int bgOffset;
00046         int evidenceOffset;
00047         int locationOffset;
00048         int audioOffset;
00049         int testimonyOffset;
00050         int blockOffset;
00051 };
00052 typedef struct _PWTHeader PWTHeader;
00053 
00055 const int FILE_MAGIC_NUM=(('T' << 16) + ('W' << 8) + 'P');
00056 
00058 const int FILE_VERSION=10;
00059 
00061 const ustring SPR_MAGIC_NUM="SPR";
00062 
00064 const int SPR_VERSION=10;
00065 
00070 bool unpackResourceFile(const ustring &path);
00071 
00077 bool loadCaseFromFile(const ustring &path, Case::Case &pcase);
00078 
00084 bool loadSpriteFromFile(const ustring &path, Sprite &sprite);
00085 
00091 bool loadStockFile(const ustring &path, Case::Case *pcase);
00092 
00098 bool loadThemeXML(const ustring &path, Theme::ColorMap &map);
00099 
00104 Textures::Texture readImage(FILE *f);
00105 
00110 ustring readString(FILE *f);
00111 
00112 }; // namespace IO
00113 
00114 #endif

Generated on Fri Feb 22 22:29:23 2008 for Phoenix Wright Case Player API by  doxygen 1.5.3