fix remaining deprecations (except in legacy stages)

This commit is contained in:
Andrei Alexeyev 2020-01-06 07:22:44 +02:00
parent d362ec2ac9
commit 77a65432d6
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
8 changed files with 43 additions and 61 deletions

View file

@ -515,22 +515,24 @@ static void player_powersurge_logic(Player *plr) {
.flags = PFLAG_NOREFLECT,
);
if(!(global.frames % 6)) {
if(!(global.frames % 6) && plr->powersurge.bonus.discharge_range > 0) {
Sprite *spr = get_sprite("part/powersurge_field");
double scale = 2 * plr->powersurge.bonus.discharge_range / spr->w;
double angle = rng_angle();
assert(scale > 0);
PARTICLE(
.sprite_ptr = spr,
.pos = plr->pos,
.color = color_mul_scalar(rng_bool() ? RGBA(1.5, 0.5, 0.0, 0.1) : RGBA(0.0, 0.5, 1.5, 0.1), 0.25),
.rule = powersurge_charge_particle,
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_fade(1, 0),
.timeout = 14,
.angle = angle,
.args = { 0, 0, (1+I)*scale, 0},
.layer = LAYER_PLAYER - 1,
.flags = PFLAG_NOREFLECT,
.scale = scale,
);
PARTICLE(
@ -538,12 +540,12 @@ static void player_powersurge_logic(Player *plr) {
.pos = plr->pos,
.color = RGBA(0.5, 0.5, 0.5, 0),
.rule = powersurge_charge_particle,
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_fade(1, 0),
.timeout = 3,
.angle = angle,
.args = { 0, 0, (1+I)*scale, 0},
.layer = LAYER_PLAYER - 1,
.flags = PFLAG_NOREFLECT,
.scale = scale,
);
}
@ -714,7 +716,7 @@ static void powersurge_distortion_draw(Projectile *p, int t, ProjDrawRuleArgs ar
return;
}
double radius = p->args[0] * pow(1 - t / p->timeout, 8) * (2 * t / 10.0);
double radius = args[0].as_float[0] * pow(1 - t / p->timeout, 8) * (2 * t / 10.0);
Framebuffer *fb_aux = stage_get_fbpair(FBPAIR_FG_AUX)->front;
Framebuffer *fb_main = r_framebuffer_current();
@ -750,8 +752,10 @@ static void player_powersurge_expired(Player *plr) {
.size = 1+I,
.pos = plr->pos,
.timeout = 60,
.draw_rule = powersurge_distortion_draw,
.args = { bonus.discharge_range },
.draw_rule = {
powersurge_distortion_draw,
.args[0].as_float = { bonus.discharge_range },
},
.layer = LAYER_PLAYER,
.flags = PFLAG_REQUIREDPARTICLE | PFLAG_NOREFLECT,
);
@ -760,10 +764,10 @@ static void player_powersurge_expired(Player *plr) {
.sprite_ptr = blast,
.pos = plr->pos,
.color = RGBA(0.6, 1.0, 4.4, 0.0),
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_scalefade(2, 0, 1, 0),
.timeout = 20,
.args = { 0, 0, scale * (2 + 0 * I) },
.angle = rng_angle(),
.scale = scale,
.flags = PFLAG_REQUIREDPARTICLE | PFLAG_NOREFLECT,
);
@ -1358,10 +1362,9 @@ void player_graze(Player *plr, cmplx pos, int pts, int effect_intensity, const C
.sprite = "graze",
.color = c,
.pos = pos,
.rule = asymptotic,
.draw_rule = pdraw_timeout_scalefade_exp(1, 0, 1, 0, 2),
.move = move_asymptotic_simple(0.2 * vrng_range(R[0], 1, 6) * vrng_dir(R[1]), 16 * (1 + 0.5 * vrng_sreal(R[3]))),
.timeout = vrng_range(R[2], 4, 29),
.draw_rule = ScaleSquaredFade,
.args = { 0.2 * vrng_range(R[0], 1, 6) * vrng_dir(R[1]), 16 * (1 + 0.5 * vrng_sreal(R[3])), 1 },
.flags = PFLAG_NOREFLECT,
// .layer = LAYER_PARTICLE_LOW,
);

View file

@ -83,9 +83,9 @@ int reimu_common_ofuda(Projectile *p, int t) {
.color = &p->color,
.timeout = 12,
.pos = p->pos + p->args[0] * 0.3,
.args = { p->args[0] * 0.5, 0, 1+2*I },
.args = { p->args[0] * 0.5 },
.rule = reimu_ofuda_trail,
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_scalefade(1, 2, 1, 0),
.layer = LAYER_PARTICLE_LOW,
.flags = PFLAG_NOREFLECT,
);

View file

@ -65,9 +65,8 @@ static int reimu_spirit_needle(Projectile *p, int t) {
.color = &c,
.timeout = 12,
.pos = p->pos,
.args = { p->args[0] * 0.8, 0, 0+2*I },
.rule = linear,
.draw_rule = ScaleFade,
.move = move_linear(p->args[0] * 0.8),
.draw_rule = pdraw_timeout_scalefade(0, 2, 1, 0),
.layer = LAYER_PARTICLE_LOW,
.flags = PFLAG_NOREFLECT,
);
@ -77,7 +76,7 @@ static int reimu_spirit_needle(Projectile *p, int t) {
#define REIMU_SPIRIT_HOMING_SCALE 0.75
static Projectile* reimu_spirit_spawn_ofuda_particle(Projectile *p, int t, double vfactor) {
static Projectile *reimu_spirit_spawn_ofuda_particle(Projectile *p, int t, double vfactor) {
Color *c = HSLA_MUL_ALPHA(t * 0.1, 0.6, 0.7, 0.3);
c->a = 0;
@ -87,12 +86,12 @@ static Projectile* reimu_spirit_spawn_ofuda_particle(Projectile *p, int t, doubl
.color = c,
.timeout = 12,
.pos = p->pos,
.args = { p->args[0] * rng_range(0.6, 1.0) * vfactor, 0, (1+1.5*I) * REIMU_SPIRIT_HOMING_SCALE },
.angle = p->angle,
.rule = linear,
.draw_rule = ScaleFade,
.move = move_linear(p->args[0] * rng_range(0.6, 1.0) * vfactor),
.draw_rule = pdraw_timeout_scalefade(1, 1.5, 1, 0),
.layer = LAYER_PARTICLE_LOW,
.flags = PFLAG_NOREFLECT | PFLAG_REQUIREDPARTICLE,
.scale = REIMU_SPIRIT_HOMING_SCALE,
);
}
@ -118,12 +117,12 @@ static Projectile* reimu_spirit_spawn_homing_impact(Projectile *p, int t) {
.color = &p->color,
.timeout = 32,
.pos = p->pos,
.args = { 0, 0, (1+1.5*I) * REIMU_SPIRIT_HOMING_SCALE },
.angle = p->angle,
.rule = reimu_spirit_homing_impact,
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_scalefade(1, 1.5, 1, 0),
.layer = LAYER_PARTICLE_HIGH,
.flags = PFLAG_NOREFLECT | PFLAG_REQUIREDPARTICLE,
.scale = REIMU_SPIRIT_HOMING_SCALE,
);
}
@ -228,9 +227,8 @@ TASK(reimu_spirit_bomb_orb_impact, { BoxedProjectile orb; }) {
.color = color_mul_scalar(COLOR_COPY(&base_colors[i]), 2),
.pos = pos + 30 * cexp(I*2*M_PI/num_impacts*(i+t*0.1)),
.timeout = 40,
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_scalefade(0, 7.5, 1, 0),
.layer = LAYER_BOSS + 2,
.args = { 0, 0, 7.5*I },
.flags = PFLAG_NOREFLECT | PFLAG_REQUIREDPARTICLE,
);
@ -371,9 +369,9 @@ TASK(reimu_spirit_bomb_orb, { BoxedPlayer plr; int index; real angle; }) {
.pos = trail_pos,
.angle = rng_angle(),
.timeout = 30,
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_scalefade(0.4, 0, 1, 0),
.rule = reimu_spirit_bomb_orb_trail,
.args = { trail_vel, 0, 0.4 },
.args = { trail_vel },
.flags = PFLAG_NOREFLECT,
);
}
@ -529,13 +527,6 @@ static int reimu_spirit_slave(Enemy *e, int t) {
return ACTION_NONE;
}
static int reimu_spirit_yinyang_flare(Projectile *p, int t) {
double a = p->angle;
int r = linear(p, t);
p->angle = a;
return r;
}
static void reimu_spirit_yinyang_focused_visual(Enemy *e, int t, bool render) {
if(!render && player_should_shoot(&global.plr, true)) {
RNG_ARRAY(R, 4);
@ -544,11 +535,10 @@ static void reimu_spirit_yinyang_focused_visual(Enemy *e, int t, bool render) {
.color = RGBA(0.5, vrng_range(R[0], 0, 0.25), 0, 0),
.timeout = vrng_range(R[1], 8, 10),
.pos = e->pos,
.args = { -I * vrng_range(R[2], 5, 10), 0, 0.25 + 0*I },
.angle = vrng_angle(R[3]),
.rule = reimu_spirit_yinyang_flare,
.draw_rule = ScaleFade,
.flags = PFLAG_NOREFLECT,
.move = move_linear(-I * vrng_range(R[2], 5, 10)),
.draw_rule = pdraw_timeout_scalefade(0.25, 0, 1, 0),
.flags = PFLAG_NOREFLECT | PFLAG_MANUALANGLE,
);
}
@ -567,9 +557,9 @@ static void reimu_spirit_yinyang_unfocused_visual(Enemy *e, int t, bool render)
.pos = e->pos,
.args = { -I * vrng_range(R[2], 5, 10), 0, 0.25 + 0*I },
.angle = vrng_angle(R[3]),
.rule = reimu_spirit_yinyang_flare,
.draw_rule = ScaleFade,
.flags = PFLAG_NOREFLECT,
.move = move_linear(-I * vrng_range(R[2], 5, 10)),
.draw_rule = pdraw_timeout_scalefade(0.25, 0, 1, 0),
.flags = PFLAG_NOREFLECT | PFLAG_MANUALANGLE,
);
}

View file

@ -82,9 +82,8 @@ static int reimu_dream_gap_bomb_projectile(Projectile *p, int t) {
.color = &p->color,
.pos = p->pos,
.timeout = 20,
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_scalefade(0, 3 * range / spr->w, 1, 0),
.layer = LAYER_BOSS + 2,
.args = { 0, 0, 3 * range / spr->w * I },
.flags = PFLAG_NOREFLECT | PFLAG_REQUIREDPARTICLE,
);
@ -336,8 +335,7 @@ static void reimu_dream_spawn_warp_effect(cmplx pos, bool exit) {
.color = RGBA(0.5, 0.5, 0.5, 0.5),
.timeout = 20,
.angle = rng_angle(),
.draw_rule = ScaleFade,
.args = { 0, 0, 0.2 + 1 * I },
.draw_rule = pdraw_timeout_scalefade(0.2, 1, 1, 0),
.layer = LAYER_PLAYER_FOCUS,
);
@ -348,8 +346,7 @@ static void reimu_dream_spawn_warp_effect(cmplx pos, bool exit) {
.color = clr,
.timeout = 20,
.angle = rng_angle(),
.draw_rule = ScaleFade,
.args = { 0, 0, 0.1 + 0.6 * I },
.draw_rule = pdraw_timeout_scalefade(0.1, 0.6, 1, 0),
.layer = LAYER_PLAYER_FOCUS,
);
}
@ -435,9 +432,8 @@ static int reimu_dream_needle(Projectile *p, int t) {
.color = c,
.timeout = 12,
.pos = p->pos,
.args = { p->args[0] * 0.8, 0, 0+3*I },
.rule = linear,
.draw_rule = ScaleFade,
.move = move_linear(p->args[0] * 0.8),
.draw_rule = pdraw_timeout_scalefade(0, 3, 1, 0),
.layer = LAYER_PARTICLE_LOW,
.flags = PFLAG_NOREFLECT,
);

View file

@ -396,8 +396,7 @@ static void youmu_mirror_bomb_damage_callback(EntityInterface *victim, cmplx vic
.pos = victim_origin,
.color = RGBA(vrng_range(R[0], 0.6, 0.7), 0.8, vrng_range(R[1], 0.7, 0.775), vrng_range(R[2], 0, 0.5)),
.timeout = 30,
.draw_rule = ScaleFade,
.args = { 0, 0, (0.0 + 0.5*I) },
.draw_rule = pdraw_timeout_scalefade(0, 0.5, 1, 0),
.layer = LAYER_PARTICLE_HIGH | 0x4,
.angle = vrng_angle(R[3]),
.flags = PFLAG_REQUIREDPARTICLE,

View file

@ -1050,10 +1050,6 @@ void ScaleFade(Projectile *p, int t, ProjDrawRuleArgs args) {
ScaleFadeImpl(p, t, 1);
}
void ScaleSquaredFade(Projectile *p, int t, ProjDrawRuleArgs args) {
ScaleFadeImpl(p, t, 2);
}
static void pdraw_scalefade_func(Projectile *p, int t, ProjDrawRuleArgs args) {
cmplx32 scale0 = args[0].as_cmplx;
cmplx32 scale1 = args[1].as_cmplx;

View file

@ -238,7 +238,6 @@ void Shrink(Projectile *p, int t, ProjDrawRuleArgs) DEPRECATED_DRAW_RULE;
void Fade(Projectile *p, int t, ProjDrawRuleArgs) DEPRECATED_DRAW_RULE;
void GrowFade(Projectile *p, int t, ProjDrawRuleArgs) DEPRECATED_DRAW_RULE;
void ScaleFade(Projectile *p, int t, ProjDrawRuleArgs) DEPRECATED_DRAW_RULE;
void ScaleSquaredFade(Projectile *p, int t, ProjDrawRuleArgs) DEPRECATED_DRAW_RULE;
ProjDrawRule pdraw_basic(void);
ProjDrawRule pdraw_timeout_scalefade_exp(cmplx32 scale0, cmplx32 scale1, float32 opacity0, float32 opacity1, float32 opacity_exp);

View file

@ -32,15 +32,14 @@ static Dialog *stage1_dialog_post_boss(void) {
return d;
}
static Projectile* spawn_stain(cmplx pos, float angle, int to) {
static Projectile *spawn_stain(cmplx pos, float angle, int to) {
return PARTICLE(
.sprite = "stain",
.pos = pos,
.draw_rule = ScaleFade,
.draw_rule = pdraw_timeout_scalefade(0, 0.8, 1, 0),
.timeout = to,
.angle = angle,
.color = RGBA(0.4, 0.4, 0.4, 0),
.args = {0, 0, 0.8*I}
);
}