Still needs work, but good enough for now. Merges #203 Squashed commit of the following: commit7f30ef2393
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Fri Jan 27 23:50:42 2023 +0100 stageinfo: finally rename stage3 commit53ca691e68
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Fri Jan 27 23:38:36 2023 +0100 stage3: telegraph moonlight rockets commit4d247877e7
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Jan 18 15:54:44 2023 +0100 stage3: moonlight rocket fixes commit684a167611
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Jan 18 14:50:48 2023 +0100 stage3: update background commitbed836f56c
Author: laochailan <laochailan@web.de> Date: Sat Jan 7 19:52:51 2023 -0500 stage3: make easy mode easier commitbec659a6eb
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 7 20:20:18 2022 +0100 stage3: sprinkle some random difficulty_value() calls commit2090821188
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Nov 20 07:57:33 2022 +0100 stage3: refactor and fix deadly dance (no design update yet) commit5dbdeae1dd
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Nov 20 07:17:05 2022 +0100 stage3: redesign scuttle nonspell commit70666a4074
Author: Andrei Alexeyev <0x416b617269@gmail.com> Date: Mon Nov 14 01:32:11 2022 +0100 stage3: last pre-boss section draft commit42bb538ff5
Author: Andrei Alexeyev <0x416b617269@gmail.com> Date: Mon Nov 14 01:28:32 2022 +0100 stage3: bunch of swarm-trail fairy fixes commit5938783591
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Nov 12 01:40:23 2022 +0100 stage3: more misery commit84342f1973
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Tue Nov 8 16:35:11 2022 +0100 stage3: post-midboss up to climax commitb40f71bbc6
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Nov 2 18:43:54 2022 +0100 stage3: experimental post-midboss pattern commitb5710faa04
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Nov 2 18:12:49 2022 +0100 stage3: deadly dance fixes commitf85aa25c00
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Nov 2 18:08:02 2022 +0100 stage3: first sparks of difficulty balance commit33b65b7fbe
Author: laochailan <laochailan@web.de> Date: Sun Oct 16 10:27:24 2022 -0400 stage3: align swarm fairies commit2556a0de9e
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Sep 26 05:35:53 2022 +0200 stage3: more progress on the first half commit86fc38255b
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Sep 24 04:10:57 2022 +0200 stage3: add some swirls after superfairy commitb0134e82c7
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Sep 24 04:10:11 2022 +0200 stage3: experimental laserball fairy commit88d7646927
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Sep 24 04:09:14 2022 +0200 stage3: tweak horde fairies commitb97da7a9e9
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Tue Sep 13 17:08:12 2022 +0200 stage3: wip circletwist fairy tweaks commitee9234a72b
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Sep 5 04:41:55 2022 +0200 wip swirls commit26c7a35e04
Author: laochailan <laochailan@web.de> Date: Sun Jan 2 11:29:41 2022 +0100 stage3 wip commitd1a263223f
Author: laochailan <laochailan@web.de> Date: Fri Nov 12 05:57:07 2021 +0100 wip wip wip commitc2527b05cf
Author: laochailan <laochailan@web.de> Date: Thu Sep 30 20:38:38 2021 +0200 stage3 redesign: some first prototypes commit0c2855e3ca
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Thu May 6 21:59:48 2021 +0300 stage3: some preliminary fixes commitfddf314db9
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Feb 28 07:36:04 2021 +0200 stage3: port rest of night ignite commit1cd84d7834
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Feb 27 04:50:46 2021 +0200 stage3: port night ignite slaves commitcb991be703
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Feb 27 04:26:26 2021 +0200 stage3: finish porting firefly storm commit0fb9733829
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Jun 23 02:44:14 2021 +0300 stage3: partial firefly storm port commitba174893a0
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Tue Feb 23 02:28:13 2021 +0200 stage3: enable all wriggle attacks commit03e1dd8078
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Tue Feb 23 02:22:35 2021 +0200 stage3: port wriggle nons commit3308255579
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Feb 22 16:27:50 2021 +0200 stage3: fix some indent issues commitb1c1115d7f
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Feb 22 16:23:07 2021 +0200 stage3: fix deprecations in moonlight rocket commit990489e960
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Thu Feb 4 08:53:00 2021 +0200 stage3: port moonlight rocket commit859592a89b
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Thu Feb 4 07:31:58 2021 +0200 stage3: basic port of wriggle slaves commitb88b4f5249
Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Feb 1 06:28:30 2021 +0200 stage3: port Light Singularity commitdb6bb13326
Author: Alice D <34408664+StarWitch@users.noreply.github.com> Date: Wed Mar 18 23:25:25 2020 -0400 stage3: preliminary coroutinization (#197) * first enemy of Stage 3 converted * review suggestions * add interval for burst_swirls * mid-commit * fairy group (second spawned enemies) * forgot to use my own variable * comment changes * better understanding of second arg of create_enemy* * fix subtasks (wasn't using them the correct way) * swirls that go from one side to the other * burst fairies complete * all complete up until midboss (stage 3 coroutines) * remove sub-rule for projectiles in charge_fairy * entire stage on coroutines now (boss spellcards missing) * rip out more old/dead code, make file better organized * timing changes * remove old background (looks jank now with new timing) * PR review changes * slight readability changes * Scuttle lethal_bite implemented * PR changes (ignore wriggle, she's still a WIP) * revert Info.plist entry (for separate PR) * finish(?) Scuttle's deadly dance, plus some PR changes Co-authored-by: Alice D <34408664+StarWitch@users.noreply.github.com> Co-authored-by: Lukas Weber <laochailan@web.de>
145 lines
4 KiB
C
145 lines
4 KiB
C
/*
|
|
* This software is licensed under the terms of the MIT License.
|
|
* See COPYING for further information.
|
|
* ---
|
|
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
|
|
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
|
|
*/
|
|
|
|
#include "taisei.h"
|
|
|
|
#include "wriggle.h"
|
|
|
|
#include "common_tasks.h"
|
|
|
|
MODERNIZE_THIS_FILE_AND_REMOVE_ME
|
|
|
|
void stage3_draw_wriggle_spellbg(Boss *b, int time) {
|
|
r_state_push();
|
|
r_blend(BLEND_NONE);
|
|
r_shader("stage3_wriggle_bg");
|
|
r_uniform_sampler("tex_bg", "stage3/wspellbg");
|
|
r_uniform_sampler("tex_clouds", "stage3/wspellclouds");
|
|
r_uniform_sampler("tex_swarm", "stage3/wspellswarm");
|
|
r_uniform_float("time", time / 60.0f);
|
|
r_mat_mv_push();
|
|
r_mat_mv_scale(VIEWPORT_W, VIEWPORT_H, 1);
|
|
r_mat_mv_translate(0.5, 0.5, 0);
|
|
r_draw_quad();
|
|
r_mat_mv_pop();
|
|
r_state_pop();
|
|
}
|
|
|
|
Boss *stage3_spawn_wriggle(cmplx pos) {
|
|
Boss *wriggle = create_boss("Wriggle EX", "wriggleex", pos);
|
|
boss_set_portrait(wriggle, "wriggle", NULL, "proud");
|
|
wriggle->glowcolor = *RGBA_MUL_ALPHA(0.2, 0.4, 0.5, 0.5);
|
|
wriggle->shadowcolor = *RGBA_MUL_ALPHA(0.4, 0.2, 0.6, 0.5);
|
|
return wriggle;
|
|
}
|
|
|
|
static void wriggle_slave_draw(EntityInterface *e) {
|
|
WriggleSlave *slave = ENT_CAST(e, WriggleSlave);
|
|
int time = global.frames - slave->spawn_time;
|
|
r_draw_sprite(&(SpriteParams) {
|
|
.pos.as_cmplx = slave->pos,
|
|
.sprite_ptr = slave->sprites.circle,
|
|
.rotation.angle = DEG2RAD * 7 * time,
|
|
.scale.as_cmplx = slave->scale,
|
|
.color = &slave->color,
|
|
});
|
|
}
|
|
|
|
TASK(wriggle_slave_particles, { BoxedWriggleSlave slave; }) {
|
|
WriggleSlave *slave = TASK_BIND(ARGS.slave);
|
|
|
|
int period = 5;
|
|
WAIT(rng_irange(0, period));
|
|
|
|
for(;;WAIT(period)) {
|
|
cmplx vel = 2 * rng_dir();
|
|
|
|
PARTICLE(
|
|
.sprite_ptr = slave->sprites.particle,
|
|
.pos = slave->pos,
|
|
.color = RGBA(0.6, 0.6, 0.5, 0),
|
|
.draw_rule = pdraw_timeout_scale(2, 0.01),
|
|
.timeout = 20,
|
|
.move = move_linear(vel),
|
|
);
|
|
}
|
|
}
|
|
|
|
void stage3_init_wriggle_slave(WriggleSlave *slave, cmplx pos) {
|
|
slave->pos = pos;
|
|
slave->spawn_time = global.frames;
|
|
slave->ent.draw_layer = LAYER_BOSS - 1;
|
|
slave->ent.draw_func = wriggle_slave_draw;
|
|
slave->sprites.circle = res_sprite("fairy_circle");
|
|
slave->sprites.particle = res_sprite("part/smoothdot");
|
|
|
|
INVOKE_TASK(wriggle_slave_particles, ENT_BOX(slave));
|
|
}
|
|
|
|
WriggleSlave *stage3_host_wriggle_slave(cmplx pos) {
|
|
WriggleSlave *slave = TASK_HOST_ENT(WriggleSlave);
|
|
TASK_HOST_EVENTS(slave->events);
|
|
stage3_init_wriggle_slave(slave, pos);
|
|
|
|
// TODO spawn animation
|
|
// INVOKE_TASK(wriggle_slave_fadein, ENT_BOX(slave));
|
|
slave->color = *RGBA(0.8, 1.0, 0.4, 0);
|
|
slave->scale = (1 + I) * 0.7;
|
|
|
|
// TODO despawn animation
|
|
// INVOKE_TASK_AFTER(&slave->events.despawned, wriggle_slave_fadeout, ENT_BOX(slave));
|
|
|
|
return slave;
|
|
}
|
|
|
|
void stage3_despawn_wriggle_slave(WriggleSlave *slave) {
|
|
coevent_signal_once(&slave->events.despawned);
|
|
}
|
|
|
|
DEFINE_EXTERN_TASK(wriggle_slave_damage_trail) {
|
|
WriggleSlave *slave = TASK_BIND(ARGS.slave);
|
|
ShaderProgram *pshader = res_shader("sprite_default");
|
|
|
|
for(;;WAIT(2)) {
|
|
float t = (global.frames - slave->spawn_time) / 25.0;
|
|
float c = 0.5f * psinf(t);
|
|
|
|
PROJECTILE(
|
|
// XXX: Do we want this to be a special snowflake without a ProjPrototype?
|
|
.sprite_ptr = slave->sprites.particle,
|
|
.size = 16 + 16*I,
|
|
.collision_size = 7.2 + 7.2*I,
|
|
|
|
.pos = slave->pos,
|
|
.color = RGBA(1.0 - c, 0.5, 0.5 + c, 0),
|
|
.draw_rule = pdraw_timeout_fade(1, 0),
|
|
.timeout = 60,
|
|
.shader_ptr = pshader,
|
|
.flags = PFLAG_NOCLEAR | PFLAG_NOCLEAREFFECT | PFLAG_NOCOLLISIONEFFECT | PFLAG_NOSPAWNEFFECTS,
|
|
);
|
|
}
|
|
}
|
|
|
|
DEFINE_EXTERN_TASK(wriggle_slave_follow) {
|
|
WriggleSlave *slave = TASK_BIND(ARGS.slave);
|
|
Boss *boss = NOT_NULL(ENT_UNBOX(ARGS.boss));
|
|
|
|
MoveParams move = move_towards(0, 0.03);
|
|
cmplx dir = cdir(ARGS.rot_initial);
|
|
cmplx r = cdir(ARGS.rot_speed);
|
|
|
|
for(;(boss = ENT_UNBOX(ARGS.boss)); YIELD) {
|
|
real t = global.frames - slave->spawn_time;
|
|
move.attraction_point = boss->pos + 100 * sin(t / 100) * dir;
|
|
move_update(&slave->pos, &move);
|
|
if(ARGS.out_dir) {
|
|
*ARGS.out_dir = dir;
|
|
}
|
|
dir *= r;
|
|
}
|
|
}
|