guru guru hina guru

This commit is contained in:
laochailan 2017-10-03 20:09:34 +02:00
parent a2b16380c7
commit 0ef53b5915
No known key found for this signature in database
GPG key ID: 49BE98017AFBC943
6 changed files with 23 additions and 10 deletions

View file

@ -1,3 +1,3 @@
rows = 1
rows = 2
cols = 6
speed = 5
speed = 6

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -30,14 +30,14 @@ void aniplayer_reset(AniPlayer *plr) { // resets to a neutral state with empty q
}
AniSequence *aniplayer_queue(AniPlayer *plr, int row, int loops, int delay) {
AniSequence *s = create_element_at_end((void **)plr->queue,sizeof(AniSequence));
AniSequence *s = create_element_at_end((void **)&plr->queue,sizeof(AniSequence));
plr->queuesize++;
s->row = row;
if(loops < 0)
log_fatal("Negative number of loops passed: %d",loops);
s->clocks = (loops+1)*plr->ani->cols*plr->ani->speed;
s->duration = (loops+1)*plr->ani->cols*plr->ani->speed;
s->delay = delay;
return s;
@ -47,8 +47,8 @@ void aniplayer_update(AniPlayer *plr) {
plr->clock++;
if(plr->queue) {
AniSequence *s = plr->queue;
if(s->clocks > 0) {
s->clocks--;
if(s->clock < s->duration) {
s->clock++;
} else if(s->delay > 0) {
s->delay--;
} else {
@ -65,7 +65,7 @@ void aniplayer_play(AniPlayer *plr, float x, float y) {
bool mirror = plr->mirrored;
if(plr->queue) {
AniSequence *s = plr->queue;
col = ((2*s->backwards-1)*s->clocks/plr->ani->speed) % plr->ani->cols;
col = ((1-2*s->backwards)*s->clock/plr->ani->speed+s->duration) % plr->ani->cols;
row = s->row;
mirror = s->mirrored;

View file

@ -21,7 +21,8 @@ struct AniSequence{
struct AniSequence *prev;
int row;
int clocks; // number of frames this sequence will be drawn
int duration; // number of frames this sequence will be drawn
int clock;
int delay; // after the sequence has played loops times before the next one is started.
bool mirrored;

View file

@ -20,9 +20,9 @@
struct stage2_spells_s stage2_spells = {
.boss = {
.amulet_of_harm = {{ 0, 1, 2, 3}, AT_Spellcard, "Shard ~ Amulet of Harm", 26, 50000,
.amulet_of_harm = {{ 0, 1, 2, 3}, AT_Spellcard, "Shard ~ Amulet of Harm", 26, 50000,
hina_amulet, hina_spell_bg, BOSS_DEFAULT_GO_POS},
.bad_pick = {{ 4, 5, 6, 7}, AT_Spellcard, "Lottery Sign ~ Bad Pick", 30, 43200,
.bad_pick = {{ 4, 5, 6, 7}, AT_Spellcard, "Lottery Sign ~ Bad Pick", 30, 43200,
hina_bad_pick, hina_spell_bg, BOSS_DEFAULT_GO_POS},
.wheel_of_fortune_easy = {{ 8, 9, -1, -1}, AT_Spellcard, "Lottery Sign ~ Wheel of Fortune", 20, 36000,
hina_wheel, hina_spell_bg, BOSS_DEFAULT_GO_POS},

View file

@ -281,6 +281,8 @@ void hina_intro(Boss *h, int time) {
AT(100)
global.dialog = stage2_dialog();
aniplayer_queue(&h->ani,0,2,0);
aniplayer_queue(&h->ani,1,0,0);
GO_TO(h, VIEWPORT_W/2 + 100.0*I, 0.05);
}
@ -291,6 +293,7 @@ void hina_cards1(Boss *h, int time) {
if(time < 0)
return;
h->ani.stdrow = 1;
FROM_TO(0, 500, 2-(global.diff > D_Normal)) {
play_sound_cooldown("shot1", 4);
create_projectile2c("card", h->pos+50*cexp(I*t/10), rgb(0.8,0.0,0.0), asymptotic, (1.6+0.4*global.diff)*cexp(I*t/5.0), 3);
@ -310,7 +313,9 @@ void hina_amulet(Boss *h, int time) {
TIMER(&t);
complex d = global.plr.pos - h->pos;
h->ani.stdrow = 0;
FROM_TO_SND("shot1_loop", 0,200*(global.diff+0.5)/(D_Lunatic+0.5),1) {
h->ani.stdrow = 1;
float f = _i/30.0;
complex n = cexp(I*2*M_PI*f+I*carg(d)+0.7*time/200*I)/sqrt(0.5+global.diff);
@ -395,6 +400,7 @@ void hina_bad_pick(Boss *h, int time) {
}
AT(200) {
aniplayer_queue(&h->ani,1,1,0);
play_sound("shot_special1");
int win = tsrand()%SLOTS;
@ -424,6 +430,7 @@ void hina_wheel(Boss *h, int time) {
GO_TO(h, VIEWPORT_W/2+VIEWPORT_H/2*I, 0.02);
h->ani.stdrow = 1;
if(time < 60) {
if(time == 0) {
if(global.diff > D_Normal) {
@ -569,6 +576,7 @@ void hina_monty(Boss *h, int time) {
play_sound("laser1");
create_laserline_ab(h->pos, o, 15, 30, 60, rgb(1.0, 0.3, 0.3));
aniplayer_queue(&h->ani,1,0,0);
}
AT(140) {
@ -607,6 +615,10 @@ void hina_monty(Boss *h, int time) {
const int end = 540;
const int ncycles = (end - start) / cycle_dur;
AT(start)
h->ani.stdrow = 1;
AT(end)
h->ani.stdrow = 0;
FROM_TO_INT(start, start + cycle_dur * ncycles - 1, cycle_dur, burst_dur, step) {
play_sound("shot1");