00001 /* 00002 Copyright (C) 2003-2006 The Pentagram team 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License 00006 as published by the Free Software Foundation; either version 2 00007 of the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef GAMEDATA_H 00020 #define GAMEDATA_H 00021 00022 #include <vector> 00023 #include "FrameID.h" 00024 00025 class RawArchive; 00026 class MainShapeArchive; 00027 class FontShapeArchive; 00028 class GumpShapeArchive; 00029 class ShapeArchive; 00030 class Usecode; 00031 class MapGlob; 00032 class Shape; 00033 class MusicFlex; 00034 class WpnOvlayDat; 00035 class ShapeFrame; 00036 class SoundFlex; 00037 class SpeechFlex; 00038 00039 class GameData 00040 { 00041 public: 00042 GameData(); 00043 ~GameData(); 00044 00045 static GameData* get_instance() { return gamedata; } 00046 00047 void loadU8Data(); 00048 void loadRemorseData(); 00049 void setupFontOverrides(); 00050 00051 Usecode* getMainUsecode() const { return mainusecode; } 00052 MainShapeArchive* getMainShapes() const { return mainshapes; } 00053 RawArchive* getFixed() const { return fixed; } 00054 MapGlob* getGlob(uint32 glob) const; 00055 FontShapeArchive* getFonts() const { return fonts; } 00056 GumpShapeArchive* getGumps() const { return gumps; } 00057 Shape* getMouse() const { return mouse; } 00058 MusicFlex* getMusic() const { return music; } 00059 WpnOvlayDat* getWeaponOverlay() const { return weaponoverlay; } 00060 SoundFlex* getSoundFlex() const { return soundflex; } 00061 SpeechFlex* getSpeechFlex(uint32 shapenum); 00062 00063 ShapeArchive* getShapeFlex(uint16 flexId) const; 00064 Shape* getShape(FrameID frameid) const; 00065 ShapeFrame* getFrame(FrameID frameid) const; 00066 00067 std::string translate(std::string text); 00068 FrameID translate(FrameID frame); 00069 00070 enum ShapeFlexId { 00071 OTHER = 0, 00072 MAINSHAPES = 1, 00073 GUMPS = 2 00074 }; 00075 private: 00076 void loadTranslation(); 00077 void setupTTFOverrides(const char* configkey, bool SJIS); 00078 void setupJPOverrides(); 00079 00080 RawArchive* fixed; 00081 MainShapeArchive* mainshapes; 00082 Usecode* mainusecode; 00083 std::vector<MapGlob*> globs; 00084 FontShapeArchive* fonts; 00085 GumpShapeArchive* gumps; 00086 Shape* mouse; 00087 MusicFlex* music; 00088 WpnOvlayDat* weaponoverlay; 00089 00090 SoundFlex* soundflex; 00091 std::vector<SpeechFlex**> speech; 00092 00093 static GameData* gamedata; 00094 }; 00095 00096 #define _TL_(x) (GameData::get_instance()->translate(x)) 00097 #define _TL_SHP_(x) (GameData::get_instance()->translate(x)) 00098 00099 #endif