… | |
… | |
28 | |
28 | |
29 | |
29 | |
30 | #include <global.h> |
30 | #include <global.h> |
31 | #include <loader.h> |
31 | #include <loader.h> |
32 | #include <sproto.h> |
32 | #include <sproto.h> |
|
|
33 | |
|
|
34 | // future resource loader base class |
|
|
35 | struct loader_base |
|
|
36 | { |
|
|
37 | virtual archetype *get_arch (const char *name); |
|
|
38 | virtual void put_arch (archetype *arch); |
|
|
39 | |
|
|
40 | virtual object *get_object (const char *name); |
|
|
41 | virtual void put_object (object *op); |
|
|
42 | |
|
|
43 | virtual player *get_player (); |
|
|
44 | virtual void put_player (player *pl); |
|
|
45 | |
|
|
46 | virtual region *get_region (); |
|
|
47 | virtual void put_region (region *region); |
|
|
48 | |
|
|
49 | virtual facetile *get_face (const char *name); |
|
|
50 | virtual void put_face (facetile *face); |
|
|
51 | |
|
|
52 | virtual treasurelist *get_treasure (const char *name, bool one = false); |
|
|
53 | virtual void put_treasure (treasurelist *treasure); |
|
|
54 | |
|
|
55 | virtual animation *get_animation (const char *name); |
|
|
56 | virtual void put_animation (animation *anim); |
|
|
57 | }; |
|
|
58 | |
|
|
59 | // future generic resource loader |
|
|
60 | // handles generic stuff valid in most files, such as |
|
|
61 | // animations, treasures, faces and so on |
|
|
62 | struct loader_generic : loader_base |
|
|
63 | { |
|
|
64 | virtual region *get_region (); |
|
|
65 | virtual void put_region (region *region); |
|
|
66 | |
|
|
67 | virtual facetile *get_face (const char *name); |
|
|
68 | virtual void put_face (facetile *face); |
|
|
69 | |
|
|
70 | virtual treasurelist *get_treasure (const char *name, bool one = false); |
|
|
71 | virtual void put_treasure (treasurelist *treasure); |
|
|
72 | |
|
|
73 | virtual animation *get_animation (const char *name); |
|
|
74 | virtual void put_animation (animation *anim); |
|
|
75 | }; |
33 | |
76 | |
34 | /* Maps the MOVE_* values to names */ |
77 | /* Maps the MOVE_* values to names */ |
35 | static const char *const move_name[] = { "walk", "fly_low", "fly_high", "swim", "boat", NULL }; |
78 | static const char *const move_name[] = { "walk", "fly_low", "fly_high", "swim", "boat", NULL }; |
36 | |
79 | |
37 | /* This table is only necessary to convert objects that existed before the |
80 | /* This table is only necessary to convert objects that existed before the |
… | |
… | |
374 | } |
417 | } |
375 | |
418 | |
376 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
419 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
377 | { |
420 | { |
378 | if (op->stats.hp > op->stats.maxhp) |
421 | if (op->stats.hp > op->stats.maxhp) |
|
|
422 | { |
379 | LOG (llevDebug, "Monster %s has hp set higher than maxhp (%d>%d)\n", op->debug_desc (), op->stats.hp, op->stats.maxhp); |
423 | LOG (llevDebug, "Monster %s has hp set higher than maxhp (%d>%d)\n", op->debug_desc (), op->stats.hp, op->stats.maxhp); |
|
|
424 | op->stats.maxhp = op->stats.hp; |
|
|
425 | } |
380 | |
426 | |
381 | /* The archs just need to be updated for this */ |
427 | /* The archs just need to be updated for this */ |
382 | if (op->move_type == 0) |
428 | if (op->move_type == 0) |
383 | op->move_type = MOVE_WALK; |
429 | op->move_type = MOVE_WALK; |
384 | } |
430 | } |