make a few vital hazards unclearable
LHC lasers, Broglie charges, Ricci danmaku field
This commit is contained in:
parent
313ddef8cd
commit
bb33afbe64
4 changed files with 26 additions and 7 deletions
|
@ -439,6 +439,18 @@ int trace_projectile(Projectile *p, ProjCollisionResult *out_col, ProjCollisionT
|
|||
return t;
|
||||
}
|
||||
|
||||
bool projectile_is_clearable(Projectile *p) {
|
||||
if(p->type == DeadProj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(p->type == EnemyProj || p->type == FakeProj) {
|
||||
return (p->flags & PFLAG_NOCLEAR) != PFLAG_NOCLEAR;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int linear(Projectile *p, int t) { // sure is physics in here; a[0]: velocity
|
||||
if(t < 0)
|
||||
return 1;
|
||||
|
|
|
@ -51,6 +51,7 @@ typedef enum ProjFlags {
|
|||
PFLAG_DRAWSUB = (1 << 1),
|
||||
PFLAG_NOSPAWNZOOM = (1 << 2),
|
||||
PFLAG_NOGRAZE = (1 << 3),
|
||||
PFLAG_NOCLEAR = (1 << 4),
|
||||
} ProjFlags;
|
||||
|
||||
struct Projectile {
|
||||
|
@ -138,6 +139,7 @@ void apply_projectile_collision(Projectile **projlist, Projectile *p, ProjCollis
|
|||
int trace_projectile(Projectile *p, ProjCollisionResult *out_col, ProjCollisionType stopflags, int timeofs);
|
||||
bool projectile_in_viewport(Projectile *proj);
|
||||
void process_projectiles(Projectile **projs, bool collision);
|
||||
bool projectile_is_clearable(Projectile *p);
|
||||
|
||||
int linear(Projectile *p, int t);
|
||||
int accelerated(Projectile *p, int t);
|
||||
|
|
11
src/stage.c
11
src/stage.c
|
@ -456,13 +456,15 @@ static void stage_logic(void) {
|
|||
|
||||
void stage_clear_hazards(bool force) {
|
||||
for(Projectile *p = global.projs; p; p = p->next) {
|
||||
if(p->type == EnemyProj || p->type == FakeProj)
|
||||
if(force || projectile_is_clearable(p)) {
|
||||
p->type = DeadProj;
|
||||
}
|
||||
}
|
||||
|
||||
for(Laser *l = global.lasers; l; l = l->next) {
|
||||
if(!l->unclearable || force)
|
||||
if(force || !l->unclearable) {
|
||||
l->dead = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -470,7 +472,7 @@ void stage_clear_hazards_instantly(bool force) {
|
|||
for(Projectile *p = global.projs, *next; p; p = next) {
|
||||
next = p->next;
|
||||
|
||||
if(p->type == EnemyProj || p->type == FakeProj || p->type == DeadProj) {
|
||||
if(force || projectile_is_clearable(p)) {
|
||||
create_bpoint(p->pos);
|
||||
delete_projectile(&global.projs, p);
|
||||
}
|
||||
|
@ -478,8 +480,9 @@ void stage_clear_hazards_instantly(bool force) {
|
|||
|
||||
// TODO: clear these instantly as well
|
||||
for(Laser *l = global.lasers; l; l = l->next) {
|
||||
if(!l->unclearable || force)
|
||||
if(force || !l->unclearable) {
|
||||
l->dead = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1169,7 +1169,7 @@ int baryon_broglie(Enemy *e, int t) {
|
|||
attack_num,
|
||||
hue
|
||||
},
|
||||
.flags = PFLAG_DRAWADD,
|
||||
.flags = PFLAG_DRAWADD | PFLAG_NOCLEAR,
|
||||
.angle = (2*M_PI*_i)/cnt + aim_angle,
|
||||
);
|
||||
}
|
||||
|
@ -1441,7 +1441,7 @@ void elly_ricci(Boss *b, int t) {
|
|||
complex pos = 0.5 * w/(float)c + fmod(w/(float)c*(i+0.5*_i),w) + (VIEWPORT_H+10)*I;
|
||||
|
||||
PROJECTILE("ball", pos, rgba(0.5, 0.0, 0,0), ricci_proj, { -v*I },
|
||||
.flags = PFLAG_DRAWADD | PFLAG_NOSPAWNZOOM | PFLAG_NOGRAZE,
|
||||
.flags = PFLAG_DRAWADD | PFLAG_NOSPAWNZOOM | PFLAG_NOGRAZE | PFLAG_NOCLEAR,
|
||||
.max_viewport_dist = SAFE_RADIUS_MAX,
|
||||
);
|
||||
}
|
||||
|
@ -1532,7 +1532,9 @@ int baryon_lhc(Enemy *e, int t) {
|
|||
|
||||
if(g == 2 || g == 5) {
|
||||
play_sound_delayed("laser1",10,true,200);
|
||||
create_laser(e->pos, 200, 300, rgb(0.1+0.9*(g>3),0,1-0.9*(g>3)), las_linear, lhc_laser_logic, (1-2*(g>3))*VIEWPORT_W*0.005, 200+30.0*I, add_ref(e), 0);
|
||||
|
||||
Laser *l = create_laser(e->pos, 200, 300, rgb(0.1+0.9*(g>3),0,1-0.9*(g>3)), las_linear, lhc_laser_logic, (1-2*(g>3))*VIEWPORT_W*0.005, 200+30.0*I, add_ref(e), 0);
|
||||
l->unclearable = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue