Mercurial > molko
comparison libmlk-adventure/adventure/state/map.c @ 260:60a214ec1ab4
adventure: change the way states are stored
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 06 Dec 2020 22:50:48 +0100 |
parents | 16be1ad3ddba |
children | bfde372bf152 |
comparison
equal
deleted
inserted
replaced
259:16be1ad3ddba | 260:60a214ec1ab4 |
---|---|
29 #include <core/state.h> | 29 #include <core/state.h> |
30 | 30 |
31 #include <rpg/map.h> | 31 #include <rpg/map.h> |
32 #include <rpg/map-file.h> | 32 #include <rpg/map-file.h> |
33 | 33 |
34 #include <adventure/actions/spawner.h> | |
34 #include <adventure/actions/teleport.h> | 35 #include <adventure/actions/teleport.h> |
35 | 36 |
36 #include "molko.h" | 37 #include "molko.h" |
37 #include "map.h" | 38 #include "map.h" |
38 | 39 |
42 int origin_x; | 43 int origin_x; |
43 int origin_y; | 44 int origin_y; |
44 struct map map; | 45 struct map map; |
45 struct map_file map_file; | 46 struct map_file map_file; |
46 }; | 47 }; |
48 | |
49 static void | |
50 load_spawner(struct map *map, int x, int y, int w, int h, const char *value) | |
51 { | |
52 (void)x; | |
53 (void)y; | |
54 (void)w; | |
55 (void)h; | |
56 (void)value; | |
57 | |
58 action_stack_add(&map->astack_par, spawner_new(map, 100, 300)); | |
59 } | |
47 | 60 |
48 static void | 61 static void |
49 load_teleport(struct map *map, int x, int y, int w, int h, const char *value) | 62 load_teleport(struct map *map, int x, int y, int w, int h, const char *value) |
50 { | 63 { |
51 char name[128] = {0}; | 64 char name[128] = {0}; |
60 { | 73 { |
61 static const struct { | 74 static const struct { |
62 const char *name; | 75 const char *name; |
63 void (*load)(struct map *, int, int, int, int, const char *); | 76 void (*load)(struct map *, int, int, int, int, const char *); |
64 } table[] = { | 77 } table[] = { |
65 { "teleport|", load_teleport } | 78 { "teleport|", load_teleport }, |
79 { "spawner|", load_spawner } | |
66 }; | 80 }; |
67 | 81 |
68 for (size_t i = 0; i < NELEM(table); ++i) { | 82 for (size_t i = 0; i < NELEM(table); ++i) { |
69 size_t len = strlen(table[i].name); | 83 size_t len = strlen(table[i].name); |
70 | 84 |