- int anim_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay);
- int wait_delay_value = (ffwd_delay ? 500 : 1000);
- int start_pos_vertically = 0;
- int i, x, y;
-
- game.envelope_active = TRUE;
-
- if (anim_mode != ANIM_NONE)
- PlaySoundStereo(sound_opening, SOUND_MIDDLE);
-
- if (anim_mode == ANIM_DEFAULT)
- {
- /* open envelope window horizontally */
- for (i = 0; i <= level.envelope_xsize[envelope_nr]; i++)
- {
- int xsize = i + 2;
- int ysize = 2;
- int startx = (SXSIZE - xsize * font_width) / 2;
- int starty = (SYSIZE - ysize * font_height) / 2;
-
- SetDrawtoField(DRAW_BUFFERED);
-
- BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
-
- SetDrawtoField(DRAW_BACKBUFFER);
-
- for (y=0; y < ysize; y++) for (x=0; x < xsize; x++)
- DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize,
- font_nr);
-
- redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
- BackToFront();
-
- WaitUntilDelayReached(&anim_delay, anim_delay_value / 2);
- }
- }
-
- if (anim_mode == ANIM_NONE)
- start_pos_vertically = level.envelope_ysize[envelope_nr];
+ int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay);
+ int anim_delay_value = (no_delay ? 0 : frame_delay_value);
+ int font_nr = FONT_ENVELOPE_1 + envelope_nr;
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ int max_xsize = level.envelope_xsize[envelope_nr];
+ int max_ysize = level.envelope_ysize[envelope_nr];
+ int xstart = (anim_mode & ANIM_VERTICAL ? max_xsize : 0);
+ int ystart = (anim_mode & ANIM_HORIZONTAL ? max_ysize : 0);
+ int xend = max_xsize;
+ int yend = (anim_mode != ANIM_DEFAULT ? max_ysize : 0);
+ int xstep = (xstart < xend ? 1 : 0);
+ int ystep = (ystart < yend || xstep == 0 ? 1 : 0);
+ int x, y;