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
29namespace Tetraedge {
30
32public:
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 XML_KEY(rippleTexture)
92 XML_PROP(path, true)
93 KEY_END()
94 KEY_END()
95 KEY_END()
96 } PARSER_END()
97
98 // Parser callback methods
99 bool parserCallback_ModelsSettings(ParserNode *node);
100 bool parserCallback_Model(ParserNode *node);
101 bool parserCallback_modelFileName(ParserNode *node);
102 bool parserCallback_defaultScale(ParserNode *node);
103 bool parserCallback_walk(ParserNode *node);
104 bool parserCallback_animationFileName(ParserNode *node);
105 bool parserCallback_walkType(ParserNode *node);
106 bool parserCallback_start(ParserNode *node); // walk anim
107 bool parserCallback_loop(ParserNode *node); // walk anim
108 bool parserCallback_endD(ParserNode *node); // for walk anim
109 bool parserCallback_endG(ParserNode *node); // for walk anim
110 bool parserCallback_speed(ParserNode *node); // walk speed
111 bool parserCallback_cutSceneCurveDemi(ParserNode *node);
112 bool parserCallback_position(ParserNode *node); // position of cutSceneCurveDemi
113 bool parserCallback_face(ParserNode *node);
114 bool parserCallback_eyes(ParserNode *node);
115 bool parserCallback_mouth(ParserNode *node);
116 bool parserCallback_body(ParserNode *node);
117 bool parserCallback_invertNormals(ParserNode *node);
118 bool parserCallback_rippleTexture(ParserNode *node);
119
120 bool textCallback(const Common::String &val) override;
121 bool handleUnknownKey(ParserNode *node) override;
122
123private:
124 Character::AnimSettings parseWalkAnimSettings(const ParserNode *node) const;
125
126 enum TextTagType {
127 TagModelFileName,
128 TagDefaultScale,
129 TagAnimationFileName,
130 TagEyes,
131 TagMouth,
132 TagSpeed,
133 TagPosition,
134 TagBody
135 };
136
137 TextTagType _curTextTag;
138 Character::CharacterSettings *_curCharacter;
139 Character::WalkSettings *_curWalkSettings;
141};
142
143} // end namespace Tetraedge
144
145#endif // TETRAEDGE_GAME_CHARACTER_SETTINGS_XML_PARSER_H
Definition: hashmap.h:85
Definition: str.h:59
Definition: xmlparser.h:98
Definition: character_settings_xml_parser.h:31
bool textCallback(const Common::String &val) override
bool handleUnknownKey(ParserNode *node) override
Definition: xmlparser.h:145
Definition: character.h:46
Definition: character.h:59
Definition: character.h:53