taisei/src/plrmodes/reimu_b.c

581 lines
14 KiB
C
Raw Normal View History

Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
*/
#include "taisei.h"
#include "global.h"
#include "plrmodes.h"
#include "reimu.h"
#include "stagedraw.h"
#define GAP_LENGTH 128
#define GAP_WIDTH 16
#define GAP_OFFSET 8
#define GAP_LIMIT 10
// #define GAP_LENGTH 160
// #define GAP_WIDTH 160
// #define GAP_OFFSET 82
#define NUM_GAPS 4
#define FOR_EACH_GAP(gap) for(Enemy *gap = global.plr.slaves.first; gap; gap = gap->next) if(gap->logic_rule == reimu_dream_gap)
static Enemy *gap_renderer;
static complex reimu_dream_gap_target_pos(Enemy *e) {
double x, y;
if(creal(e->pos0)) {
x = creal(e->pos0) * VIEWPORT_W;
} else {
x = creal(global.plr.pos);
}
if(cimag(e->pos0)) {
y = cimag(e->pos0) * VIEWPORT_H;
} else {
y = cimag(global.plr.pos);
}
bool focus = global.plr.inputflags & INFLAG_FOCUS;
// complex ofs = GAP_OFFSET * (1 + I) + (GAP_LENGTH * 0.5 + GAP_LIMIT) * e->args[0];
double ofs_x = GAP_OFFSET + (GAP_LENGTH * 0.5 + GAP_LIMIT) * creal(e->args[0]);
double ofs_y = GAP_OFFSET + (!focus) * (GAP_LENGTH * 0.5 + GAP_LIMIT) * cimag(e->args[0]);
x = clamp(x, ofs_x, VIEWPORT_W - ofs_x);
y = clamp(y, ofs_y, VIEWPORT_H - ofs_y);
if(focus) {
/*
if(cimag(e->pos0)) {
x = VIEWPORT_W - x;
}
*/
} else {
if(creal(e->pos0)) {
y = VIEWPORT_H - y;
}
}
return x + I * y;
}
static int reimu_dream_gap_bomb_projectile(Projectile *p, int t) {
if(t == EVENT_BIRTH) {
return ACTION_ACK;
}
if(t == EVENT_DEATH) {
return ACTION_ACK;
}
p->pos += p->args[0];
if(!(t % 3)) {
double range = GAP_LENGTH * 0.35;
double damage = 50;
// Yes, I know, this is inefficient as hell, but I'm too lazy to write a
// stage_clear_hazards_inside_rectangle function.
stage_clear_hazards_at(p->pos, range, CLEAR_HAZARDS_ALL | CLEAR_HAZARDS_NOW);
2019-01-10 00:56:33 +01:00
ent_area_damage(p->pos, range, &(DamageInfo) { damage, DMG_PLAYER_BOMB }, NULL, NULL);
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
}
return ACTION_NONE;
}
static void reimu_dream_gap_bomb_projectile_draw(Projectile *p, int t) {
r_draw_sprite(&(SpriteParams) {
.sprite_ptr = p->sprite,
.shader_ptr = p->shader,
.color = &p->color,
.shader_params = &p->shader_params,
.pos = { creal(p->pos), cimag(p->pos) },
.scale.both = 0.75 * clamp(t / 5.0, 0.1, 1.0),
});
}
static void reimu_dream_gap_bomb(Enemy *e, int t) {
if(!(t % 4)) {
PROJECTILE(
.sprite = "glowball",
.size = 32 * (1 + I),
.color = HSLA(t/30.0, 0.5, 0.5, 0.5),
.pos = e->pos + e->args[0] * (frand() - 0.5) * GAP_LENGTH * 0.5,
.rule = reimu_dream_gap_bomb_projectile,
.draw_rule = reimu_dream_gap_bomb_projectile_draw,
.type = PlrProj,
.damage_type = DMG_PLAYER_BOMB,
.damage = 75,
.args = { -20 * e->pos0 },
);
global.shake_view += 5;
if(!(t % 16)) {
play_sound("boon");
}
}
}
static int reimu_dream_gap(Enemy *e, int t) {
if(t == EVENT_DEATH) {
free_ref(creal(e->args[3]));
return ACTION_ACK;
}
if(t == EVENT_BIRTH) {
return ACTION_ACK;
}
if(player_is_bomb_active(&global.plr)) {
reimu_dream_gap_bomb(e, t + cimag(e->args[3]));
} else {
complex new_pos = reimu_dream_gap_target_pos(e);
if(t == 0) {
e->pos = new_pos;
} else {
e->pos += (new_pos - e->pos) * 0.1 * (1 - sqrt(gap_renderer->args[0]));
}
}
return ACTION_NONE;
}
static void reimu_dream_gap_link(Enemy *g0, Enemy *g1) {
int ref0 = add_ref(g0);
int ref1 = add_ref(g1);
g0->args[3] = ref1;
g1->args[3] = ref0;
}
static Enemy* reimu_dream_gap_get_linked(Enemy *gap) {
return REF(creal(gap->args[3]));
}
static void reimu_dream_gap_draw_lights(int time, double strength) {
if(strength <= 0) {
return;
}
r_shader("reimu_gap_light");
r_uniform_sampler("tex", "gaplight");
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
r_uniform_float("time", time / 60.0);
r_uniform_float("strength", strength);
FOR_EACH_GAP(gap) {
const float len = GAP_LENGTH * 3 * sqrt(log(strength + 1) / 0.693);
complex center = gap->pos - gap->pos0 * (len * 0.5 - GAP_WIDTH * 0.6);
r_mat_push();
r_mat_translate(creal(center), cimag(center), 0);
r_mat_rotate(carg(gap->pos0)+M_PI, 0, 0, 1);
r_mat_scale(len, GAP_LENGTH, 1);
r_draw_quad();
r_mat_pop();
}
}
static void reimu_dream_gap_renderer_visual(Enemy *e, int t, bool render) {
if(!render) {
return;
}
float gaps[NUM_GAPS][2];
float angles[NUM_GAPS];
int links[NUM_GAPS];
int i = 0;
FOR_EACH_GAP(gap) {
gaps[i][0] = creal(gap->pos);
gaps[i][1] = cimag(gap->pos);
angles[i] = carg(gap->pos0);
links[i] = cimag(reimu_dream_gap_get_linked(gap)->args[3]);
++i;
}
FBPair *framebuffers = stage_get_fbpair(FBPAIR_FG);
fbpair_swap(framebuffers);
Framebuffer *target_fb = framebuffers->back;
// This change must propagate
r_state_pop();
r_framebuffer(target_fb);
r_state_push();
r_shader("reimu_gap");
r_uniform_vec2("viewport", VIEWPORT_W, VIEWPORT_H);
r_uniform_float("time", t / (float)FPS);
r_uniform_vec2("gap_size", GAP_WIDTH/2.0, GAP_LENGTH/2.0);
r_uniform_vec2_array("gaps[0]", 0, NUM_GAPS, gaps);
r_uniform_float_array("gap_angles[0]", 0, NUM_GAPS, angles);
r_uniform_int_array("gap_links[0]", 0, NUM_GAPS, links);
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
draw_framebuffer_tex(framebuffers->front, VIEWPORT_W, VIEWPORT_H);
FOR_EACH_GAP(gap) {
r_mat_push();
r_mat_translate(creal(gap->pos), cimag(gap->pos), 0);
complex stretch_vector = gap->args[0];
for(float ofs = -0.5; ofs <= 0.5; ofs += 1) {
r_draw_sprite(&(SpriteParams) {
.sprite = "yinyang",
.shader = "sprite_yinyang",
.pos = {
creal(stretch_vector) * GAP_LENGTH * ofs,
cimag(stretch_vector) * GAP_LENGTH * ofs
},
.rotation.angle = global.frames * -6 * DEG2RAD,
.color = RGB(0.95, 0.75, 1.0),
.scale.both = 0.5,
});
}
r_mat_pop();
}
reimu_dream_gap_draw_lights(t, pow(e->args[0], 2));
}
static int reimu_dream_gap_renderer(Enemy *e, int t) {
if(t < 0) {
return ACTION_ACK;
}
if(player_is_bomb_active(&global.plr)) {
e->args[0] = approach(e->args[0], 1.0, 0.1);
} else {
e->args[0] = approach(e->args[0], 0.0, 0.025);
}
return ACTION_NONE;
}
static void reimu_dream_preload(void) {
const int flags = RESF_DEFAULT;
2018-08-14 02:56:16 +02:00
preload_resources(RES_SPRITE, flags,
"yinyang",
"proj/ofuda",
"proj/needle2",
"proj/glowball",
"part/myon",
"part/stardust",
NULL);
preload_resources(RES_TEXTURE, flags,
"runes",
"gaplight",
NULL);
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
preload_resources(RES_SHADER_PROGRAM, flags,
2018-08-14 02:56:16 +02:00
"sprite_yinyang",
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
"reimu_gap",
2018-08-14 02:56:16 +02:00
"reimu_gap_light",
"reimu_bomb_bg",
NULL);
preload_resources(RES_SFX, flags | RESF_OPTIONAL,
"bomb_marisa_a",
"boon",
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
NULL);
}
static void reimu_dream_bomb(Player *p) {
play_sound("bomb_marisa_a");
}
static void reimu_dream_bomb_bg(Player *p) {
float a = gap_renderer->args[0];
reimu_common_bomb_bg(p, a);
}
static void reimu_dream_spawn_warp_effect(complex pos, bool exit) {
PARTICLE(
.sprite = "myon",
.pos = pos,
.color = RGBA(0.5, 0.5, 0.5, 0.5),
.timeout = 20,
.angle = frand() * M_PI * 2,
.draw_rule = ScaleFade,
Lots of disorganized (mostly) visual overhaul (#156) * WIP some projectile effects * fix segfault * Laser smoothing and glow via post-processing blur magic TODO: make it optional * fix memory corruption * fix memory corruption for realsies now * fix color_get_hsl for out-of-range colors * some more bullet flare tweaks * some lame clear effect workarounds * spawn bullet flares after frame 0; looks better and fixes some problems * New baryon explosion; fix petal_explosion; leanify everything * Add missing bullet flare sprite, rebuild main atlas * improve batching efficiency with bullet spawn flares * forgot git add * Group projectiles/particles by shader where possible * Another take on baryon explosion; make fg framebuffers 16bit * WIP some settings for toasters * remove stupid debug log * microoptimization that probably does nothing anyway * somewhat more intuitive quality settings * Whitelist more particles (MarisaB is on hold) * Whitelist (and fix) some more stage6 particles (mostly ToE) * Add a spell name background * Experimental radial healthbar for bosses * healthbar tweaks * thiccer healthbars in response to feedback * remove healthbar survival timer; just fade out on survivals * Add linear healthbars option; WIP other boss HUD tweaks * Use the proper spell card name format * New font and some random garbage to go along with it * Generate static font outlines for use in text shaders * Use outlines in overlay text shader * Complete boss HUD/healthbar fading logic * fix boss timer limit * stage5 bombs explosion effect * split PFLAG_NOSPAWNZOOM into PFLAG_NOSPAWNFLARE and PFLAG_NOSPAWNFADE; introduce PFLAG_NOSPAWNEFFECTS which disables both (it's just the two values OR'd together) simplify vampiric vapor bullet spawning effect * Remove spawn fade-in from super-fast stage5 fairy projectiles (limiters) * lower particle density in v.vapor in minimal mode * graze effect tweaks * fix text shortening, tweak replay menu layout * stupid debug spam * revisit grazing effects again * dumb debug spam again * improve boss attack timer * overlay effect for boss deaths (similar to the player one) * spice up spellcard declaration (HUD) * don't spawn boss death overlay if fleed * modify Exo2 font to use tabular figures * adjust replay menu for the font change * draw timer & power with standard font (phasing out the numbers font) * WIP new HUD; random fixes/tweaks * hud: move difficulty indicator * hud: move debug stuff around * preloads, mostly * fix youmuA batching conflict * shitty workaround for the shitty screenshake shit * remove extraspell lag by stopping to draw stagebg sooner which is possible because extra spells have a different spellcard_intro timing. Fun fact of the day: the duration of spellcard_intro is always ATTACK_START_DELAY_EXTRA even for normal spells! * new stain particle * i disabled background rendering… * "batch" marisa_b masterspark draws * remove these once a new atlas is generated * make toe quick again * hopefully fix all occurences of changed stain and ScaleFade behavior * tweaking reimu_a and toe boson launch effects * make lhc fast again * softer involnerability effect * fix stage 1 snow on the water bug (and improve performance) translated the time to the future a bit because it only seemed to be an issue for small time values * remove unnecessary spawnflare from toe * tone down extra spell start effect * experimental ReimuB gap shader optimization * fix python3 shebangs * generate simple blur shaders w/ hardcoded kernels * New loading screen * lasers: fix incorrect draw hook registration * add webp support for atlas generator * Use ImageMagick for atlas composition (adds 16-bit support) * Atlas maintenance * make the vampiric vapor bullets less prone to invisibility * Revert a few particles to the quadratic fade curve * experimental baryon effect * improve baryon sprites * disable the baryon effect on minimal postprocessing setting
2019-01-04 23:59:39 +01:00
.args = { 0, 0, 0.2 + 1 * I },
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
.layer = LAYER_PLAYER_FOCUS,
);
PARTICLE(
.sprite = exit ? "stain" : "stardust",
.pos = pos,
Lots of disorganized (mostly) visual overhaul (#156) * WIP some projectile effects * fix segfault * Laser smoothing and glow via post-processing blur magic TODO: make it optional * fix memory corruption * fix memory corruption for realsies now * fix color_get_hsl for out-of-range colors * some more bullet flare tweaks * some lame clear effect workarounds * spawn bullet flares after frame 0; looks better and fixes some problems * New baryon explosion; fix petal_explosion; leanify everything * Add missing bullet flare sprite, rebuild main atlas * improve batching efficiency with bullet spawn flares * forgot git add * Group projectiles/particles by shader where possible * Another take on baryon explosion; make fg framebuffers 16bit * WIP some settings for toasters * remove stupid debug log * microoptimization that probably does nothing anyway * somewhat more intuitive quality settings * Whitelist more particles (MarisaB is on hold) * Whitelist (and fix) some more stage6 particles (mostly ToE) * Add a spell name background * Experimental radial healthbar for bosses * healthbar tweaks * thiccer healthbars in response to feedback * remove healthbar survival timer; just fade out on survivals * Add linear healthbars option; WIP other boss HUD tweaks * Use the proper spell card name format * New font and some random garbage to go along with it * Generate static font outlines for use in text shaders * Use outlines in overlay text shader * Complete boss HUD/healthbar fading logic * fix boss timer limit * stage5 bombs explosion effect * split PFLAG_NOSPAWNZOOM into PFLAG_NOSPAWNFLARE and PFLAG_NOSPAWNFADE; introduce PFLAG_NOSPAWNEFFECTS which disables both (it's just the two values OR'd together) simplify vampiric vapor bullet spawning effect * Remove spawn fade-in from super-fast stage5 fairy projectiles (limiters) * lower particle density in v.vapor in minimal mode * graze effect tweaks * fix text shortening, tweak replay menu layout * stupid debug spam * revisit grazing effects again * dumb debug spam again * improve boss attack timer * overlay effect for boss deaths (similar to the player one) * spice up spellcard declaration (HUD) * don't spawn boss death overlay if fleed * modify Exo2 font to use tabular figures * adjust replay menu for the font change * draw timer & power with standard font (phasing out the numbers font) * WIP new HUD; random fixes/tweaks * hud: move difficulty indicator * hud: move debug stuff around * preloads, mostly * fix youmuA batching conflict * shitty workaround for the shitty screenshake shit * remove extraspell lag by stopping to draw stagebg sooner which is possible because extra spells have a different spellcard_intro timing. Fun fact of the day: the duration of spellcard_intro is always ATTACK_START_DELAY_EXTRA even for normal spells! * new stain particle * i disabled background rendering… * "batch" marisa_b masterspark draws * remove these once a new atlas is generated * make toe quick again * hopefully fix all occurences of changed stain and ScaleFade behavior * tweaking reimu_a and toe boson launch effects * make lhc fast again * softer involnerability effect * fix stage 1 snow on the water bug (and improve performance) translated the time to the future a bit because it only seemed to be an issue for small time values * remove unnecessary spawnflare from toe * tone down extra spell start effect * experimental ReimuB gap shader optimization * fix python3 shebangs * generate simple blur shaders w/ hardcoded kernels * New loading screen * lasers: fix incorrect draw hook registration * add webp support for atlas generator * Use ImageMagick for atlas composition (adds 16-bit support) * Atlas maintenance * make the vampiric vapor bullets less prone to invisibility * Revert a few particles to the quadratic fade curve * experimental baryon effect * improve baryon sprites * disable the baryon effect on minimal postprocessing setting
2019-01-04 23:59:39 +01:00
.color = color_mul_scalar(RGBA(0.75, 0.4 * frand(), 0.4, 0), 0.8-0.4*exit),
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
.timeout = 20,
.angle = frand() * M_PI * 2,
.draw_rule = ScaleFade,
Lots of disorganized (mostly) visual overhaul (#156) * WIP some projectile effects * fix segfault * Laser smoothing and glow via post-processing blur magic TODO: make it optional * fix memory corruption * fix memory corruption for realsies now * fix color_get_hsl for out-of-range colors * some more bullet flare tweaks * some lame clear effect workarounds * spawn bullet flares after frame 0; looks better and fixes some problems * New baryon explosion; fix petal_explosion; leanify everything * Add missing bullet flare sprite, rebuild main atlas * improve batching efficiency with bullet spawn flares * forgot git add * Group projectiles/particles by shader where possible * Another take on baryon explosion; make fg framebuffers 16bit * WIP some settings for toasters * remove stupid debug log * microoptimization that probably does nothing anyway * somewhat more intuitive quality settings * Whitelist more particles (MarisaB is on hold) * Whitelist (and fix) some more stage6 particles (mostly ToE) * Add a spell name background * Experimental radial healthbar for bosses * healthbar tweaks * thiccer healthbars in response to feedback * remove healthbar survival timer; just fade out on survivals * Add linear healthbars option; WIP other boss HUD tweaks * Use the proper spell card name format * New font and some random garbage to go along with it * Generate static font outlines for use in text shaders * Use outlines in overlay text shader * Complete boss HUD/healthbar fading logic * fix boss timer limit * stage5 bombs explosion effect * split PFLAG_NOSPAWNZOOM into PFLAG_NOSPAWNFLARE and PFLAG_NOSPAWNFADE; introduce PFLAG_NOSPAWNEFFECTS which disables both (it's just the two values OR'd together) simplify vampiric vapor bullet spawning effect * Remove spawn fade-in from super-fast stage5 fairy projectiles (limiters) * lower particle density in v.vapor in minimal mode * graze effect tweaks * fix text shortening, tweak replay menu layout * stupid debug spam * revisit grazing effects again * dumb debug spam again * improve boss attack timer * overlay effect for boss deaths (similar to the player one) * spice up spellcard declaration (HUD) * don't spawn boss death overlay if fleed * modify Exo2 font to use tabular figures * adjust replay menu for the font change * draw timer & power with standard font (phasing out the numbers font) * WIP new HUD; random fixes/tweaks * hud: move difficulty indicator * hud: move debug stuff around * preloads, mostly * fix youmuA batching conflict * shitty workaround for the shitty screenshake shit * remove extraspell lag by stopping to draw stagebg sooner which is possible because extra spells have a different spellcard_intro timing. Fun fact of the day: the duration of spellcard_intro is always ATTACK_START_DELAY_EXTRA even for normal spells! * new stain particle * i disabled background rendering… * "batch" marisa_b masterspark draws * remove these once a new atlas is generated * make toe quick again * hopefully fix all occurences of changed stain and ScaleFade behavior * tweaking reimu_a and toe boson launch effects * make lhc fast again * softer involnerability effect * fix stage 1 snow on the water bug (and improve performance) translated the time to the future a bit because it only seemed to be an issue for small time values * remove unnecessary spawnflare from toe * tone down extra spell start effect * experimental ReimuB gap shader optimization * fix python3 shebangs * generate simple blur shaders w/ hardcoded kernels * New loading screen * lasers: fix incorrect draw hook registration * add webp support for atlas generator * Use ImageMagick for atlas composition (adds 16-bit support) * Atlas maintenance * make the vampiric vapor bullets less prone to invisibility * Revert a few particles to the quadratic fade curve * experimental baryon effect * improve baryon sprites * disable the baryon effect on minimal postprocessing setting
2019-01-04 23:59:39 +01:00
.args = { 0, 0, 0.1 + 0.6 * I },
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
.layer = LAYER_PLAYER_FOCUS,
);
}
static void reimu_dream_bullet_warp(Projectile *p, int t) {
if(creal(p->args[3]) > 0 /*global.plr.power / 100*/) {
return;
}
double p_long_side = max(creal(p->size), cimag(p->size));
complex half = 0.5 * (1 + I);
Rect p_bbox = { p->pos - p_long_side * half, p->pos + p_long_side * half };
FOR_EACH_GAP(gap) {
double a = (carg(-gap->pos0) - carg(p->args[0]));
if(fabs(a) < 2*M_PI/3) {
continue;
}
Rect gap_bbox, overlap;
complex gap_size = (GAP_LENGTH + I * GAP_WIDTH) * cexp(I*carg(gap->args[0]));
complex p0 = gap->pos - gap_size * 0.5;
complex p1 = gap->pos + gap_size * 0.5;
gap_bbox.top_left = min(creal(p0), creal(p1)) + I * min(cimag(p0), cimag(p1));
gap_bbox.bottom_right = max(creal(p0), creal(p1)) + I * max(cimag(p0), cimag(p1));
if(rect_rect_intersection(p_bbox, gap_bbox, true, false, &overlap)) {
Add Reimu Hakurei as a playable character (#106) * Reimu (#101) * add the reimu * Add Reimu story * account for various blunders * add reimu dialog picture * Reimu: WIP yin-yang orbs * reimu: fix up indents * Reimu: swap the shotmode names to match the kanji order in her Japanese name * Reimu: compatibility with the latest system * WIP ReimuA crap * ReimuA homing trails * more ReimuA stuff * more ReimuA adjustments + enhanced DPS stats * Reimu: stubs for new player animation sequences * Reimu: occupy the 0th character slot * Reimu: tweak needle sprite * Reimu: buff movement speed to better match Touhou * Reimu: fixup for the recent projectile changes * ReimuA: make homing shots a bit smaller; give them custom effect on collision * Reimu: add intermediate frames; move some loose sprites to the atlas * Reimu: fix compile errors * replace DBL_MAX by INFINITY * Don’t draw reimu orbs twice fixes #127 * add new reimu dialog pic * ReimuA adjustments (mostly homing); it's still OP * wip ReimuB gaps * still not sure where i'm going with these gaps * meh * Reimu: premultiplied alpha fixups after rebase * reimuB shot pattern with basic power scaling (not balanced at all) * reimuB: some lame-ass particle effects * ReimuB bomb effect prototype * reimuA bomb prototype * fix reimu shots for the new damage system * Reimu: use the new player_is_bomb_active() function, add placeholder BG for ReimuB * some reimuB bomb projectiles * ReimuB bomb bg and some framebuffer utils required to support it. Might reuse this at least in part for ReimuA unless we come up with something better. * hack to fix ReimuB bomb fade; refactoring needed * reimuA damaging bombs * fix ub * prevent nan when reimuA bombs without enemies present * add a bomb_bg to reimuA * ... * various fantasy seal tweaks * Reimu: placeholder bomb sounds; slight fantasy seal buff * fix null pointer dereference * Reimu "balance" adjustments; minor fixes * putting bandaids over gunshot wounds * Add aoe damage and bullet cancel to ReimuB's bomb * more exorcism porn * make reimu bomb bg runes better visible on dark backgrounds * More ReimuA shot changes
2018-08-11 21:13:48 +02:00
complex o = (overlap.top_left + overlap.bottom_right) / 2;
double fract;
if(creal(gap_size) > cimag(gap_size)) {
fract = creal(o - gap_bbox.top_left) / creal(gap_size);
} else {
fract = cimag(o - gap_bbox.top_left) / cimag(gap_size);
}
Enemy *ngap = reimu_dream_gap_get_linked(gap);
o = ngap->pos + ngap->args[0] * GAP_LENGTH * (1 - fract - 0.5);
reimu_dream_spawn_warp_effect(gap->pos + gap->args[0] * GAP_LENGTH * (fract - 0.5), false);
reimu_dream_spawn_warp_effect(o, true);
p->args[0] = -cabs(p->args[0]) * ngap->pos0;
p->pos = o + p->args[0];
p->args[3] += 1;
}
}
}
static int reimu_dream_ofuda(Projectile *p, int t) {
if(t >= 0) {
reimu_dream_bullet_warp(p, t);
}
complex ov = p->args[0];
double s = cabs(ov);
p->args[0] *= clamp(s * (1.5 - t / 10.0), s*1.0, 1.5*s) / s;
int r = reimu_common_ofuda(p, t);
p->args[0] = ov;
return r;
}
static int reimu_dream_needle(Projectile *p, int t) {
if(t >= 0) {
reimu_dream_bullet_warp(p, t);
}
p->angle = carg(p->args[0]);
if(t < 0) {
return ACTION_ACK;
}
p->pos += p->args[0];
Color *c = color_mul(COLOR_COPY(&p->color), RGBA_MUL_ALPHA(0.75, 0.5, 1, 0.35));
c->a = 0;
PARTICLE(
.sprite_ptr = p->sprite,
.color = c,
.timeout = 12,
.pos = p->pos,
.args = { p->args[0] * 0.8, 0, 0+3*I },
.rule = linear,
.draw_rule = ScaleFade,
.layer = LAYER_PARTICLE_LOW,
.flags = PFLAG_NOREFLECT,
);
return ACTION_NONE;
}
static void reimu_dream_shot(Player *p) {
play_loop("generic_shot");
int dmg = 50;
if(!(global.frames % 6)) {
for(int i = -1; i < 2; i += 2) {
complex shot_dir = i * ((p->inputflags & INFLAG_FOCUS) ? 1 : I);
complex spread_dir = shot_dir * cexp(I*M_PI*0.5);
for(int j = -1; j < 2; j += 2) {
PROJECTILE(
.proto = pp_ofuda,
.pos = p->pos + 10 * j * spread_dir,
.color = RGBA_MUL_ALPHA(1, 1, 1, 0.5),
.rule = reimu_dream_ofuda,
.args = { -20.0 * shot_dir },
.type = PlrProj,
.damage = dmg,
.shader = "sprite_default",
);
}
}
}
}
static void reimu_dream_slave_visual(Enemy *e, int t, bool render) {
if(render) {
r_draw_sprite(&(SpriteParams) {
.sprite = "yinyang",
.shader = "sprite_yinyang",
.pos = {
creal(e->pos),
cimag(e->pos),
},
.rotation.angle = global.frames * -6 * DEG2RAD,
.color = RGB(0.95, 0.75, 1.0),
.scale.both = 0.5,
});
}
}
static int reimu_dream_slave(Enemy *e, int t) {
if(t < 0) {
return ACTION_ACK;
}
// double a = M_PI * psin(t * 0.1) + creal(e->args[0]) + M_PI/2;
double a = t * -0.1 + creal(e->args[0]) + M_PI/2;
complex ofs = e->pos0;
complex shotdir = e->args[1];
if(global.plr.inputflags & INFLAG_FOCUS) {
ofs = cimag(ofs) + I * creal(ofs);
shotdir = cimag(shotdir) + I * creal(shotdir);
}
if(t == 0) {
e->pos = global.plr.pos;
} else {
double x = creal(ofs);
double y = cimag(ofs);
complex tpos = global.plr.pos + x * sin(a) + y * I * cos(a);
e->pos += (tpos - e->pos) * 0.5;
}
if(player_should_shoot(&global.plr, true)) {
if(!(global.frames % 6)) {
PROJECTILE(
.proto = pp_needle2,
.pos = e->pos,
.color = RGBA_MUL_ALPHA(1, 1, 1, 0.35),
.rule = reimu_dream_needle,
.args = { 20.0 * shotdir },
.type = PlrProj,
.damage = 35,
.shader = "sprite_default",
);
}
}
return ACTION_NONE;
}
static Enemy* reimu_dream_spawn_slave(Player *plr, complex pos, complex a0, complex a1, complex a2, complex a3) {
Enemy *e = create_enemy_p(&plr->slaves, pos, ENEMY_IMMUNE, reimu_dream_slave_visual, reimu_dream_slave, a0, a1, a2, a3);
e->ent.draw_layer = LAYER_PLAYER_SLAVE;
return e;
}
static void reimu_dream_kill_slaves(EnemyList *slaves) {
for(Enemy *e = slaves->first, *next; e; e = next) {
next = e->next;
if(e->logic_rule == reimu_dream_slave) {
delete_enemy(slaves, e);
}
}
}
static void reimu_dream_respawn_slaves(Player *plr, short npow) {
reimu_dream_kill_slaves(&plr->slaves);
int p = 2 * (npow / 100);
double s = 1;
for(int i = 0; i < p; ++i, s = -s) {
reimu_dream_spawn_slave(plr, 48+32*I, ((double)i/p)*(M_PI*2), s*I, 0, 0);
}
}
static void reimu_dream_power(Player *p, short npow) {
if(p->power / 100 != npow / 100) {
reimu_dream_respawn_slaves(p, npow);
}
}
static Enemy* reimu_dream_spawn_gap(Player *plr, complex pos, complex a0, complex a1, complex a2, complex a3) {
Enemy *gap = create_enemy_p(&plr->slaves, pos, ENEMY_IMMUNE, NULL, reimu_dream_gap, a0, a1, a2, a3);
gap->ent.draw_layer = LAYER_PLAYER_SLAVE;
return gap;
}
static void reimu_dream_think(Player *plr) {
if(player_is_bomb_active(plr)) {
global.shake_view_fade = max(global.shake_view_fade, 5);
}
}
static void reimu_dream_init(Player *plr) {
Enemy* left = reimu_dream_spawn_gap(plr, -1, I, 0, 0, 0);
Enemy* top = reimu_dream_spawn_gap(plr, -I, 1, 0, 0, 0);
Enemy* right = reimu_dream_spawn_gap(plr, 1, I, 0, 0, 0);
Enemy* bottom = reimu_dream_spawn_gap(plr, I, 1, 0, 0, 0);
reimu_dream_gap_link(top, left);
reimu_dream_gap_link(bottom, right);
gap_renderer= create_enemy_p(&plr->slaves, 0, ENEMY_IMMUNE, reimu_dream_gap_renderer_visual, reimu_dream_gap_renderer, 0, 0, 0, 0);
gap_renderer->ent.draw_layer = LAYER_PLAYER_FOCUS;
int idx = 0;
FOR_EACH_GAP(gap) {
gap->args[3] = creal(gap->args[3]) + I*idx++;
}
reimu_dream_respawn_slaves(plr, plr->power);
reimu_common_bomb_buffer_init();
}
PlayerMode plrmode_reimu_b = {
.name = "Dream Sign",
.character = &character_reimu,
.dialog = &dialog_reimu,
.shot_mode = PLR_SHOT_REIMU_DREAM,
.procs = {
.property = reimu_common_property,
.bomb = reimu_dream_bomb,
.bombbg = reimu_dream_bomb_bg,
.shot = reimu_dream_shot,
.power = reimu_dream_power,
.init = reimu_dream_init,
.preload = reimu_dream_preload,
.think = reimu_dream_think,
},
};