+ ResetDelayCounterExt(&part->step_delay, anim_sync_frame);
+
+ part->init_delay_value =
+ (c->init_delay_fixed + GetSimpleRandom(c->init_delay_random));
+
+ part->anim_delay_value =
+ (c->anim_delay_fixed + GetSimpleRandom(c->anim_delay_random));
+
+ part->initial_anim_sync_frame =
+ (g->anim_global_sync ? 0 : anim_sync_frame + part->init_delay_value);
+
+ if (c->direction & MV_HORIZONTAL)
+ {
+ int pos_bottom = FULL_SYSIZE - g->height;
+
+ if (c->position == POS_TOP)
+ part->y = 0;
+ else if (c->position == POS_UPPER)
+ part->y = GetSimpleRandom(pos_bottom / 2);
+ else if (c->position == POS_MIDDLE)
+ part->y = pos_bottom / 2;
+ else if (c->position == POS_LOWER)
+ part->y = pos_bottom / 2 + GetSimpleRandom(pos_bottom / 2);
+ else if (c->position == POS_BOTTOM)
+ part->y = pos_bottom;
+ else
+ part->y = GetSimpleRandom(pos_bottom);
+
+ if (c->direction == MV_RIGHT)
+ {
+ part->step_xoffset = c->step_offset;
+ part->x = -g->width + part->step_xoffset;
+ }
+ else
+ {
+ part->step_xoffset = -c->step_offset;
+ part->x = FULL_SXSIZE + part->step_xoffset;
+ }
+
+ part->step_yoffset = 0;
+ }
+ else if (c->direction & MV_VERTICAL)
+ {
+ int pos_right = FULL_SXSIZE - g->width;
+
+ if (c->position == POS_LEFT)
+ part->x = 0;
+ else if (c->position == POS_RIGHT)
+ part->x = pos_right;
+ else
+ part->x = GetSimpleRandom(pos_right);
+
+ if (c->direction == MV_DOWN)
+ {
+ part->step_yoffset = c->step_offset;
+ part->y = -g->height + part->step_yoffset;
+ }
+ else
+ {
+ part->step_yoffset = -c->step_offset;
+ part->y = FULL_SYSIZE + part->step_yoffset;
+ }
+
+ part->step_xoffset = 0;
+ }
+ else
+ {
+ part->x = 0;
+ part->y = 0;
+
+ part->step_xoffset = 0;
+ part->step_yoffset = 0;
+ }
+
+ if (c->x != ARG_UNDEFINED_VALUE)
+ part->x = c->x;
+ if (c->y != ARG_UNDEFINED_VALUE)
+ part->y = c->y;
+
+ if (c->step_xoffset != ARG_UNDEFINED_VALUE)
+ part->step_xoffset = c->step_xoffset;
+ if (c->step_yoffset != ARG_UNDEFINED_VALUE)
+ part->step_yoffset = c->step_yoffset;
+ }
+
+ if (part->init_delay_value > 0)