summaryrefslogtreecommitdiff
path: root/src/trigger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/trigger.c')
-rw-r--r--src/trigger.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/trigger.c b/src/trigger.c
index 41dc4a0..987b7f9 100644
--- a/src/trigger.c
+++ b/src/trigger.c
@@ -1,6 +1,11 @@
NAME(trigger);
PARENT(tile);
+static u8 strtobyte(const char *s) {
+ const char buf[3] = {s[0], s[1], '\0'};
+ return strtol(buf, nullptr, 16);
+}
+
INIT {
super("init");
this->on = propertyb("on");
@@ -8,6 +13,20 @@ INIT {
this->leave = propertyb("leave");
this->do_x = propertyb("flip x") || propertyb("x");
this->do_y = propertyb("flip y") || propertyb("y");
+ this->color_group = propertyi_default("color group", 0);
+
+ const auto color = propertyc("color");
+ if (color != nullptr && strlen(color) > 8) {
+ this->color.r = strtobyte(color + 1);
+ this->color.g = strtobyte(color + 3);
+ this->color.b = strtobyte(color + 5);
+ this->color.a = strtobyte(color + 7);
+ } else {
+ this->color.r = 0;
+ this->color.g = 0;
+ this->color.b = 0;
+ this->color.a = 255;
+ }
}
IMPL(target) {