summaryrefslogtreecommitdiffstats
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 @@
+#ifndef __ID_PM__
+#define __ID_PM__
+
+#ifdef USE_HIRES
+#define PMPageSize 16384
+#else
+#define PMPageSize 4096
+#endif
+
+extern int ChunksInFile;
+extern int PMSpriteStart;
+extern int PMSoundStart;
+
+extern bool PMSoundInfoPagePadded;
+
+// ChunksInFile+1 pointers to page starts.
+// The last pointer points one byte after the last page.
+extern uint8_t **PMPages;
+
+void PM_Startup();
+void PM_Shutdown();
+
+static uint32_t PM_GetPageSize(int page)
+{
+ if(page < 0 || page >= ChunksInFile)
+ Quit("PM_GetPageSize: Tried to access illegal page: %i", page);
+ return (uint32_t) (PMPages[page + 1] - PMPages[page]);
+}
+
+static uint8_t *PM_GetPage(int page)
+{
+ if(page < 0 || page >= ChunksInFile)
+ Quit("PM_GetPage: Tried to access illegal page: %i", page);
+ return PMPages[page];
+}
+
+static uint8_t *PM_GetEnd()
+{
+ return PMPages[ChunksInFile];
+}
+
+static byte *PM_GetTexture(int wallpic)
+{
+ return PM_GetPage(wallpic);
+}
+
+static uint16_t *PM_GetSprite(int shapenum)
+{
+ // correct alignment is enforced by PM_Startup()
+ return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum);
+}
+
+static byte *PM_GetSound(int soundpagenum)
+{
+ return PM_GetPage(PMSoundStart + soundpagenum);
+}
+
+#endif