ScummVM API documentation
character_settings_xml_parser.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TETRAEDGE_GAME_CHARACTER_SETTINGS_XML_PARSER_H
23 #define TETRAEDGE_GAME_CHARACTER_SETTINGS_XML_PARSER_H
24 
25 #include "common/formats/xmlparser.h"
26 #include "tetraedge/game/character.h"
27 #include "tetraedge/te/te_vector3f32.h"
28 
29 namespace Tetraedge {
30 
32 public:
33  void setCharacterSettings(Common::HashMap<Common::String, Character::CharacterSettings> *settings) {
34  _characterSettings = settings;
35  };
36 
37  // Parser
38  CUSTOM_XML_PARSER(CharacterSettingsXmlParser) {
39  XML_KEY(ModelsSettings)
40  XML_KEY(Model)
41  XML_PROP(name, true)
42  XML_KEY(modelFileName)
43  KEY_END()
44  XML_KEY(defaultScale)
45  KEY_END()
46  XML_KEY(invertNormals)
47  KEY_END()
48  XML_KEY(walk)
49  XML_KEY(animationFileName)
50  KEY_END()
51  XML_KEY(walkType)
52  XML_PROP(name, true)
53  XML_KEY(start)
54  XML_PROP(file, true)
55  XML_PROP(stepRight, false)
56  XML_PROP(stepLeft, false)
57  KEY_END()
58  XML_KEY(loop)
59  XML_PROP(file, true)
60  XML_PROP(stepRight, false)
61  XML_PROP(stepLeft, false)
62  KEY_END()
63  XML_KEY(endD)
64  XML_PROP(file, true)
65  XML_PROP(stepRight, false)
66  XML_PROP(stepLeft, false)
67  KEY_END()
68  XML_KEY(endG)
69  XML_PROP(file, true)
70  XML_PROP(stepRight, false)
71  XML_PROP(stepLeft, false)
72  KEY_END()
73  KEY_END()
74  XML_KEY(speed)
75  KEY_END()
76  KEY_END()
77  XML_KEY(cutSceneCurveDemi)
78  XML_KEY(position)
79  KEY_END()
80  KEY_END()
81  XML_KEY(face)
82  XML_PROP(name, true)
83  XML_KEY(eyes)
84  KEY_END()
85  XML_KEY(mouth)
86  KEY_END()
87  KEY_END()
88  XML_KEY(body)
89  XML_PROP(name, true)
90  KEY_END()
91  KEY_END()
92  KEY_END()
93  } PARSER_END()
94 
95  // Parser callback methods
96  bool parserCallback_ModelsSettings(ParserNode *node);
97  bool parserCallback_Model(ParserNode *node);
98  bool parserCallback_modelFileName(ParserNode *node);
99  bool parserCallback_defaultScale(ParserNode *node);
100  bool parserCallback_walk(ParserNode *node);
101  bool parserCallback_animationFileName(ParserNode *node);
102  bool parserCallback_walkType(ParserNode *node);
103  bool parserCallback_start(ParserNode *node); // walk anim
104  bool parserCallback_loop(ParserNode *node); // walk anim
105  bool parserCallback_endD(ParserNode *node); // for walk anim
106  bool parserCallback_endG(ParserNode *node); // for walk anim
107  bool parserCallback_speed(ParserNode *node); // walk speed
108  bool parserCallback_cutSceneCurveDemi(ParserNode *node);
109  bool parserCallback_position(ParserNode *node); // position of cutSceneCurveDemi
110  bool parserCallback_face(ParserNode *node);
111  bool parserCallback_eyes(ParserNode *node);
112  bool parserCallback_mouth(ParserNode *node);
113  bool parserCallback_body(ParserNode *node);
114  bool parserCallback_invertNormals(ParserNode *node);
115 
116  bool textCallback(const Common::String &val) override;
117  bool handleUnknownKey(ParserNode *node) override;
118 
119 private:
120  Character::AnimSettings parseWalkAnimSettings(const ParserNode *node) const;
121 
122  enum TextTagType {
123  TagModelFileName,
124  TagDefaultScale,
125  TagAnimationFileName,
126  TagEyes,
127  TagMouth,
128  TagSpeed,
129  TagPosition,
130  TagBody
131  };
132 
133  TextTagType _curTextTag;
134  Character::CharacterSettings *_curCharacter;
135  Character::WalkSettings *_curWalkSettings;
137 };
138 
139 } // end namespace Tetraedge
140 
141 #endif // TETRAEDGE_GAME_CHARACTER_SETTINGS_XML_PARSER_H
Definition: str.h:59
Definition: detection.h:27
Definition: character_settings_xml_parser.h:31
Definition: xmlparser.h:145
bool handleUnknownKey(ParserNode *node) override
Definition: xmlparser.h:98
Definition: hashmap.h:85
Definition: character.h:46
Definition: character.h:59
bool textCallback(const Common::String &val) override
Definition: character.h:53