X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fanim.c;h=b79959dfcbf8fc58215d68090a070ba270cd591c;hb=efda7f7ff333c8aa84af7966e11e2ea070c6aea9;hp=cb2dc8816789d722f60e419e35dc54fd784d7bb5;hpb=912fcafbd1601312dcf94837380480638fa3f4b3;p=rocksndiamonds.git diff --git a/src/anim.c b/src/anim.c index cb2dc881..b79959df 100644 --- a/src/anim.c +++ b/src/anim.c @@ -1072,7 +1072,7 @@ static boolean clickConsumed(struct GlobalAnimPartControlInfo *part) static void InitGlobalAnim_Triggered(struct GlobalAnimPartControlInfo *part, boolean *anything_clicked, boolean *any_event_action, - int event_value) + int event_value, char *info_text) { struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[part->mode_nr]; @@ -1103,8 +1103,8 @@ static void InitGlobalAnim_Triggered(struct GlobalAnimPartControlInfo *part, *anything_clicked = clickConsumed(part); // click was on "part"! #if DEBUG_ANIM_EVENTS - printf("::: => %d.%d TRIGGERED BY %d.%d\n", - part2->old_anim_nr + 1, part2->old_nr + 1, + printf("::: => %d.%d TRIGGERED BY %s OF %d.%d\n", + part2->old_anim_nr + 1, part2->old_nr + 1, info_text, part->old_anim_nr + 1, part->old_nr + 1); #endif #if 0 @@ -1133,6 +1133,21 @@ static void InitGlobalAnim_Triggered(struct GlobalAnimPartControlInfo *part, } } +static void HandleGlobalAnimEvent(struct GlobalAnimPartControlInfo *part, + int event_value, char *info_text) +{ +#if DEBUG_ANIM_EVENTS + printf("::: %d.%d %s\n", part->old_anim_nr + 1, part->old_nr + 1, info_text); +#endif + + boolean anything_clicked = FALSE; + boolean any_event_action = FALSE; + + // check if this event is defined to trigger other animations + InitGlobalAnim_Triggered(part, &anything_clicked, &any_event_action, + event_value, info_text); +} + static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state) { @@ -1249,7 +1264,15 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, if (part->init_delay_counter == 0 && !part->init_event_state) + { PlayGlobalAnimSoundAndMusic(part); + + HandleGlobalAnimEvent(part, ANIM_EVENT_START, "START [ANIM]"); + } + else + { + HandleGlobalAnimEvent(part, ANIM_EVENT_INIT, "START [INIT_DELAY/EVENT]"); + } } if (part->clicked && @@ -1282,6 +1305,8 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, part->init_event_state = FALSE; PlayGlobalAnimSoundAndMusic(part); + + HandleGlobalAnimEvent(part, ANIM_EVENT_START, "START [ANIM]"); } return ANIM_STATE_WAITING; @@ -1308,6 +1333,8 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, { StopGlobalAnimSoundAndMusic(part); + HandleGlobalAnimEvent(part, ANIM_EVENT_END, "END [ANIM/OFF-SCREEN]"); + part->post_delay_counter = (c->post_delay_fixed + GetSimpleRandom(c->post_delay_random)); @@ -1329,6 +1356,8 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, StopGlobalAnimSoundAndMusic(part); + HandleGlobalAnimEvent(part, ANIM_EVENT_END, "END [ANIM_DELAY/EVENT]"); + part->post_delay_counter = (c->post_delay_fixed + GetSimpleRandom(c->post_delay_random)); @@ -1345,7 +1374,11 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, part->post_delay_counter--; if (part->post_delay_counter == 0) + { + HandleGlobalAnimEvent(part, ANIM_EVENT_POST, "END [POST_DELAY]"); + return ANIM_STATE_RESTART; + } return ANIM_STATE_WAITING; } @@ -1699,7 +1732,7 @@ static boolean InitGlobalAnim_Clicked(int mx, int my, boolean clicked) // check if this click is defined to trigger other animations InitGlobalAnim_Triggered(part, &anything_clicked, &any_event_action, - ANIM_EVENT_CLICK); + ANIM_EVENT_CLICK, "CLICK"); } } }