1 /* 2 * miscinf.h - Information about several previously-hardcoded shape data. 3 * 4 * Copyright (C) 2006 The Exult Team 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 */ 20 21 #ifndef MISCINF_H 22 #define MISCINF_H 1 23 #include <map> 24 #include <memory> 25 #include <string> 26 #include <vector> 27 28 class Actor; 29 30 struct Base_Avatar_info { 31 int shape_num; 32 int face_shape; // Shape and frame for face during the 33 int face_frame; // normal game. 34 }; 35 36 struct Avatar_default_skin { 37 int default_skin; // The starting skin color. 38 bool default_female; // True if the default sex if female. 39 }; 40 41 struct Skin_data { 42 int skin_id; 43 int shape_num; 44 int naked_shape; 45 int face_shape; // Shape and frame for face during the 46 int face_frame; // normal game. 47 int alter_face_shape; // Shape and frame for face to be used 48 int alter_face_frame; // when flag 33 is set. 49 bool is_female; 50 bool copy_info; // Whether or not Exult should overwrite shape info 51 // with info from the default avatar shape 52 }; 53 54 struct Usecode_function_data { 55 int fun_id; 56 int event_id; 57 }; 58 59 class Shapeinfo_entry_parser; 60 struct Shapeinfo_data; 61 struct Avatar_data; 62 63 /* 64 * A class to get the extra information for a given shape. 65 */ 66 class Shapeinfo_lookup { 67 using Readstrings = std::vector<std::string>; 68 static Skin_data *ScrollSkins(int skin, bool sex, bool sishapes, bool ignoresex, bool prev, bool sel); 69 public: 70 static void reset(); 71 72 static std::vector<std::pair<std::string, int> > *GetFacesSources(); 73 static std::vector<std::pair<std::string, int> > *GetPaperdollSources(); 74 static std::vector<std::pair<int, int> > *GetImportedSkins(); 75 static std::vector<std::pair<int, int> > *GetImportedGumpShapes(); 76 static int GetBlueShapeData(int spot); 77 static bool IsSkinImported(int shape); 78 79 static Base_Avatar_info *GetBaseAvInfo(bool sex); 80 static int GetMaleAvShape(); 81 static int GetFemaleAvShape(); 82 static int GetNextSkin(int skin, bool sex, bool sishapes, bool ignoresex = false) { 83 return (ScrollSkins(skin, sex, sishapes, ignoresex, false, false))->skin_id; 84 } 85 static int GetPrevSkin(int skin, bool sex, bool sishapes, bool ignoresex = false) { 86 return (ScrollSkins(skin, sex, sishapes, ignoresex, true, false))->skin_id; 87 } 88 static Skin_data *GetNextSelSkin(Skin_data *sk, bool sishapes, bool ignoresex = false) { 89 return ScrollSkins(sk->skin_id, sk->is_female, sishapes, ignoresex, false, true); 90 } 91 static Skin_data *GetPrevSelSkin(Skin_data *sk, bool sishapes, bool ignoresex = false) { 92 return ScrollSkins(sk->skin_id, sk->is_female, sishapes, ignoresex, true, true); 93 } 94 static int GetNumSkins(bool sex); 95 static Avatar_default_skin *GetDefaultAvSkin(); 96 static std::vector<Skin_data> *GetSkinList(); 97 static Skin_data *GetSkinInfo(int skin, bool sex); 98 static Skin_data *GetSkinInfoSafe(int skin, bool sex, bool sishapes); 99 static Skin_data *GetSkinInfoSafe(Actor *npc); 100 static bool IsSkinSelectable(int skin); 101 static bool HasFaceReplacement(int npcid); 102 static int GetFaceReplacement(int facenum); 103 static Usecode_function_data *GetAvUsecode(int type); 104 105 static int get_skinvar(const std::string& key); 106 private: 107 static void Read_data_file(const char *fname, const char *sections[], 108 Shapeinfo_entry_parser *parsers[], int numsections); 109 static void setup_shape_files(); 110 static void setup_avatar_data(); 111 static std::unique_ptr<Shapeinfo_data> data; 112 static std::unique_ptr<Avatar_data> avdata; 113 }; 114 115 #endif 116