dialog: animate x position for multiple actors on the same side

This commit is contained in:
Andrei Alexeyev 2020-05-05 11:47:42 +03:00
parent 9deea31f06
commit b8088998d8
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4

View file

@ -88,12 +88,19 @@ void dialog_update(Dialog *d) {
fapproach_asymptotic_p(&d->opacity, 1, 0.05, 1e-3);
}
for(DialogActor *a = d->actors.first; a; a = a->next) {
const float offset_per_actor = 32;
float target_offsets[2] = { 0 };
for(DialogActor *a = d->actors.last; a; a = a->prev) {
fapproach_asymptotic_p(&a->offset.x, target_offsets[a->side], 0.10, 1e-3);
target_offsets[a->side] += offset_per_actor;
if(d->state == DIALOG_STATE_FADEOUT) {
fapproach_asymptotic_p(&a->opacity, 0, 0.12, 1e-3);
} else {
fapproach_asymptotic_p(&a->opacity, a->target_opacity, 0.04, 1e-3);
}
fapproach_asymptotic_p(&a->focus, a->target_focus, 0.12, 1e-3);
}
}