}
static void InitGlobalAnim_Triggered_ByCustomElement(int nr, int page,
- int x, int y)
+ int x, int y,
+ int trigger_x,
+ int trigger_y)
{
struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[GAME_MODE_PLAYING];
{
struct GraphicInfo *c = &part2->control_info;
- if (c->position == POS_CE)
+ if (c->position == POS_CE ||
+ c->position == POS_CE_TRIGGER)
{
// store CE tile and offset position to handle scrolling
- part2->tile_x = x;
- part2->tile_y = y;
+ part2->tile_x = (c->position == POS_CE_TRIGGER ? trigger_x : x);
+ part2->tile_y = (c->position == POS_CE_TRIGGER ? trigger_y : y);
part2->tile_xoffset = c->x;
part2->tile_yoffset = c->y;
}
#endif
- if (c->position == POS_CE)
+ if (c->position == POS_CE ||
+ c->position == POS_CE_TRIGGER)
{
SetGlobalAnimPartTileXY(part);
}
return anim_sync_frame;
}
-void HandleGlobalAnimEventByElementChange(int element, int page, int x, int y)
+void HandleGlobalAnimEventByElementChange(int element, int page, int x, int y,
+ int trigger_x, int trigger_y)
{
if (!IS_CUSTOM_ELEMENT(element))
return;
// custom element stored as 0 to 255, change page stored as 1 to 32
InitGlobalAnim_Triggered_ByCustomElement(element - EL_CUSTOM_START, page + 1,
- x, y);
+ x, y, trigger_x, trigger_y);
}
void SetAnimStatusBeforeFading(int);
boolean HandleGlobalAnimClicks(int, int, int, boolean);
-void HandleGlobalAnimEventByElementChange(int, int, int, int);
+void HandleGlobalAnimEventByElementChange(int, int, int, int, int, int);
int getGlobalAnimSyncFrame(void);
strEqual(value, "bottom") ? POS_BOTTOM :
strEqual(value, "any") ? POS_ANY :
strEqual(value, "ce") ? POS_CE :
+ strEqual(value, "ce_trigger") ? POS_CE_TRIGGER :
strEqual(value, "last") ? POS_LAST : POS_UNDEFINED);
}
else if (strEqual(suffix, ".align"))
change->actual_trigger_side = CH_SIDE_NONE;
change->actual_trigger_ce_value = 0;
change->actual_trigger_ce_score = 0;
+ change->actual_trigger_x = -1;
+ change->actual_trigger_y = -1;
}
}
change->actual_trigger_side = CH_SIDE_NONE;
change->actual_trigger_ce_value = 0;
change->actual_trigger_ce_score = 0;
+ change->actual_trigger_x = -1;
+ change->actual_trigger_y = -1;
}
// do not change elements more than a specified maximum number of changes
ChangeCount[x][y]++; // count number of changes in the same frame
if (ei->has_anim_event)
- HandleGlobalAnimEventByElementChange(element, page, x, y);
+ HandleGlobalAnimEventByElementChange(element, page, x, y,
+ change->actual_trigger_x,
+ change->actual_trigger_y);
if (change->explode)
{
change->actual_trigger_side = trigger_side;
change->actual_trigger_ce_value = CustomValue[trigger_x][trigger_y];
change->actual_trigger_ce_score = GET_CE_SCORE(trigger_element);
+ change->actual_trigger_x = trigger_x;
+ change->actual_trigger_y = trigger_y;
if ((change->can_change && !change_done) || change->has_action)
{
change->actual_trigger_side = trigger_side;
change->actual_trigger_ce_value = CustomValue[x][y];
change->actual_trigger_ce_score = GET_CE_SCORE(trigger_element);
+ change->actual_trigger_x = x;
+ change->actual_trigger_y = y;
// special case: trigger element not at (x,y) position for some events
if (check_trigger_element)
change->actual_trigger_ce_value = CustomValue[xx][yy];
change->actual_trigger_ce_score = GET_CE_SCORE(trigger_element);
+ change->actual_trigger_x = xx;
+ change->actual_trigger_y = yy;
}
if (change->can_change && !change_done)
#define POS_BOTTOM 6
#define POS_ANY 7
#define POS_CE 8
-#define POS_LAST 9
+#define POS_CE_TRIGGER 9
+#define POS_LAST 10
// values for text alignment
#define ALIGN_LEFT (1 << 0)
void (*post_change_function)(int x, int y);
short actual_trigger_element; // element that actually triggered change
+ int actual_trigger_x; // element x position that triggered change
+ int actual_trigger_y; // element y position that triggered change
int actual_trigger_side; // element side that triggered the change
int actual_trigger_player; // player which actually triggered change
int actual_trigger_player_bits; // player bits of triggering players