From cf7b4fab6313cd2162cb0bd3f28596fbdc2fffd3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 7 Sep 2008 20:33:36 +0000 Subject: Move m_bbox.[ch], f_wipe.[ch] to doom/ Subversion-branch: /branches/raven-branch Subversion-revision: 1209 --- src/Makefile.am | 2 - src/doom/Makefile.am | 2 + src/doom/f_wipe.c | 302 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/doom/f_wipe.h | 71 ++++++++++++ src/doom/m_bbox.c | 62 +++++++++++ src/doom/m_bbox.h | 55 ++++++++++ src/f_wipe.c | 302 --------------------------------------------------- src/f_wipe.h | 71 ------------ src/m_bbox.c | 62 ----------- src/m_bbox.h | 55 ---------- 10 files changed, 492 insertions(+), 492 deletions(-) create mode 100644 src/doom/f_wipe.c create mode 100644 src/doom/f_wipe.h create mode 100644 src/doom/m_bbox.c create mode 100644 src/doom/m_bbox.h delete mode 100644 src/f_wipe.c delete mode 100644 src/f_wipe.h delete mode 100644 src/m_bbox.c delete mode 100644 src/m_bbox.h diff --git a/src/Makefile.am b/src/Makefile.am index e0a17534..a91de106 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,7 +31,6 @@ doomkeys.h \ doomfeatures.h \ doomtype.h \ d_ticcmd.h \ -f_wipe.c f_wipe.h \ i_main.c \ i_joystick.c i_joystick.h \ i_scale.c i_scale.h \ @@ -40,7 +39,6 @@ i_system.c i_system.h \ i_timer.c i_timer.h \ i_video.c i_video.h \ m_argv.c m_argv.h \ -m_bbox.c m_bbox.h \ m_cheat.c m_cheat.h \ m_config.c m_config.h \ m_fixed.c m_fixed.h \ diff --git a/src/doom/Makefile.am b/src/doom/Makefile.am index dfba05a7..4d95266e 100644 --- a/src/doom/Makefile.am +++ b/src/doom/Makefile.am @@ -17,10 +17,12 @@ dstrings.c dstrings.h \ d_textur.h \ d_think.h \ f_finale.c f_finale.h \ +f_wipe.c f_wipe.h \ g_game.c g_game.h \ hu_lib.c hu_lib.h \ hu_stuff.c hu_stuff.h \ info.c info.h \ +m_bbox.c m_bbox.h \ m_menu.c m_menu.h \ p_ceilng.c \ p_doors.c \ diff --git a/src/doom/f_wipe.c b/src/doom/f_wipe.c new file mode 100644 index 00000000..2ab66848 --- /dev/null +++ b/src/doom/f_wipe.c @@ -0,0 +1,302 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 2005 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// Mission begin melt/wipe screen special effect. +// +//----------------------------------------------------------------------------- + +#include + +#include "z_zone.h" +#include "i_video.h" +#include "v_video.h" +#include "m_random.h" + +#include "doomtype.h" + +#include "f_wipe.h" + +// +// SCREEN WIPE PACKAGE +// + +// when zero, stop the wipe +static boolean go = 0; + +static byte* wipe_scr_start; +static byte* wipe_scr_end; +static byte* wipe_scr; + + +void +wipe_shittyColMajorXform +( short* array, + int width, + int height ) +{ + int x; + int y; + short* dest; + + dest = (short*) Z_Malloc(width*height*2, PU_STATIC, 0); + + for(y=0;y *e) + { + newval = *w - ticks; + if (newval < *e) + *w = *e; + else + *w = newval; + changed = true; + } + else if (*w < *e) + { + newval = *w + ticks; + if (newval > *e) + *w = *e; + else + *w = newval; + changed = true; + } + } + w++; + e++; + } + + return !changed; + +} + +int +wipe_exitColorXForm +( int width, + int height, + int ticks ) +{ + return 0; +} + + +static int* y; + +int +wipe_initMelt +( int width, + int height, + int ticks ) +{ + int i, r; + + // copy start screen to main screen + memcpy(wipe_scr, wipe_scr_start, width*height); + + // makes this wipe faster (in theory) + // to have stuff in column-major format + wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height); + wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height); + + // setup initial column positions + // (y<0 => not ready to scroll yet) + y = (int *) Z_Malloc(width*sizeof(int), PU_STATIC, 0); + y[0] = -(M_Random()%16); + for (i=1;i 0) y[i] = 0; + else if (y[i] == -16) y[i] = -15; + } + + return 0; +} + +int +wipe_doMelt +( int width, + int height, + int ticks ) +{ + int i; + int j; + int dy; + int idx; + + short* s; + short* d; + boolean done = true; + + width/=2; + + while (ticks--) + { + for (i=0;i= height) dy = height - y[i]; + s = &((short *)wipe_scr_end)[i*height+y[i]]; + d = &((short *)wipe_scr)[y[i]*width+i]; + idx = 0; + for (j=dy;j;j--) + { + d[idx] = *(s++); + idx += width; + } + y[i] += dy; + s = &((short *)wipe_scr_start)[i*height]; + d = &((short *)wipe_scr)[y[i]*width+i]; + idx = 0; + for (j=height-y[i];j;j--) + { + d[idx] = *(s++); + idx += width; + } + done = false; + } + } + } + + return done; + +} + +int +wipe_exitMelt +( int width, + int height, + int ticks ) +{ + Z_Free(y); + return 0; +} + +int +wipe_StartScreen +( int x, + int y, + int width, + int height ) +{ + wipe_scr_start = screens[2]; + I_ReadScreen(wipe_scr_start); + return 0; +} + +int +wipe_EndScreen +( int x, + int y, + int width, + int height ) +{ + wipe_scr_end = screens[3]; + I_ReadScreen(wipe_scr_end); + V_DrawBlock(x, y, 0, width, height, wipe_scr_start); // restore start scr. + return 0; +} + +int +wipe_ScreenWipe +( int wipeno, + int x, + int y, + int width, + int height, + int ticks ) +{ + int rc; + static int (*wipes[])(int, int, int) = + { + wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm, + wipe_initMelt, wipe_doMelt, wipe_exitMelt + }; + + void V_MarkRect(int, int, int, int); + + // initial stuff + if (!go) + { + go = 1; + // wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG + wipe_scr = screens[0]; + (*wipes[wipeno*3])(width, height, ticks); + } + + // do a piece of wipe-in + V_MarkRect(0, 0, width, height); + rc = (*wipes[wipeno*3+1])(width, height, ticks); + // V_DrawBlock(x, y, 0, width, height, wipe_scr); // DEBUG + + // final stuff + if (rc) + { + go = 0; + (*wipes[wipeno*3+2])(width, height, ticks); + } + + return !go; + +} diff --git a/src/doom/f_wipe.h b/src/doom/f_wipe.h new file mode 100644 index 00000000..9045be3f --- /dev/null +++ b/src/doom/f_wipe.h @@ -0,0 +1,71 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 2005 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// Mission start screen wipe/melt, special effects. +// +//----------------------------------------------------------------------------- + + +#ifndef __F_WIPE_H__ +#define __F_WIPE_H__ + +// +// SCREEN WIPE PACKAGE +// + +enum +{ + // simple gradual pixel change for 8-bit only + wipe_ColorXForm, + + // weird screen melt + wipe_Melt, + + wipe_NUMWIPES +}; + +int +wipe_StartScreen +( int x, + int y, + int width, + int height ); + + +int +wipe_EndScreen +( int x, + int y, + int width, + int height ); + + +int +wipe_ScreenWipe +( int wipeno, + int x, + int y, + int width, + int height, + int ticks ); + +#endif diff --git a/src/doom/m_bbox.c b/src/doom/m_bbox.c new file mode 100644 index 00000000..02389209 --- /dev/null +++ b/src/doom/m_bbox.c @@ -0,0 +1,62 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 2005 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// Main loop menu stuff. +// Random number LUT. +// Default Config File. +// PCX Screenshots. +// +//----------------------------------------------------------------------------- + + + +#include "m_bbox.h" + + + + +void M_ClearBox (fixed_t *box) +{ + box[BOXTOP] = box[BOXRIGHT] = INT_MIN; + box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX; +} + +void +M_AddToBox +( fixed_t* box, + fixed_t x, + fixed_t y ) +{ + if (xbox[BOXRIGHT]) + box[BOXRIGHT] = x; + if (ybox[BOXTOP]) + box[BOXTOP] = y; +} + + + + + diff --git a/src/doom/m_bbox.h b/src/doom/m_bbox.h new file mode 100644 index 00000000..3788044b --- /dev/null +++ b/src/doom/m_bbox.h @@ -0,0 +1,55 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 2005 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// Nil. +// +//----------------------------------------------------------------------------- + + +#ifndef __M_BBOX__ +#define __M_BBOX__ + +#include + +#include "m_fixed.h" + + +// Bounding box coordinate storage. +enum +{ + BOXTOP, + BOXBOTTOM, + BOXLEFT, + BOXRIGHT +}; // bbox coordinates + +// Bounding box functions. +void M_ClearBox (fixed_t* box); + +void +M_AddToBox +( fixed_t* box, + fixed_t x, + fixed_t y ); + + +#endif diff --git a/src/f_wipe.c b/src/f_wipe.c deleted file mode 100644 index 2ab66848..00000000 --- a/src/f_wipe.c +++ /dev/null @@ -1,302 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 2005 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -// DESCRIPTION: -// Mission begin melt/wipe screen special effect. -// -//----------------------------------------------------------------------------- - -#include - -#include "z_zone.h" -#include "i_video.h" -#include "v_video.h" -#include "m_random.h" - -#include "doomtype.h" - -#include "f_wipe.h" - -// -// SCREEN WIPE PACKAGE -// - -// when zero, stop the wipe -static boolean go = 0; - -static byte* wipe_scr_start; -static byte* wipe_scr_end; -static byte* wipe_scr; - - -void -wipe_shittyColMajorXform -( short* array, - int width, - int height ) -{ - int x; - int y; - short* dest; - - dest = (short*) Z_Malloc(width*height*2, PU_STATIC, 0); - - for(y=0;y *e) - { - newval = *w - ticks; - if (newval < *e) - *w = *e; - else - *w = newval; - changed = true; - } - else if (*w < *e) - { - newval = *w + ticks; - if (newval > *e) - *w = *e; - else - *w = newval; - changed = true; - } - } - w++; - e++; - } - - return !changed; - -} - -int -wipe_exitColorXForm -( int width, - int height, - int ticks ) -{ - return 0; -} - - -static int* y; - -int -wipe_initMelt -( int width, - int height, - int ticks ) -{ - int i, r; - - // copy start screen to main screen - memcpy(wipe_scr, wipe_scr_start, width*height); - - // makes this wipe faster (in theory) - // to have stuff in column-major format - wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height); - wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height); - - // setup initial column positions - // (y<0 => not ready to scroll yet) - y = (int *) Z_Malloc(width*sizeof(int), PU_STATIC, 0); - y[0] = -(M_Random()%16); - for (i=1;i 0) y[i] = 0; - else if (y[i] == -16) y[i] = -15; - } - - return 0; -} - -int -wipe_doMelt -( int width, - int height, - int ticks ) -{ - int i; - int j; - int dy; - int idx; - - short* s; - short* d; - boolean done = true; - - width/=2; - - while (ticks--) - { - for (i=0;i= height) dy = height - y[i]; - s = &((short *)wipe_scr_end)[i*height+y[i]]; - d = &((short *)wipe_scr)[y[i]*width+i]; - idx = 0; - for (j=dy;j;j--) - { - d[idx] = *(s++); - idx += width; - } - y[i] += dy; - s = &((short *)wipe_scr_start)[i*height]; - d = &((short *)wipe_scr)[y[i]*width+i]; - idx = 0; - for (j=height-y[i];j;j--) - { - d[idx] = *(s++); - idx += width; - } - done = false; - } - } - } - - return done; - -} - -int -wipe_exitMelt -( int width, - int height, - int ticks ) -{ - Z_Free(y); - return 0; -} - -int -wipe_StartScreen -( int x, - int y, - int width, - int height ) -{ - wipe_scr_start = screens[2]; - I_ReadScreen(wipe_scr_start); - return 0; -} - -int -wipe_EndScreen -( int x, - int y, - int width, - int height ) -{ - wipe_scr_end = screens[3]; - I_ReadScreen(wipe_scr_end); - V_DrawBlock(x, y, 0, width, height, wipe_scr_start); // restore start scr. - return 0; -} - -int -wipe_ScreenWipe -( int wipeno, - int x, - int y, - int width, - int height, - int ticks ) -{ - int rc; - static int (*wipes[])(int, int, int) = - { - wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm, - wipe_initMelt, wipe_doMelt, wipe_exitMelt - }; - - void V_MarkRect(int, int, int, int); - - // initial stuff - if (!go) - { - go = 1; - // wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG - wipe_scr = screens[0]; - (*wipes[wipeno*3])(width, height, ticks); - } - - // do a piece of wipe-in - V_MarkRect(0, 0, width, height); - rc = (*wipes[wipeno*3+1])(width, height, ticks); - // V_DrawBlock(x, y, 0, width, height, wipe_scr); // DEBUG - - // final stuff - if (rc) - { - go = 0; - (*wipes[wipeno*3+2])(width, height, ticks); - } - - return !go; - -} diff --git a/src/f_wipe.h b/src/f_wipe.h deleted file mode 100644 index 9045be3f..00000000 --- a/src/f_wipe.h +++ /dev/null @@ -1,71 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 2005 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -// DESCRIPTION: -// Mission start screen wipe/melt, special effects. -// -//----------------------------------------------------------------------------- - - -#ifndef __F_WIPE_H__ -#define __F_WIPE_H__ - -// -// SCREEN WIPE PACKAGE -// - -enum -{ - // simple gradual pixel change for 8-bit only - wipe_ColorXForm, - - // weird screen melt - wipe_Melt, - - wipe_NUMWIPES -}; - -int -wipe_StartScreen -( int x, - int y, - int width, - int height ); - - -int -wipe_EndScreen -( int x, - int y, - int width, - int height ); - - -int -wipe_ScreenWipe -( int wipeno, - int x, - int y, - int width, - int height, - int ticks ); - -#endif diff --git a/src/m_bbox.c b/src/m_bbox.c deleted file mode 100644 index 02389209..00000000 --- a/src/m_bbox.c +++ /dev/null @@ -1,62 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 2005 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -// DESCRIPTION: -// Main loop menu stuff. -// Random number LUT. -// Default Config File. -// PCX Screenshots. -// -//----------------------------------------------------------------------------- - - - -#include "m_bbox.h" - - - - -void M_ClearBox (fixed_t *box) -{ - box[BOXTOP] = box[BOXRIGHT] = INT_MIN; - box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX; -} - -void -M_AddToBox -( fixed_t* box, - fixed_t x, - fixed_t y ) -{ - if (xbox[BOXRIGHT]) - box[BOXRIGHT] = x; - if (ybox[BOXTOP]) - box[BOXTOP] = y; -} - - - - - diff --git a/src/m_bbox.h b/src/m_bbox.h deleted file mode 100644 index 3788044b..00000000 --- a/src/m_bbox.h +++ /dev/null @@ -1,55 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 2005 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -// DESCRIPTION: -// Nil. -// -//----------------------------------------------------------------------------- - - -#ifndef __M_BBOX__ -#define __M_BBOX__ - -#include - -#include "m_fixed.h" - - -// Bounding box coordinate storage. -enum -{ - BOXTOP, - BOXBOTTOM, - BOXLEFT, - BOXRIGHT -}; // bbox coordinates - -// Bounding box functions. -void M_ClearBox (fixed_t* box); - -void -M_AddToBox -( fixed_t* box, - fixed_t x, - fixed_t y ); - - -#endif -- cgit v1.2.3