wave-particle duality changes

whatever, ship it
This commit is contained in:
Andrei Alexeyev 2017-10-20 21:31:21 +03:00
parent 4b690910bf
commit c5717cca5e
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
8 changed files with 138 additions and 28 deletions

View file

@ -66,6 +66,15 @@ return pos + a0*t + 0.5*a1*t*t;
vec2 p = vec2(t, a2.x*t*0.02*sin(0.1*t+a2.y));
return pos + vec2(a0.x*p.x - a0.y*p.y, a0.x*p.y + a0.y*p.x);
%%sine%%
vec2 line_vel = a0;
vec2 line_dir = line_vel / length(line_vel);
vec2 line_normal = vec2(line_dir.y, -line_dir.x);
float sine_amp = a1.x;
float sine_freq = a2.x;
float sine_phase = a3.x;
vec2 sine_ofs = line_normal * sine_amp * sin(sine_freq * t + sine_phase);
return pos + t * line_vel + sine_ofs;
%%weird_sine%%
float s = (a2.x * t + a3.x);
return pos + dir(angle(a0) + a1.x * sin(s) / s) * t * length(a0);
%%sine_expanding%%

View file

@ -304,9 +304,12 @@ complex las_accel(Laser *l, float t) {
return l->pos + l->args[0]*t + 0.5*l->args[1]*t*t;
}
complex las_sine(Laser *l, float t) { // [0] = velocity; [1] = sine amplitude; [2] = sine frequency; [3] = sine phase
complex las_weird_sine(Laser *l, float t) { // [0] = velocity; [1] = sine amplitude; [2] = sine frequency; [3] = sine phase
// XXX: this used to be called "las_sine", but it's actually not a proper sine wave
// do we even still need this?
if(t == EVENT_BIRTH) {
l->shader = get_shader_optional("laser_sine");
l->shader = get_shader_optional("laser_weird_sine");
l->collision_step = 3;
return 0;
}
@ -315,7 +318,29 @@ complex las_sine(Laser *l, float t) { // [0] = velocity; [1] = sine amplitude
return l->pos + cexp(I * (carg(l->args[0]) + l->args[1] * sin(s) / s)) * t * cabs(l->args[0]);
}
complex las_sine(Laser *l, float t) { // [0] = velocity; [1] = sine amplitude; [2] = sine frequency; [3] = sine phase
// this is actually shaped like a sine wave
if(t == EVENT_BIRTH) {
l->shader = get_shader_optional("laser_sine");
l->collision_step = 3;
return 0;
}
complex line_vel = l->args[0];
complex line_dir = line_vel / cabs(line_vel);
complex line_normal = cimag(line_dir) - I*creal(line_dir);
complex sine_amp = l->args[1];
complex sine_freq = l->args[2];
complex sine_phase = l->args[3];
complex sine_ofs = line_normal * sine_amp * sin(sine_freq * t + sine_phase);
return l->pos + t * line_vel + sine_ofs;
}
complex las_sine_expanding(Laser *l, float t) { // [0] = velocity; [1] = sine amplitude; [2] = sine frequency; [3] = sine phase
// XXX: this is also a "weird" one
if(t == EVENT_BIRTH) {
l->shader = get_shader_optional("laser_sine_expanding");
l->collision_step = 3;

View file

@ -69,6 +69,7 @@ int collision_laser_curve(Laser *l);
complex las_linear(Laser *l, float t);
complex las_accel(Laser *l, float t);
complex las_sine(Laser *l, float t);
complex las_weird_sine(Laser *l, float t);
complex las_sine_expanding(Laser *l, float t);
complex las_turning(Laser *l, float t);
complex las_circle(Laser *l, float t);

View file

@ -56,6 +56,11 @@ Projectile *create_projectile_p(Projectile **dest, Texture *tex, complex pos, Co
p->args[2] = a3;
p->args[3] = a4;
// BUG: this currently breaks some projectiles
// enable this when they're fixed
// assert(rule != NULL);
// rule(p, EVENT_BIRTH);
return p;
}

View file

@ -532,7 +532,7 @@ void stage_draw_hud(void) {
}
}
#ifdef PLR_DPS_STATS
else {
else if(global.frames) {
snprintf(buf, sizeof(buf), "Avg DPS: %f", global.plr.total_dmg / (global.frames / (double)FPS));
draw_text(AL_Left, 0, SCREEN_H - 0.5 * stringheight(buf, _fonts.standard), buf, _fonts.standard);
}

View file

@ -31,8 +31,8 @@ struct stage6_spells_s stage6_spells = {
.baryon = {
.many_world_interpretation = {{ 8, 9, 10, 11}, AT_Spellcard, "Eigenstate ~ Many-World Interpretation", 40, 60000,
elly_eigenstate, elly_spellbg_modern, BOSS_DEFAULT_GO_POS},
.wave_particle_duality = {{28, 29, 30, 31}, AT_Spellcard, "de Broglie Sign ~ Wave-Particle Duality", 60, 50000,
elly_broglie, elly_spellbg_modern, BOSS_DEFAULT_GO_POS},
.wave_particle_duality = {{28, 29, 30, 31}, AT_Spellcard, "de Broglie Sign ~ Wave-Particle Duality", 60, 70000,
elly_broglie, elly_spellbg_modern_dark, BOSS_DEFAULT_GO_POS},
.spacetime_curvature = {{12, 13, 14, 15}, AT_Spellcard, "Ricci Sign ~ Spacetime Curvature", 50, 90000,
elly_ricci, elly_spellbg_modern, BOSS_DEFAULT_GO_POS},
.higgs_boson_uncovered = {{16, 17, 18, 19}, AT_Spellcard, "LHC ~ Higgs Boson Uncovered", 50, 60000,

View file

@ -519,8 +519,9 @@ void Baryon(Enemy *e, int t) {
// create_particle2c("flare", e->pos+40*frand()*cexp(2.0*I*M_PI*frand()), rgb(0, 1, 1), GrowFadeAdd, timeout_linear, 50, 1-I);
if(!(t % 10))
if(!(t % 10) && global.boss && cabs(e->pos - global.boss->pos) > 2) {
create_particle1c("stain", e->pos+10*frand()*cexp(2.0*I*M_PI*frand()), rgb(0, 1*alpha, 0.7*alpha), FadeAdd, timeout, 50)->angle = 2*M_PI*frand();
}
}
void BaryonCenter(Enemy *e, int t) {
@ -709,6 +710,14 @@ int broglie_particle(Projectile *p, int t) {
return 1;
}
/*
if(t == EVENT_BIRTH) {
// hidden and no collision detection until scattertime
p->type = FakeProj;
p->draw = ProjNoDraw;
}
*/
if(t < 0) {
return 1;
}
@ -719,7 +728,6 @@ int broglie_particle(Projectile *p, int t) {
Laser *laser = (Laser*)REF(p->args[0]);
if(laser) {
// p->args[3] = laser->prule(laser, max(0, t - cimag(p->args[1]))) - p->pos;
complex oldpos = p->pos;
p->pos = laser->prule(laser, min(t, cimag(p->args[1])));
@ -729,8 +737,13 @@ int broglie_particle(Projectile *p, int t) {
}
} else {
if(t == scattertime) {
p->type = FairyProj;
p->draw = ProjDrawAdd;
p->angle += nfrand() * M_PI/8;
double angle_ampl = creal(p->args[3]);
double angle_freq = cimag(p->args[3]);
p->angle += angle_ampl * sin(t * angle_freq);
p->args[2] = -cabs(p->args[2]) * cexp(I*p->angle);
}
@ -741,6 +754,25 @@ int broglie_particle(Projectile *p, int t) {
return 1;
}
#define BROGLIE_PERIOD (420 - 30 * global.diff)
void broglie_laser_logic(Laser *l, int t) {
double hue = cimag(l->args[3]);
if(t == EVENT_BIRTH) {
l->color = hsl(hue, 1.0, 0.5);
}
if(t < 0) {
return;
}
int dt = l->deathtime + l->timespan * l->speed;
log_debug("%i %i", t, dt);
l->color = hsl(hue, 1.0, 0.5 + 0.3 * pow((double)t / dt, 2));
}
int broglie_charge(Projectile *p, int t) {
if(t < 0) {
@ -750,18 +782,40 @@ int broglie_charge(Projectile *p, int t) {
int firetime = creal(p->args[1]);
if(t == firetime) {
int attack_num = creal(p->args[2]);
double hue = creal(p->args[3]);
complex aim = p->args[0];
double dt = 100;
float a = 5;
Laser *l = create_lasercurve4c(p->pos, dt, dt, p->clr, las_sine, 5*aim, a*M_PI/8, 0.2, 0);
l->width = 20;
double dt = 200;
for(double ofs = 0; ofs < dt; ofs += 1) {
complex pos = l->prule(l, ofs);
double s_ampl = 30 + 2 * attack_num;
double s_freq = 0.10 + 0.01 * attack_num;
for(int i = 0; i < 2; ++i) {
create_projectile4c(i ? "rice" : "thickrice", pos, p->clr, broglie_particle,
add_ref(l), I*ofs + dt + ofs - 20, cexp(I*frand()*M_PI*2), 0)->draw = ProjNoDraw;
for(int lnum = 0; lnum < 2; ++lnum) {
Laser *l = create_lasercurve4c(p->pos - aim * 15, dt, dt/2, 0, las_sine,
5*aim, s_ampl, s_freq, lnum * M_PI +
I*(hue + lnum * (M_PI/12)/(M_PI/2)));
l->width = 20;
l->lrule = broglie_laser_logic;
int pnum = 0;
double inc = pow(1.10 - 0.10 * (global.diff - D_Easy), 2);
for(double ofs = 0; ofs < dt; ofs += inc, ++pnum) {
complex pos = l->prule(l, ofs);
bool fast = global.diff == D_Easy || pnum & 1;
char *txt = fast ? "thickrice" : "rice";
double spd = fast ? 2.0 : 1.5;
Projectile *part = create_projectile4c(txt, pos,
hsl(hue + lnum * (M_PI/12)/(M_PI/2), 1.0, 0.5), broglie_particle,
add_ref(l), I*ofs + dt + ofs - 10, spd,
(1 + 2 * ((global.diff - 1) / (double)(D_Lunatic - 1))) * M_PI/11 + s_freq*5*I);
part->draw = ProjNoDraw;
part->type = FakeProj;
}
}
@ -776,9 +830,15 @@ int baryon_broglie(Enemy *e, int t) {
return 1;
}
int t_real = t;
if(!global.boss) {
return ACTION_DESTROY;
}
int period = BROGLIE_PERIOD;
int t_real = t;
int attack_num = t_real / period;
t %= period;
t %= 300;
TIMER(&t);
Enemy *master = NULL;
@ -792,7 +852,7 @@ int baryon_broglie(Enemy *e, int t) {
assert(master != NULL);
if(master != e) {
if(t_real < 300) {
if(t_real < period) {
GO_TO(e, global.boss->pos, 0.03);
} else {
e->pos = global.boss->pos;
@ -810,9 +870,11 @@ int baryon_broglie(Enemy *e, int t) {
double a = 2*M_PI * (0.25 + 1.0/cnt*_i);
complex n = cexp(I*a);
create_projectile2c("ball", e->pos + 15*n,
hsl(((t_real / 300) * 2*M_PI/3 + a + M_PI/6) / (M_PI*2), 1.0, 0.55),
broglie_charge, n, fire_delay - step * _i)->draw = ProjDrawAdd;
double hue = (attack_num * M_PI + a + M_PI/6) / (M_PI*2);
create_projectile4c("ball", e->pos + 15*n,
hsl(hue, 1.0, 0.55),
broglie_charge, n, fire_delay - step * _i, attack_num, hue)->draw = ProjDrawAdd;
}
if(t < delay || t > delay + fire_delay) {
@ -838,6 +900,7 @@ void elly_broglie(Boss *b, int t) {
set_baryon_rule(baryon_reset);
}
int period = BROGLIE_PERIOD;
double ofs = 100;
complex positions[] = {
@ -847,8 +910,8 @@ void elly_broglie(Boss *b, int t) {
ofs + ofs*I,
};
if(t/300 > 0) {
GO_TO(b, positions[(t/600) % (sizeof(positions)/sizeof(complex))], 0.02);
if(t/period > 0) {
GO_TO(b, positions[(t/(period*2)) % (sizeof(positions)/sizeof(complex))], 0.02);
}
}
@ -1044,6 +1107,8 @@ void elly_ricci(Boss *b, int t) {
float v = 3;
int interval = 5;
GO_TO(b, BOSS_DEFAULT_GO_POS, 0.03);
FROM_TO(30, 100000, interval) {
for(int i = 0; i < c; i++) {
int w = VIEWPORT_W;
@ -1266,9 +1331,6 @@ int curvature_slave(Enemy *e, int t) {
if(global.diff == D_Lunatic) {
create_projectile2c("plainball",global.boss->pos,rgb(0.2, 0.4,1), curvature_orbiter, 40*cexp(I*t/400),add_ref(p))->draw = ProjDrawAdd;
}
}
return 1;
@ -1450,6 +1512,11 @@ void elly_spellbg_modern(Boss *b, int t) {
glColor4f(1,1,1,1);
}
void elly_spellbg_modern_dark(Boss *b, int t) {
elly_spellbg_modern(b, t);
fade_out(0.75 * min(1, t / 300.0));
}
static void elly_global_rule(Boss *b, int time) {
global.boss->shadowcolor = hsla(time/120.0, 1.0, 0.25, 0.5);
}
@ -1472,6 +1539,7 @@ Boss* create_elly(void) {
boss_add_attack(b, AT_Move, "Unbound", 3, 10, elly_unbound, NULL);
boss_add_attack_from_info(b, &stage6_spells.baryon.many_world_interpretation, false);
boss_add_attack(b, AT_Normal, "Baryon", 40, 50000, elly_baryonattack, NULL);
boss_add_attack_from_info(b, &stage6_spells.baryon.wave_particle_duality, false);
boss_add_attack_from_info(b, &stage6_spells.baryon.spacetime_curvature, false);
boss_add_attack(b, AT_Normal, "Baryon", 40, 50000, elly_baryonattack2, NULL);
boss_add_attack_from_info(b, &stage6_spells.baryon.higgs_boson_uncovered, false);

View file

@ -12,6 +12,8 @@
void elly_spellbg_classic(Boss*, int);
void elly_spellbg_modern(Boss*, int);
void elly_spellbg_modern_dark(Boss*, int);
void elly_kepler(Boss*, int);
void elly_newton(Boss*, int);
void elly_maxwell(Boss*, int);