stage3: port rest of night ignite

This commit is contained in:
Andrei Alexeyev 2021-02-28 07:36:04 +02:00
parent 1cd84d7834
commit fddf314db9
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -56,6 +56,41 @@ TASK(slave, { BoxedBoss boss; real rot_speed; real rot_initial; }) {
}
}
TASK(warnlaser, { BoxedLaser base_laser; }) {
Laser *b = NOT_NULL(ENT_UNBOX(ARGS.base_laser));
real f = 6;
Laser *l = TASK_BIND(create_laser(
b->pos, 90, 120, RGBA(1, 1, 1, 0), b->prule, NULL,
f*b->args[0], b->args[1], f*b->args[2], b->args[3]
));
laser_make_static(l);
for(int t = 0;; ++t, YIELD) {
if(t == 90) {
play_sfx_ex("laser1", 30, false);
}
laser_charge(l, t, 90, 10);
l->color = *color_lerp(RGBA(0.2, 0.2, 1, 0), RGBA(1, 0.2, 0.2, 0), t / l->deathtime);
}
}
TASK(laserbullet, { ProjPrototype *proto; Color *color; BoxedLaser laser; cmplx pos; real time_offset; }) {
Projectile *p = TASK_BIND(PROJECTILE(
.proto = ARGS.proto,
.color = ARGS.color,
.pos = ARGS.pos,
.move = move_linear(0),
));
int t = 0;
for(Laser *l; (l = ENT_UNBOX(ARGS.laser)); ++t, YIELD) {
p->move.velocity = l->prule(l, t + ARGS.time_offset) - p->pos;
}
}
DEFINE_EXTERN_TASK(stage3_spell_night_ignite) {
Boss *boss = INIT_BOSS_ATTACK(&ARGS);
boss->move = move_towards(VIEWPORT_W/2 + VIEWPORT_H*I/3, 0.05);
@ -68,5 +103,60 @@ DEFINE_EXTERN_TASK(stage3_spell_night_ignite) {
INVOKE_SUBTASK(slave, ENT_BOX(boss), -1/70.0, -i*M_TAU/nslaves);
}
real dt = 200;
real lt = difficulty_value(25, 50, 75, 100);
real amp = M_PI/5;
real freq = 0.05;
int laserbullets = difficulty_value(8, 12, 16, 20);
int t = 0;
for(int cycle = 0;; ++cycle, t += WAIT(180)) {
for(int step = 0; step < 12; ++step, t += WAIT(10)) {
real a = step * M_PI/2.5 + cycle + t;
cmplx vel = 2 * cdir(a);
Laser *l1 = create_lasercurve3c(
boss->pos, lt, dt,
RGBA(0.3, 0.3, 1.0, 0.0),
las_sine_expanding, vel, amp, freq
);
INVOKE_TASK(warnlaser, ENT_BOX(l1));
Laser *l2 = create_lasercurve3c(
boss->pos, lt * 1.5, dt,
RGBA(1.0, 0.3, 0.3, 0.0),
las_sine_expanding, vel, amp, freq - 0.002 * imin(global.diff, D_Hard)
);
INVOKE_TASK(warnlaser, ENT_BOX(l2));
Laser *l3 = create_lasercurve3c(
boss->pos, lt, dt,
RGBA(0.3, 0.3, 1.0, 0.0),
las_sine_expanding, vel, amp, freq - 0.004 * imin(global.diff, D_Hard)
);
INVOKE_TASK(warnlaser, ENT_BOX(l3));
for(int i = 0; i < laserbullets; ++i) {
#define LASERBULLLET(_proto, _color, _laser) \
INVOKE_TASK(laserbullet, \
.proto = _proto, \
.color = _color, \
.laser = ENT_BOX(_laser), \
.pos = boss->pos, \
.time_offset = -i \
)
LASERBULLLET(pp_plainball, RGBA(0.3, 0.3, 1.0, 0), l1);
LASERBULLLET(pp_bigball, RGBA(1.0, 0.3, 0.3, 0), l2);
LASERBULLLET(pp_plainball, RGBA(0.3, 0.3, 1.0, 0), l3);
play_sfx("shot1");
}
play_sfx_ex("shot_special1", 1, false);
}
}
STALL;
}