shapevga.h

Go to the documentation of this file.
00001 /*
00002  *  shapevga.h - Handle the 'shapes.vga' file and associated info.
00003  *
00004  *  Copyright (C) 1999  Jeffrey S. Freedman
00005  *  Copyright (C) 2000-2001  The Exult Team
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020  */
00021 
00022 #ifndef INCL_SHAPEVGA
00023 #define INCL_SHAPEVGA 1
00024 
00025 #include <fstream>
00026 #include <iostream>
00027 #ifdef MACOS
00028   #include <cassert>
00029 #endif
00030 #include "autoarray.h"
00031 #include "fnames.h"
00032 #include "imagebuf.h"
00033 #include "vgafile.h"
00034 #include "shapeinf.h"
00035 
00036 /*
00037  *  The "shapes.vga" file:
00038  */
00039 class Shapes_vga_file : public Vga_file
00040 {
00041   autoarray<Shape_info> info; // Extra info. about each shape.
00042   Shape_info zinfo;   // A fake one (all 0's).
00043   bool info_read;     // True when info is set.
00044 public:
00045   Shapes_vga_file() : info(), info_read(false) {  }
00046   Shapes_vga_file(const char *nm, int u7drag = -1, const char *nm2 = 0);
00047   void init();
00048   virtual ~Shapes_vga_file();
00049           // Read additional data files.
00050   void read_info(bool bg, bool editing = false);
00051   void write_info(bool bg); // Write them back out.
00052   Shape_info& get_info(int shapenum)
00053   {
00054     // Shapes 1024 -> 1035 in SI are alternative player chars.
00055     // Odd are female, even are male.
00056     return shapenum>=1024&&shapenum<=1035&&shapenum%2 ? info[989]:
00057       shapenum>=1024&&shapenum<=1035 ? info[721]:
00058       info[shapenum];
00059   }
00060 };
00061 
00062 #endif

Generated on Mon Jul 9 14:42:50 2007 for ExultEngine by  doxygen 1.5.1