add move_asymptotic_halflife

This commit is contained in:
Andrei Alexeyev 2020-02-19 04:06:14 +02:00
parent 90b8fa0ef0
commit 203c3c657d
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
2 changed files with 5 additions and 2 deletions

View file

@ -34,10 +34,13 @@ INLINE MoveParams move_accelerated(cmplx vel, cmplx accel) {
}
INLINE MoveParams move_asymptotic(cmplx vel0, cmplx vel1, cmplx retention) {
// NOTE: retention could be derived by something like: exp(-1 / halflife)
return (MoveParams) { vel0, vel1 * (1 - retention), retention };
}
INLINE MoveParams move_asymptotic_halflife(cmplx vel0, cmplx vel1, double halflife) {
return move_asymptotic(vel0, vel1, exp2(-1.0 / halflife));
}
INLINE MoveParams move_asymptotic_simple(cmplx vel, double boost_factor) {
// NOTE: this matches the old asymptotic rule semantics exactly
double retention = 0.8;

View file

@ -100,7 +100,7 @@ TASK_WITH_INTERFACE(boss_nonspell_1, BossAttack) {
.proto = pp_crystal,
.pos = shot_org,
.color = RGB(0.3, 0.3, 0.8),
.move = move_asymptotic(speed0 * -I * cdir(angle), speed1 * I, exp2(-1 / 30.0)),
.move = move_asymptotic_halflife(speed0 * -I * cdir(angle), speed1 * I, 30.0),
.max_viewport_dist = 256,
);
t += WAIT(difficulty_value(3, 3, 1, 1));