1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
20 // Mission begin melt/wipe screen special effect.
22 //-----------------------------------------------------------------------------
25 static const char rcsid[] = "$Id: f_wipe.c,v 1.2 1997/02/03 22:45:09 b1 Exp $";
38 // SCREEN WIPE PACKAGE
41 // when zero, stop the wipe
42 static boolean go = 0;
44 static byte* wipe_scr_start;
45 static byte* wipe_scr_end;
46 static byte* wipe_scr;
50 wipe_shittyColMajorXform
59 dest = (short*) Z_Malloc(width*height*2, PU_STATIC, 0);
63 dest[x*height+y] = array[y*width+x];
65 memcpy(array, dest, width*height*2);
77 memcpy(wipe_scr, wipe_scr_start, width*height);
96 while (w!=wipe_scr+width*height)
147 // copy start screen to main screen
148 memcpy(wipe_scr, wipe_scr_start, width*height);
150 // makes this wipe faster (in theory)
151 // to have stuff in column-major format
152 wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height);
153 wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height);
155 // setup initial column positions
156 // (y<0 => not ready to scroll yet)
157 y = (int *) Z_Malloc(width*sizeof(int), PU_STATIC, 0);
158 y[0] = -(M_Random()%16);
159 for (i=1;i<width;i++)
161 r = (M_Random()%3) - 1;
163 if (y[i] > 0) y[i] = 0;
164 else if (y[i] == -16) y[i] = -15;
189 for (i=0;i<width;i++)
193 y[i]++; done = false;
195 else if (y[i] < height)
197 dy = (y[i] < 16) ? y[i]+1 : 8;
198 if (y[i]+dy >= height) dy = height - y[i];
199 s = &((short *)wipe_scr_end)[i*height+y[i]];
200 d = &((short *)wipe_scr)[y[i]*width+i];
208 s = &((short *)wipe_scr_start)[i*height];
209 d = &((short *)wipe_scr)[y[i]*width+i];
211 for (j=height-y[i];j;j--)
242 wipe_scr_start = screens[2];
243 I_ReadScreen(wipe_scr_start);
254 wipe_scr_end = screens[3];
255 I_ReadScreen(wipe_scr_end);
256 V_DrawBlock(x, y, 0, width, height, wipe_scr_start); // restore start scr.
270 static int (*wipes[])(int, int, int) =
272 wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm,
273 wipe_initMelt, wipe_doMelt, wipe_exitMelt
276 void V_MarkRect(int, int, int, int);
282 // wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG
283 wipe_scr = screens[0];
284 (*wipes[wipeno*3])(width, height, ticks);
287 // do a piece of wipe-in
288 V_MarkRect(0, 0, width, height);
289 rc = (*wipes[wipeno*3+1])(width, height, ticks);
290 // V_DrawBlock(x, y, 0, width, height, wipe_scr); // DEBUG
296 (*wipes[wipeno*3+2])(width, height, ticks);