Commit 893a320a authored by Steven Fuller's avatar Steven Fuller

Moved FadeIn/Out to id_vh.

parent 32ab9957
......@@ -21,6 +21,9 @@ and the intro screen which came with wolf3d has copyrighted images
two screens for nostalga
* fix the input code, everything is spread out... ideally everything should
work the same, let the input handler do it all instead
i think its safe for now to go with the scancodes as being the "universal"
key type, and for everything not scancode-based, have a function to
translate
* when viewsize is around 20, sprites end up being drawn over the border.
maybe there are clipping bugs that will cause it to fill over the top, left,
and right (happens at any view basically, except this version of source does
......@@ -50,24 +53,22 @@ just call a different function (most are left from the update block code)
rename/remove them
* fix wl_debug.c, lots of junk code..
* change the current parameter handling code to something like getopt
* urgent: fix input (event handling), so that it makes sense
* wl_menu.c does loops on Keyboard. should call id_in functions instead
* rename goobers to debugmode, then remove debugmode for things...
* for some reason, it feels sluggish, maybe its from having mikmod playing
at the same time... especially when you pick up items
or the pallete ops calling waitvbl
* look for places where gfx needs to be redrawn, like back to game etc
* wl_menu uses specific scancodes for names, config file will have to use
metaname like sc_Left etc or something
* fizzlefade is hackish, stipple buf would work ok in opengl, maybe only
update once per frame or such.. hm
and where is that stray pixel coming from (when using end game with largest
window size)
window size) in svgalib
* change id_sd to sd_oss, sd_win, sd_dos, sd_oal, etc
idea is that different <outputs> can share some drivers, unlike video
* check filehandling (ex, file missing, bad file type, and such)
PlayDemoFromFile specifically
* make sure all infinite loops are found (looping around Keyboard)
* move FadeIn/FadeOut to id_vh? since it calls vl functions only
Specific:
* memory/sound intro screen goes
......
......@@ -15,6 +15,10 @@ unsigned freelatch;
unsigned latchpics[NUMLATCHPICS];
*/
boolean screenfaded;
byte palette1[256][3], palette2[256][3];
/* ======================================================================== */
void VW_DrawPropString(char *string)
......@@ -244,8 +248,6 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width,unsigned height, uns
VL_DirectPlot(xx+x, yy+y, xx+x, yy+y);
//*(graph_mem + (xx+x) + (yy+y) * 320) = *(gfxbuf + (xx+x) + (yy+y) * 320);
if (rndval == 1) /* entire sequence has been completed */
return false;
......@@ -254,3 +256,97 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width,unsigned height, uns
while (get_TimeCount() < frame) ;
} while (1);
}
/*
=================
=
= VL_FadeOut
=
= Fades the current palette to the given color in the given number of steps
=
=================
*/
void VL_FadeOut(int start, int end, int red, int green, int blue, int steps)
{
int i,j,orig,delta;
byte *origptr, *newptr;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]);
memcpy (palette2,palette1,768);
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
origptr = &palette1[start][0];
newptr = &palette2[start][0];
for (j=start;j<=end;j++)
{
orig = *origptr++;
delta = red-orig;
*newptr++ = orig + delta * i / steps;
orig = *origptr++;
delta = green-orig;
*newptr++ = orig + delta * i / steps;
orig = *origptr++;
delta = blue-orig;
*newptr++ = orig + delta * i / steps;
}
VL_WaitVBL(1);
VL_SetPalette (&palette2[0][0]);
}
//
// final color
//
VL_FillPalette (red,green,blue);
screenfaded = true;
}
/*
=================
=
= VL_FadeIn
=
=================
*/
void VL_FadeIn(int start, int end, byte *palette, int steps)
{
int i,j,delta;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]);
memcpy (&palette2[0][0],&palette1[0][0],sizeof(palette1));
start *= 3;
end = end*3+2;
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
for (j=start;j<=end;j++)
{
delta = palette[j]-palette1[0][j];
palette2[0][j] = palette1[0][j] + delta * i / steps;
}
VL_WaitVBL(1);
VL_SetPalette (&palette2[0][0]);
}
//
// final color
//
VL_SetPalette (palette);
screenfaded = false;
}
......@@ -38,6 +38,7 @@ void VWB_Hlin(int x1, int x2, int y, int color);
void VWB_Vlin(int y1, int y2, int x, int color);
extern byte gamepal;
extern boolean screenfaded;
#define VW_Startup VL_Startup
#define VW_Shutdown VL_Shutdown
......@@ -45,7 +46,6 @@ extern byte gamepal;
#define VW_Plot VL_Plot
#define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c)
#define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c)
#define VW_ColorBorder VL_ColorBorder
#define VW_WaitVBL VL_WaitVBL
#define VW_FadeIn() VL_FadeIn(0,255,&gamepal,30);
#define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30);
......@@ -53,6 +53,9 @@ void VW_MeasurePropString(char *string, word *width, word *height);
boolean FizzleFade(unsigned xoffset, unsigned yoffset, unsigned width,unsigned height, unsigned frames,boolean abortable);
void VL_FadeOut(int start, int end, int red, int green, int blue, int steps);
void VL_FadeIn(int start, int end, byte *palette, int steps);
void LatchDrawPic(unsigned x, unsigned y, unsigned picnum);
void LoadLatchMem(void);
......
......@@ -6,7 +6,7 @@
/* SDM = 2 */
/* SOD = 3 */
#ifndef WMODE
#define WMODE 0
#define WMODE 2
#endif
#if WMODE == 0
......
......@@ -5,16 +5,14 @@
extern byte *gfxbuf;
extern boolean screenfaded;
//===========================================================================
void VL_Startup (void);
void VL_Shutdown (void);
void VL_Startup();
void VL_Shutdown();
void VL_ClearVideo (byte color);
void VL_ClearVideo(byte color);
void VL_WaitVBL (int vbls);
void VL_WaitVBL(int vbls);
void VW_UpdateScreen();
void VL_FillPalette(int red, int green, int blue);
......@@ -22,9 +20,6 @@ void VL_SetColor(int color, int red, int green, int blue);
void VL_GetColor(int color, int *red, int *green, int *blue);
void VL_SetPalette(byte *palette);
void VL_GetPalette(byte *palette);
void VL_FadeOut(int start, int end, int red, int green, int blue, int steps);
void VL_FadeIn(int start, int end, byte *palette, int steps);
void VL_ColorBorder (int color);
void VL_Plot(int x, int y, int color);
void VL_Hlin(unsigned x, unsigned y, unsigned width, unsigned color);
......
......@@ -5,10 +5,6 @@
#include <X11/Xlib.h>
#include <X11/keysym.h>
boolean screenfaded;
byte palette1[256][3], palette2[256][3];
byte *gfxbuf = NULL;
void VL_WaitVBL(int vbls)
......@@ -154,102 +150,6 @@ void VL_GetPalette(byte *palette)
}
}
//===========================================================================
/*
=================
=
= VL_FadeOut
=
= Fades the current palette to the given color in the given number of steps
=
=================
*/
void VL_FadeOut(int start, int end, int red, int green, int blue, int steps)
{
int i,j,orig,delta;
byte *origptr, *newptr;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]);
memcpy (palette2,palette1,768);
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
origptr = &palette1[start][0];
newptr = &palette2[start][0];
for (j=start;j<=end;j++)
{
orig = *origptr++;
delta = red-orig;
*newptr++ = orig + delta * i / steps;
orig = *origptr++;
delta = green-orig;
*newptr++ = orig + delta * i / steps;
orig = *origptr++;
delta = blue-orig;
*newptr++ = orig + delta * i / steps;
}
VL_WaitVBL(1);
VL_SetPalette (&palette2[0][0]);
}
//
// final color
//
VL_FillPalette (red,green,blue);
screenfaded = true;
}
/*
=================
=
= VL_FadeIn
=
=================
*/
void VL_FadeIn(int start, int end, byte *palette, int steps)
{
int i,j,delta;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]);
memcpy (&palette2[0][0],&palette1[0][0],sizeof(palette1));
start *= 3;
end = end*3+2;
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
for (j=start;j<=end;j++)
{
delta = palette[j]-palette1[0][j];
palette2[0][j] = palette1[0][j] + delta * i / steps;
}
VL_WaitVBL(1);
VL_SetPalette (&palette2[0][0]);
}
//
// final color
//
VL_SetPalette (palette);
screenfaded = false;
}
/*
=============================================================================
......
......@@ -2,10 +2,6 @@
#include "id_heads.h"
boolean screenfaded;
byte palette1[256][3], palette2[256][3];
byte *gfxbuf = NULL;
void VL_WaitVBL(int vbls)
......@@ -173,102 +169,6 @@ void VL_GetPalette(byte *palette)
}
}
//===========================================================================
/*
=================
=
= VL_FadeOut
=
= Fades the current palette to the given color in the given number of steps
=
=================
*/
void VL_FadeOut(int start, int end, int red, int green, int blue, int steps)
{
int i,j,orig,delta;
byte *origptr, *newptr;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]);
memcpy (palette2,palette1,768);
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
origptr = &palette1[start][0];
newptr = &palette2[start][0];
for (j=start;j<=end;j++)
{
orig = *origptr++;
delta = red-orig;
*newptr++ = orig + delta * i / steps;
orig = *origptr++;
delta = green-orig;
*newptr++ = orig + delta * i / steps;
orig = *origptr++;
delta = blue-orig;
*newptr++ = orig + delta * i / steps;
}
VL_WaitVBL(1);
VL_SetPalette (&palette2[0][0]);
}
//
// final color
//
VL_FillPalette (red,green,blue);
screenfaded = true;
}
/*
=================
=
= VL_FadeIn
=
=================
*/
void VL_FadeIn(int start, int end, byte *palette, int steps)
{
int i,j,delta;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]);
memcpy (&palette2[0][0],&palette1[0][0],sizeof(palette1));
start *= 3;
end = end*3+2;
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
for (j=start;j<=end;j++)
{
delta = palette[j]-palette1[0][j];
palette2[0][j] = palette1[0][j] + delta * i / steps;
}
VL_WaitVBL(1);
VL_SetPalette (&palette2[0][0]);
}
//
// final color
//
VL_SetPalette (palette);
screenfaded = false;
}
/*
=============================================================================
......
......@@ -12,10 +12,6 @@
#include <X11/Xatom.h>
#include <X11/extensions/XShm.h>
boolean screenfaded;
byte palette1[256][3], palette2[256][3];
byte *gfxbuf = NULL;
Display *dpy;
......@@ -289,102 +285,6 @@ void VL_GetPalette(byte *palette)
}
}
//===========================================================================
/*
=================
=
= VL_FadeOut
=
= Fades the current palette to the given color in the given number of steps
=
=================
*/
void VL_FadeOut(int start, int end, int red, int green, int blue, int steps)
{
int i,j,orig,delta;
byte *origptr, *newptr;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]);
memcpy (palette2,palette1,768);
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
origptr = &palette1[start][0];
newptr = &palette2[start][0];
for (j=start;j<=end;j++)
{
orig = *origptr++;
delta = red-orig;
*newptr++ = orig + delta * i / steps;
orig = *origptr++;
delta = green-orig;
*newptr++ = orig + delta * i / steps;
orig = *origptr++;
delta = blue-orig;
*newptr++ = orig + delta * i / steps;
}
VL_WaitVBL(1);
VL_SetPalette (&palette2[0][0]);
}
//
// final color
//
VL_FillPalette (red,green,blue);
screenfaded = true;
}
/*
=================
=
= VL_FadeIn
=
=================
*/
void VL_FadeIn(int start, int end, byte *palette, int steps)
{
int i,j,delta;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]);
memcpy (&palette2[0][0],&palette1[0][0],sizeof(palette1));
start *= 3;
end = end*3+2;
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
for (j=start;j<=end;j++)
{
delta = palette[j]-palette1[0][j];
palette2[0][j] = palette1[0][j] + delta * i / steps;
}
VL_WaitVBL(1);
VL_SetPalette (&palette2[0][0]);
}
//
// final color
//
VL_SetPalette (palette);
screenfaded = false;
}
/*
=============================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment