Rev 8557 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8557 | Rev 9097 | ||
---|---|---|---|
1 | // ID_VL.H |
1 | // ID_VL.H |
2 | 2 | ||
3 | // wolf compatability |
3 | // wolf compatability |
4 | 4 | ||
5 | void Quit (const char *error,...); |
5 | void Quit (const char *error,...); |
6 | 6 | ||
7 | //=========================================================================== |
7 | //=========================================================================== |
8 | 8 | ||
9 | #define CHARWIDTH 2 |
9 | #define CHARWIDTH 2 |
10 | #define TILEWIDTH 4 |
10 | #define TILEWIDTH 4 |
11 | 11 | ||
12 | //=========================================================================== |
12 | //=========================================================================== |
13 | 13 | ||
14 | extern SDL_Surface *screen, *screenBuffer, *curSurface; |
14 | extern SDL_Surface *screen, *screenBuffer, *curSurface; |
15 | 15 | ||
16 | extern boolean fullscreen, usedoublebuffering; |
16 | extern boolean fullscreen, usedoublebuffering; |
17 | extern unsigned screenWidth, screenHeight, screenBits, screenPitch, bufferPitch, curPitch; |
17 | extern unsigned screenWidth, screenHeight, screenBits, screenPitch, bufferPitch, curPitch; |
18 | extern unsigned scaleFactor; |
18 | extern unsigned scaleFactor; |
19 | 19 | ||
20 | extern boolean screenfaded; |
20 | extern boolean screenfaded; |
21 | extern unsigned bordercolor; |
21 | extern unsigned bordercolor; |
22 | 22 | ||
23 | extern SDL_Color gamepal[256]; |
23 | extern SDL_Color gamepal[256]; |
24 | 24 | ||
25 | //=========================================================================== |
25 | //=========================================================================== |
26 | 26 | ||
27 | // |
27 | // |
28 | // VGA hardware routines |
28 | // VGA hardware routines |
29 | // |
29 | // |
30 | 30 | ||
31 | #define VL_WaitVBL(a) SDL_Delay((a)*8) |
31 | #define VL_WaitVBL(a) uSDL_Delay((a)*8) |
32 | 32 | ||
33 | void VL_SetVGAPlaneMode (void); |
33 | void VL_SetVGAPlaneMode (void); |
34 | void VL_SetTextMode (void); |
34 | void VL_SetTextMode (void); |
35 | void VL_Shutdown (void); |
35 | void VL_Shutdown (void); |
36 | 36 | ||
37 | void VL_ConvertPalette(byte *srcpal, SDL_Color *destpal, int numColors); |
37 | void VL_ConvertPalette(byte *srcpal, SDL_Color *destpal, int numColors); |
38 | void VL_FillPalette (int red, int green, int blue); |
38 | void VL_FillPalette (int red, int green, int blue); |
39 | void VL_SetColor (int color, int red, int green, int blue); |
39 | void VL_SetColor (int color, int red, int green, int blue); |
40 | void VL_GetColor (int color, int *red, int *green, int *blue); |
40 | void VL_GetColor (int color, int *red, int *green, int *blue); |
41 | void VL_SetPalette (SDL_Color *palette, bool forceupdate); |
41 | void VL_SetPalette (SDL_Color *palette, bool forceupdate); |
42 | void VL_GetPalette (SDL_Color *palette); |
42 | void VL_GetPalette (SDL_Color *palette); |
43 | void VL_FadeOut (int start, int end, int red, int green, int blue, int steps); |
43 | void VL_FadeOut (int start, int end, int red, int green, int blue, int steps); |
44 | void VL_FadeIn (int start, int end, SDL_Color *palette, int steps); |
44 | void VL_FadeIn (int start, int end, SDL_Color *palette, int steps); |
45 | 45 | ||
46 | byte *VL_LockSurface(SDL_Surface *surface); |
46 | byte *VL_LockSurface(SDL_Surface *surface); |
47 | void VL_UnlockSurface(SDL_Surface *surface); |
47 | void VL_UnlockSurface(SDL_Surface *surface); |
48 | 48 | ||
49 | byte VL_GetPixel (int x, int y); |
49 | byte VL_GetPixel (int x, int y); |
50 | void VL_Plot (int x, int y, int color); |
50 | void VL_Plot (int x, int y, int color); |
51 | void VL_Hlin (unsigned x, unsigned y, unsigned width, int color); |
51 | void VL_Hlin (unsigned x, unsigned y, unsigned width, int color); |
52 | void VL_Vlin (int x, int y, int height, int color); |
52 | void VL_Vlin (int x, int y, int height, int color); |
53 | void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color); |
53 | void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color); |
54 | void inline VL_Bar (int x, int y, int width, int height, int color) |
54 | void inline VL_Bar (int x, int y, int width, int height, int color) |
55 | { |
55 | { |
56 | VL_BarScaledCoord(scaleFactor*x, scaleFactor*y, |
56 | VL_BarScaledCoord(scaleFactor*x, scaleFactor*y, |
57 | scaleFactor*width, scaleFactor*height, color); |
57 | scaleFactor*width, scaleFactor*height, color); |
58 | } |
58 | } |
59 | void inline VL_ClearScreen(int color) |
59 | void inline VL_ClearScreen(int color) |
60 | { |
60 | { |
61 | SDL_FillRect(curSurface, NULL, color); |
61 | SDL_FillRect(curSurface, NULL, color); |
62 | } |
62 | } |
63 | 63 | ||
64 | void VL_MungePic (byte *source, unsigned width, unsigned height); |
64 | void VL_MungePic (byte *source, unsigned width, unsigned height); |
65 | void VL_DrawPicBare (int x, int y, byte *pic, int width, int height); |
65 | void VL_DrawPicBare (int x, int y, byte *pic, int width, int height); |
66 | void VL_MemToLatch (byte *source, int width, int height, |
66 | void VL_MemToLatch (byte *source, int width, int height, |
67 | SDL_Surface *destSurface, int x, int y); |
67 | SDL_Surface *destSurface, int x, int y); |
68 | void VL_ScreenToScreen (SDL_Surface *source, SDL_Surface *dest); |
68 | void VL_ScreenToScreen (SDL_Surface *source, SDL_Surface *dest); |
69 | void VL_MemToScreenScaledCoord (byte *source, int width, int height, int scx, int scy); |
69 | void VL_MemToScreenScaledCoord (byte *source, int width, int height, int scx, int scy); |
70 | void VL_MemToScreenScaledCoord (byte *source, int origwidth, int origheight, int srcx, int srcy, |
70 | void VL_MemToScreenScaledCoord (byte *source, int origwidth, int origheight, int srcx, int srcy, |
71 | int destx, int desty, int width, int height); |
71 | int destx, int desty, int width, int height); |
72 | 72 | ||
73 | void inline VL_MemToScreen (byte *source, int width, int height, int x, int y) |
73 | void inline VL_MemToScreen (byte *source, int width, int height, int x, int y) |
74 | { |
74 | { |
75 | VL_MemToScreenScaledCoord(source, width, height, |
75 | VL_MemToScreenScaledCoord(source, width, height, |
76 | scaleFactor*x, scaleFactor*y); |
76 | scaleFactor*x, scaleFactor*y); |
77 | } |
77 | } |
78 | 78 | ||
79 | void VL_MaskedToScreen (byte *source, int width, int height, int x, int y); |
79 | void VL_MaskedToScreen (byte *source, int width, int height, int x, int y); |
80 | 80 | ||
81 | void VL_LatchToScreenScaledCoord (SDL_Surface *source, int xsrc, int ysrc, |
81 | void VL_LatchToScreenScaledCoord (SDL_Surface *source, int xsrc, int ysrc, |
82 | int width, int height, int scxdest, int scydest); |
82 | int width, int height, int scxdest, int scydest); |
83 | 83 | ||
84 | void inline VL_LatchToScreen (SDL_Surface *source, int xsrc, int ysrc, |
84 | void inline VL_LatchToScreen (SDL_Surface *source, int xsrc, int ysrc, |
85 | int width, int height, int xdest, int ydest) |
85 | int width, int height, int xdest, int ydest) |
86 | { |
86 | { |
87 | VL_LatchToScreenScaledCoord(source,xsrc,ysrc,width,height, |
87 | VL_LatchToScreenScaledCoord(source,xsrc,ysrc,width,height, |
88 | scaleFactor*xdest,scaleFactor*ydest); |
88 | scaleFactor*xdest,scaleFactor*ydest); |
89 | } |
89 | } |
90 | void inline VL_LatchToScreenScaledCoord (SDL_Surface *source, int scx, int scy) |
90 | void inline VL_LatchToScreenScaledCoord (SDL_Surface *source, int scx, int scy) |
91 | { |
91 | { |
92 | VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h,scx,scy); |
92 | VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h,scx,scy); |
93 | } |
93 | } |
94 | void inline VL_LatchToScreen (SDL_Surface *source, int x, int y) |
94 | void inline VL_LatchToScreen (SDL_Surface *source, int x, int y) |
95 | { |
95 | { |
96 | VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h, |
96 | VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h, |
97 | scaleFactor*x,scaleFactor*y); |
97 | scaleFactor*x,scaleFactor*y); |
98 | } |
98 | } |