X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FInterpreter.h;h=b826d2cf7be2b15b03c58903b7b3078881545d04;hb=b02da898c7c8a08141df4e797774a61cf5e0163f;hp=c2fc25f84b6a1b6cb09edf1492e046f1e13c50d2;hpb=107b78b720db69ad402c09c0b1d9beb3b88a1952;p=l2e.git diff --git a/src/loader/Interpreter.h b/src/loader/Interpreter.h index c2fc25f..b826d2c 100644 --- a/src/loader/Interpreter.h +++ b/src/loader/Interpreter.h @@ -8,13 +8,40 @@ #ifndef LOADER_INTERPRETER_H_ #define LOADER_INTERPRETER_H_ +#include "TypeDescription.h" +#include "../geometry/Vector.h" +#include "../graphics/Color.h" +#include "../graphics/ComplexAnimation.h" + #include #include #include #include +#include namespace battle { + class Hero; class Monster; + class PartyLayout; + struct Resources; + class Stats; +} + +namespace common { + class Ikari; + class Item; + class Spell; + class TargetingMode; +} + +namespace graphics { + class Animation; + class Font; + class Frame; + class Gauge; + struct MenuProperties; + class SimpleAnimation; + class Sprite; } namespace loader { @@ -22,6 +49,7 @@ namespace loader { class Definition; class ParsedSource; class PropertyList; +class Value; class Interpreter { @@ -33,23 +61,54 @@ public: public: Interpreter(const ParsedSource &source) : source(source) { } - ~Interpreter() { } + ~Interpreter(); private: Interpreter(const Interpreter &); Interpreter &operator =(const Interpreter &); public: void ReadSource(); + void *GetObject(int typeId, const std::string &name); + + static void CreateTypeDescriptions(); + struct PostponedDefinition { + PostponedDefinition(int type, int id, std::ptrdiff_t offset, const char *identifier, int linkedType) + : type(type), id(id), offset(offset), identifier(identifier), linkedType(linkedType) { } + int type; + int id; + std::ptrdiff_t offset; + const char *identifier; + int linkedType; + }; + + const std::vector &PostponedDefinitions() { return postponedDefinitions; } private: + void ReadDefinition(const Definition &); void ReadLiteral(const Definition &); void ReadObject(const Definition &); - void ReadMonster(battle::Monster &, const PropertyList &); + void *GetObject(int typeId, const Value &value); + void ReadObject(int typeId, int id, char *dest, const PropertyList &); private: const ParsedSource &source; - std::vector monsters; + struct ParsedDefinition { + ParsedDefinition(const Definition *dfn, int type, int id) + : dfn(dfn), type(type), id(id) { } + const Definition *dfn; + int type; + int id; + }; + std::map parsedDefinitions; + + bool CanLink(const Value &) const; + void Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType); + std::vector postponedDefinitions; + + std::map imageCache; + + std::map > values; };