Add stage_get_by_spellcard()
This commit is contained in:
parent
16cbec9ca1
commit
b68b70a562
3 changed files with 18 additions and 0 deletions
|
@ -176,7 +176,13 @@ void free_attack(Attack *a) {
|
|||
}
|
||||
|
||||
void start_attack(Boss *b, Attack *a) {
|
||||
#if DEBUG
|
||||
printf("BOSS start_attack(): %s\n", a->name);
|
||||
StageInfo *i = stage_get_by_spellcard(a->info, global.diff);
|
||||
if(i) {
|
||||
printf("This attack has a spell stage: %u\n", i->id);
|
||||
}
|
||||
#endif
|
||||
|
||||
a->starttime = global.frames + ATTACK_START_DELAY;
|
||||
a->rule(b, EVENT_BIRTH);
|
||||
|
|
11
src/stage.c
11
src/stage.c
|
@ -241,6 +241,17 @@ StageInfo* stage_get(uint16_t n) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
StageInfo* stage_get_by_spellcard(AttackInfo *spell, Difficulty diff) {
|
||||
if(!spell)
|
||||
return NULL;
|
||||
|
||||
for(StageInfo *stg = stages; stg->loop; ++stg)
|
||||
if(stg->spell == spell && stg->difficulty == diff)
|
||||
return stg;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void stage_start(void) {
|
||||
global.timer = 0;
|
||||
global.frames = 0;
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef struct StageInfo {
|
|||
|
||||
extern StageInfo stages[];
|
||||
StageInfo* stage_get(uint16_t);
|
||||
StageInfo* stage_get_by_spellcard(AttackInfo *spell, Difficulty diff);
|
||||
void stage_init_array(void);
|
||||
|
||||
void stage_loop(StageRule start, StageRule end, StageRule draw, StageRule event, ShaderRule *shaderrules, int endtime);
|
||||
|
|
Loading…
Reference in a new issue