all: use re()/im() macros
This commit is contained in:
parent
95053f7fe8
commit
c2810e228d
51 changed files with 247 additions and 242 deletions
18
src/boss.c
18
src/boss.c
|
@ -356,7 +356,7 @@ static void update_hud(Boss *boss) {
|
|||
target_spell_opacity = 0.0;
|
||||
}
|
||||
|
||||
if(cimag(global.plr.pos) < 128) {
|
||||
if(im(global.plr.pos) < 128) {
|
||||
target_plrproximity_opacity = 0.25;
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ static void draw_radial_healthbar(Boss *boss) {
|
|||
|
||||
r_state_push();
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(creal(boss->pos), cimag(boss->pos), 0);
|
||||
r_mat_mv_translate(re(boss->pos), im(boss->pos), 0);
|
||||
r_mat_mv_scale(220, 220, 0);
|
||||
r_shader("healthbar_radial");
|
||||
r_uniform_vec4_rgba("borderColor", RGBA(0.75, 0.75, 0.75, 0.75));
|
||||
|
@ -428,7 +428,7 @@ static void draw_spell_warning(Font *font, float y_pos, float f, float opacity)
|
|||
opacity *= 1 - 2 * fabs(f - 0.5);
|
||||
cmplx pos = (VIEWPORT_W + msg_width) * f - msg_width * 0.5 + I * y_pos;
|
||||
|
||||
draw_boss_text(ALIGN_CENTER, creal(pos), cimag(pos), msg, font, color_mul_scalar(RGBA(1, flash, flash, 1), opacity));
|
||||
draw_boss_text(ALIGN_CENTER, re(pos), im(pos), msg, font, color_mul_scalar(RGBA(1, flash, flash, 1), opacity));
|
||||
}
|
||||
|
||||
static void draw_spell_name(Boss *b, int time, bool healthbar_radial) {
|
||||
|
@ -459,7 +459,7 @@ static void draw_spell_name(Boss *b, int time, bool healthbar_radial) {
|
|||
float warn_progress = clamp((time + delay) / 120.0, 0, 1);
|
||||
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(creal(x), cimag(x),0);
|
||||
r_mat_mv_translate(re(x), im(x),0);
|
||||
float scale = f+1.*(1-f)*(1-f)*(1-f);
|
||||
r_mat_mv_scale(scale,scale,1);
|
||||
r_mat_mv_rotate(glm_ease_quad_out(f) * 2 * M_PI, 0.8, -0.2, 0);
|
||||
|
@ -481,7 +481,7 @@ static void draw_spell_name(Boss *b, int time, bool healthbar_radial) {
|
|||
r_capability(RCAP_CULL_FACE, cullcap_saved);
|
||||
|
||||
if(warn_progress < 1) {
|
||||
draw_spell_warning(font, cimag(x0) - font_get_lineskip(font), warn_progress, opacity);
|
||||
draw_spell_warning(font, im(x0) - font_get_lineskip(font), warn_progress, opacity);
|
||||
}
|
||||
|
||||
StageProgress *p = get_spellstage_progress(b->current, NULL, false);
|
||||
|
@ -612,7 +612,7 @@ static void boss_glow_draw(Projectile *p, int t, ProjDrawRuleArgs args) {
|
|||
color_mul_scalar(&c, 1.5 - s);
|
||||
|
||||
r_draw_sprite(&(SpriteParams) {
|
||||
.pos = { creal(p->pos), cimag(p->pos) },
|
||||
.pos = { re(p->pos), im(p->pos) },
|
||||
.sprite_ptr = p->sprite,
|
||||
.scale.both = s,
|
||||
.color = &c,
|
||||
|
@ -679,7 +679,7 @@ DEFINE_TASK(boss_particles) {
|
|||
|
||||
void draw_boss_background(Boss *boss) {
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(creal(boss->pos), cimag(boss->pos), 0);
|
||||
r_mat_mv_translate(re(boss->pos), im(boss->pos), 0);
|
||||
r_mat_mv_rotate(global.frames * 4.0 * DEG2RAD, 0, 0, -1);
|
||||
|
||||
float f = 0.8+0.1*sin(global.frames/8.0);
|
||||
|
@ -1298,8 +1298,8 @@ static void boss_death_effect_draw_overlay(Projectile *p, int t, ProjDrawRuleArg
|
|||
r_uniform_sampler("noise_tex", "static");
|
||||
r_uniform_int("frames", global.frames);
|
||||
r_uniform_float("progress", t / p->timeout);
|
||||
r_uniform_vec2("origin", creal(p->pos), VIEWPORT_H - cimag(p->pos));
|
||||
r_uniform_vec2("clear_origin", creal(p->pos), VIEWPORT_H - cimag(p->pos));
|
||||
r_uniform_vec2("origin", re(p->pos), VIEWPORT_H - im(p->pos));
|
||||
r_uniform_vec2("clear_origin", re(p->pos), VIEWPORT_H - im(p->pos));
|
||||
r_uniform_vec2("viewport", VIEWPORT_W, VIEWPORT_H);
|
||||
r_uniform_float("size", hypotf(VIEWPORT_W, VIEWPORT_H));
|
||||
draw_framebuffer_tex(framebuffers->back, VIEWPORT_W, VIEWPORT_H);
|
||||
|
|
|
@ -304,10 +304,10 @@ cmplx common_wander(cmplx origin, double dist, Rect bounds) {
|
|||
}
|
||||
|
||||
log_warn("Clipping fallback origin = %f%+fi dist = %f bounds.top_left = %f%+fi bounds.bottom_right = %f%+fi",
|
||||
creal(origin), cimag(origin),
|
||||
re(origin), im(origin),
|
||||
dist,
|
||||
creal(bounds.top_left), cimag(bounds.top_left),
|
||||
creal(bounds.bottom_right), cimag(bounds.bottom_right)
|
||||
re(bounds.top_left), im(bounds.top_left),
|
||||
re(bounds.bottom_right), im(bounds.bottom_right)
|
||||
);
|
||||
|
||||
// TODO: implement proper line-clipping here?
|
||||
|
|
|
@ -57,6 +57,8 @@ struct CoTask {
|
|||
uint32_t unique_id;
|
||||
const char *name;
|
||||
|
||||
char _end[0];
|
||||
|
||||
#ifdef CO_TASK_DEBUG
|
||||
char debug_label[256];
|
||||
#endif
|
||||
|
|
16
src/enemy.c
16
src/enemy.c
|
@ -41,8 +41,8 @@ static void fix_pos0_visual(Enemy *e) {
|
|||
return;
|
||||
}
|
||||
|
||||
double x = creal(e->pos0_visual);
|
||||
double y = cimag(e->pos0_visual);
|
||||
double x = re(e->pos0_visual);
|
||||
double y = im(e->pos0_visual);
|
||||
double ofs = 21;
|
||||
|
||||
if(x <= 0 && x > -ofs) {
|
||||
|
@ -82,8 +82,8 @@ static inline void enemy_update(Enemy *e, int t) {
|
|||
|
||||
// TODO: backport unified left/right move animations from the obsolete `newart` branch
|
||||
cmplx v = move_update(&e->pos, &e->move);
|
||||
e->moving = fabs(creal(v)) >= 1;
|
||||
e->dir = creal(v) < 0;
|
||||
e->moving = fabs(re(v)) >= 1;
|
||||
e->dir = re(v) < 0;
|
||||
}
|
||||
|
||||
Enemy *create_enemy_p(EnemyList *enemies, cmplx pos, float hp, EnemyVisual visual) {
|
||||
|
@ -244,10 +244,10 @@ bool enemy_in_viewport(Enemy *enemy) {
|
|||
real s = base + enemy->max_viewport_dist;
|
||||
|
||||
return
|
||||
creal(enemy->pos) >= -s &&
|
||||
creal(enemy->pos) <= VIEWPORT_W + s &&
|
||||
cimag(enemy->pos) >= -s &&
|
||||
cimag(enemy->pos) <= VIEWPORT_H + s;
|
||||
re(enemy->pos) >= -s &&
|
||||
re(enemy->pos) <= VIEWPORT_W + s &&
|
||||
im(enemy->pos) >= -s &&
|
||||
im(enemy->pos) <= VIEWPORT_H + s;
|
||||
}
|
||||
|
||||
void enemy_kill(Enemy *enemy) {
|
||||
|
|
|
@ -422,8 +422,8 @@ static cmplx gamepad_restrict_analog_input(cmplx z) {
|
|||
LEFT = (1 << 2),
|
||||
} MoveDir;
|
||||
|
||||
double x = creal(z);
|
||||
double y = cimag(z);
|
||||
double x = re(z);
|
||||
double y = im(z);
|
||||
|
||||
MoveDir move = 0;
|
||||
|
||||
|
@ -464,8 +464,8 @@ static double gamepad_apply_sensitivity(double p, double sens) {
|
|||
}
|
||||
|
||||
static cmplx square_to_circle(cmplx z) {
|
||||
double u = creal(z) * sqrt(1.0 - cimag(z) * cimag(z) / 2.0);
|
||||
double v = cimag(z) * sqrt(1.0 - creal(z) * creal(z) / 2.0);
|
||||
double u = re(z) * sqrt(1.0 - im(z) * im(z) / 2.0);
|
||||
double v = im(z) * sqrt(1.0 - re(z) * re(z) / 2.0);
|
||||
|
||||
return CMPLX(u, v);
|
||||
}
|
||||
|
@ -503,16 +503,16 @@ void gamepad_get_player_analog_input(int *xaxis, int *yaxis) {
|
|||
z *= new_abs / raw_abs;
|
||||
|
||||
z = CMPLX(
|
||||
gamepad_apply_sensitivity(creal(z), config_get_float(CONFIG_GAMEPAD_AXIS_LR_SENS)),
|
||||
gamepad_apply_sensitivity(cimag(z), config_get_float(CONFIG_GAMEPAD_AXIS_UD_SENS))
|
||||
gamepad_apply_sensitivity(re(z), config_get_float(CONFIG_GAMEPAD_AXIS_LR_SENS)),
|
||||
gamepad_apply_sensitivity(im(z), config_get_float(CONFIG_GAMEPAD_AXIS_UD_SENS))
|
||||
);
|
||||
|
||||
if(!config_get_int(CONFIG_GAMEPAD_AXIS_FREE)) {
|
||||
z = gamepad_restrict_analog_input(z);
|
||||
}
|
||||
|
||||
*xaxis = gamepad_denormalize_axis_value(creal(z));
|
||||
*yaxis = gamepad_denormalize_axis_value(cimag(z));
|
||||
*xaxis = gamepad_denormalize_axis_value(re(z));
|
||||
*yaxis = gamepad_denormalize_axis_value(im(z));
|
||||
}
|
||||
|
||||
static int gamepad_axis_get_digital_value(int raw) {
|
||||
|
|
28
src/item.c
28
src/item.c
|
@ -76,7 +76,7 @@ static void ent_draw_item(EntityInterface *ent) {
|
|||
|
||||
const int indicator_display_y = 6;
|
||||
|
||||
float y = cimag(i->pos);
|
||||
float y = im(i->pos);
|
||||
if(y < 0) {
|
||||
Sprite *s = item_indicator_sprite(i->type);
|
||||
|
||||
|
@ -85,7 +85,7 @@ static void ent_draw_item(EntityInterface *ent) {
|
|||
if(s != NULL) {
|
||||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite_ptr = s,
|
||||
.pos = { creal(i->pos), indicator_display_y },
|
||||
.pos = { re(i->pos), indicator_display_y },
|
||||
.color = RGBA_MUL_ALPHA(1, 1, 1, alpha),
|
||||
});
|
||||
}
|
||||
|
@ -101,14 +101,14 @@ static void ent_draw_item(EntityInterface *ent) {
|
|||
|
||||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite_ptr = item_sprite(i->type),
|
||||
.pos = { creal(i->pos), y },
|
||||
.pos = { re(i->pos), y },
|
||||
.color = c,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Item* create_item(cmplx pos, cmplx v, ItemType type) {
|
||||
if((creal(pos) < 0 || creal(pos) > VIEWPORT_W)) {
|
||||
if((re(pos) < 0 || re(pos) > VIEWPORT_W)) {
|
||||
// we need this because we clamp the item position to the viewport boundary during motion
|
||||
// e.g. enemies that die offscreen shouldn't spawn any items inside the viewport
|
||||
return NULL;
|
||||
|
@ -187,12 +187,12 @@ static cmplx move_item(Item *i) {
|
|||
double half = item_sprite(i->type)->w/2.0; // TODO remove dependence on sprite size
|
||||
bool over = false;
|
||||
|
||||
if((over = creal(i->pos) > VIEWPORT_W-half) || creal(i->pos) < half) {
|
||||
if((over = re(i->pos) > VIEWPORT_W-half) || re(i->pos) < half) {
|
||||
cmplx normal = over ? -1 : 1;
|
||||
v -= 2 * normal * (creal(normal)*creal(v));
|
||||
v = 1.5*creal(v) - I*fabs(cimag(v));
|
||||
v -= 2 * normal * (re(normal)*re(v));
|
||||
v = 1.5*re(v) - I*fabs(im(v));
|
||||
|
||||
i->pos = clamp(creal(i->pos), half, VIEWPORT_W-half) + I*cimag(i->pos);
|
||||
i->pos = clamp(re(i->pos), half, VIEWPORT_W-half) + I*im(i->pos);
|
||||
i->v = v;
|
||||
i->pos0 = i->pos;
|
||||
i->birthtime = global.frames;
|
||||
|
@ -206,9 +206,9 @@ static bool item_out_of_bounds(Item *item) {
|
|||
double margin = fmax(item_sprite(item->type)->w, item_sprite(item->type)->h);
|
||||
|
||||
return (
|
||||
creal(item->pos) < -margin ||
|
||||
creal(item->pos) > VIEWPORT_W + margin ||
|
||||
cimag(item->pos) > VIEWPORT_H + margin
|
||||
re(item->pos) < -margin ||
|
||||
re(item->pos) > VIEWPORT_W + margin ||
|
||||
im(item->pos) > VIEWPORT_H + margin
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ void process_items(void) {
|
|||
real item_dist2 = cabs2(global.plr.pos - item->pos);
|
||||
|
||||
if(plr_alive) {
|
||||
if(cimag(global.plr.pos) < poc || stage_cleared) {
|
||||
if(im(global.plr.pos) < poc || stage_cleared) {
|
||||
collect_item(item, 1);
|
||||
} else if(item_dist2 < attract_dist * attract_dist) {
|
||||
real value;
|
||||
|
@ -286,7 +286,7 @@ void process_items(void) {
|
|||
if(surge_active) {
|
||||
value = 1;
|
||||
} else {
|
||||
value = 1 - cimag(global.plr.pos) / VIEWPORT_H;
|
||||
value = 1 - im(global.plr.pos) / VIEWPORT_H;
|
||||
}
|
||||
|
||||
collect_item(item, value);
|
||||
|
@ -350,7 +350,7 @@ void process_items(void) {
|
|||
}
|
||||
}
|
||||
|
||||
if(grabbed || (cimag(deltapos) > 0 && item_out_of_bounds(item))) {
|
||||
if(grabbed || (im(deltapos) > 0 && item_out_of_bounds(item))) {
|
||||
del = item;
|
||||
item = item->next;
|
||||
delete_item(del);
|
||||
|
|
|
@ -256,10 +256,10 @@ static int quantize_laser(Laser *l) {
|
|||
|
||||
float w = calc_sample_width(l, i, half_samples, width_factor, tail);
|
||||
|
||||
float xa = crealf(a);
|
||||
float ya = cimagf(a);
|
||||
float xb = crealf(b);
|
||||
float yb = cimagf(b);
|
||||
float xa = re(a);
|
||||
float ya = im(a);
|
||||
float xb = re(b);
|
||||
float yb = im(b);
|
||||
|
||||
bool visible =
|
||||
(xa > viewbounds.x && xa < viewbounds.w && ya > viewbounds.y && ya < viewbounds.h) ||
|
||||
|
@ -673,10 +673,10 @@ cmplx las_sine(Laser *l, float t) { // [0] = velocity; [1] = sine
|
|||
|
||||
cmplx line_vel = l->args[0];
|
||||
cmplx line_dir = line_vel / cabs(line_vel);
|
||||
cmplx line_normal = cimag(line_dir) - I*creal(line_dir);
|
||||
cmplx line_normal = im(line_dir) - I*re(line_dir);
|
||||
cmplx sine_amp = l->args[1];
|
||||
real sine_freq = creal(l->args[2]);
|
||||
real sine_phase = creal(l->args[3]);
|
||||
real sine_freq = re(l->args[2]);
|
||||
real sine_phase = re(l->args[3]);
|
||||
|
||||
cmplx sine_ofs = line_normal * sine_amp * sin(sine_freq * t + sine_phase);
|
||||
return l->pos + t * line_vel + sine_ofs;
|
||||
|
@ -689,9 +689,9 @@ cmplx las_sine_expanding(Laser *l, float t) { // [0] = velocity; [1] = sine ampl
|
|||
}
|
||||
|
||||
cmplx velocity = l->args[0];
|
||||
real amplitude = creal(l->args[1]);
|
||||
real frequency = creal(l->args[2]);
|
||||
real phase = creal(l->args[3]);
|
||||
real amplitude = re(l->args[1]);
|
||||
real frequency = re(l->args[2]);
|
||||
real phase = re(l->args[3]);
|
||||
|
||||
real angle = carg(velocity);
|
||||
real speed = cabs(velocity);
|
||||
|
@ -707,8 +707,8 @@ cmplx las_turning(Laser *l, float t) { // [0] = vel0; [1] = vel1; [2] r: turn be
|
|||
|
||||
cmplx v0 = l->args[0];
|
||||
cmplx v1 = l->args[1];
|
||||
float begin = creal(l->args[2]);
|
||||
float end = cimag(l->args[2]);
|
||||
float begin = re(l->args[2]);
|
||||
float end = im(l->args[2]);
|
||||
|
||||
float a = clamp((t - begin) / (end - begin), 0, 1);
|
||||
a = 1.0 - (0.5 + 0.5 * cos(a * M_PI));
|
||||
|
@ -724,9 +724,9 @@ cmplx las_circle(Laser *l, float t) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
real turn_speed = creal(l->args[0]);
|
||||
real time_ofs = cimag(l->args[0]);
|
||||
real radius = creal(l->args[1]);
|
||||
real turn_speed = re(l->args[0]);
|
||||
real time_ofs = im(l->args[0]);
|
||||
real radius = re(l->args[1]);
|
||||
|
||||
return l->pos + radius * cdir(turn_speed * (t + time_ofs));
|
||||
}
|
||||
|
|
24
src/player.c
24
src/player.c
|
@ -265,7 +265,7 @@ static void ent_draw_player(EntityInterface *ent) {
|
|||
.sprite = "fairy_circle",
|
||||
.rotation.angle = DEG2RAD * global.frames * 10,
|
||||
.color = RGBA_MUL_ALPHA(1, 1, 1, 0.2 * plr->focus_circle_alpha),
|
||||
.pos = { creal(plr->pos), cimag(plr->pos) },
|
||||
.pos = { re(plr->pos), im(plr->pos) },
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ static void player_draw_indicators(EntityInterface *ent) {
|
|||
if(ps_opacity > 0) {
|
||||
r_state_push();
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(crealf(pos), cimagf(pos), 0);
|
||||
r_mat_mv_translate(re(pos), im(pos), 0);
|
||||
r_mat_mv_scale(140, 140, 0);
|
||||
r_shader("healthbar_radial");
|
||||
r_uniform_vec4_rgba("borderColor", RGBA(0.5, 0.5, 0.5, 0.5));
|
||||
|
@ -345,8 +345,8 @@ static void player_draw_indicators(EntityInterface *ent) {
|
|||
format_huge_num(0, plr->powersurge.bonus.baseline, sizeof(buf), buf);
|
||||
Font *fnt = res_font("monotiny");
|
||||
|
||||
float x = crealf(pos);
|
||||
float y = cimagf(pos) + 80;
|
||||
float x = re(pos);
|
||||
float y = im(pos) + 80;
|
||||
|
||||
float text_opacity = ps_opacity * 0.75;
|
||||
|
||||
|
@ -457,7 +457,7 @@ static void _powersurge_trail_draw(Projectile *p, float t, float cmul) {
|
|||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite_ptr = p->sprite,
|
||||
.scale.both = s,
|
||||
.pos = { creal(p->pos), cimag(p->pos) },
|
||||
.pos = { re(p->pos), im(p->pos) },
|
||||
.color = color_mul_scalar(RGBA(0.8, 0.1 + 0.2 * psin((t+global.frames)/5.0), 0.1, 0.0), 0.5 * (1 - nt) * cmul),
|
||||
.shader_params = &(ShaderCustomParams){{ -2 * nt * nt }},
|
||||
.shader_ptr = p->shader,
|
||||
|
@ -762,7 +762,7 @@ static void powersurge_distortion_draw(Projectile *p, int t, ProjDrawRuleArgs ar
|
|||
|
||||
r_framebuffer(fb_aux);
|
||||
r_shader("circle_distort");
|
||||
r_uniform_vec3("distortOriginRadius", creal(p->pos), VIEWPORT_H - cimag(p->pos), radius);
|
||||
r_uniform_vec3("distortOriginRadius", re(p->pos), VIEWPORT_H - im(p->pos), radius);
|
||||
r_uniform_vec2("viewport", VIEWPORT_W, VIEWPORT_H);
|
||||
r_blend(BLEND_NONE);
|
||||
draw_framebuffer_tex(fb_main, VIEWPORT_W, VIEWPORT_H);
|
||||
|
@ -901,8 +901,8 @@ static void player_death_effect_draw_overlay(Projectile *p, int t, ProjDrawRuleA
|
|||
r_uniform_sampler("noise_tex", "static");
|
||||
r_uniform_int("frames", global.frames);
|
||||
r_uniform_float("progress", t / p->timeout);
|
||||
r_uniform_vec2("origin", creal(p->pos), VIEWPORT_H - cimag(p->pos));
|
||||
r_uniform_vec2("clear_origin", creal(global.plr.pos), VIEWPORT_H - cimag(global.plr.pos));
|
||||
r_uniform_vec2("origin", re(p->pos), VIEWPORT_H - im(p->pos));
|
||||
r_uniform_vec2("clear_origin", re(global.plr.pos), VIEWPORT_H - im(global.plr.pos));
|
||||
r_uniform_vec2("viewport", VIEWPORT_W, VIEWPORT_H);
|
||||
r_uniform_float("size", hypotf(VIEWPORT_W, VIEWPORT_H));
|
||||
draw_framebuffer_tex(framebuffers->back, VIEWPORT_W, VIEWPORT_H);
|
||||
|
@ -1249,8 +1249,8 @@ static bool player_applymovement_gamepad(Player *plr) {
|
|||
direction /= cabs(direction);
|
||||
}
|
||||
|
||||
int sr = sign(creal(direction));
|
||||
int si = sign(cimag(direction));
|
||||
int sr = sign(re(direction));
|
||||
int si = sign(im(direction));
|
||||
|
||||
player_updateinputflags_moveonly(plr,
|
||||
(INFLAG_UP * (si == -1)) |
|
||||
|
@ -1645,7 +1645,7 @@ void player_register_damage(Player *plr, EntityInterface *target, const DamageIn
|
|||
}
|
||||
}
|
||||
|
||||
if(!isnan(creal(pos)) && damage->type == DMG_PLAYER_DISCHARGE) {
|
||||
if(!isnan(re(pos)) && damage->type == DMG_PLAYER_DISCHARGE) {
|
||||
double rate = NOT_NULL(target)->type == ENT_TYPE_ID(Boss) ? 110 : 256;
|
||||
spawn_and_collect_items(pos, 1, ITEM_VOLTAGE, (int)(damage->amount / rate));
|
||||
}
|
||||
|
@ -1654,7 +1654,7 @@ void player_register_damage(Player *plr, EntityInterface *target, const DamageIn
|
|||
plr->powersurge.damage_done += damage->amount;
|
||||
plr->powersurge.damage_accum += damage->amount;
|
||||
|
||||
if(!isnan(creal(pos))) {
|
||||
if(!isnan(re(pos))) {
|
||||
double rate = 500;
|
||||
|
||||
while(plr->powersurge.damage_accum > rate) {
|
||||
|
|
|
@ -93,20 +93,20 @@ static void draw_masterspark_ring(int t, float width) {
|
|||
|
||||
static void draw_masterspark_beam(cmplx origin, cmplx size, float angle, int t, float alpha) {
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(creal(origin), cimag(origin), 0);
|
||||
r_mat_mv_translate(re(origin), im(origin), 0);
|
||||
r_mat_mv_rotate(angle, 0, 0, 1);
|
||||
|
||||
r_shader("masterspark");
|
||||
r_uniform_float("t", t);
|
||||
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(0, cimag(size) * -0.5, 0);
|
||||
r_mat_mv_scale(alpha * creal(size), cimag(size), 1);
|
||||
r_mat_mv_translate(0, im(size) * -0.5, 0);
|
||||
r_mat_mv_scale(alpha * re(size), im(size), 1);
|
||||
r_draw_quad();
|
||||
r_mat_mv_pop();
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
draw_masterspark_ring(t % 20 + 10 * i, alpha * creal(size));
|
||||
draw_masterspark_ring(t % 20 + 10 * i, alpha * re(size));
|
||||
}
|
||||
|
||||
r_mat_mv_pop();
|
||||
|
|
|
@ -177,12 +177,12 @@ static void draw_laser_beam(cmplx src, cmplx dst, real size, real step, real t,
|
|||
|
||||
r_mat_mv_push();
|
||||
|
||||
r_mat_mv_translate(creal(center), cimag(center), 0);
|
||||
r_mat_mv_translate(re(center), im(center), 0);
|
||||
r_mat_mv_rotate(carg(dir), 0, 0, 1);
|
||||
r_mat_mv_scale(cabs(dir), size, 1);
|
||||
|
||||
r_mat_tex_push_identity();
|
||||
r_mat_tex_translate(-cimag(src) / step + t, 0, 0);
|
||||
r_mat_tex_translate(-im(src) / step + t, 0, 0);
|
||||
r_mat_tex_scale(cabs(dir) / step, 1, 1);
|
||||
|
||||
r_uniform_sampler("tex", tex);
|
||||
|
@ -442,7 +442,7 @@ TASK(marisa_laser_slave, {
|
|||
capproach_asymptotic_p(&offset, offsets[focused], formation_switch_rate, epsilon);
|
||||
|
||||
capproach_asymptotic_p(&slave->pos, plr->pos + offset, follow_rate, epsilon);
|
||||
approach_asymptotic_p(&slave->lean, -lean_strength * creal(slave->pos - prev_pos), lean_rate, epsilon);
|
||||
approach_asymptotic_p(&slave->lean, -lean_strength * re(slave->pos - prev_pos), lean_rate, epsilon);
|
||||
prev_pos = slave->pos;
|
||||
|
||||
if(player_should_shoot(plr)) {
|
||||
|
@ -566,7 +566,7 @@ TASK(marisa_laser_bomb_masterspark, { MarisaAController *ctrl; }) {
|
|||
do {
|
||||
real bomb_progress = player_get_bomb_progress(plr);
|
||||
ms->alpha = marisa_laser_masterspark_width(bomb_progress);
|
||||
ms->dir *= cdir(0.005 * (creal(plr->velocity) + 2 * rng_sreal()));
|
||||
ms->dir *= cdir(0.005 * (re(plr->velocity) + 2 * rng_sreal()));
|
||||
ms->pos = plr->pos - 30 * I;
|
||||
|
||||
marisa_laser_masterspark_damage(ms);
|
||||
|
|
|
@ -145,13 +145,13 @@ TASK(marisa_star_slave_projectile, {
|
|||
|
||||
cmplx center = clerp(plr->pos, ctrl->slave_ref_pos, tanh(t / 10.0));
|
||||
|
||||
real brightener = -1 / (1 + sqrt(0.03 * fabs(creal(p->pos - center))));
|
||||
real brightener = -1 / (1 + sqrt(0.03 * fabs(re(p->pos - center))));
|
||||
marisa_star_slave_projectile_color(&p->color, focus, brightener);
|
||||
|
||||
real verticalfac = - 5 * t * (1 + 0.01 * t) + 10 * t / (0.01 * t + 1);
|
||||
|
||||
prev_pos = p->pos;
|
||||
next_pos = center + focusfac * cbrt(0.1 * t) * creal(vel) * 70 * sin(freq * t + cimag(vel)) + verticalfac*I;
|
||||
next_pos = center + focusfac * cbrt(0.1 * t) * re(vel) * 70 * sin(freq * t + im(vel)) + verticalfac*I;
|
||||
p->move.velocity = next_pos - prev_pos;
|
||||
|
||||
if(t%(2+(int)round(2*rng_real())) == 0) { // please never write stuff like this ever again
|
||||
|
|
|
@ -600,7 +600,7 @@ TASK(reimu_spirit_slave_needle, {
|
|||
MoveParams move = move_towards(0, plr->pos + offset, 0);
|
||||
|
||||
do {
|
||||
move.attraction = approach(creal(move.attraction), target_speed, target_speed / 12.0);
|
||||
move.attraction = approach(re(move.attraction), target_speed, target_speed / 12.0);
|
||||
move.attraction_point = plr->pos + offset;
|
||||
offset *= rot;
|
||||
move_update(&slave->pos, &move);
|
||||
|
@ -669,7 +669,7 @@ TASK(reimu_spirit_slave_homing, {
|
|||
MoveParams move = move_towards(0, plr->pos + offset, 0);
|
||||
|
||||
do {
|
||||
move.attraction = approach(creal(move.attraction), target_speed, target_speed / 12.0);
|
||||
move.attraction = approach(re(move.attraction), target_speed, target_speed / 12.0);
|
||||
move.attraction_point = plr->pos + offset;
|
||||
move_update(&slave->pos, &move);
|
||||
YIELD;
|
||||
|
|
|
@ -232,7 +232,7 @@ static void reimu_dream_draw_gap_lights(ReimuBController *ctrl, int time, real s
|
|||
cmplx center = gap->pos - gap->orientation * (len * 0.5 - GAP_WIDTH * 0.6);
|
||||
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(creal(center), cimag(center), 0);
|
||||
r_mat_mv_translate(re(center), im(center), 0);
|
||||
r_mat_mv_rotate(carg(gap->orientation) + M_PI, 0, 0, 1);
|
||||
r_mat_mv_scale(len, GAP_LENGTH, 1);
|
||||
r_draw_quad();
|
||||
|
@ -249,8 +249,8 @@ static void reimu_dream_draw_gaps(EntityInterface *gap_renderer_ent) {
|
|||
|
||||
for(int i = 0; i < NUM_GAPS; ++i) {
|
||||
ReimuBGap *gap = ctrl->gaps.array + i;
|
||||
gaps[i][0] = creal(gap->pos);
|
||||
gaps[i][1] = cimag(gap->pos);
|
||||
gaps[i][0] = re(gap->pos);
|
||||
gaps[i][1] = im(gap->pos);
|
||||
angles[i] = -carg(gap->orientation);
|
||||
links[i] = gap->link - ctrl->gaps.array;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ static void reimu_dream_bullet_warp(ReimuBController *ctrl, Projectile *p, int *
|
|||
return;
|
||||
}
|
||||
|
||||
real p_long_side = fmax(creal(p->size), cimag(p->size));
|
||||
real p_long_side = fmax(re(p->size), im(p->size));
|
||||
cmplx half = 0.25 * (1 + I);
|
||||
Rect p_bbox = { p->pos - p_long_side * half, p->pos + p_long_side * half };
|
||||
|
||||
|
@ -352,17 +352,17 @@ static void reimu_dream_bullet_warp(ReimuBController *ctrl, Projectile *p, int *
|
|||
cmplx gap_size = (GAP_LENGTH + I * GAP_WIDTH) * gap->parallel_axis;
|
||||
cmplx p0 = gap->pos - gap_size * 0.5;
|
||||
cmplx p1 = gap->pos + gap_size * 0.5;
|
||||
gap_bbox.top_left = fmin(creal(p0), creal(p1)) + I * fmin(cimag(p0), cimag(p1));
|
||||
gap_bbox.bottom_right = fmax(creal(p0), creal(p1)) + I * fmax(cimag(p0), cimag(p1));
|
||||
gap_bbox.top_left = fmin(re(p0), re(p1)) + I * fmin(im(p0), im(p1));
|
||||
gap_bbox.bottom_right = fmax(re(p0), re(p1)) + I * fmax(im(p0), im(p1));
|
||||
|
||||
if(rect_rect_intersection(p_bbox, gap_bbox, true, false, &overlap)) {
|
||||
cmplx o = (overlap.top_left + overlap.bottom_right) / 2;
|
||||
real fract;
|
||||
|
||||
if(creal(gap_size) > cimag(gap_size)) {
|
||||
fract = 1 - creal(o - gap_bbox.top_left) / creal(gap_size);
|
||||
if(re(gap_size) > im(gap_size)) {
|
||||
fract = 1 - re(o - gap_bbox.top_left) / re(gap_size);
|
||||
} else {
|
||||
fract = 1 - cimag(o - gap_bbox.top_left) / cimag(gap_size);
|
||||
fract = 1 - im(o - gap_bbox.top_left) / im(gap_size);
|
||||
}
|
||||
|
||||
ReimuBGap *ngap = gap->link;
|
||||
|
@ -513,9 +513,9 @@ static cmplx reimu_dream_gaps_reference_pos(ReimuBController *ctrl, cmplx vp) {
|
|||
cmplx rp = ctrl->plr->pos;
|
||||
|
||||
if(!(ctrl->plr->inputflags & INFLAG_FOCUS)) {
|
||||
rp = CMPLX(creal(rp), cimag(vp) - cimag(rp));
|
||||
rp = CMPLX(re(rp), im(vp) - im(rp));
|
||||
} else {
|
||||
// rp = CMPLX(creal(vp) - creal(rp), cimag(rp));
|
||||
// rp = CMPLX(re(vp) - re(rp), im(rp));
|
||||
}
|
||||
|
||||
return rp;
|
||||
|
|
|
@ -390,7 +390,7 @@ TASK(youmu_mirror_myon, { YoumuAController *ctrl; }) {
|
|||
real follow_speed = smoothmin(10, follow_factor * fmax(0, cabs(target - myon->pos)), 10);
|
||||
cmplx v = cnormalize(target - myon->pos) * follow_speed * (1 - focus_factor) * (1 - focus_factor);
|
||||
|
||||
real s = sign(creal(myon->pos) - creal(plr->pos));
|
||||
real s = sign(re(myon->pos) - re(plr->pos));
|
||||
if(!s) {
|
||||
s = sign(sin(t / 10.0));
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ TASK(youmu_mirror_bomb_postprocess, { YoumuAMyon *myon; }) {
|
|||
|
||||
float t = player_get_bomb_progress(&global.plr);
|
||||
float f = fmaxf(0, 1 - 10 * t);
|
||||
cmplx myonpos = CMPLX(creal(myon->pos)/VIEWPORT_W, 1 - cimag(myon->pos)/VIEWPORT_H);
|
||||
cmplx myonpos = CMPLX(re(myon->pos)/VIEWPORT_W, 1 - im(myon->pos)/VIEWPORT_H);
|
||||
|
||||
FBPair *fbpair = stage_get_postprocess_fbpair();
|
||||
r_framebuffer(fbpair->back);
|
||||
|
|
|
@ -73,7 +73,7 @@ static void youmu_homing_trail(YoumuBController *ctrl, Projectile *p, cmplx v, i
|
|||
.sprite_ptr = ctrl->sprites.smoothdot,
|
||||
.pos = p->pos,
|
||||
.color = color_mul(RGBA(0.2, 0.24, 0.3, 0.2), &p->color),
|
||||
.move = move_asymptotic_simple(-0.5*v*cdir(0.2*sin(u+3*creal(p->pos)/VIEWPORT_W*M_TAU) + 0.2*cos(u+3*cimag(p->pos)/VIEWPORT_H*M_TAU)), 2),
|
||||
.move = move_asymptotic_simple(-0.5*v*cdir(0.2*sin(u+3*re(p->pos)/VIEWPORT_W*M_TAU) + 0.2*cos(u+3*im(p->pos)/VIEWPORT_H*M_TAU)), 2),
|
||||
.draw_rule = pdraw_timeout_scalefade_exp(0.5+0.5*I, 3+7*I, 1, 0, 2),
|
||||
.timeout = to,
|
||||
.flags = PFLAG_NOREFLECT,
|
||||
|
@ -303,7 +303,7 @@ TASK(youmu_orb_homing_spirit, { YoumuBController *ctrl; cmplx pos; cmplx velocit
|
|||
if(orb) {
|
||||
target = orb->pos;
|
||||
} else {
|
||||
target = plrutil_homing_target(p->pos, creal(global.plr.pos) - 128*I);
|
||||
target = plrutil_homing_target(p->pos, re(global.plr.pos) - 128*I);
|
||||
}
|
||||
|
||||
cmplx aimdir = cnormalize(target - p->pos - p->move.velocity);
|
||||
|
|
|
@ -103,8 +103,8 @@ static void process_projectile_args(ProjArgs *args, ProjArgs *defaults) {
|
|||
|
||||
if(args->scale == 0) {
|
||||
args->scale = 1+I;
|
||||
} else if(cimagf(args->scale) == 0) {
|
||||
args->scale = CMPLXF(crealf(args->scale), crealf(args->scale));
|
||||
} else if(im(args->scale) == 0) {
|
||||
args->scale = CMPLXF(re(args->scale), re(args->scale));
|
||||
}
|
||||
|
||||
if(args->opacity == 0) {
|
||||
|
@ -119,8 +119,8 @@ static void projectile_size(Projectile *p, double *w, double *h) {
|
|||
*w = p->sprite->w;
|
||||
*h = p->sprite->h;
|
||||
} else {
|
||||
*w = creal(p->size);
|
||||
*h = cimag(p->size);
|
||||
*w = re(p->size);
|
||||
*h = im(p->size);
|
||||
}
|
||||
|
||||
assert(*w > 0);
|
||||
|
@ -180,7 +180,7 @@ cmplx projectile_graze_size(Projectile *p) {
|
|||
global.frames >= p->graze_cooldown
|
||||
) {
|
||||
cmplx s = (p->size * 420 /* graze it */) / (2 * p->graze_counter + 1);
|
||||
return sqrt(creal(s)) + sqrt(cimag(s)) * I;
|
||||
return sqrt(re(s)) + sqrt(im(s)) * I;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -266,8 +266,8 @@ static Projectile* _create_projectile(ProjArgs *args) {
|
|||
// p->collision_size *= 10;
|
||||
// p->size *= 5;
|
||||
|
||||
if((p->type == PROJ_ENEMY || p->type == PROJ_PLAYER) && (creal(p->size) <= 0 || cimag(p->size) <= 0)) {
|
||||
log_fatal("Tried to spawn a projectile with invalid size %f x %f", creal(p->size), cimag(p->size));
|
||||
if((p->type == PROJ_ENEMY || p->type == PROJ_PLAYER) && (re(p->size) <= 0 || im(p->size) <= 0)) {
|
||||
log_fatal("Tried to spawn a projectile with invalid size %f x %f", re(p->size), im(p->size));
|
||||
}
|
||||
|
||||
projectile_set_layer(p, args->layer);
|
||||
|
@ -375,7 +375,7 @@ void calc_projectile_collision(Projectile *p, ProjCollisionResult *out_col) {
|
|||
} else {
|
||||
e_proj.axes = projectile_graze_size(p);
|
||||
|
||||
if(creal(e_proj.axes) > 1 && lineseg_ellipse_intersect(seg, e_proj)) {
|
||||
if(re(e_proj.axes) > 1 && lineseg_ellipse_intersect(seg, e_proj)) {
|
||||
out_col->type = PCOL_PLAYER_GRAZE;
|
||||
out_col->entity = &global.plr.ent;
|
||||
out_col->location = p->pos;
|
||||
|
@ -476,8 +476,8 @@ bool projectile_in_viewport(Projectile *proj) {
|
|||
int e = proj->max_viewport_dist;
|
||||
projectile_size(proj, &w, &h);
|
||||
|
||||
return !(creal(proj->pos) + w/2 + e < 0 || creal(proj->pos) - w/2 - e > VIEWPORT_W
|
||||
|| cimag(proj->pos) + h/2 + e < 0 || cimag(proj->pos) - h/2 - e > VIEWPORT_H);
|
||||
return !(re(proj->pos) + w/2 + e < 0 || re(proj->pos) - w/2 - e > VIEWPORT_W
|
||||
|| im(proj->pos) + h/2 + e < 0 || im(proj->pos) - h/2 - e > VIEWPORT_H);
|
||||
}
|
||||
|
||||
Projectile *spawn_projectile_collision_effect(Projectile *proj) {
|
||||
|
@ -662,7 +662,7 @@ static void bullet_highlight_draw(Projectile *p, int t, ProjDrawRuleArgs args) {
|
|||
opacity *= p->opacity;
|
||||
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(creal(p->pos), cimag(p->pos), 0);
|
||||
r_mat_mv_translate(re(p->pos), im(p->pos), 0);
|
||||
r_mat_mv_rotate(p->angle + M_PI * 0.5, 0, 0, 1);
|
||||
r_mat_mv_scale(sx, sy, 1);
|
||||
r_mat_mv_rotate(tex_angle, 0, 0, 1);
|
||||
|
@ -821,14 +821,14 @@ SpriteParams projectile_sprite_params(Projectile *proj, SpriteParamsBuffer *spbu
|
|||
SpriteParams sp = { 0 };
|
||||
sp.blend = proj->blend;
|
||||
sp.color = &spbuf->color;
|
||||
sp.pos.x = creal(proj->pos);
|
||||
sp.pos.y = cimag(proj->pos);
|
||||
sp.pos.x = re(proj->pos);
|
||||
sp.pos.y = im(proj->pos);
|
||||
sp.rotation = (SpriteRotationParams) {
|
||||
.angle = proj->angle + (float)(M_PI/2),
|
||||
.vector = { 0, 0, 1 },
|
||||
};
|
||||
sp.scale.x = crealf(proj->scale);
|
||||
sp.scale.y = cimagf(proj->scale);
|
||||
sp.scale.x = re(proj->scale);
|
||||
sp.scale.y = im(proj->scale);
|
||||
sp.shader_params = &spbuf->shader_params;
|
||||
sp.shader_ptr = proj->shader;
|
||||
sp.sprite_ptr = proj->sprite;
|
||||
|
@ -919,7 +919,7 @@ static void pdraw_scalefade_func(Projectile *p, int t, ProjDrawRuleArgs args) {
|
|||
float opacity = lerpf(opacity0, opacity1, timefactor);
|
||||
opacity = powf(opacity, opacity_exp);
|
||||
|
||||
if(creal(scale) == 0 || cimag(scale) == 0 || opacity == 0) {
|
||||
if(re(scale) == 0 || im(scale) == 0 || opacity == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -933,12 +933,12 @@ static void pdraw_scalefade_func(Projectile *p, int t, ProjDrawRuleArgs args) {
|
|||
|
||||
ProjDrawRule pdraw_timeout_scalefade_exp(cmplxf scale0,
|
||||
cmplxf scale1, float opacity0, float opacity1, float opacity_exp) {
|
||||
if(cimagf(scale0) == 0) {
|
||||
scale0 = CMPLXF(crealf(scale0), crealf(scale0));
|
||||
if(im(scale0) == 0) {
|
||||
scale0 = CMPLXF(re(scale0), re(scale0));
|
||||
}
|
||||
|
||||
if(cimagf(scale1) == 0) {
|
||||
scale1 = CMPLXF(crealf(scale1), crealf(scale1));
|
||||
if(im(scale1) == 0) {
|
||||
scale1 = CMPLXF(re(scale1), re(scale1));
|
||||
}
|
||||
|
||||
return (ProjDrawRule) {
|
||||
|
|
|
@ -871,7 +871,7 @@ void _r_uniform_vec2_vec(const char *uniform, vec2_noalign value) {
|
|||
|
||||
void _r_uniform_ptr_vec2_complex(Uniform *uniform, cmplx value) {
|
||||
ASSERT_UTYPE(uniform, UNIFORM_VEC2);
|
||||
if(uniform) B.uniform(uniform, 0, 1, (vec2_noalign) { creal(value), cimag(value) });
|
||||
if(uniform) B.uniform(uniform, 0, 1, (vec2_noalign) { re(value), im(value) });
|
||||
}
|
||||
|
||||
void _r_uniform_vec2_complex(const char *uniform, cmplx value) {
|
||||
|
@ -895,8 +895,8 @@ void _r_uniform_ptr_vec2_array_complex(Uniform *uniform, uint offset, uint count
|
|||
float *aptr = arr, *aend = arr + sizeof(arr)/sizeof(*arr);
|
||||
|
||||
do {
|
||||
*aptr++ = creal(*eptr);
|
||||
*aptr++ = cimag(*eptr++);
|
||||
*aptr++ = re(*eptr);
|
||||
*aptr++ = im(*eptr++);
|
||||
} while(aptr < aend);
|
||||
|
||||
B.uniform(uniform, offset, count, arr);
|
||||
|
|
|
@ -25,8 +25,8 @@ ReplayStage *replay_stage_new(Replay *rpy, StageInfo *stage, uint64_t start_time
|
|||
s->rng_seed = seed;
|
||||
s->diff = diff;
|
||||
|
||||
s->plr_pos_x = floor(creal(plr->pos));
|
||||
s->plr_pos_y = floor(cimag(plr->pos));
|
||||
s->plr_pos_x = floor(re(plr->pos));
|
||||
s->plr_pos_y = floor(im(plr->pos));
|
||||
|
||||
s->plr_points = plr->points;
|
||||
s->plr_total_lives_used = plr->stats.total.lives_used;
|
||||
|
|
|
@ -173,7 +173,7 @@ void loop_tex_line_p(cmplx a, cmplx b, float w, float t, Texture *texture) {
|
|||
cmplx c = (b+a)/2;
|
||||
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(creal(c), cimag(c), 0);
|
||||
r_mat_mv_translate(re(c), im(c), 0);
|
||||
r_mat_mv_rotate(carg(d), 0, 0, 1);
|
||||
r_mat_mv_scale(cabs(d), w, 1);
|
||||
|
||||
|
|
|
@ -399,13 +399,13 @@ static void stage_draw_collision_areas(void) {
|
|||
for(Projectile *p = global.projs.first; p; p = p->next) {
|
||||
cmplx gsize = projectile_graze_size(p);
|
||||
|
||||
if(creal(gsize)) {
|
||||
if(re(gsize)) {
|
||||
r_draw_sprite(&(SpriteParams) {
|
||||
.color = RGB(0, 0.5, 0.5),
|
||||
.sprite_ptr = &stagedraw.dummy,
|
||||
.pos = { creal(p->pos), cimag(p->pos) },
|
||||
.pos = { re(p->pos), im(p->pos) },
|
||||
.rotation.angle = p->angle + M_PI/2,
|
||||
.scale = { .x = creal(gsize), .y = cimag(gsize) },
|
||||
.scale = { .x = re(gsize), .y = im(gsize) },
|
||||
.blend = BLEND_SUB,
|
||||
});
|
||||
}
|
||||
|
@ -418,9 +418,9 @@ static void stage_draw_collision_areas(void) {
|
|||
for(Projectile *p = global.projs.first; p; p = p->next) {
|
||||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite_ptr = &stagedraw.dummy,
|
||||
.pos = { creal(p->pos), cimag(p->pos) },
|
||||
.pos = { re(p->pos), im(p->pos) },
|
||||
.rotation.angle = p->angle + M_PI/2,
|
||||
.scale = { .x = creal(p->collision_size), .y = cimag(p->collision_size) },
|
||||
.scale = { .x = re(p->collision_size), .y = im(p->collision_size) },
|
||||
.blend = BLEND_ALPHA,
|
||||
});
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ static void stage_draw_collision_areas(void) {
|
|||
if(hurt_radius > 0) {
|
||||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite_ptr = &stagedraw.dummy,
|
||||
.pos = { creal(e->pos), cimag(e->pos) },
|
||||
.pos = { re(e->pos), im(e->pos) },
|
||||
.scale = { .x = hurt_radius * 2, .y = hurt_radius * 2 },
|
||||
.blend = BLEND_ALPHA,
|
||||
});
|
||||
|
@ -441,7 +441,7 @@ static void stage_draw_collision_areas(void) {
|
|||
if(global.boss && boss_is_player_collision_active(global.boss)) {
|
||||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite_ptr = &stagedraw.dummy,
|
||||
.pos = { creal(global.boss->pos), cimag(global.boss->pos) },
|
||||
.pos = { re(global.boss->pos), im(global.boss->pos) },
|
||||
.scale = { .x = BOSS_HURT_RADIUS * 2, .y = BOSS_HURT_RADIUS * 2 },
|
||||
.blend = BLEND_ALPHA,
|
||||
});
|
||||
|
@ -449,7 +449,7 @@ static void stage_draw_collision_areas(void) {
|
|||
|
||||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite_ptr = &stagedraw.dummy,
|
||||
.pos = { creal(global.plr.pos), cimag(global.plr.pos) },
|
||||
.pos = { re(global.plr.pos), im(global.plr.pos) },
|
||||
.scale.both = 2, // NOTE: actual player is a singular point
|
||||
});
|
||||
|
||||
|
@ -503,7 +503,7 @@ static void draw_wall_of_text(float f, const char *txt) {
|
|||
r_uniform_float("w", spr.tex_area.w);
|
||||
r_uniform_float("h", spr.tex_area.h);
|
||||
r_uniform_float("ratio", h/w);
|
||||
r_uniform_vec2("origin", creal(global.boss->pos)/h, cimag(global.boss->pos)/w); // what the fuck?
|
||||
r_uniform_vec2("origin", re(global.boss->pos)/h, im(global.boss->pos)/w); // what the fuck?
|
||||
r_uniform_float("t", f);
|
||||
r_uniform_sampler("tex", spr.tex);
|
||||
r_draw_quad();
|
||||
|
@ -532,7 +532,7 @@ static void draw_spellbg(int t) {
|
|||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite = "boss_spellcircle0",
|
||||
.shader = "sprite_default",
|
||||
.pos = { creal(b->pos), cimag(b->pos) },
|
||||
.pos = { re(b->pos), im(b->pos) },
|
||||
.rotation.angle = global.frames * 7.0 * DEG2RAD,
|
||||
.rotation.vector = { 0, 0, -1 },
|
||||
.scale.both = scale,
|
||||
|
@ -669,8 +669,8 @@ static bool boss_distortion_rule(Framebuffer *fb) {
|
|||
cmplx pos = fpos;
|
||||
|
||||
r_shader("boss_zoom");
|
||||
r_uniform_vec2("blur_orig", creal(pos) / VIEWPORT_W, 1-cimag(pos) / VIEWPORT_H);
|
||||
r_uniform_vec2("fix_orig", creal(fpos) / VIEWPORT_W, 1-cimag(fpos) / VIEWPORT_H);
|
||||
r_uniform_vec2("blur_orig", re(pos) / VIEWPORT_W, 1-im(pos) / VIEWPORT_H);
|
||||
r_uniform_vec2("fix_orig", re(fpos) / VIEWPORT_W, 1-im(fpos) / VIEWPORT_H);
|
||||
r_uniform_float("blur_rad", 1.5*(0.2+0.025*sin(global.frames/15.0)));
|
||||
r_uniform_float("rad", 0.24);
|
||||
r_uniform_float("ratio", (float)VIEWPORT_H/VIEWPORT_W);
|
||||
|
@ -765,7 +765,7 @@ static void apply_bg_shaders(ShaderRule *shaderrules, FBPair *fbos) {
|
|||
if(trans_intro) {
|
||||
r_shader("spellcard_intro");
|
||||
r_uniform_float("ratio", ratio);
|
||||
r_uniform_vec2("origin", creal(pos) / VIEWPORT_W, 1 - cimag(pos) / VIEWPORT_H);
|
||||
r_uniform_vec2("origin", re(pos) / VIEWPORT_W, 1 - im(pos) / VIEWPORT_H);
|
||||
r_uniform_float("t", SPELL_INTRO_TIME_FACTOR * (t + delay) / (float)SPELL_INTRO_DURATION);
|
||||
} else {
|
||||
int tn = global.frames - b->current->endtime;
|
||||
|
@ -773,7 +773,7 @@ static void apply_bg_shaders(ShaderRule *shaderrules, FBPair *fbos) {
|
|||
|
||||
r_shader("spellcard_outro");
|
||||
r_uniform_float("ratio", ratio);
|
||||
r_uniform_vec2("origin", creal(pos) / VIEWPORT_W, 1 - cimag(pos) / VIEWPORT_H);
|
||||
r_uniform_vec2("origin", re(pos) / VIEWPORT_W, 1 - im(pos) / VIEWPORT_H);
|
||||
r_uniform_float("t", fmax(0, tn / (float)delay + 1));
|
||||
}
|
||||
|
||||
|
@ -885,7 +885,7 @@ void stage_draw_overlay(void) {
|
|||
static void postprocess_prepare(Framebuffer *fb, ShaderProgram *s, void *arg) {
|
||||
r_uniform_int("frames", global.frames);
|
||||
r_uniform_vec2("viewport", VIEWPORT_W, VIEWPORT_H);
|
||||
r_uniform_vec2("player", creal(global.plr.pos), VIEWPORT_H - cimag(global.plr.pos));
|
||||
r_uniform_vec2("player", re(global.plr.pos), VIEWPORT_H - im(global.plr.pos));
|
||||
}
|
||||
|
||||
static inline void begin_viewport_shake(void) {
|
||||
|
@ -1811,7 +1811,7 @@ void stage_draw_hud(void) {
|
|||
r_draw_sprite(&(SpriteParams) {
|
||||
.sprite = "boss_indicator",
|
||||
.shader = "sprite_default",
|
||||
.pos = { VIEWPORT_X+creal(global.boss->pos), 590 },
|
||||
.pos = { VIEWPORT_X+re(global.boss->pos), 590 },
|
||||
.color = RGBA(1 - red, 1 - red, 1 - red, 1 - red),
|
||||
});
|
||||
}
|
||||
|
@ -1835,7 +1835,7 @@ void stage_draw_hud(void) {
|
|||
};
|
||||
|
||||
r_mat_mv_push();
|
||||
r_mat_mv_translate(crealf(pos), cimagf(pos), 0);
|
||||
r_mat_mv_translate(re(pos), im(pos), 0);
|
||||
r_mat_mv_scale(bg_width / bg->w, bg_height / bg->h, 1);
|
||||
|
||||
r_mat_mv_push();
|
||||
|
|
|
@ -22,7 +22,7 @@ static void stage1_spell_benchmark_proc(Boss *b, int t) {
|
|||
int c = N*speed/VIEWPORT_H;
|
||||
for(int i = 0; i < c; i++) {
|
||||
double x = rng_range(0, VIEWPORT_W);
|
||||
double plrx = creal(global.plr.pos);
|
||||
double plrx = re(global.plr.pos);
|
||||
x = plrx + sqrt((x-plrx)*(x-plrx)+100)*(1-2*(x<plrx));
|
||||
|
||||
Projectile *p = PROJECTILE(
|
||||
|
|
|
@ -28,7 +28,7 @@ TASK(cirno_icicle, { cmplx pos; cmplx vel; }) {
|
|||
|
||||
WAIT(80);
|
||||
|
||||
v = 2.5 * cdir(carg(v) - M_PI/2.0 + M_PI * (creal(v) > 0));
|
||||
v = 2.5 * cdir(carg(v) - M_PI/2.0 + M_PI * (re(v) > 0));
|
||||
p->move = move_asymptotic_simple(v, 2);
|
||||
p->angle = carg(p->move.velocity);
|
||||
p->color = *RGB(0.5, 0.5, 0.5);
|
||||
|
|
|
@ -126,7 +126,7 @@ TASK(sinepass_swirl_move, { BoxedEnemy e; cmplx v; cmplx sv; }) {
|
|||
cmplx v = ARGS.v;
|
||||
|
||||
for(;;) {
|
||||
sv -= cimag(e->pos - e->pos0) * 0.03 * I;
|
||||
sv -= im(e->pos - e->pos0) * 0.03 * I;
|
||||
e->pos += sv * 0.4 + v;
|
||||
YIELD;
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ static void testlights(Camera3D *cam, uint nlights, PointLight3D lights[nlights]
|
|||
PointLight3D *l = lights + i;
|
||||
glm_vec3_scale(HSL(i / (float)nlights, 1, 0.5)->rgb, TESTLIGHT_STRENGTH, l->radiance);
|
||||
glm_vec3_copy(orig, l->pos);
|
||||
glm_vec3_muladds(X, crealf(r), l->pos);
|
||||
glm_vec3_muladds(Y, cimagf(r), l->pos);
|
||||
glm_vec3_muladds(X, re(r), l->pos);
|
||||
glm_vec3_muladds(Y, im(r), l->pos);
|
||||
r *= p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ void stage2_draw_hina_spellbg(Boss *h, int time) {
|
|||
Animation *fireani = res_anim("fire");
|
||||
sp.sprite_ptr = animation_get_frame(fireani, get_ani_sequence(fireani, "main"), global.frames);
|
||||
sp.sprite = NULL;
|
||||
sp.pos.x = creal(h->pos);
|
||||
sp.pos.y = cimag(h->pos);
|
||||
sp.pos.x = re(h->pos);
|
||||
sp.pos.y = im(h->pos);
|
||||
sp.scale.both = 1;
|
||||
sp.rotation = (SpriteRotationParams) { 0 };
|
||||
sp.blend = BLEND_PREMUL_ALPHA;
|
||||
|
|