… | |
… | |
21 | * |
21 | * |
22 | * The authors can be reached via e-mail to crossfire@schmorp.de |
22 | * The authors can be reached via e-mail to crossfire@schmorp.de |
23 | */ |
23 | */ |
24 | |
24 | |
25 | |
25 | |
|
|
26 | #ifndef LOADER_H__ |
|
|
27 | #define LOADER_H__ |
|
|
28 | |
26 | #define LL_IGNORED -1 |
29 | #define LL_IGNORED -1 |
27 | #define LL_EOF 0 |
30 | #define LL_EOF 0 |
28 | #define LL_MORE 1 |
31 | #define LL_MORE 1 |
29 | #define LL_NORMAL 2 |
32 | #define LL_NORMAL 2 |
30 | |
33 | |
31 | extern int nrofpixmaps; |
34 | extern int nrofpixmaps; |
32 | |
35 | |
33 | // resource loader pure base class |
36 | bool load_resource_file (const char *filename); |
34 | struct loader_base |
|
|
35 | { |
|
|
36 | const char *filename; |
|
|
37 | |
37 | |
38 | virtual ~loader_base (); |
38 | #endif |
39 | |
39 | |
40 | virtual archetype *get_arch (const char *name); |
|
|
41 | virtual void put_arch (archetype *arch); |
|
|
42 | |
|
|
43 | virtual object *get_object (const char *name); |
|
|
44 | virtual void put_object (object *op); |
|
|
45 | |
|
|
46 | virtual player *get_player (); |
|
|
47 | virtual void put_player (player *pl); |
|
|
48 | |
|
|
49 | virtual region *get_region (const char *name); |
|
|
50 | virtual void put_region (region *rgn); |
|
|
51 | |
|
|
52 | virtual facetile *get_face (const char *name); |
|
|
53 | virtual void put_face (facetile *face); |
|
|
54 | |
|
|
55 | virtual treasurelist *get_treasure (const char *name, bool one = false); |
|
|
56 | virtual void put_treasure (treasurelist *treasure); |
|
|
57 | |
|
|
58 | virtual animation *get_animation (const char *name); |
|
|
59 | virtual void put_animation (animation *anim); |
|
|
60 | |
|
|
61 | bool parse_arch (object_thawer &thawer, archetype *arch); |
|
|
62 | bool parse_object (object_thawer &thawer, object *op); |
|
|
63 | bool parse_player (object_thawer &thawer, player *pl); |
|
|
64 | bool parse_region (object_thawer &thawer, region *rgn); |
|
|
65 | bool parse_face (object_thawer &thawer, facetile *face); |
|
|
66 | bool parse_treasure (object_thawer &thawer, treasurelist *treasure); |
|
|
67 | bool parse_animation (object_thawer &thawer, animation *anim); |
|
|
68 | |
|
|
69 | bool parse (object_thawer &thawer); |
|
|
70 | |
|
|
71 | bool load (const char *filename); |
|
|
72 | }; |
|
|
73 | |
|
|
74 | // pure base class for default archetype loader |
|
|
75 | struct loader_arch : virtual loader_base { |
|
|
76 | archetype *get_arch (const char *name); |
|
|
77 | void put_arch (archetype *arch); |
|
|
78 | }; |
|
|
79 | |
|
|
80 | // pure base class for default object loader |
|
|
81 | struct loader_object : virtual loader_base { |
|
|
82 | object *get_object (const char *name); |
|
|
83 | void put_object (object *op); |
|
|
84 | }; |
|
|
85 | |
|
|
86 | // pure base class for default player loader |
|
|
87 | struct loader_player : virtual loader_base { |
|
|
88 | virtual player *get_player (); |
|
|
89 | virtual void put_player (player *pl); |
|
|
90 | }; |
|
|
91 | |
|
|
92 | // pure base class for default region loader |
|
|
93 | struct loader_region : virtual loader_base { |
|
|
94 | region *get_region (const char *name); |
|
|
95 | void put_region (region *rgn); |
|
|
96 | }; |
|
|
97 | |
|
|
98 | // pure base class for default face loader |
|
|
99 | struct loader_face : virtual loader_base { |
|
|
100 | facetile *get_face (const char *name); |
|
|
101 | void put_face (facetile *face); |
|
|
102 | }; |
|
|
103 | |
|
|
104 | // pure base class for default treasure loader |
|
|
105 | struct loader_treasure : virtual loader_base { |
|
|
106 | treasurelist *get_treasure (const char *name, bool one = false); |
|
|
107 | void put_treasure (treasurelist *treasure); |
|
|
108 | }; |
|
|
109 | |
|
|
110 | // pure base class for default animation loader |
|
|
111 | struct loader_animation : virtual loader_base { |
|
|
112 | animation *get_animation (const char *name); |
|
|
113 | void put_animation (animation *anim); |
|
|
114 | }; |
|
|
115 | |
|
|
116 | // future generic resource loader |
|
|
117 | // handles generic stuff valid in most files, such as |
|
|
118 | // animations, treasures, faces and so on |
|
|
119 | struct loader_generic |
|
|
120 | : virtual loader_base, |
|
|
121 | loader_object, loader_player, |
|
|
122 | loader_region, loader_face, |
|
|
123 | loader_treasure, loader_animation |
|
|
124 | { |
|
|
125 | }; |
|
|
126 | |
|
|