Upgrade several files to new RNG API
This commit is contained in:
parent
9868fbcaa4
commit
c19922bd1d
10 changed files with 100 additions and 77 deletions
|
@ -86,14 +86,14 @@ static void trace_laser(Enemy *e, cmplx vel, float damage) {
|
|||
}
|
||||
|
||||
if(col.type & col_types) {
|
||||
tsrand_fill(3);
|
||||
RNG_ARRAY(R, 3);
|
||||
PARTICLE(
|
||||
.sprite = "flare",
|
||||
.pos = col.location,
|
||||
.rule = linear,
|
||||
.timeout = 3 + 5 * afrand(2),
|
||||
.timeout = vrng_range(R[0], 3, 8),
|
||||
.draw_rule = Shrink,
|
||||
.args = { (2+afrand(0)*6)*cexp(I*M_PI*2*afrand(1)) },
|
||||
.args = { vrng_range(R[1], 2, 8) * vrng_dir(R[2]) },
|
||||
.flags = PFLAG_NOREFLECT,
|
||||
.layer = LAYER_PARTICLE_HIGH,
|
||||
);
|
||||
|
@ -471,7 +471,7 @@ static int masterspark(Enemy *e, int t2) {
|
|||
if(t2 < 0)
|
||||
return 1;
|
||||
|
||||
e->args[0] *= cexp(I*(0.005*creal(global.plr.velocity) + nfrand() * 0.005));
|
||||
e->args[0] *= cexp(I*(0.005*creal(global.plr.velocity) + rng_sreal() * 0.005));
|
||||
cmplx diroffset = e->args[0];
|
||||
|
||||
float t = player_get_bomb_progress(&global.plr);
|
||||
|
@ -480,7 +480,7 @@ static int masterspark(Enemy *e, int t2) {
|
|||
global.shake_view = 8 * (1 - t * 4 + 3);
|
||||
} else if(t2 % 2 == 0) {
|
||||
cmplx dir = -cexp(1.5*I*sin(t2*M_PI*1.12))*I;
|
||||
Color *c = HSLA(-t*5.321,1,0.5,0.5*frand());
|
||||
Color *c = HSLA(-t*5.321, 1, 0.5, rng_range(0, 0.5));
|
||||
|
||||
uint flags = PFLAG_NOREFLECT;
|
||||
|
||||
|
@ -495,7 +495,7 @@ static int masterspark(Enemy *e, int t2) {
|
|||
.rule = masterspark_star,
|
||||
.timeout = 50,
|
||||
.args= { (10 * dir - 10*I)*diroffset, 4 },
|
||||
.angle = nfrand(),
|
||||
.angle = rng_angle(),
|
||||
.draw_rule = GrowFade,
|
||||
.flags = flags,
|
||||
);
|
||||
|
@ -507,7 +507,7 @@ static int masterspark(Enemy *e, int t2) {
|
|||
.rule = masterspark_star,
|
||||
.timeout = 50,
|
||||
.args = { (10 * dir - 10*I)*diroffset, 4 },
|
||||
.angle = nfrand(),
|
||||
.angle = rng_angle(),
|
||||
.draw_rule = GrowFade,
|
||||
.flags = flags,
|
||||
);
|
||||
|
@ -518,7 +518,7 @@ static int masterspark(Enemy *e, int t2) {
|
|||
.rule = linear,
|
||||
.timeout = 50,
|
||||
.args = { -7*dir + 7*I, 6 },
|
||||
.angle = nfrand(),
|
||||
.angle = rng_angle(),
|
||||
.draw_rule = GrowFade,
|
||||
.flags = flags,
|
||||
);
|
||||
|
|
|
@ -68,7 +68,7 @@ static int marisa_star_projectile(Projectile *p, int t) {
|
|||
p->pos0 = p->pos - p->pos0;
|
||||
p->angle = carg(p->pos0);
|
||||
|
||||
if(t%(2+(int)round(2*frand())) == 0) {
|
||||
if(t%(2+(int)round(2*rng_real())) == 0) { // please never write stuff like this ever again
|
||||
PARTICLE(
|
||||
.sprite = "stardust",
|
||||
.pos = p->pos,
|
||||
|
|
|
@ -96,7 +96,7 @@ static Projectile* reimu_spirit_spawn_ofuda_particle(Projectile *p, int t, doubl
|
|||
.color = c,
|
||||
.timeout = 12,
|
||||
.pos = p->pos,
|
||||
.args = { p->args[0] * (0.6 + 0.4 * frand()) * vfactor, 0, (1+1.5*I) * REIMU_SPIRIT_HOMING_SCALE },
|
||||
.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,
|
||||
|
@ -247,17 +247,17 @@ static int reimu_spirit_bomb_orb(Projectile *p, int t) {
|
|||
stage_clear_hazards_at(p->pos, range, CLEAR_HAZARDS_ALL | CLEAR_HAZARDS_NOW);
|
||||
|
||||
int count = 21;
|
||||
double offset = frand();
|
||||
real offset = rng_real();
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
PARTICLE(
|
||||
.sprite_ptr = get_sprite("proj/glowball"),
|
||||
.shader = "sprite_bullet",
|
||||
.color = HSLA(3 * (float)i / count + offset, 1, 0.5, 0), // reimu_spirit_orb_color(&(Color){0}, i%3),w
|
||||
.color = HSLA(3 * (float)i / count + offset, 1, 0.5, 0),
|
||||
.timeout = 60,
|
||||
.pos = p->pos,
|
||||
.args = { cexp(I * 2 * M_PI / count * (i + offset)) * 15 },
|
||||
.angle = 2*M_PI*frand(),
|
||||
.args = { cdir(2 * M_PI / count * (i + offset)) * 15 },
|
||||
.angle = rng_angle(),
|
||||
.rule = linear,
|
||||
.draw_rule = Fade,
|
||||
.layer = LAYER_BOSS,
|
||||
|
@ -284,7 +284,7 @@ static int reimu_spirit_bomb_orb(Projectile *p, int t) {
|
|||
.timeout = 120,
|
||||
.draw_rule = reimu_spirit_bomb_orb_draw_impact,
|
||||
.layer = LAYER_BOSS + 1,
|
||||
.args = { frand() },
|
||||
.args = { rng_real() },
|
||||
.flags = PFLAG_NOREFLECT | PFLAG_REQUIREDPARTICLE,
|
||||
);
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ static int reimu_spirit_bomb_orb(Projectile *p, int t) {
|
|||
// .color = reimu_spirit_orb_color(&(Color){0}, i),
|
||||
.color = HSLA(t/p->timeout, 0.3, 0.3, 0.0),
|
||||
.pos = trail_pos,
|
||||
.angle = 2*M_PI*frand(),
|
||||
.angle = rng_angle(),
|
||||
.timeout = 30,
|
||||
.draw_rule = ScaleFade,
|
||||
.rule = reimu_spirit_bomb_orb_trail,
|
||||
|
@ -508,13 +508,14 @@ static int reimu_spirit_yinyang_flare(Projectile *p, int t) {
|
|||
|
||||
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);
|
||||
PARTICLE(
|
||||
.sprite = "stain",
|
||||
.color = RGBA(0.5, 0.0 + 0.25 * frand(), 0, 0),
|
||||
.timeout = 8 + 2 * nfrand(),
|
||||
.color = RGBA(0.5, vrng_range(R[0], 0, 0.25), 0, 0),
|
||||
.timeout = vrng_range(R[1], 8, 10),
|
||||
.pos = e->pos,
|
||||
.args = { -5*I * (1 + frand()), 0, 0.25 + 0*I },
|
||||
.angle = 2*M_PI*frand(),
|
||||
.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,
|
||||
|
@ -528,13 +529,14 @@ static void reimu_spirit_yinyang_focused_visual(Enemy *e, int t, bool render) {
|
|||
|
||||
static void reimu_spirit_yinyang_unfocused_visual(Enemy *e, int t, bool render) {
|
||||
if(!render && player_should_shoot(&global.plr, true)) {
|
||||
RNG_ARRAY(R, 4);
|
||||
PARTICLE(
|
||||
.sprite = "stain",
|
||||
.color = RGBA(0.5, 0.125, 0.0 + 0.25 * frand(), 0),
|
||||
.timeout = 8 + 2 * nfrand(),
|
||||
.color = RGBA(0.5, 0.125, vrng_range(R[0], 0, 0.25), 0),
|
||||
.timeout = vrng_range(R[1], 8, 10),
|
||||
.pos = e->pos,
|
||||
.args = { -5*I * (1 + frand()), 0, 0.25 + 0*I },
|
||||
.angle = 2*M_PI*frand(),
|
||||
.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,
|
||||
|
|
|
@ -125,7 +125,7 @@ static void reimu_dream_gap_bomb(Enemy *e, int t) {
|
|||
.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,
|
||||
.pos = e->pos + e->args[0] * GAP_LENGTH * 0.25 * rng_sreal(),
|
||||
.rule = reimu_dream_gap_bomb_projectile,
|
||||
.draw_rule = reimu_dream_gap_bomb_projectile_draw,
|
||||
.type = PROJ_PLAYER,
|
||||
|
@ -335,7 +335,7 @@ static void reimu_dream_spawn_warp_effect(cmplx pos, bool exit) {
|
|||
.pos = pos,
|
||||
.color = RGBA(0.5, 0.5, 0.5, 0.5),
|
||||
.timeout = 20,
|
||||
.angle = frand() * M_PI * 2,
|
||||
.angle = rng_angle(),
|
||||
.draw_rule = ScaleFade,
|
||||
.args = { 0, 0, 0.2 + 1 * I },
|
||||
.layer = LAYER_PLAYER_FOCUS,
|
||||
|
@ -344,9 +344,9 @@ static void reimu_dream_spawn_warp_effect(cmplx pos, bool exit) {
|
|||
PARTICLE(
|
||||
.sprite = exit ? "stain" : "stardust",
|
||||
.pos = pos,
|
||||
.color = color_mul_scalar(RGBA(0.75, 0.4 * frand(), 0.4, 0), 0.8-0.4*exit),
|
||||
.color = color_mul_scalar(RGBA(0.75, rng_range(0, 0.4), 0.4, 0), 0.8-0.4*exit),
|
||||
.timeout = 20,
|
||||
.angle = frand() * M_PI * 2,
|
||||
.angle = rng_angle(),
|
||||
.draw_rule = ScaleFade,
|
||||
.args = { 0, 0, 0.1 + 0.6 * I },
|
||||
.layer = LAYER_PLAYER_FOCUS,
|
||||
|
|
|
@ -66,48 +66,50 @@ static void myon_draw_trail(Projectile *p, int t) {
|
|||
}
|
||||
|
||||
static void spawn_stardust(cmplx pos, float myon_color_f, int timeout, cmplx v) {
|
||||
RNG_ARRAY(R, 4);
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "stardust",
|
||||
.pos = pos+5*frand()*cexp(2.0*I*M_PI*frand()),
|
||||
.pos = pos + vrng_range(R[0], 0, 5) * vrng_dir(R[1]),
|
||||
.draw_rule = myon_draw_trail,
|
||||
.rule = myon_particle_rule,
|
||||
.timeout = timeout,
|
||||
.args = { v, 0.2 + 0.1 * frand(), 0, myon_color_f },
|
||||
.angle = M_PI*2*frand(),
|
||||
.args = { v, vrng_range(R[2], 0.2, 0.3), 0, myon_color_f },
|
||||
.angle = vrng_angle(R[3]),
|
||||
.flags = PFLAG_NOREFLECT,
|
||||
.layer = LAYER_PARTICLE_LOW | 1,
|
||||
);
|
||||
}
|
||||
|
||||
static void myon_spawn_trail(Enemy *e, int t) {
|
||||
float a = global.frames * 0.07;
|
||||
cmplx pos = e->pos + 3 * (cos(a) + I * sin(a));
|
||||
|
||||
cmplx stardust_v = 3 * myon_tail_dir() * cexp(I*M_PI/16*sin(1.33*t));
|
||||
float f = abs(global.plr.focus) / 30.0;
|
||||
cmplx pos = e->pos + 3 * cdir(global.frames * 0.07);
|
||||
cmplx stardust_v = 3 * myon_tail_dir() * cdir(M_PI/16*sin(1.33*t));
|
||||
real f = abs(global.plr.focus) / 30.0;
|
||||
stardust_v = f * stardust_v + (1 - f) * -I;
|
||||
|
||||
if(player_should_shoot(&global.plr, true)) {
|
||||
RNG_ARRAY(R, 7);
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "smoke",
|
||||
.pos = pos+10*frand()*cexp(2.0*I*M_PI*frand()),
|
||||
.pos = pos + vrng_range(R[0], 0, 10) * vrng_dir(R[1]),
|
||||
.draw_rule = myon_draw_trail,
|
||||
.rule = myon_particle_rule,
|
||||
.timeout = 60,
|
||||
.args = { -I*0.0*cexp(I*M_PI/16*sin(t)), -0.2, 0, f },
|
||||
.args = { 0, -0.2, 0, f },
|
||||
.flags = PFLAG_NOREFLECT,
|
||||
.angle = M_PI*2*frand(),
|
||||
.angle = vrng_angle(R[2]),
|
||||
);
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "flare",
|
||||
.pos = pos+5*frand()*cexp(2.0*I*M_PI*frand()),
|
||||
.pos = pos + vrng_range(R[3], 0, 5) * vrng_dir(R[4]),
|
||||
.draw_rule = Shrink,
|
||||
.rule = myon_particle_rule,
|
||||
.timeout = 10,
|
||||
.args = { cexp(I*M_PI*2*frand())*0.5, 0.2, 0, f },
|
||||
.args = { 0.5 * vrng_dir(R[5]), 0.2, 0, f },
|
||||
.flags = PFLAG_NOREFLECT,
|
||||
.angle = M_PI*2*frand(),
|
||||
.angle = vrng_angle(R[6]),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -119,7 +121,7 @@ static void myon_spawn_trail(Enemy *e, int t) {
|
|||
.args = { f * stardust_v, 0, 0, f },
|
||||
.draw_rule = Shrink,
|
||||
.flags = PFLAG_NOREFLECT | PFLAG_REQUIREDPARTICLE,
|
||||
.angle = M_PI*2*frand(),
|
||||
.angle = rng_angle(),
|
||||
.layer = LAYER_PARTICLE_LOW,
|
||||
);
|
||||
|
||||
|
@ -372,17 +374,20 @@ static void youmu_mirror_shot(Player *plr) {
|
|||
}
|
||||
|
||||
static void youmu_mirror_bomb_damage_callback(EntityInterface *victim, cmplx victim_origin, void *arg) {
|
||||
victim_origin += cexp(I*M_PI*2*frand()) * 15 * frand();
|
||||
cmplx ofs_dir = rng_dir();
|
||||
victim_origin += ofs_dir * rng_range(0, 15);
|
||||
|
||||
RNG_ARRAY(R, 6);
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "blast_huge_halo",
|
||||
.pos = victim_origin,
|
||||
.color = RGBA(0.6 + 0.1 * frand(), 0.8, 0.7 + 0.075 * frand(), 0.5 * frand()),
|
||||
.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) },
|
||||
.layer = LAYER_PARTICLE_HIGH | 0x4,
|
||||
.angle = frand() * 2 * M_PI,
|
||||
.angle = vrng_angle(R[3]),
|
||||
.flags = PFLAG_REQUIREDPARTICLE,
|
||||
);
|
||||
|
||||
|
@ -390,7 +395,8 @@ static void youmu_mirror_bomb_damage_callback(EntityInterface *victim, cmplx vic
|
|||
return;
|
||||
}
|
||||
|
||||
float t = frand();
|
||||
real t = rng_real();
|
||||
RNG_NEXT(R);
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "petal",
|
||||
|
@ -399,10 +405,10 @@ static void youmu_mirror_bomb_damage_callback(EntityInterface *victim, cmplx vic
|
|||
.draw_rule = Petal,
|
||||
.color = RGBA(sin(5*t) * t, cos(5*t) * t, 0.5 * t, 0),
|
||||
.args = {
|
||||
sign(nfrand())*(3+t*5*frand())*cexp(I*M_PI*8*t),
|
||||
vrng_sign(R[0]) * vrng_range(R[1], 3, 3 + 5 * t) * cdir(M_PI*8*t),
|
||||
5+I,
|
||||
frand() + frand()*I,
|
||||
frand() + 360.0*I*frand()
|
||||
vrng_real(R[2]) + vrng_real(R[3])*I,
|
||||
vrng_real(R[4]) + vrng_range(R[5], 0, 360)*I,
|
||||
},
|
||||
.layer = LAYER_PARTICLE_PETAL,
|
||||
);
|
||||
|
@ -441,20 +447,23 @@ static int youmu_mirror_bomb_controller(Enemy *e, int t) {
|
|||
.color = RGBA(0.9, 0.8, 1.0, 0.0),
|
||||
.timeout = 30,
|
||||
.args = {
|
||||
2*cexp(2*I*M_PI*frand()),
|
||||
2 * rng_dir(),
|
||||
},
|
||||
.flags = _i%2 == 0 ? PFLAG_REQUIREDPARTICLE : 0
|
||||
);
|
||||
|
||||
RNG_ARRAY(R, 2);
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "stain",
|
||||
.pos = e->pos,
|
||||
.rule = accelerated,
|
||||
.draw_rule = GrowFade,
|
||||
.angle = 2*M_PI*frand(),
|
||||
.angle = vrng_angle(R[0]),
|
||||
.color = RGBA(0.2, 0.1, 1.0, 0.0),
|
||||
.timeout = 50,
|
||||
.args = {
|
||||
-1*e->args[0]*cexp(I*0.2*nfrand())/30,
|
||||
-1*e->args[0]*cdir(0.2*rng_real())/30,
|
||||
0.1*e->args[0]*I*sin(t/4.)/30,
|
||||
2
|
||||
},
|
||||
|
|
|
@ -96,7 +96,7 @@ static int youmu_homing(Projectile *p, int t) { // a[0]: velocity, a[1]: aim (r:
|
|||
.layer = LAYER_PARTICLE_HIGH,
|
||||
.args = { 0, 0, 0.5 * I },
|
||||
.flags = PFLAG_NOREFLECT,
|
||||
.angle = M_PI*nfrand(),
|
||||
.angle = rng_angle(),
|
||||
);
|
||||
return ACTION_ACK;
|
||||
}
|
||||
|
@ -283,10 +283,11 @@ static int youmu_particle_slice_logic(Projectile *p, int t) {
|
|||
|
||||
p->color = *RGBA(a, a, a, 0);
|
||||
|
||||
cmplx phase = cexp(p->angle * I);
|
||||
|
||||
if(t%5 == 0) {
|
||||
tsrand_fill(4);
|
||||
cmplx phase = cdir(p->angle);
|
||||
RNG_ARRAY(R, 4);
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "petal",
|
||||
.pos = p->pos-400*phase,
|
||||
|
@ -294,9 +295,9 @@ static int youmu_particle_slice_logic(Projectile *p, int t) {
|
|||
.draw_rule = Petal,
|
||||
.args = {
|
||||
phase,
|
||||
phase*cexp(0.1*I),
|
||||
afrand(1) + afrand(2)*I,
|
||||
afrand(3) + 360.0*I*afrand(0)
|
||||
phase*cdir(0.1),
|
||||
vrng_real(R[0]) + vrng_real(R[1])*I,
|
||||
vrng_real(R[2]) + vrng_range(R[3], 0, 360)*I,
|
||||
},
|
||||
.layer = LAYER_PARTICLE_HIGH | 0x2,
|
||||
.flags = PFLAG_NOREFLECT | PFLAG_REQUIREDPARTICLE,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "list.h"
|
||||
#include "stageobjects.h"
|
||||
|
||||
ht_ptr2int_t shader_sublayer_map;
|
||||
static ht_ptr2int_t shader_sublayer_map;
|
||||
|
||||
static ProjArgs defaults_proj = {
|
||||
.sprite = "proj/",
|
||||
|
@ -750,17 +750,19 @@ static Projectile* spawn_projectile_highlight_effect_internal(Projectile *p, boo
|
|||
sx = pow(p->sprite->w, 0.7);
|
||||
sy = pow(p->sprite->h, 0.7);
|
||||
|
||||
RNG_ARRAY(R, 5);
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "stardust_green",
|
||||
.shader = "sprite_bullet",
|
||||
.size = p->size * 4.5,
|
||||
.layer = LAYER_PARTICLE_HIGH | 0x40,
|
||||
.draw_rule = ScaleSquaredFade,
|
||||
.args = { 0, 0, (0 + 2*I) * 0.1 * fmax(sx, sy) * (1 - 0.2 * frand()) },
|
||||
.angle = frand() * M_PI * 2,
|
||||
.pos = p->pos + frand() * 8 * cexp(I*M_PI*2*frand()),
|
||||
.args = { 0, 0, (0 + 2*I) * 0.1 * fmax(sx, sy) * (1 - 0.2 * vrng_real(R[0])) },
|
||||
.angle = vrng_angle(R[1]),
|
||||
.pos = p->pos + vrng_range(R[2], 0, 8) * vrng_dir(R[3]),
|
||||
.flags = PFLAG_NOREFLECT,
|
||||
.timeout = 24 + 2 * nfrand(),
|
||||
.timeout = vrng_range(R[4], 22, 26),
|
||||
.color = &clr,
|
||||
);
|
||||
}
|
||||
|
@ -769,17 +771,19 @@ static Projectile* spawn_projectile_highlight_effect_internal(Projectile *p, boo
|
|||
sy = pow((1.5 * p->sprite->h + 0.5 * p->sprite->w) * 0.5, 0.65);
|
||||
clr.a = 0.2;
|
||||
|
||||
RNG_ARRAY(R, 5);
|
||||
|
||||
return PARTICLE(
|
||||
.sprite = "bullet_cloud",
|
||||
.size = p->size * 4.5,
|
||||
.shader = "sprite_bullet",
|
||||
.layer = LAYER_PARTICLE_HIGH | 0x80,
|
||||
.draw_rule = bullet_highlight_draw,
|
||||
.args = { 0.125 * (sx + I * sy), frand() * M_PI * 2 },
|
||||
.args = { 0.125 * (sx + I * sy), vrng_angle(R[0]) },
|
||||
.angle = p->angle,
|
||||
.pos = p->pos + frand() * 5 * cexp(I*M_PI*2*frand()),
|
||||
.pos = p->pos + vrng_range(R[1], 0, 5) * vrng_dir(R[2]),
|
||||
.flags = PFLAG_NOREFLECT | PFLAG_REQUIREDPARTICLE,
|
||||
.timeout = 32 + 2 * nfrand(),
|
||||
.timeout = vrng_range(R[3], 30, 34),
|
||||
.color = &clr,
|
||||
);
|
||||
}
|
||||
|
@ -1032,8 +1036,8 @@ void Petal(Projectile *p, int t) {
|
|||
|
||||
void petal_explosion(int n, cmplx pos) {
|
||||
for(int i = 0; i < n; i++) {
|
||||
tsrand_fill(6);
|
||||
float t = frand();
|
||||
RNG_ARRAY(R, 6);
|
||||
real t = rng_real();
|
||||
|
||||
PARTICLE(
|
||||
.sprite = "petal",
|
||||
|
@ -1042,10 +1046,10 @@ void petal_explosion(int n, cmplx pos) {
|
|||
.rule = asymptotic,
|
||||
.draw_rule = Petal,
|
||||
.args = {
|
||||
(3+5*afrand(2))*cexp(I*M_PI*2*afrand(3)),
|
||||
vrng_range(R[0], 3, 8) * vrng_dir(R[1]),
|
||||
5,
|
||||
afrand(4) + afrand(5)*I,
|
||||
afrand(1) + 360.0*I*afrand(0),
|
||||
vrng_real(R[2]) + vrng_real(R[3])*I,
|
||||
vrng_real(R[4]) + vrng_range(R[5], 0, 360)*I,
|
||||
},
|
||||
// TODO: maybe remove this noreflect, there shouldn't be a cull mode mess anymore
|
||||
.flags = PFLAG_NOREFLECT | (n % 2 ? 0 : PFLAG_REQUIREDPARTICLE),
|
||||
|
|
|
@ -57,8 +57,15 @@ static void pp_blast_init_projectile(ProjPrototype *proto, Projectile *p) {
|
|||
pp_basic_init_projectile(proto, p);
|
||||
assert(p->rule == NULL);
|
||||
assert(p->timeout > 0);
|
||||
p->args[1] = frand()*360 + frand()*I;
|
||||
p->args[2] = frand() + frand()*I;
|
||||
|
||||
real a1_x, a1_y, a2_x, a2_y;
|
||||
a1_x = rng_range(0, 360);
|
||||
a1_y = rng_real();
|
||||
a2_x = rng_real();
|
||||
a2_y = rng_real();
|
||||
|
||||
p->args[1] = CMPLX(a1_x, a1_y);
|
||||
p->args[2] = CMPLX(a2_x, a2_y);
|
||||
}
|
||||
|
||||
ProjPrototype _pp_blast = {
|
||||
|
|
|
@ -834,7 +834,7 @@ static LogicFrameAction stage_logic_frame(void *arg) {
|
|||
stage->procs->update();
|
||||
}
|
||||
|
||||
replay_stage_check_desync(global.replay_stage, global.frames, (tsrand() ^ global.plr.points) & 0xFFFF, global.replaymode);
|
||||
replay_stage_check_desync(global.replay_stage, global.frames, (rng_u64() ^ global.plr.points) & 0xFFFF, global.replaymode);
|
||||
stage_logic();
|
||||
|
||||
if(fstate->transition_delay) {
|
||||
|
|
|
@ -55,7 +55,7 @@ TASK(wait_event_test, { BoxedEnemy e; int rounds; int delay; int cnt; int cnt_in
|
|||
while(ARGS.rounds--) {
|
||||
WAIT(ARGS.delay);
|
||||
|
||||
double angle_ofs = frand() * M_PI * 2;
|
||||
real angle_ofs = rng_angle();
|
||||
|
||||
for(int i = 0; i < ARGS.cnt; ++i) {
|
||||
complex aim = cexp(I * (angle_ofs + M_PI * 2.0 * i / (double)ARGS.cnt));
|
||||
|
@ -125,7 +125,7 @@ TASK_WITH_FINALIZER(test_enemy, {
|
|||
}
|
||||
|
||||
// keep wandering, randomly
|
||||
ARGS.dir *= cexp(I*M_PI*nfrand());
|
||||
ARGS.dir *= rng_dir();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue