summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/wolf3d/id_pm.h
diff options
context:
space:
mode:
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