summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/wolf3d/id_vl.h
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2019-07-07 22:00:20 -0400
committerFranklin Wei <git@fwei.tk>2019-07-09 11:20:55 -0400
commit3f59fc8b771625aca9c3aefe03cf1038d8461963 (patch)
treee0623a323613baa0b0993411b38bcaed144b27ed /apps/plugins/sdl/progs/wolf3d/id_vl.h
parent439a0d1d91fa040d261fc39b87278bc9f5391dcc (diff)
downloadrockbox-3f59fc8b771625aca9c3aefe03cf1038d8461963.tar.gz
rockbox-3f59fc8b771625aca9c3aefe03cf1038d8461963.zip
Wolfenstein 3-D!
This is a port of Wolf4SDL, which is derived from the original id software source release. The port runs on top of the SDL plugin runtime and is loaded as an overlay. Licensing of the game code is not an issue, as discussed below (essentially, the Debian project treats Wolf4SDL as GPLv2, with an email from John Carmack backing it up): http://forums.rockbox.org/index.php?topic=52872 Included is a copy of MAME's Yamaha OPL sound chip emulator (fmopl_gpl.c). This file was not part of the original Wolf4SDL source (which includes a non-GPL'd version), but was rather rebased from from a later MAME source which had been relicensed to GPLv2. Change-Id: I64c2ba035e0be7e2f49252f40640641416613439
Diffstat (limited to 'apps/plugins/sdl/progs/wolf3d/id_vl.h')
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_vl.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/wolf3d/id_vl.h b/apps/plugins/sdl/progs/wolf3d/id_vl.h
new file mode 100644
index 0000000000..d4a15f4d46
--- /dev/null
+++ b/apps/plugins/sdl/progs/wolf3d/id_vl.h
@@ -0,0 +1,101 @@
1// ID_VL.H
2
3// wolf compatability
4
5void Quit (const char *error,...);
6
7//===========================================================================
8
9#define CHARWIDTH 2
10#define TILEWIDTH 4
11
12//===========================================================================
13
14extern SDL_Surface *screen, *screenBuffer, *curSurface;
15
16extern boolean fullscreen, usedoublebuffering;
17extern unsigned screenWidth, screenHeight, screenBits, screenPitch, bufferPitch, curPitch;
18extern unsigned scaleFactor;
19
20extern boolean screenfaded;
21extern unsigned bordercolor;
22
23extern SDL_Color gamepal[256];
24
25//===========================================================================
26
27//
28// VGA hardware routines
29//
30
31#define VL_WaitVBL(a) SDL_Delay((a)*8)
32
33void VL_SetVGAPlaneMode (void);
34void VL_SetTextMode (void);
35void VL_Shutdown (void);
36
37void VL_ConvertPalette(byte *srcpal, SDL_Color *destpal, int numColors);
38void VL_FillPalette (int red, int green, int blue);
39void VL_SetColor (int color, int red, int green, int blue);
40void VL_GetColor (int color, int *red, int *green, int *blue);
41void VL_SetPalette (SDL_Color *palette, bool forceupdate);
42void VL_GetPalette (SDL_Color *palette);
43void VL_FadeOut (int start, int end, int red, int green, int blue, int steps);
44void VL_FadeIn (int start, int end, SDL_Color *palette, int steps);
45
46byte *VL_LockSurface(SDL_Surface *surface);
47void VL_UnlockSurface(SDL_Surface *surface);
48
49#define LOCK() VL_LockSurface(curSurface)
50#define UNLOCK() VL_UnlockSurface(curSurface)
51
52byte VL_GetPixel (int x, int y);
53void VL_Plot (int x, int y, int color);
54void VL_Hlin (unsigned x, unsigned y, unsigned width, int color);
55void VL_Vlin (int x, int y, int height, int color);
56void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color);
57inline void VL_Bar (int x, int y, int width, int height, int color)
58{
59 VL_BarScaledCoord(scaleFactor*x, scaleFactor*y,
60 scaleFactor*width, scaleFactor*height, color);
61}
62inline void VL_ClearScreen(int color)
63{
64 SDL_FillRect(curSurface, NULL, color);
65}
66
67void VL_MungePic (byte *source, unsigned width, unsigned height);
68void VL_DrawPicBare (int x, int y, byte *pic, int width, int height);
69void VL_MemToLatch (byte *source, int width, int height,
70 SDL_Surface *destSurface, int x, int y);
71void VL_ScreenToScreen (SDL_Surface *source, SDL_Surface *dest);
72void VL_MemToScreenScaledCoord (byte *source, int width, int height, int scx, int scy);
73void VL_MemToScreenScaledCoord_ex (byte *source, int origwidth, int origheight, int srcx, int srcy,
74 int destx, int desty, int width, int height);
75
76inline void VL_MemToScreen (byte *source, int width, int height, int x, int y)
77{
78 VL_MemToScreenScaledCoord(source, width, height,
79 scaleFactor*x, scaleFactor*y);
80}
81
82void VL_MaskedToScreen (byte *source, int width, int height, int x, int y);
83
84void VL_LatchToScreenScaledCoord (SDL_Surface *source, int xsrc, int ysrc,
85 int width, int height, int scxdest, int scydest);
86
87inline void VL_LatchToScreen (SDL_Surface *source, int xsrc, int ysrc,
88 int width, int height, int xdest, int ydest)
89{
90 VL_LatchToScreenScaledCoord(source,xsrc,ysrc,width,height,
91 scaleFactor*xdest,scaleFactor*ydest);
92}
93inline void VL_LatchToScreenScaledCoord_ez (SDL_Surface *source, int scx, int scy)
94{
95 VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h,scx,scy);
96}
97inline void VL_LatchToScreen_ez (SDL_Surface *source, int x, int y)
98{
99 VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h,
100 scaleFactor*x,scaleFactor*y);
101}