2018-08-11 21:13:48 +02:00
|
|
|
/*
|
2019-08-03 19:43:48 +02:00
|
|
|
* This software is licensed under the terms of the MIT License.
|
2018-08-11 21:13:48 +02:00
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
2019-01-23 21:10:43 +01:00
|
|
|
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
|
2019-07-03 20:00:56 +02:00
|
|
|
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
|
2018-08-11 21:13:48 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "taisei.h"
|
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
#include "plrmodes.h"
|
|
|
|
#include "reimu.h"
|
|
|
|
#include "stagedraw.h"
|
|
|
|
|
|
|
|
static Framebuffer *bomb_buffer;
|
|
|
|
|
|
|
|
PlayerCharacter character_reimu = {
|
|
|
|
.id = PLR_CHAR_REIMU,
|
|
|
|
.lower_name = "reimu",
|
|
|
|
.proper_name = "Reimu",
|
|
|
|
.full_name = "Hakurei Reimu",
|
2020-02-27 03:38:37 +01:00
|
|
|
.title = "Shrine Maiden of Fantasy",
|
2019-04-22 14:29:44 +02:00
|
|
|
.menu_texture_name = "reimubg",
|
2018-08-11 21:13:48 +02:00
|
|
|
.ending = {
|
|
|
|
.good = good_ending_reimu,
|
|
|
|
.bad = bad_ending_reimu,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
double reimu_common_property(Player *plr, PlrProperty prop) {
|
|
|
|
switch(prop) {
|
|
|
|
case PLR_PROP_BOMB_TIME:
|
|
|
|
return 300;
|
|
|
|
|
|
|
|
case PLR_PROP_COLLECT_RADIUS:
|
|
|
|
return (plr->inputflags & INFLAG_FOCUS) ? 60 : 30;
|
|
|
|
|
|
|
|
case PLR_PROP_SPEED:
|
|
|
|
// NOTE: For equivalents in Touhou units, divide these by 1.25.
|
|
|
|
return (plr->inputflags & INFLAG_FOCUS) ? 2.5 : 5.625;
|
|
|
|
|
|
|
|
case PLR_PROP_POC:
|
|
|
|
return VIEWPORT_H / 3.5;
|
|
|
|
|
|
|
|
case PLR_PROP_DEATHBOMB_WINDOW:
|
|
|
|
return 12;
|
|
|
|
}
|
|
|
|
|
|
|
|
UNREACHABLE;
|
|
|
|
}
|
|
|
|
|
2020-03-25 07:52:18 +01:00
|
|
|
TASK(reimu_ofuda_trail, { BoxedProjectile trail; }) {
|
|
|
|
Projectile *trail = TASK_BIND(ARGS.trail);
|
|
|
|
|
|
|
|
for(;;) {
|
|
|
|
trail->color.g *= 0.95;
|
|
|
|
YIELD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Projectile *reimu_common_ofuda_swawn_trail(Projectile *p) {
|
|
|
|
Projectile *trail = PARTICLE(
|
2018-08-11 21:13:48 +02:00
|
|
|
// .sprite_ptr = p->sprite,
|
2020-06-09 03:33:22 +02:00
|
|
|
.sprite_ptr = res_sprite("proj/hghost"),
|
2018-08-11 21:13:48 +02:00
|
|
|
.color = &p->color,
|
|
|
|
.timeout = 12,
|
2020-01-10 05:55:43 +01:00
|
|
|
.pos = p->pos + p->move.velocity * 0.3,
|
|
|
|
.move = move_linear(p->move.velocity * 0.5),
|
2020-01-06 06:22:44 +01:00
|
|
|
.draw_rule = pdraw_timeout_scalefade(1, 2, 1, 0),
|
2018-08-11 21:13:48 +02:00
|
|
|
.layer = LAYER_PARTICLE_LOW,
|
|
|
|
.flags = PFLAG_NOREFLECT,
|
|
|
|
);
|
2020-03-25 07:52:18 +01:00
|
|
|
|
|
|
|
// TODO maybe replace this with something better looking and less task-hungry
|
|
|
|
INVOKE_TASK(reimu_ofuda_trail, ENT_BOX(trail));
|
|
|
|
return trail;
|
2018-08-11 21:13:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void capture_frame(Framebuffer *dest, Framebuffer *src) {
|
|
|
|
r_state_push();
|
|
|
|
r_framebuffer(dest);
|
|
|
|
r_shader_standard();
|
|
|
|
r_color4(1, 1, 1, 1);
|
|
|
|
r_blend(BLEND_NONE);
|
|
|
|
draw_framebuffer_tex(src, VIEWPORT_W, VIEWPORT_H);
|
|
|
|
r_state_pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
void reimu_common_bomb_bg(Player *p, float alpha) {
|
|
|
|
if(alpha <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
r_state_push();
|
|
|
|
r_color(HSLA_MUL_ALPHA(global.frames / 30.0, 0.2, 0.9, alpha));
|
|
|
|
|
|
|
|
r_shader("reimu_bomb_bg");
|
2018-09-14 09:37:20 +02:00
|
|
|
r_uniform_sampler("runes", "runes");
|
2018-08-11 21:13:48 +02:00
|
|
|
r_uniform_float("zoom", VIEWPORT_H / sqrt(VIEWPORT_W*VIEWPORT_W + VIEWPORT_H*VIEWPORT_H));
|
|
|
|
r_uniform_vec2("aspect", VIEWPORT_W / (float)VIEWPORT_H, 1);
|
|
|
|
r_uniform_float("time", 9000 + 3 * global.frames / 60.0);
|
|
|
|
draw_framebuffer_tex(bomb_buffer, VIEWPORT_W, VIEWPORT_H);
|
|
|
|
|
|
|
|
r_state_pop();
|
|
|
|
capture_frame(bomb_buffer, r_framebuffer_current());
|
|
|
|
}
|
|
|
|
|
|
|
|
void reimu_common_bomb_buffer_init(void) {
|
|
|
|
FBAttachmentConfig cfg;
|
|
|
|
memset(&cfg, 0, sizeof(cfg));
|
|
|
|
cfg.attachment = FRAMEBUFFER_ATTACH_COLOR0;
|
|
|
|
cfg.tex_params.type = TEX_TYPE_RGB;
|
|
|
|
cfg.tex_params.filter.min = TEX_FILTER_LINEAR;
|
|
|
|
cfg.tex_params.filter.mag = TEX_FILTER_LINEAR;
|
|
|
|
cfg.tex_params.wrap.s = TEX_WRAP_MIRROR;
|
|
|
|
cfg.tex_params.wrap.t = TEX_WRAP_MIRROR;
|
2019-01-04 23:59:39 +01:00
|
|
|
bomb_buffer = stage_add_background_framebuffer("Reimu bomb FB", 0.25, 1, 1, &cfg);
|
2018-08-11 21:13:48 +02:00
|
|
|
}
|