summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/wolf3d/id_pm.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_pm.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_pm.h')
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_pm.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/wolf3d/id_pm.h b/apps/plugins/sdl/progs/wolf3d/id_pm.h
new file mode 100644
index 0000000000..bbedb78c78
--- /dev/null
+++ b/apps/plugins/sdl/progs/wolf3d/id_pm.h
@@ -0,0 +1,58 @@
1#ifndef __ID_PM__
2#define __ID_PM__
3
4#ifdef USE_HIRES
5#define PMPageSize 16384
6#else
7#define PMPageSize 4096
8#endif
9
10extern int ChunksInFile;
11extern int PMSpriteStart;
12extern int PMSoundStart;
13
14extern bool PMSoundInfoPagePadded;
15
16// ChunksInFile+1 pointers to page starts.
17// The last pointer points one byte after the last page.
18extern uint8_t **PMPages;
19
20void PM_Startup();
21void PM_Shutdown();
22
23static uint32_t PM_GetPageSize(int page)
24{
25 if(page < 0 || page >= ChunksInFile)
26 Quit("PM_GetPageSize: Tried to access illegal page: %i", page);
27 return (uint32_t) (PMPages[page + 1] - PMPages[page]);
28}
29
30static uint8_t *PM_GetPage(int page)
31{
32 if(page < 0 || page >= ChunksInFile)
33 Quit("PM_GetPage: Tried to access illegal page: %i", page);
34 return PMPages[page];
35}
36
37static uint8_t *PM_GetEnd()
38{
39 return PMPages[ChunksInFile];
40}
41
42static byte *PM_GetTexture(int wallpic)
43{
44 return PM_GetPage(wallpic);
45}
46
47static uint16_t *PM_GetSprite(int shapenum)
48{
49 // correct alignment is enforced by PM_Startup()
50 return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum);
51}
52
53static byte *PM_GetSound(int soundpagenum)
54{
55 return PM_GetPage(PMSoundStart + soundpagenum);
56}
57
58#endif