1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
4 // Copyright(C) 1993-1996 Id Software, Inc.
5 // Copyright(C) 2005 Simon Howard
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 // Mission begin melt/wipe screen special effect.
25 //-----------------------------------------------------------------------------
41 // SCREEN WIPE PACKAGE
44 // when zero, stop the wipe
45 static boolean go
= 0;
47 static byte
* wipe_scr_start
;
48 static byte
* wipe_scr_end
;
49 static byte
* wipe_scr
;
53 wipe_shittyColMajorXform
62 dest
= (short*) Z_Malloc(width
*height
*2, PU_STATIC
, 0);
66 dest
[x
*height
+y
] = array
[y
*width
+x
];
68 memcpy(array
, dest
, width
*height
*2);
80 memcpy(wipe_scr
, wipe_scr_start
, width
*height
);
99 while (w
!=wipe_scr
+width
*height
)
150 // copy start screen to main screen
151 memcpy(wipe_scr
, wipe_scr_start
, width
*height
);
153 // makes this wipe faster (in theory)
154 // to have stuff in column-major format
155 wipe_shittyColMajorXform((short*)wipe_scr_start
, width
/2, height
);
156 wipe_shittyColMajorXform((short*)wipe_scr_end
, width
/2, height
);
158 // setup initial column positions
159 // (y<0 => not ready to scroll yet)
160 y
= (int *) Z_Malloc(width
*sizeof(int), PU_STATIC
, 0);
161 y
[0] = -(M_Random()%16);
162 for (i
=1;i
<width
;i
++)
164 r
= (M_Random()%3) - 1;
166 if (y
[i
] > 0) y
[i
] = 0;
167 else if (y
[i
] == -16) y
[i
] = -15;
192 for (i
=0;i
<width
;i
++)
196 y
[i
]++; done
= false;
198 else if (y
[i
] < height
)
200 dy
= (y
[i
] < 16) ? y
[i
]+1 : 8;
201 if (y
[i
]+dy
>= height
) dy
= height
- y
[i
];
202 s
= &((short *)wipe_scr_end
)[i
*height
+y
[i
]];
203 d
= &((short *)wipe_scr
)[y
[i
]*width
+i
];
211 s
= &((short *)wipe_scr_start
)[i
*height
];
212 d
= &((short *)wipe_scr
)[y
[i
]*width
+i
];
214 for (j
=height
-y
[i
];j
;j
--)
245 wipe_scr_start
= screens
[2];
246 I_ReadScreen(wipe_scr_start
);
257 wipe_scr_end
= screens
[3];
258 I_ReadScreen(wipe_scr_end
);
259 V_DrawBlock(x
, y
, 0, width
, height
, wipe_scr_start
); // restore start scr.
273 static int (*wipes
[])(int, int, int) =
275 wipe_initColorXForm
, wipe_doColorXForm
, wipe_exitColorXForm
,
276 wipe_initMelt
, wipe_doMelt
, wipe_exitMelt
279 void V_MarkRect(int, int, int, int);
285 // wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG
286 wipe_scr
= screens
[0];
287 (*wipes
[wipeno
*3])(width
, height
, ticks
);
290 // do a piece of wipe-in
291 V_MarkRect(0, 0, width
, height
);
292 rc
= (*wipes
[wipeno
*3+1])(width
, height
, ticks
);
293 // V_DrawBlock(x, y, 0, width, height, wipe_scr); // DEBUG
299 (*wipes
[wipeno
*3+2])(width
, height
, ticks
);