- [NEW] Al crear o duplicar un actor, el selecciona

- [NEW] Es pot esborrar actors.
- [FIX] Al crear, duplicar o esborrar un actor no updatava l'habitació
This commit is contained in:
2024-06-14 13:09:59 +02:00
parent 00c38299bf
commit 68eb379d2d

View File

@@ -413,6 +413,8 @@ bool game::loop()
actor::actor_t *new_act = actor::duplicate(actor::templates::get(editor::getCurrentTemplate())); actor::actor_t *new_act = actor::duplicate(actor::templates::get(editor::getCurrentTemplate()));
actor::setUniqueName(new_act); actor::setUniqueName(new_act);
actor::setDirty(new_act, true); actor::setDirty(new_act, true);
actor::select(new_act);
room::editor::modify();
} }
draw::color(LIGHT+WHITE); draw::color(LIGHT+WHITE);
@@ -692,23 +694,31 @@ switch (section)
changed |= btn_check(24+62, line, "ZN", act->react_push, PUSH_ZN, 12); changed |= btn_check(24+62, line, "ZN", act->react_push, PUSH_ZN, 12);
line+=12; line+=12;
if (changed) { room::editor::modify(); }
draw::color(PAPER); draw::color(PAPER);
draw::rect(2, 0, 96, 204); draw::rect(2, 0, 96, 204);
if (ui::button("DUPLICATE", 2, line, 96, 11)) if (ui::button("DUPLICATE", 2, line, 48, 11))
{ {
actor::actor_t *new_act = actor::duplicate(act); actor::actor_t *new_act = actor::duplicate(act);
actor::setUniqueName(new_act); actor::setUniqueName(new_act);
new_act->pos.x++; new_act->pos.y++; new_act->pos.x++; new_act->pos.y++;
actor::setDirty(new_act, true); actor::setDirty(new_act, true);
actor::select(new_act);
changed = true;
}
if (ui::button("DELETE", 48, line, 48, 11))
{
actor::remove(act);
act = nullptr;
changed = true;
} }
line+=10; line+=10;
if (changed) { room::editor::modify(); }
if (ui::button("ADD TO TEMPLATES", 2, line, 96, 11)) if (ui::button("ADD TO TEMPLATES", 2, line, 96, 11))
{ {
if (!actor::templates::getByName(act->name)) actor::templates::add(act); if (act && !actor::templates::getByName(act->name)) actor::templates::add(act);
} }
//changed |= btn_opt("ANIMCYC", 2, 106, act->anim_cycle, {0, 1}, {"0 1 0 2", "0 1 2 3"}); //changed |= btn_opt("ANIMCYC", 2, 106, act->anim_cycle, {0, 1}, {"0 1 0 2", "0 1 2 3"});