]> 4ch.mooo.com Git - 16.git/commitdiff
wolf3d 8088 port by king crimsom is added to 16/
authorsparky4 <sparky4@cock.li>
Mon, 25 Jul 2016 16:43:36 +0000 (11:43 -0500)
committersparky4 <sparky4@cock.li>
Mon, 25 Jul 2016 16:43:36 +0000 (11:43 -0500)
109 files changed:
16/wf3d8086.zip [new file with mode: 0755]
16/wf3d8086/audiosdm.h [new file with mode: 0755]
16/wf3d8086/audiosod.h [new file with mode: 0755]
16/wf3d8086/audiowl1.h [new file with mode: 0755]
16/wf3d8086/audiowl6.h [new file with mode: 0755]
16/wf3d8086/budiosod.h [new file with mode: 0755]
16/wf3d8086/budiowl6.h [new file with mode: 0755]
16/wf3d8086/c0.asm [new file with mode: 0755]
16/wf3d8086/contigsc.c [new file with mode: 0755]
16/wf3d8086/detect.c [new file with mode: 0755]
16/wf3d8086/f_spear.h [new file with mode: 0755]
16/wf3d8086/foreign.h [new file with mode: 0755]
16/wf3d8086/gfxe_sod.equ [new file with mode: 0755]
16/wf3d8086/gfxe_sod.h [new file with mode: 0755]
16/wf3d8086/gfxe_wl1.equ [new file with mode: 0755]
16/wf3d8086/gfxe_wl1.h [new file with mode: 0755]
16/wf3d8086/gfxe_wl6.equ [new file with mode: 0755]
16/wf3d8086/gfxe_wl6.h [new file with mode: 0755]
16/wf3d8086/gfxv_sdm.equ [new file with mode: 0755]
16/wf3d8086/gfxv_sdm.h [new file with mode: 0755]
16/wf3d8086/gfxv_sod.equ [new file with mode: 0755]
16/wf3d8086/gfxv_sod.h [new file with mode: 0755]
16/wf3d8086/gfxv_wl1.equ [new file with mode: 0755]
16/wf3d8086/gfxv_wl1.h [new file with mode: 0755]
16/wf3d8086/gfxv_wl6.equ [new file with mode: 0755]
16/wf3d8086/gfxv_wl6.h [new file with mode: 0755]
16/wf3d8086/go.bat [new file with mode: 0755]
16/wf3d8086/goodstuf.txt [new file with mode: 0755]
16/wf3d8086/h_ldiv.asm [new file with mode: 0755]
16/wf3d8086/id_ca.c [new file with mode: 0755]
16/wf3d8086/id_ca.h [new file with mode: 0755]
16/wf3d8086/id_head.h [new file with mode: 0755]
16/wf3d8086/id_heads.h [new file with mode: 0755]
16/wf3d8086/id_in.c [new file with mode: 0755]
16/wf3d8086/id_in.h [new file with mode: 0755]
16/wf3d8086/id_mm.c [new file with mode: 0755]
16/wf3d8086/id_mm.h [new file with mode: 0755]
16/wf3d8086/id_pm.c [new file with mode: 0755]
16/wf3d8086/id_pm.h [new file with mode: 0755]
16/wf3d8086/id_sd.c [new file with mode: 0755]
16/wf3d8086/id_sd.equ [new file with mode: 0755]
16/wf3d8086/id_sd.h [new file with mode: 0755]
16/wf3d8086/id_sd_a.asm [new file with mode: 0755]
16/wf3d8086/id_sd_a.bak [new file with mode: 0755]
16/wf3d8086/id_us.h [new file with mode: 0755]
16/wf3d8086/id_us_1.c [new file with mode: 0755]
16/wf3d8086/id_us_a.asm [new file with mode: 0755]
16/wf3d8086/id_vh.c [new file with mode: 0755]
16/wf3d8086/id_vh.h [new file with mode: 0755]
16/wf3d8086/id_vh_a.asm [new file with mode: 0755]
16/wf3d8086/id_vl.bak [new file with mode: 0755]
16/wf3d8086/id_vl.c [new file with mode: 0755]
16/wf3d8086/id_vl.equ [new file with mode: 0755]
16/wf3d8086/id_vl.h [new file with mode: 0755]
16/wf3d8086/id_vl_a.asm [new file with mode: 0755]
16/wf3d8086/jabhack.asm [new file with mode: 0755]
16/wf3d8086/makefile.wl6 [new file with mode: 0755]
16/wf3d8086/mapssdm.h [new file with mode: 0755]
16/wf3d8086/mapssod.h [new file with mode: 0755]
16/wf3d8086/mapswl1.h [new file with mode: 0755]
16/wf3d8086/mapswl6.h [new file with mode: 0755]
16/wf3d8086/mapswlf.h [new file with mode: 0755]
16/wf3d8086/munge.c [new file with mode: 0755]
16/wf3d8086/obj/wolf3d.exe [new file with mode: 0755]
16/wf3d8086/obj/wolf3d.map [new file with mode: 0755]
16/wf3d8086/oldscale.c [new file with mode: 0755]
16/wf3d8086/piclist.h [new file with mode: 0755]
16/wf3d8086/readme.uso [new file with mode: 0755]
16/wf3d8086/readme/license.doc [new file with mode: 0755]
16/wf3d8086/readme/readme.txt [new file with mode: 0755]
16/wf3d8086/readme/release.txt [new file with mode: 0755]
16/wf3d8086/rules.asi [new file with mode: 0755]
16/wf3d8086/sdmver.h [new file with mode: 0755]
16/wf3d8086/sharemsg.h [new file with mode: 0755]
16/wf3d8086/sodver.h [new file with mode: 0755]
16/wf3d8086/spanish.h [new file with mode: 0755]
16/wf3d8086/spanver.h [new file with mode: 0755]
16/wf3d8086/sv.exe [new file with mode: 0755]
16/wf3d8086/version.h [new file with mode: 0755]
16/wf3d8086/whack_a.asm [new file with mode: 0755]
16/wf3d8086/wl_act1.c [new file with mode: 0755]
16/wf3d8086/wl_act2.c [new file with mode: 0755]
16/wf3d8086/wl_agent.c [new file with mode: 0755]
16/wf3d8086/wl_asm.asm [new file with mode: 0755]
16/wf3d8086/wl_debug.c [new file with mode: 0755]
16/wf3d8086/wl_def.h [new file with mode: 0755]
16/wf3d8086/wl_dr_a.asm [new file with mode: 0755]
16/wf3d8086/wl_draw.c [new file with mode: 0755]
16/wf3d8086/wl_game.c [new file with mode: 0755]
16/wf3d8086/wl_inter.c [new file with mode: 0755]
16/wf3d8086/wl_main.c [new file with mode: 0755]
16/wf3d8086/wl_menu.c [new file with mode: 0755]
16/wf3d8086/wl_menu.h [new file with mode: 0755]
16/wf3d8086/wl_play.c [new file with mode: 0755]
16/wf3d8086/wl_scale.c [new file with mode: 0755]
16/wf3d8086/wl_state.c [new file with mode: 0755]
16/wf3d8086/wl_text.c [new file with mode: 0755]
16/wf3d8086/wlfj1ver.h [new file with mode: 0755]
16/wf3d8086/wolf.ide [new file with mode: 0755]
16/wf3d8086/wolf.obr [new file with mode: 0755]
16/wf3d8086/wolf.~de [new file with mode: 0755]
16/wf3d8086/wolf1ver.h [new file with mode: 0755]
16/wf3d8086/wolf3d.dsk [new file with mode: 0755]
16/wf3d8086/wolf3d.map [new file with mode: 0755]
16/wf3d8086/wolf3d.prj [new file with mode: 0755]
16/wf3d8086/wolfgtv.h [new file with mode: 0755]
16/wf3d8086/wolfhack.c [new file with mode: 0755]
16/wf3d8086/wolfjver.h [new file with mode: 0755]
16/wf3d8086/wolfver.h [new file with mode: 0755]

diff --git a/16/wf3d8086.zip b/16/wf3d8086.zip
new file mode 100755 (executable)
index 0000000..8b46d8f
Binary files /dev/null and b/16/wf3d8086.zip differ
diff --git a/16/wf3d8086/audiosdm.h b/16/wf3d8086/audiosdm.h
new file mode 100755 (executable)
index 0000000..1154646
--- /dev/null
@@ -0,0 +1,142 @@
+/////////////////////////////////////////////////\r
+//\r
+// MUSE Header for .SDM\r
+// Created Thu Aug 27 07:12:39 1992\r
+//\r
+/////////////////////////////////////////////////\r
+\r
+#define NUMSOUNDS              81\r
+#define NUMSNDCHUNKS           267\r
+\r
+//\r
+// Sound names & indexes\r
+//\r
+typedef enum {\r
+               HITWALLSND,              // 0\r
+               MISSILEHITSND,           // 1\r
+               SELECTITEMSND,           // 2\r
+               GHOSTSIGHTSND,           // 3\r
+               MOVEGUN2SND,             // 4\r
+               MOVEGUN1SND,             // 5\r
+               NOWAYSND,                // 6\r
+               NAZIHITPLAYERSND,        // 7\r
+               MISSILEFIRESND,          // 8\r
+               PLAYERDEATHSND,          // 9\r
+               DOGDEATHSND,             // 10\r
+               ATKGATLINGSND,           // 11\r
+               GETKEYSND,               // 12\r
+               NOITEMSND,               // 13\r
+               WALK1SND,                // 14\r
+               WALK2SND,                // 15\r
+               TAKEDAMAGESND,           // 16\r
+               GAMEOVERSND,             // 17\r
+               OPENDOORSND,             // 18\r
+               CLOSEDOORSND,            // 19\r
+               DONOTHINGSND,            // 20\r
+               HALTSND,                 // 21\r
+               DEATHSCREAM2SND,         // 22\r
+               ATKKNIFESND,             // 23\r
+               ATKPISTOLSND,            // 24\r
+               DEATHSCREAM3SND,         // 25\r
+               ATKMACHINEGUNSND,        // 26\r
+               HITENEMYSND,             // 27\r
+               SHOOTDOORSND,            // 28\r
+               DEATHSCREAM1SND,         // 29\r
+               GETMACHINESND,           // 30\r
+               GETAMMOSND,              // 31\r
+               SHOOTSND,                // 32\r
+               HEALTH1SND,              // 33\r
+               HEALTH2SND,              // 34\r
+               BONUS1SND,               // 35\r
+               BONUS2SND,               // 36\r
+               BONUS3SND,               // 37\r
+               GETGATLINGSND,           // 38\r
+               ESCPRESSEDSND,           // 39\r
+               LEVELDONESND,            // 40\r
+               DOGBARKSND,              // 41\r
+               ENDBONUS1SND,            // 42\r
+               ENDBONUS2SND,            // 43\r
+               BONUS1UPSND,             // 44\r
+               BONUS4SND,               // 45\r
+               PUSHWALLSND,             // 46\r
+               NOBONUSSND,              // 47\r
+               PERCENT100SND,           // 48\r
+               BOSSACTIVESND,           // 49\r
+               DEATHSCREAM4SND,         // 50\r
+               SCHUTZADSND,             // 51\r
+               AHHHGSND,                // 52\r
+               DEATHSCREAM5SND,         // 53\r
+               DEATHSCREAM7SND,         // 54\r
+               DEATHSCREAM8SND,         // 55\r
+               LEBENSND,                // 56\r
+               DEATHSCREAM6SND,         // 57\r
+               NAZIFIRESND,             // 58\r
+               BOSSFIRESND,             // 59\r
+               SSFIRESND,               // 60\r
+               SLURPIESND,              // 61\r
+               GHOSTFADESND,            // 62\r
+               DEATHSCREAM9SND,         // 63\r
+               GETAMMOBOXSND,           // 64\r
+               ANGELSIGHTSND,           // 65\r
+               SPIONSND,                // 66\r
+               NEINSOVASSND,            // 67\r
+               DOGATTACKSND,            // 68\r
+               ANGELFIRESND,            // 69\r
+               TRANSSIGHTSND,           // 70\r
+               TRANSDEATHSND,           // 71\r
+               WILHELMSIGHTSND,         // 72\r
+               WILHELMDEATHSND,         // 73\r
+               UBERDEATHSND,            // 74\r
+               KNIGHTSIGHTSND,          // 75\r
+               KNIGHTDEATHSND,          // 76\r
+               ANGELDEATHSND,           // 77\r
+               KNIGHTMISSILESND,        // 78\r
+               GETSPEARSND,             // 79\r
+               ANGELTIREDSND,           // 80\r
+               LASTSOUND\r
+            } soundnames;\r
+\r
+//\r
+// Base offsets\r
+//\r
+#define STARTPCSOUNDS          0\r
+#define STARTADLIBSOUNDS       81\r
+#define STARTDIGISOUNDS                162\r
+#define STARTMUSIC             243\r
+\r
+//\r
+// Music names & indexes\r
+//\r
+typedef enum {\r
+               XFUNKIE_MUS,             // 0\r
+               DUNGEON_MUS,             // 1\r
+               XDEATH_MUS,              // 2\r
+               GETTHEM_MUS,             // 3\r
+               XTIPTOE_MUS,             // 4\r
+               GOINGAFT_MUS,            // 5\r
+               URAHERO_MUS,             // 6\r
+               XTHEEND_MUS,             // 7\r
+               NAZI_OMI_MUS,            // 8\r
+               POW_MUS,                 // 9\r
+               TWELFTH_MUS,             // 10\r
+               SEARCHN_MUS,             // 11\r
+               SUSPENSE_MUS,            // 12\r
+               ZEROHOUR_MUS,            // 13\r
+               WONDERIN_MUS,            // 14\r
+               ULTIMATE_MUS,            // 15\r
+               ENDLEVEL_MUS,            // 16\r
+               XEVIL_MUS,               // 17\r
+               XJAZNAZI_MUS,            // 18\r
+               COPYPRO_MUS,             // 19\r
+               XAWARD_MUS,              // 20\r
+               XPUTIT_MUS,              // 21\r
+               XGETYOU_MUS,             // 22\r
+               XTOWER2_MUS,             // 23\r
+               LASTMUSIC\r
+            } musicnames;\r
+\r
+/////////////////////////////////////////////////\r
+//\r
+// Thanks for playing with MUSE!\r
+//\r
+/////////////////////////////////////////////////\r
diff --git a/16/wf3d8086/audiosod.h b/16/wf3d8086/audiosod.h
new file mode 100755 (executable)
index 0000000..543e2c1
--- /dev/null
@@ -0,0 +1,142 @@
+/////////////////////////////////////////////////\r
+//\r
+// MUSE Header for .SOD\r
+// Created Thu Aug 13 09:25:58 1992\r
+//\r
+/////////////////////////////////////////////////\r
+\r
+#define NUMSOUNDS              81\r
+#define NUMSNDCHUNKS           267\r
+\r
+//\r
+// Sound names & indexes\r
+//\r
+typedef enum {\r
+               HITWALLSND,              // 0\r
+               MISSILEHITSND,           // 1\r
+               SELECTITEMSND,           // 2\r
+               GHOSTSIGHTSND,           // 3\r
+               MOVEGUN2SND,             // 4\r
+               MOVEGUN1SND,             // 5\r
+               NOWAYSND,                // 6\r
+               NAZIHITPLAYERSND,        // 7\r
+               MISSILEFIRESND,          // 8\r
+               PLAYERDEATHSND,          // 9\r
+               DOGDEATHSND,             // 10\r
+               ATKGATLINGSND,           // 11\r
+               GETKEYSND,               // 12\r
+               NOITEMSND,               // 13\r
+               WALK1SND,                // 14\r
+               WALK2SND,                // 15\r
+               TAKEDAMAGESND,           // 16\r
+               GAMEOVERSND,             // 17\r
+               OPENDOORSND,             // 18\r
+               CLOSEDOORSND,            // 19\r
+               DONOTHINGSND,            // 20\r
+               HALTSND,                 // 21\r
+               DEATHSCREAM2SND,         // 22\r
+               ATKKNIFESND,             // 23\r
+               ATKPISTOLSND,            // 24\r
+               DEATHSCREAM3SND,         // 25\r
+               ATKMACHINEGUNSND,        // 26\r
+               HITENEMYSND,             // 27\r
+               SHOOTDOORSND,            // 28\r
+               DEATHSCREAM1SND,         // 29\r
+               GETMACHINESND,           // 30\r
+               GETAMMOSND,              // 31\r
+               SHOOTSND,                // 32\r
+               HEALTH1SND,              // 33\r
+               HEALTH2SND,              // 34\r
+               BONUS1SND,               // 35\r
+               BONUS2SND,               // 36\r
+               BONUS3SND,               // 37\r
+               GETGATLINGSND,           // 38\r
+               ESCPRESSEDSND,           // 39\r
+               LEVELDONESND,            // 40\r
+               DOGBARKSND,              // 41\r
+               ENDBONUS1SND,            // 42\r
+               ENDBONUS2SND,            // 43\r
+               BONUS1UPSND,             // 44\r
+               BONUS4SND,               // 45\r
+               PUSHWALLSND,             // 46\r
+               NOBONUSSND,              // 47\r
+               PERCENT100SND,           // 48\r
+               BOSSACTIVESND,           // 49\r
+               DEATHSCREAM4SND,         // 50\r
+               SCHUTZADSND,             // 51\r
+               AHHHGSND,                // 52\r
+               DEATHSCREAM5SND,         // 53\r
+               DEATHSCREAM7SND,         // 54\r
+               DEATHSCREAM8SND,         // 55\r
+               LEBENSND,                // 56\r
+               DEATHSCREAM6SND,         // 57\r
+               NAZIFIRESND,             // 58\r
+               BOSSFIRESND,             // 59\r
+               SSFIRESND,               // 60\r
+               SLURPIESND,              // 61\r
+               GHOSTFADESND,            // 62\r
+               DEATHSCREAM9SND,         // 63\r
+               GETAMMOBOXSND,           // 64\r
+               ANGELSIGHTSND,           // 65\r
+               SPIONSND,                // 66\r
+               NEINSOVASSND,            // 67\r
+               DOGATTACKSND,            // 68\r
+               ANGELFIRESND,            // 69\r
+               TRANSSIGHTSND,           // 70\r
+               TRANSDEATHSND,           // 71\r
+               WILHELMSIGHTSND,         // 72\r
+               WILHELMDEATHSND,         // 73\r
+               UBERDEATHSND,            // 74\r
+               KNIGHTSIGHTSND,          // 75\r
+               KNIGHTDEATHSND,          // 76\r
+               ANGELDEATHSND,           // 77\r
+               KNIGHTMISSILESND,        // 78\r
+               GETSPEARSND,             // 79\r
+               ANGELTIREDSND,           // 80\r
+               LASTSOUND\r
+            } soundnames;\r
+\r
+//\r
+// Base offsets\r
+//\r
+#define STARTPCSOUNDS          0\r
+#define STARTADLIBSOUNDS       81\r
+#define STARTDIGISOUNDS                162\r
+#define STARTMUSIC             243\r
+\r
+//\r
+// Music names & indexes\r
+//\r
+typedef enum {\r
+               XFUNKIE_MUS,             // 0\r
+               DUNGEON_MUS,             // 1\r
+               XDEATH_MUS,              // 2\r
+               GETTHEM_MUS,             // 3\r
+               XTIPTOE_MUS,             // 4\r
+               GOINGAFT_MUS,            // 5\r
+               URAHERO_MUS,             // 6\r
+               XTHEEND_MUS,             // 7\r
+               NAZI_OMI_MUS,            // 8\r
+               POW_MUS,                 // 9\r
+               TWELFTH_MUS,             // 10\r
+               SEARCHN_MUS,             // 11\r
+               SUSPENSE_MUS,            // 12\r
+               ZEROHOUR_MUS,            // 13\r
+               WONDERIN_MUS,            // 14\r
+               ULTIMATE_MUS,            // 15\r
+               ENDLEVEL_MUS,            // 16\r
+               XEVIL_MUS,               // 17\r
+               XJAZNAZI_MUS,            // 18\r
+               COPYPRO_MUS,             // 19\r
+               XAWARD_MUS,              // 20\r
+               XPUTIT_MUS,              // 21\r
+               XGETYOU_MUS,             // 22\r
+               XTOWER2_MUS,             // 23\r
+               LASTMUSIC\r
+            } musicnames;\r
+\r
+/////////////////////////////////////////////////\r
+//\r
+// Thanks for playing with MUSE!\r
+//\r
+/////////////////////////////////////////////////\r
diff --git a/16/wf3d8086/audiowl1.h b/16/wf3d8086/audiowl1.h
new file mode 100755 (executable)
index 0000000..7ce44c0
--- /dev/null
@@ -0,0 +1,133 @@
+/////////////////////////////////////////////////\r
+//\r
+// MUSE Header for .WL1\r
+// Created Tue Apr 28 23:57:08 1992\r
+//\r
+/////////////////////////////////////////////////\r
+\r
+#define NUMSOUNDS              69\r
+#define NUMSNDCHUNKS           234\r
+\r
+//\r
+// Sound names & indexes\r
+//\r
+typedef enum {\r
+               HITWALLSND,              // 0\r
+               SELECTWPNSND,            // 1\r
+               SELECTITEMSND,           // 2\r
+               HEARTBEATSND,            // 3\r
+               MOVEGUN2SND,             // 4\r
+               MOVEGUN1SND,             // 5\r
+               NOWAYSND,                // 6\r
+               NAZIHITPLAYERSND,        // 7\r
+               NAZIMISSSND,             // 8\r
+               PLAYERDEATHSND,          // 9\r
+               DOGDEATHSND,             // 10\r
+               ATKGATLINGSND,           // 11\r
+               GETKEYSND,               // 12\r
+               NOITEMSND,               // 13\r
+               WALK1SND,                // 14\r
+               WALK2SND,                // 15\r
+               TAKEDAMAGESND,           // 16\r
+               GAMEOVERSND,             // 17\r
+               OPENDOORSND,             // 18\r
+               CLOSEDOORSND,            // 19\r
+               DONOTHINGSND,            // 20\r
+               HALTSND,                 // 21\r
+               DEATHSCREAM2SND,         // 22\r
+               ATKKNIFESND,             // 23\r
+               ATKPISTOLSND,            // 24\r
+               DEATHSCREAM3SND,         // 25\r
+               ATKMACHINEGUNSND,        // 26\r
+               HITENEMYSND,             // 27\r
+               SHOOTDOORSND,            // 28\r
+               DEATHSCREAM1SND,         // 29\r
+               GETMACHINESND,           // 30\r
+               GETAMMOSND,              // 31\r
+               SHOOTSND,                // 32\r
+               HEALTH1SND,              // 33\r
+               HEALTH2SND,              // 34\r
+               BONUS1SND,               // 35\r
+               BONUS2SND,               // 36\r
+               BONUS3SND,               // 37\r
+               GETGATLINGSND,           // 38\r
+               ESCPRESSEDSND,           // 39\r
+               LEVELDONESND,            // 40\r
+               DOGBARKSND,              // 41\r
+               ENDBONUS1SND,            // 42\r
+               ENDBONUS2SND,            // 43\r
+               BONUS1UPSND,             // 44\r
+               BONUS4SND,               // 45\r
+               PUSHWALLSND,             // 46\r
+               NOBONUSSND,              // 47\r
+               PERCENT100SND,           // 48\r
+               BOSSACTIVESND,           // 49\r
+               BOSSDIESSND,             // 50\r
+               SCHUTZADSND,             // 51\r
+               AHHHGSND,                // 52\r
+               DIESND,                  // 53\r
+               EVASND,                  // 54\r
+               GUTENTAGSND,             // 55\r
+               LEBENSND,                // 56\r
+               MUTTISND,                // 57\r
+               NAZIFIRESND,             // 58\r
+               BOSSFIRESND,             // 59\r
+               SSFIRESND,               // 60\r
+               SLURPIESND,              // 61\r
+               TOT_HUNDSND,             // 62\r
+               MEINGOTTSND,             // 63\r
+               SCHABBSHASND,            // 64\r
+               HILTERHASND,             // 65\r
+               SPIONSND,                // 66\r
+               NEINSOVASSND,            // 67\r
+               DOGATTACKSND,            // 68\r
+               LASTSOUND\r
+            } soundnames;\r
+\r
+//\r
+// Base offsets\r
+//\r
+#define STARTPCSOUNDS          0\r
+#define STARTADLIBSOUNDS       69\r
+#define STARTDIGISOUNDS                138\r
+#define STARTMUSIC             207\r
+\r
+//\r
+// Music names & indexes\r
+//\r
+typedef enum {\r
+               CORNER_MUS,              // 0\r
+               DUNGEON_MUS,             // 1\r
+               GETOUT_MUS,              // 2\r
+               GETTHEM_MUS,             // 3\r
+               HEADACHE_MUS,            // 4\r
+               HITLWLTZ_MUS,            // 5\r
+               INTROCW3_MUS,            // 6\r
+               NAZI_NOR_MUS,            // 7\r
+               NAZI_OMI_MUS,            // 8\r
+               POW_MUS,                 // 9\r
+               SALUTE_MUS,              // 10\r
+               SEARCHN_MUS,             // 11\r
+               SUSPENSE_MUS,            // 12\r
+               VICTORS_MUS,             // 13\r
+               WONDERIN_MUS,            // 14\r
+               FUNKYOU_MUS,             // 15\r
+               ENDLEVEL_MUS,            // 16\r
+               GOINGAFT_MUS,            // 17\r
+               PREGNANT_MUS,            // 18\r
+               ULTIMATE_MUS,            // 19\r
+               NAZI_RAP_MUS,            // 20\r
+               ZEROHOUR_MUS,            // 21\r
+               TWELFTH_MUS,             // 22\r
+               ROSTER_MUS,              // 23\r
+               URAHERO_MUS,             // 24\r
+               VICMARCH_MUS,            // 25\r
+               WARMRCH1_MUS,            // 26\r
+               LASTMUSIC\r
+            } musicnames;\r
+\r
+/////////////////////////////////////////////////\r
+//\r
+// Thanks for playing with MUSE!\r
+//\r
+/////////////////////////////////////////////////\r
diff --git a/16/wf3d8086/audiowl6.h b/16/wf3d8086/audiowl6.h
new file mode 100755 (executable)
index 0000000..3cb747b
--- /dev/null
@@ -0,0 +1,151 @@
+/////////////////////////////////////////////////\r
+//\r
+// MUSE Header for .WL6\r
+// Created Tue Jul 14 15:04:53 1992\r
+//\r
+/////////////////////////////////////////////////\r
+\r
+#define NUMSOUNDS              87\r
+#define NUMSNDCHUNKS           288\r
+\r
+//\r
+// Sound names & indexes\r
+//\r
+typedef enum {\r
+               HITWALLSND,              // 0\r
+               SELECTWPNSND,            // 1\r
+               SELECTITEMSND,           // 2\r
+               HEARTBEATSND,            // 3\r
+               MOVEGUN2SND,             // 4\r
+               MOVEGUN1SND,             // 5\r
+               NOWAYSND,                // 6\r
+               NAZIHITPLAYERSND,        // 7\r
+               SCHABBSTHROWSND,         // 8\r
+               PLAYERDEATHSND,          // 9\r
+               DOGDEATHSND,             // 10\r
+               ATKGATLINGSND,           // 11\r
+               GETKEYSND,               // 12\r
+               NOITEMSND,               // 13\r
+               WALK1SND,                // 14\r
+               WALK2SND,                // 15\r
+               TAKEDAMAGESND,           // 16\r
+               GAMEOVERSND,             // 17\r
+               OPENDOORSND,             // 18\r
+               CLOSEDOORSND,            // 19\r
+               DONOTHINGSND,            // 20\r
+               HALTSND,                 // 21\r
+               DEATHSCREAM2SND,         // 22\r
+               ATKKNIFESND,             // 23\r
+               ATKPISTOLSND,            // 24\r
+               DEATHSCREAM3SND,         // 25\r
+               ATKMACHINEGUNSND,        // 26\r
+               HITENEMYSND,             // 27\r
+               SHOOTDOORSND,            // 28\r
+               DEATHSCREAM1SND,         // 29\r
+               GETMACHINESND,           // 30\r
+               GETAMMOSND,              // 31\r
+               SHOOTSND,                // 32\r
+               HEALTH1SND,              // 33\r
+               HEALTH2SND,              // 34\r
+               BONUS1SND,               // 35\r
+               BONUS2SND,               // 36\r
+               BONUS3SND,               // 37\r
+               GETGATLINGSND,           // 38\r
+               ESCPRESSEDSND,           // 39\r
+               LEVELDONESND,            // 40\r
+               DOGBARKSND,              // 41\r
+               ENDBONUS1SND,            // 42\r
+               ENDBONUS2SND,            // 43\r
+               BONUS1UPSND,             // 44\r
+               BONUS4SND,               // 45\r
+               PUSHWALLSND,             // 46\r
+               NOBONUSSND,              // 47\r
+               PERCENT100SND,           // 48\r
+               BOSSACTIVESND,           // 49\r
+               MUTTISND,                // 50\r
+               SCHUTZADSND,             // 51\r
+               AHHHGSND,                // 52\r
+               DIESND,                  // 53\r
+               EVASND,                  // 54\r
+               GUTENTAGSND,             // 55\r
+               LEBENSND,                // 56\r
+               SCHEISTSND,              // 57\r
+               NAZIFIRESND,             // 58\r
+               BOSSFIRESND,             // 59\r
+               SSFIRESND,               // 60\r
+               SLURPIESND,              // 61\r
+               TOT_HUNDSND,             // 62\r
+               MEINGOTTSND,             // 63\r
+               SCHABBSHASND,            // 64\r
+               HITLERHASND,             // 65\r
+               SPIONSND,                // 66\r
+               NEINSOVASSND,            // 67\r
+               DOGATTACKSND,            // 68\r
+               FLAMETHROWERSND,         // 69\r
+               MECHSTEPSND,             // 70\r
+               GOOBSSND,                // 71\r
+               YEAHSND,                 // 72\r
+               DEATHSCREAM4SND,         // 73\r
+               DEATHSCREAM5SND,         // 74\r
+               DEATHSCREAM6SND,         // 75\r
+               DEATHSCREAM7SND,         // 76\r
+               DEATHSCREAM8SND,         // 77\r
+               DEATHSCREAM9SND,         // 78\r
+               DONNERSND,               // 79\r
+               EINESND,                 // 80\r
+               ERLAUBENSND,             // 81\r
+               KEINSND,                 // 82\r
+               MEINSND,                 // 83\r
+               ROSESND,                 // 84\r
+               MISSILEFIRESND,          // 85\r
+               MISSILEHITSND,           // 86\r
+               LASTSOUND\r
+            } soundnames;\r
+\r
+//\r
+// Base offsets\r
+//\r
+#define STARTPCSOUNDS          0\r
+#define STARTADLIBSOUNDS       87\r
+#define STARTDIGISOUNDS                174\r
+#define STARTMUSIC             261\r
+\r
+//\r
+// Music names & indexes\r
+//\r
+typedef enum {\r
+               CORNER_MUS,              // 0\r
+               DUNGEON_MUS,             // 1\r
+               WARMARCH_MUS,            // 2\r
+               GETTHEM_MUS,             // 3\r
+               HEADACHE_MUS,            // 4\r
+               HITLWLTZ_MUS,            // 5\r
+               INTROCW3_MUS,            // 6\r
+               NAZI_NOR_MUS,            // 7\r
+               NAZI_OMI_MUS,            // 8\r
+               POW_MUS,                 // 9\r
+               SALUTE_MUS,              // 10\r
+               SEARCHN_MUS,             // 11\r
+               SUSPENSE_MUS,            // 12\r
+               VICTORS_MUS,             // 13\r
+               WONDERIN_MUS,            // 14\r
+               FUNKYOU_MUS,             // 15\r
+               ENDLEVEL_MUS,            // 16\r
+               GOINGAFT_MUS,            // 17\r
+               PREGNANT_MUS,            // 18\r
+               ULTIMATE_MUS,            // 19\r
+               NAZI_RAP_MUS,            // 20\r
+               ZEROHOUR_MUS,            // 21\r
+               TWELFTH_MUS,             // 22\r
+               ROSTER_MUS,              // 23\r
+               URAHERO_MUS,             // 24\r
+               VICMARCH_MUS,            // 25\r
+               PACMAN_MUS,              // 26\r
+               LASTMUSIC\r
+            } musicnames;\r
+\r
+/////////////////////////////////////////////////\r
+//\r
+// Thanks for playing with MUSE!\r
+//\r
+/////////////////////////////////////////////////\r
diff --git a/16/wf3d8086/budiosod.h b/16/wf3d8086/budiosod.h
new file mode 100755 (executable)
index 0000000..543e2c1
--- /dev/null
@@ -0,0 +1,142 @@
+/////////////////////////////////////////////////\r
+//\r
+// MUSE Header for .SOD\r
+// Created Thu Aug 13 09:25:58 1992\r
+//\r
+/////////////////////////////////////////////////\r
+\r
+#define NUMSOUNDS              81\r
+#define NUMSNDCHUNKS           267\r
+\r
+//\r
+// Sound names & indexes\r
+//\r
+typedef enum {\r
+               HITWALLSND,              // 0\r
+               MISSILEHITSND,           // 1\r
+               SELECTITEMSND,           // 2\r
+               GHOSTSIGHTSND,           // 3\r
+               MOVEGUN2SND,             // 4\r
+               MOVEGUN1SND,             // 5\r
+               NOWAYSND,                // 6\r
+               NAZIHITPLAYERSND,        // 7\r
+               MISSILEFIRESND,          // 8\r
+               PLAYERDEATHSND,          // 9\r
+               DOGDEATHSND,             // 10\r
+               ATKGATLINGSND,           // 11\r
+               GETKEYSND,               // 12\r
+               NOITEMSND,               // 13\r
+               WALK1SND,                // 14\r
+               WALK2SND,                // 15\r
+               TAKEDAMAGESND,           // 16\r
+               GAMEOVERSND,             // 17\r
+               OPENDOORSND,             // 18\r
+               CLOSEDOORSND,            // 19\r
+               DONOTHINGSND,            // 20\r
+               HALTSND,                 // 21\r
+               DEATHSCREAM2SND,         // 22\r
+               ATKKNIFESND,             // 23\r
+               ATKPISTOLSND,            // 24\r
+               DEATHSCREAM3SND,         // 25\r
+               ATKMACHINEGUNSND,        // 26\r
+               HITENEMYSND,             // 27\r
+               SHOOTDOORSND,            // 28\r
+               DEATHSCREAM1SND,         // 29\r
+               GETMACHINESND,           // 30\r
+               GETAMMOSND,              // 31\r
+               SHOOTSND,                // 32\r
+               HEALTH1SND,              // 33\r
+               HEALTH2SND,              // 34\r
+               BONUS1SND,               // 35\r
+               BONUS2SND,               // 36\r
+               BONUS3SND,               // 37\r
+               GETGATLINGSND,           // 38\r
+               ESCPRESSEDSND,           // 39\r
+               LEVELDONESND,            // 40\r
+               DOGBARKSND,              // 41\r
+               ENDBONUS1SND,            // 42\r
+               ENDBONUS2SND,            // 43\r
+               BONUS1UPSND,             // 44\r
+               BONUS4SND,               // 45\r
+               PUSHWALLSND,             // 46\r
+               NOBONUSSND,              // 47\r
+               PERCENT100SND,           // 48\r
+               BOSSACTIVESND,           // 49\r
+               DEATHSCREAM4SND,         // 50\r
+               SCHUTZADSND,             // 51\r
+               AHHHGSND,                // 52\r
+               DEATHSCREAM5SND,         // 53\r
+               DEATHSCREAM7SND,         // 54\r
+               DEATHSCREAM8SND,         // 55\r
+               LEBENSND,                // 56\r
+               DEATHSCREAM6SND,         // 57\r
+               NAZIFIRESND,             // 58\r
+               BOSSFIRESND,             // 59\r
+               SSFIRESND,               // 60\r
+               SLURPIESND,              // 61\r
+               GHOSTFADESND,            // 62\r
+               DEATHSCREAM9SND,         // 63\r
+               GETAMMOBOXSND,           // 64\r
+               ANGELSIGHTSND,           // 65\r
+               SPIONSND,                // 66\r
+               NEINSOVASSND,            // 67\r
+               DOGATTACKSND,            // 68\r
+               ANGELFIRESND,            // 69\r
+               TRANSSIGHTSND,           // 70\r
+               TRANSDEATHSND,           // 71\r
+               WILHELMSIGHTSND,         // 72\r
+               WILHELMDEATHSND,         // 73\r
+               UBERDEATHSND,            // 74\r
+               KNIGHTSIGHTSND,          // 75\r
+               KNIGHTDEATHSND,          // 76\r
+               ANGELDEATHSND,           // 77\r
+               KNIGHTMISSILESND,        // 78\r
+               GETSPEARSND,             // 79\r
+               ANGELTIREDSND,           // 80\r
+               LASTSOUND\r
+            } soundnames;\r
+\r
+//\r
+// Base offsets\r
+//\r
+#define STARTPCSOUNDS          0\r
+#define STARTADLIBSOUNDS       81\r
+#define STARTDIGISOUNDS                162\r
+#define STARTMUSIC             243\r
+\r
+//\r
+// Music names & indexes\r
+//\r
+typedef enum {\r
+               XFUNKIE_MUS,             // 0\r
+               DUNGEON_MUS,             // 1\r
+               XDEATH_MUS,              // 2\r
+               GETTHEM_MUS,             // 3\r
+               XTIPTOE_MUS,             // 4\r
+               GOINGAFT_MUS,            // 5\r
+               URAHERO_MUS,             // 6\r
+               XTHEEND_MUS,             // 7\r
+               NAZI_OMI_MUS,            // 8\r
+               POW_MUS,                 // 9\r
+               TWELFTH_MUS,             // 10\r
+               SEARCHN_MUS,             // 11\r
+               SUSPENSE_MUS,            // 12\r
+               ZEROHOUR_MUS,            // 13\r
+               WONDERIN_MUS,            // 14\r
+               ULTIMATE_MUS,            // 15\r
+               ENDLEVEL_MUS,            // 16\r
+               XEVIL_MUS,               // 17\r
+               XJAZNAZI_MUS,            // 18\r
+               COPYPRO_MUS,             // 19\r
+               XAWARD_MUS,              // 20\r
+               XPUTIT_MUS,              // 21\r
+               XGETYOU_MUS,             // 22\r
+               XTOWER2_MUS,             // 23\r
+               LASTMUSIC\r
+            } musicnames;\r
+\r
+/////////////////////////////////////////////////\r
+//\r
+// Thanks for playing with MUSE!\r
+//\r
+/////////////////////////////////////////////////\r
diff --git a/16/wf3d8086/budiowl6.h b/16/wf3d8086/budiowl6.h
new file mode 100755 (executable)
index 0000000..9cd66ca
--- /dev/null
@@ -0,0 +1,151 @@
+/////////////////////////////////////////////////\r
+//\r
+// MUSE Header for .WL6\r
+// Created Sat May 30 18:41:31 1992\r
+//\r
+/////////////////////////////////////////////////\r
+\r
+#define NUMSOUNDS              87\r
+#define NUMSNDCHUNKS           288\r
+\r
+//\r
+// Sound names & indexes\r
+//\r
+typedef enum {\r
+               HITWALLSND,              // 0\r
+               SELECTWPNSND,            // 1\r
+               SELECTITEMSND,           // 2\r
+               HEARTBEATSND,            // 3\r
+               MOVEGUN2SND,             // 4\r
+               MOVEGUN1SND,             // 5\r
+               NOWAYSND,                // 6\r
+               NAZIHITPLAYERSND,        // 7\r
+               SCHABBSTHROWSND,         // 8\r
+               PLAYERDEATHSND,          // 9\r
+               DOGDEATHSND,             // 10\r
+               ATKGATLINGSND,           // 11\r
+               GETKEYSND,               // 12\r
+               NOITEMSND,               // 13\r
+               WALK1SND,                // 14\r
+               WALK2SND,                // 15\r
+               TAKEDAMAGESND,           // 16\r
+               GAMEOVERSND,             // 17\r
+               OPENDOORSND,             // 18\r
+               CLOSEDOORSND,            // 19\r
+               DONOTHINGSND,            // 20\r
+               HALTSND,                 // 21\r
+               DEATHSCREAM2SND,         // 22\r
+               ATKKNIFESND,             // 23\r
+               ATKPISTOLSND,            // 24\r
+               DEATHSCREAM3SND,         // 25\r
+               ATKMACHINEGUNSND,        // 26\r
+               HITENEMYSND,             // 27\r
+               SHOOTDOORSND,            // 28\r
+               DEATHSCREAM1SND,         // 29\r
+               GETMACHINESND,           // 30\r
+               GETAMMOSND,              // 31\r
+               SHOOTSND,                // 32\r
+               HEALTH1SND,              // 33\r
+               HEALTH2SND,              // 34\r
+               BONUS1SND,               // 35\r
+               BONUS2SND,               // 36\r
+               BONUS3SND,               // 37\r
+               GETGATLINGSND,           // 38\r
+               ESCPRESSEDSND,           // 39\r
+               LEVELDONESND,            // 40\r
+               DOGBARKSND,              // 41\r
+               ENDBONUS1SND,            // 42\r
+               ENDBONUS2SND,            // 43\r
+               BONUS1UPSND,             // 44\r
+               BONUS4SND,               // 45\r
+               PUSHWALLSND,             // 46\r
+               NOBONUSSND,              // 47\r
+               PERCENT100SND,           // 48\r
+               BOSSACTIVESND,           // 49\r
+               MUTTISND,                // 50\r
+               SCHUTZADSND,             // 51\r
+               AHHHGSND,                // 52\r
+               DIESND,                  // 53\r
+               EVASND,                  // 54\r
+               GUTENTAGSND,             // 55\r
+               LEBENSND,                // 56\r
+               SCHEISTSND,              // 57\r
+               NAZIFIRESND,             // 58\r
+               BOSSFIRESND,             // 59\r
+               SSFIRESND,               // 60\r
+               SLURPIESND,              // 61\r
+               TOT_HUNDSND,             // 62\r
+               MEINGOTTSND,             // 63\r
+               SCHABBSHASND,            // 64\r
+               HITLERHASND,             // 65\r
+               SPIONSND,                // 66\r
+               NEINSOVASSND,            // 67\r
+               DOGATTACKSND,            // 68\r
+               FLAMETHROWERSND,         // 69\r
+               MECHSTEPSND,             // 70\r
+               GOOBSSND,                // 71\r
+               YEAHSND,                 // 72\r
+               DEATHSCREAM4SND,         // 73\r
+               DEATHSCREAM5SND,         // 74\r
+               DEATHSCREAM6SND,         // 75\r
+               DEATHSCREAM7SND,         // 76\r
+               DEATHSCREAM8SND,         // 77\r
+               DEATHSCREAM9SND,         // 78\r
+               DONNERSND,               // 79\r
+               EINESND,                 // 80\r
+               ERLAUBENSND,             // 81\r
+               KEINSND,                 // 82\r
+               MEINSND,                 // 83\r
+               ROSESND,                 // 84\r
+               MISSILEFIRESND,          // 85\r
+               MISSILEHITSND,           // 86\r
+               LASTSOUND\r
+            } soundnames;\r
+\r
+//\r
+// Base offsets\r
+//\r
+#define STARTPCSOUNDS          0\r
+#define STARTADLIBSOUNDS       87\r
+#define STARTDIGISOUNDS                174\r
+#define STARTMUSIC             261\r
+\r
+//\r
+// Music names & indexes\r
+//\r
+typedef enum {\r
+               CORNER_MUS,              // 0\r
+               DUNGEON_MUS,             // 1\r
+               WARMARCH_MUS,            // 2\r
+               GETTHEM_MUS,             // 3\r
+               HEADACHE_MUS,            // 4\r
+               HITLWLTZ_MUS,            // 5\r
+               INTROCW3_MUS,            // 6\r
+               NAZI_NOR_MUS,            // 7\r
+               NAZI_OMI_MUS,            // 8\r
+               POW_MUS,                 // 9\r
+               SALUTE_MUS,              // 10\r
+               SEARCHN_MUS,             // 11\r
+               SUSPENSE_MUS,            // 12\r
+               VICTORS_MUS,             // 13\r
+               WONDERIN_MUS,            // 14\r
+               FUNKYOU_MUS,             // 15\r
+               ENDLEVEL_MUS,            // 16\r
+               GOINGAFT_MUS,            // 17\r
+               PREGNANT_MUS,            // 18\r
+               ULTIMATE_MUS,            // 19\r
+               NAZI_RAP_MUS,            // 20\r
+               ZEROHOUR_MUS,            // 21\r
+               TWELFTH_MUS,             // 22\r
+               ROSTER_MUS,              // 23\r
+               URAHERO_MUS,             // 24\r
+               VICMARCH_MUS,            // 25\r
+               PACMAN_MUS,              // 26\r
+               LASTMUSIC\r
+            } musicnames;\r
+\r
+/////////////////////////////////////////////////\r
+//\r
+// Thanks for playing with MUSE!\r
+//\r
+/////////////////////////////////////////////////\r
diff --git a/16/wf3d8086/c0.asm b/16/wf3d8086/c0.asm
new file mode 100755 (executable)
index 0000000..f93f921
--- /dev/null
@@ -0,0 +1,843 @@
+        NAME    c0\r
+        PAGE    60,132\r
+        LOCALS\r
+;[]------------------------------------------------------------[]\r
+;|      C0.ASM -- Start Up Code                                 |\r
+;|                                                              |\r
+;|      Turbo C++ Run Time Library                              |\r
+;|                                                              |\r
+;|      Copyright (c) 1987, 1991 by Borland International Inc.  |\r
+;|      All Rights Reserved.                                    |\r
+;[]------------------------------------------------------------[]\r
+\r
+                __C0__ = 1\r
+INCLUDE         RULES.ASI\r
+\r
+;       Segment and Group declarations\r
+\r
+_TEXT           SEGMENT BYTE PUBLIC 'CODE'\r
+                ENDS\r
+_FARDATA        SEGMENT PARA PUBLIC 'FAR_DATA'\r
+                ENDS\r
+_FARBSS         SEGMENT PARA PUBLIC 'FAR_BSS'\r
+                ENDS\r
+IFNDEF __TINY__\r
+_OVERLAY_       SEGMENT PARA PUBLIC 'OVRINFO'\r
+        ENDS\r
+_1STUB_     SEGMENT PARA PUBLIC 'STUBSEG'\r
+        ENDS\r
+ENDIF\r
+_DATA           SEGMENT PARA PUBLIC 'DATA'\r
+                ENDS\r
+_INIT_          SEGMENT WORD PUBLIC 'INITDATA'\r
+InitStart       label byte\r
+                ENDS\r
+_INITEND_       SEGMENT BYTE PUBLIC 'INITDATA'\r
+InitEnd         label byte\r
+                ENDS\r
+_EXIT_          SEGMENT WORD PUBLIC 'EXITDATA'\r
+ExitStart       label byte\r
+                ENDS\r
+_EXITEND_       SEGMENT BYTE PUBLIC 'EXITDATA'\r
+ExitEnd         label byte\r
+                ENDS\r
+_CVTSEG         SEGMENT WORD PUBLIC 'DATA'\r
+                ENDS\r
+_SCNSEG         SEGMENT WORD PUBLIC 'DATA'\r
+                ENDS\r
+IFNDEF __HUGE__\r
+  _BSS          SEGMENT WORD PUBLIC 'BSS'\r
+                ENDS\r
+  _BSSEND       SEGMENT BYTE PUBLIC 'BSSEND'\r
+                ENDS\r
+ENDIF\r
+IFNDEF __TINY__\r
+  _STACK        SEGMENT STACK 'STACK'\r
+                ENDS\r
+ENDIF\r
+\r
+        ASSUME  CS:_TEXT, DS:DGROUP\r
+\r
+;       External References\r
+\r
+extrn       _main:DIST\r
+extrn       _exit:DIST\r
+extrn       __exit:DIST\r
+extrn       __nfile:word\r
+extrn       __setupio:near          ;required!\r
+extrn       __stklen:word\r
+IF LDATA EQ false\r
+extrn       __heaplen:word\r
+ENDIF\r
+\r
+        SUBTTL  Start Up Code\r
+        PAGE\r
+;/*                                                     */\r
+;/*-----------------------------------------------------*/\r
+;/*                                                     */\r
+;/*     Start Up Code                                   */\r
+;/*     -------------                                   */\r
+;/*                                                     */\r
+;/*-----------------------------------------------------*/\r
+;/*                                                     */\r
+PSPHigh         equ     00002h\r
+PSPEnv          equ     0002ch\r
+PSPCmd          equ     00080h\r
+\r
+                public  __AHINCR\r
+__AHINCR        equ     1000h\r
+                public  __AHSHIFT\r
+__AHSHIFT       equ     12\r
+\r
+IFDEF   __NOFLOAT__\r
+MINSTACK        equ     128     ; minimal stack size in words\r
+ELSE\r
+MINSTACK        equ     256     ; minimal stack size in words\r
+ENDIF\r
+;\r
+;       At the start, DS and ES both point to the segment prefix.\r
+;       SS points to the stack segment except in TINY model where\r
+;       SS is equal to CS\r
+;\r
+_TEXT           SEGMENT\r
+IFDEF           __TINY__\r
+                ORG     100h\r
+ENDIF\r
+STARTX          PROC    NEAR\r
+;       Save general information, such as :\r
+;               DGROUP segment address\r
+;               DOS version number\r
+;               Program Segment Prefix address\r
+;               Environment address\r
+;               Top of far heap\r
+\r
+IFDEF   __TINY__\r
+                               mov     dx, cs          ; DX = GROUP Segment address\r
+ELSE\r
+                               mov     dx, DGROUP      ; DX = GROUP Segment address\r
+ENDIF\r
+IFNDEF __BOSS__\r
+                               mov     cs:DGROUP@@, dx ;  __BOSS__\r
+ENDIF\r
+                               mov     ah, 30h\r
+                               int     21h             ; get DOS version number\r
+                               mov     bp, ds:[PSPHigh]; BP = Highest Memory Segment Addr\r
+                               mov     bx, ds:[PSPEnv] ; BX = Environment Segment address\r
+                               mov     ds, dx\r
+                               mov     _version@, ax   ; Keep major and minor version number\r
+                               mov     _psp@, es       ; Keep Program Segment Prefix address\r
+                               mov     _envseg@, bx    ; Keep Environment Segment address\r
+                               mov     word ptr _heaptop@ + 2, bp\r
+;\r
+;       Save several vectors and install default divide by zero handler.\r
+;\r
+                               call    SaveVectors\r
+\r
+;===================\r
+;\r
+;              IDsoft - Check to make sure that we're running on a 286 or better\r
+\r
+                               pushf                                   ; Save original flags\r
+                               xor             ax,ax                   ; Clear AX\r
+                               push    ax\r
+                               popf                                    ; Try to pop the 0\r
+                               pushf\r
+                               pop             ax                              ; Get results of popping 0 into flags\r
+                               popf                                    ; Restore original flags\r
+                               or              ax,ax\r
+                               ;begin 8086 hack\r
+                               ;jns            @@Have286               ; If no sign bit, have a 286\r
+                               jmp             @@Have286\r
+\r
+                               mov     cx, lgth_no286MSG\r
+                               mov     dx, offset DGROUP: no286MSG\r
+                               jmp             MsgExit3\r
+\r
+@@Have286:\r
+;              IDsoft - End of modifications (there's also a code segment string)\r
+;\r
+;===================\r
+\r
+IFDEF  __BOSS__\r
+; Determine if in real mode\r
+                       mov     ax,0FB42h       ; find out if DPMI loader is here\r
+               mov     bx,1            ; get info function\r
+               int     2fh             ;\r
+\r
+               push    ax              ;\r
+               mov     ax, cs          ; now, save DGROUP\r
+               add     ax, cx          ;\r
+               mov     es, ax          ;\r
+               mov     dx, ds          ;\r
+               mov     es:DGROUP@@, dx  ;\r
+               mov     es:CSalias@@, ax ;\r
+               pop     ax               ;\r
+\r
+;              cmp     ax,0001h        ; if not "TRUE"\r
+;              JNE     InRealMode\r
+\r
+; 8 is the value of the alias selector\r
+; in this system\r
+               MOV     _protected@, cx\r
+               MOV     _hugeincval@, cx\r
+               clc\r
+               mov     ax, cx\r
+               xor     cx, cx\r
+               or      ax, ax\r
+               je      @@gotshift\r
+@@shiftcnt:\r
+               rcr     ax,1\r
+               jc      @@gotshift\r
+               inc     cx\r
+               jmp     @@shiftcnt\r
+@@gotshift:\r
+               mov     _shiftcount@,cx\r
+\r
+; used by emulator\r
+;              PUSH    DS\r
+;              MOV     AX, 0E502H      ; prot kernel function, get LDT alias\r
+;              INT     21H\r
+;              POP     DS\r
+;              MOV     _LDT@, AX\r
+\r
+;              cmp     _protected@,0001h       ; if not "TRUE"\r
+;              JNE     InRealMode\r
+\r
+               .286P\r
+IFE    LDATA                                   \r
+               mov     dx, ds                  ;\r
+;              LSL     AX, DX                  ;\r
+;              DEC     AX                      ;\r
+               MOV     AX, 0FFFEh              ;\r
+               MOV     SP, AX                  ;\r
+               MOV     SS, DX                  ;\r
+ENDIF                                          \r
+               .8086\r
+;              JMP     BossSkip\r
+\r
+InRealMode     label   near\r
+\r
+ENDIF\r
+\r
+;       Count the number of environment variables and compute the size.\r
+;       Each variable is ended by a 0 and a zero-length variable stops\r
+;       the environment. The environment can NOT be greater than 32k.\r
+\r
+                les     di, dword ptr _envLng@\r
+                mov     ax, di\r
+                mov     bx, ax\r
+                mov     cx, 07FFFh      ; Environment cannot be > 32 Kbytes\r
+                cld\r
+@@EnvLoop:\r
+                repnz   scasb\r
+                jcxz    InitFailed      ; Bad environment !!!\r
+IFDEF __BOSS__\r
+                jmp     InitOK\r
+InitFailed:     jmp     near ptr _abort\r
+InitOK:\r
+ENDIF\r
+     \r
+                inc     bx              ; BX = Nb environment variables\r
+                cmp     es:[di], al\r
+                jne     @@EnvLoop       ; Next variable ...\r
+                or      ch, 10000000b\r
+                neg     cx\r
+                mov     _envLng@, cx    ; Save Environment size\r
+                mov     cx, dPtrSize / 2\r
+                shl     bx, cl\r
+                add     bx, dPtrSize * 4\r
+                and     bx, not ((dPtrSize * 4) - 1)\r
+                mov     _envSize@, bx   ; Save Environment Variables Nb.\r
+\r
+IFNDEF __BOSS__\r
+\r
+;       Determine the amount of memory that we need to keep\r
+\r
+IFDEF _DSSTACK_\r
+                mov     dx, ds\r
+ELSE\r
+                mov     dx, ss\r
+ENDIF\r
+                sub     bp, dx          ; BP = remaining size in paragraphs\r
+IF LDATA\r
+                mov     di, seg __stklen\r
+                mov     es, di\r
+                mov     di, es:__stklen ; DI = Requested stack size\r
+ELSE\r
+                mov     di, __stklen    ; DI = Requested stack size\r
+ENDIF\r
+;\r
+; Make sure that the requested stack size is at least MINSTACK words.\r
+;\r
+                cmp     di, 2*MINSTACK  ; requested stack big enough ?\r
+                jae     AskedStackOK\r
+                mov     di, 2*MINSTACK  ; no --> use minimal value\r
+IF LDATA\r
+                mov     es:__stklen, di ; override requested stack size\r
+ELSE\r
+                mov        __stklen, di ; override requested stack size\r
+ENDIF\r
+\r
+AskedStackOK    label   near\r
+IFDEF _DSSTACK_\r
+                add     di, offset DGROUP: edata@\r
+                jb      InitFailed      ; DATA segment can NOT be > 64 Kbytes\r
+ENDIF\r
+IF LDATA EQ false\r
+                add     di, __heaplen\r
+                jb      InitFailed      ; DATA segment can NOT be > 64 Kbytes\r
+ENDIF\r
+                mov     cl, 4\r
+                shr     di, cl          ; $$$ Do not destroy CL $$$\r
+                inc     di              ; DI = DS size in paragraphs\r
+                cmp     bp, di\r
+IF LDATA EQ false\r
+                jb      InitFailed      ; Not enough memory\r
+                cmp     __stklen, 0\r
+                je      ExpandDS        ; Expand DS up to 64 Kb\r
+                cmp     __heaplen, 0\r
+                jne     ExcessOfMemory  ; Much more available than needed\r
+ExpandDS        label   near\r
+                mov     di, 1000h\r
+                cmp     bp, di\r
+                ja      ExcessOfMemory  ; Enough to run the program\r
+                mov     di, bp\r
+                jmp     short ExcessOfMemory  ; Enough to run the program\r
+ELSE\r
+                jnb     ExcessOfMemory  ; Much more available than needed\r
+ENDIF\r
+\r
+;       All initialization errors arrive here\r
+\r
+InitFailed      label   near\r
+                jmp     near ptr _abort\r
+\r
+;       Return to DOS the amount of memory in excess\r
+;       Set far heap base and pointer\r
+\r
+ExcessOfMemory  label   near\r
+                mov     bx, di\r
+                add     bx, dx\r
+                mov     word ptr _heapbase@ + 2, bx\r
+                mov     word ptr _brklvl@ + 2, bx\r
+                mov     ax, _psp@\r
+                sub     bx, ax          ; BX = Number of paragraphs to keep\r
+                mov     es, ax          ; ES = Program Segment Prefix address\r
+                mov     ah, 04Ah\r
+                push    di              ; preserve DI\r
+                int     021h            ; this call clobbers SI,DI,BP !!!!!!\r
+                pop     di              ; restore  DI\r
+\r
+                shl     di, cl          ; $$$ CX is still equal to 4 $$$\r
+\r
+                cli                     ; req'd for pre-1983 88/86s\r
+                mov     ss, dx          ; Set the program stack\r
+                mov     sp, di\r
+                sti\r
+\r
+IFNDEF _DSSTACK_\r
+                mov     ax, seg __stklen\r
+                mov     es, ax\r
+                mov     es:__stklen, di ; If separate stack segment, save size\r
+ENDIF\r
+\r
+ENDIF ; __BOSS__\r
+\r
+IFNDEF  __HUGE__\r
+\r
+;       Reset uninitialized data area\r
+\r
+                xor     ax, ax\r
+                mov     es, cs:DGROUP@@\r
+                mov     di, offset DGROUP: bdata@\r
+                mov     cx, offset DGROUP: edata@\r
+                sub     cx, di\r
+                cld\r
+                rep     stosb\r
+ENDIF\r
+\r
+;   If default number of file handles have changed then tell DOS\r
+                cmp     __nfile, 20\r
+                jbe     @@NoChange\r
+\r
+                cmp     _osmajor@, 3   ; Check for >= DOS 3.3\r
+                jb      @@NoChange\r
+                ja      @@DoChange\r
+                cmp     _osminor@, 1Eh\r
+                jb      @@NoChange\r
+@@DoChange:\r
+                mov     ax, 5801h      ; Set last fit allocation\r
+                mov     bx, 2\r
+                int     21h\r
+                jc      @@BadInit\r
+\r
+                mov     ah, 67h        ; Expand handle table\r
+                mov     bx, __nfile\r
+                int     21h\r
+                jc      @@BadInit\r
+\r
+                mov     ah, 48h        ; Allocate 16 bytes to find new\r
+                mov     bx, 1          ;   top of memory address\r
+                int     21h\r
+                jc      @@BadInit\r
+                inc     ax             ; Adjust address to point after block\r
+                mov     word ptr _heaptop@ + 2, ax\r
+\r
+                dec     ax             ; Change back and release block\r
+                mov     es, ax\r
+                mov     ah, 49h\r
+                int     21h\r
+                jc      @@BadInit\r
+\r
+                mov     ax, 5801h      ; Set first fit allocation\r
+                mov     bx, 0\r
+                int     21h\r
+                jnc     @@NoChange\r
+\r
+@@BadInit:      jmp near ptr _abort\r
+\r
+@@NoChange:\r
+\r
+;       Prepare main arguments\r
+\r
+                mov     ah, 0\r
+                int     1ah                     ; get current BIOS time in ticks\r
+                mov     word ptr _StartTime@,dx ; save it for clock() fn\r
+                mov     word ptr _StartTime@+2,cx\r
+               or      al,al                   ; was midnight flag set?\r
+               jz      @@NotMidnight\r
+               mov     ax,40h                  ; set BIOS midnight flag\r
+               mov     es,ax                   ;  at 40:70\r
+               mov     bx,70h\r
+               mov     byte ptr es:[bx],1\r
+                       \r
+@@NotMidnight:\r
+                xor     bp,bp                   ; set BP to 0 for overlay mgr\r
+\r
+                mov     es, cs:DGROUP@@\r
+                mov     si,offset DGROUP:InitStart      ;si = start of table\r
+                mov     di,offset DGROUP:InitEnd        ;di = end of table\r
+                call    StartExit\r
+\r
+;       ExitCode = main(argc,argv,envp);\r
+\r
+IF      LDATA\r
+                push    word ptr __C0environ+2\r
+                push    word ptr __C0environ\r
+                push    word ptr __C0argv+2\r
+                push    word ptr __C0argv\r
+ELSE\r
+                push    word ptr __C0environ\r
+                push    word ptr __C0argv\r
+ENDIF\r
+                push    __C0argc\r
+                call    _main\r
+\r
+;       Flush and close streams and files\r
+\r
+                push    ax\r
+                call    _exit\r
+\r
+;---------------------------------------------------------------------------\r
+;       _cleanup()      call all #pragma exit cleanup routines.\r
+;       _checknull()    check for null pointer zapping copyright message\r
+;       _terminate(int) exit program with error code\r
+;\r
+;       These functions are called by exit(), _exit(), _cexit(),\r
+;       and _c_exit().\r
+;---------------------------------------------------------------------------\r
+\r
+;       Call cleanup routines\r
+\r
+__cleanup       PROC    DIST\r
+                PUBLIC  __cleanup\r
+\r
+                mov     es, cs:DGROUP@@\r
+                push    si\r
+                push    di\r
+                mov     si,offset DGROUP:ExitStart\r
+                mov     di,offset DGROUP:ExitEnd\r
+                call    StartExit\r
+                pop     di\r
+                pop     si\r
+                ret\r
+__cleanup       ENDP\r
+\r
+;       Check for null pointers before exit\r
+\r
+__checknull     PROC    DIST\r
+                PUBLIC  __checknull\r
+\r
+IF      LDATA EQ false\r
+  IFNDEF  __TINY__\r
+                push    si\r
+                push    di\r
+                mov     es, cs:DGROUP@@\r
+                xor     ax, ax\r
+                mov     si, ax\r
+                mov     cx, lgth_CopyRight\r
+ComputeChecksum label   near\r
+                add     al, es:[si]\r
+                adc     ah, 0\r
+                inc     si\r
+                loop    ComputeChecksum\r
+                sub     ax, CheckSum\r
+                jz      @@SumOk\r
+                mov     cx, lgth_NullCheck\r
+                mov     dx, offset DGROUP: NullCheck\r
+                call    ErrorDisplay\r
+@@SumOK:        pop     di\r
+                pop     si\r
+  ENDIF\r
+ENDIF\r
+                ret\r
+__checknull     ENDP\r
+\r
+;       Exit to DOS\r
+\r
+__terminate     PROC    DIST\r
+                PUBLIC  __terminate\r
+                mov     bp,sp\r
+                mov     ah,4Ch\r
+                mov     al,[bp+cPtrSize]\r
+                int     21h                     ; Exit to DOS\r
+__terminate     ENDP\r
+\r
+STARTX          ENDP\r
+\r
+        SUBTTL  Vector save/restore & default Zero divide routines\r
+        PAGE\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;| Interrupt Save/Restore routines and default divide by zero   |\r
+;| handler.                                                     |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+ZeroDivision    PROC    FAR\r
+                mov     cx, lgth_ZeroDivMSG\r
+                mov     dx, offset DGROUP: ZeroDivMSG\r
+                jmp     MsgExit3\r
+ZeroDivision    ENDP\r
+\r
+;--------------------------------------------------------------------------\r
+;       savevectors()\r
+;\r
+;       Save vectors for 0, 4, 5 & 6 interrupts.  This is for extended\r
+;       signal()/raise() support as the signal functions can steal these\r
+;       vectors during runtime.\r
+;--------------------------------------------------------------------------\r
+SaveVectors     PROC    NEAR\r
+                push    ds\r
+; Save INT 0\r
+                mov     ax, 3500h\r
+                int     021h\r
+                mov     word ptr _Int0Vector@, bx\r
+                mov     word ptr _Int0Vector@+2, es\r
+; Save INT 4\r
+                mov     ax, 3504h\r
+                int     021h\r
+                mov     word ptr _Int4Vector@, bx\r
+                mov     word ptr _Int4Vector@+2, es\r
+; Save INT 5\r
+                mov     ax, 3505h\r
+                int     021h\r
+                mov     word ptr _Int5Vector@, bx\r
+                mov     word ptr _Int5Vector@+2, es\r
+; Save INT 6\r
+                mov     ax, 3506h\r
+                int     021h\r
+                mov     word ptr _Int6Vector@, bx\r
+                mov     word ptr _Int6Vector@+2, es\r
+;\r
+;       Install default divide by zero handler.\r
+;\r
+                mov     ax, 2500h\r
+                mov     dx, cs\r
+                mov     ds, dx\r
+                mov     dx, offset ZeroDivision\r
+                int     21h\r
+\r
+                pop     ds\r
+                ret\r
+SaveVectors     ENDP\r
+\r
+;--------------------------------------------------------------------------\r
+;       _restorezero() puts back all the vectors that SaveVectors took.\r
+;\r
+;NOTE : TSRs must BE AWARE that signal() functions which take these \r
+;       vectors will be deactivated if the keep() function is executed.\r
+;       If a TSR wants to use the signal functions when it is active it \r
+;       will have to save/restore these vectors itself when activated and\r
+;       deactivated.\r
+;--------------------------------------------------------------------------\r
+__restorezero   PROC    DIST\r
+                PUBLIC  __restorezero\r
+IFDEF   __HUGE__\r
+                push    ds\r
+                mov     ds, cs: DGROUP@@\r
+ENDIF\r
+                push    ds\r
+                mov     ax, 2500h\r
+                lds     dx, _Int0Vector@\r
+                int     21h\r
+                pop     ds\r
+\r
+                push    ds\r
+                mov     ax, 2504h\r
+                lds     dx, _Int4Vector@\r
+                int     21h\r
+                pop     ds\r
+\r
+                push    ds\r
+                mov     ax, 2505h\r
+                lds     dx, _Int5Vector@\r
+                int     21h\r
+                pop     ds\r
+\r
+IFNDEF   __HUGE__\r
+                push    ds\r
+ENDIF\r
+                mov     ax, 2506h\r
+                lds     dx, _Int6Vector@\r
+                int     21h\r
+                pop     ds\r
+\r
+                ret\r
+                ENDP\r
+\r
+;------------------------------------------------------------------\r
+;  Loop through a startup/exit (SE) table, \r
+;  calling functions in order of priority.\r
+;  ES:SI is assumed to point to the beginning of the SE table\r
+;  ES:DI is assumed to point to the end of the SE table\r
+;  First 64 priorities are reserved by Borland\r
+;------------------------------------------------------------------\r
+PNEAR           EQU     0\r
+PFAR            EQU     1\r
+NOTUSED         EQU     0ffh\r
+\r
+SE              STRUC\r
+calltype        db      ?                       ; 0=near,1=far,ff=not used\r
+priority        db      ?                       ; 0=highest,ff=lowest\r
+addrlow         dw      ?\r
+addrhigh        dw      ?\r
+SE              ENDS\r
+\r
+StartExit       proc near\r
+@@Start:        cmp     si,offset DGROUP:InitStart      ; startup or exit?\r
+                je      @@StartLow              ; it's startup\r
+                xor     ah,ah                   ; start with high priority\r
+                jmp     short @@SaveEnd\r
+@@StartLow:     mov     ah,0ffh                 ;start with lowest priority\r
+@@SaveEnd:      mov     dx,di                   ;set sentinel to end of table\r
+                mov     bx,si                   ;bx = start of table\r
+\r
+@@TopOfTable:   cmp     bx,di                   ;and the end of the table?\r
+                je      @@EndOfTable            ;yes, exit the loop\r
+                cmp     es:[bx.calltype],NOTUSED;check the call type\r
+                je      @@Next\r
+                cmp     si,offset DGROUP:InitStart      ; startup or exit?\r
+                je      @@CompareHigh           ; it's startup\r
+                cmp     ah,es:[bx.priority]     ; it's exit\r
+                jmp     short @@CheckPrior      ; if priority too low, skip\r
+@@CompareHigh:  cmp     es:[bx.priority],ah     ;check the priority\r
+@@CheckPrior:   ja      @@Next                  ;too high?  skip\r
+                mov     ah,es:[bx.priority]     ;keep priority\r
+                mov     dx,bx                   ;keep index in dx\r
+@@Next:         add     bx,SIZE SE              ;bx = next item in table\r
+                jmp     @@TopOfTable\r
+\r
+@@EndOfTable:   cmp     dx,di                   ;did we exhaust the table?\r
+                je      @@Done                  ;yes, quit\r
+                mov     bx,dx                   ;bx = highest priority item\r
+                cmp     es:[bx.calltype],PNEAR  ;is it near or far?\r
+                mov     es:[bx.calltype],NOTUSED;wipe the call type\r
+                push    es                      ;save es\r
+                je      @@NearCall\r
+\r
+@@FarCall:      call    DWORD PTR es:[bx.addrlow]\r
+                pop     es                      ;restore es\r
+                jmp     short @@Start\r
+\r
+@@NearCall:     call    WORD PTR es:[bx.addrlow]\r
+                pop     es                      ;restore es\r
+                jmp     short @@Start\r
+\r
+@@Done:         ret\r
+                endp\r
+\r
+;------------------------------------------------------------------\r
+\r
+ErrorDisplay    PROC    NEAR\r
+                mov     ah, 040h\r
+                mov     bx, 2\r
+                int     021h\r
+                ret\r
+ErrorDisplay    ENDP\r
+\r
+_abort          PROC    DIST\r
+                PUBLIC  _abort\r
+                mov     cx, lgth_abortMSG\r
+                mov     dx, offset DGROUP: abortMSG\r
+MsgExit3        label   near\r
+                mov     ds, cs: DGROUP@@\r
+                call    ErrorDisplay\r
+CallExit3       label   near\r
+                mov     ax, 3\r
+                push    ax\r
+                call    __exit           ; _exit(3);\r
+                ENDP\r
+\r
+; The DGROUP@ variable is used to reload DS with DGROUP\r
+\r
+PubSym@         DGROUP@, <dw    ?>, __PASCAL__\r
+\r
+IFDEF  __BOSS__\r
+PubSym@                CSalias@,<dw    ?>, __PASCAL__\r
+ENDIF\r
+\r
+\r
+; __MMODEL is used to determine the memory model or the default\r
+; pointer types at run time.\r
+\r
+                public __MMODEL\r
+__MMODEL        dw      MMODEL\r
+\r
+_TEXT           ENDS\r
+\r
+                SUBTTL  Start Up Data Area\r
+                PAGE\r
+;[]------------------------------------------------------------[]\r
+;|      Start Up Data Area                                      |\r
+;|                                                              |\r
+;|      WARNING         Do not move any variables in the data   |\r
+;|                      segment unless you're absolutely sure   |\r
+;|                      that it does not matter.                |\r
+;[]------------------------------------------------------------[]\r
+\r
+_DATA           SEGMENT\r
+\r
+;       Magic symbol used by the debug info to locate the data segment\r
+                public DATASEG@\r
+DATASEG@        label   byte\r
+\r
+;       The CopyRight string must NOT be moved or changed without\r
+;       changing the null pointer check logic\r
+\r
+CopyRight       db      4 dup(0)\r
+                db      'Borland C++ - Copyright 1991 Borland Intl.',0\r
+lgth_CopyRight  equ     $ - CopyRight\r
+\r
+IF      LDATA EQ false\r
+IFNDEF  __TINY__\r
+CheckSum        equ     00D5Ch\r
+NullCheck       db      'Null pointer assignment', 13, 10\r
+lgth_NullCheck  equ     $ - NullCheck\r
+ENDIF\r
+ENDIF\r
+\r
+ZeroDivMSG      db      'Divide error', 13, 10\r
+lgth_ZeroDivMSG equ     $ - ZeroDivMSG\r
+\r
+abortMSG        db      'Abnormal program termination', 13, 10\r
+lgth_abortMSG   equ     $ - abortMSG\r
+\r
+; JAB - Added string for no 286\r
+no286MSG               db              'Sorry, this program requires a 286 or better.', 13, 10\r
+lgth_no286MSG  equ             $ - no286MSG\r
+; JAB - End of modifications\r
+\r
+;\r
+;                       Interrupt vector save areas\r
+;       \r
+;       Interrupt vectors 0,4,5 & 6 are saved at startup and then restored\r
+;       when the program terminates.  The signal/raise functions might\r
+;       steal these vectors during execution.\r
+;\r
+;       Note: These vectors save area must not be altered \r
+;             without changing the save/restore logic.\r
+;\r
+PubSym@         _Int0Vector     <dd     0>,             __CDECL__\r
+PubSym@         _Int4Vector     <dd     0>,             __CDECL__\r
+PubSym@         _Int5Vector     <dd     0>,             __CDECL__\r
+PubSym@         _Int6Vector     <dd     0>,             __CDECL__\r
+;\r
+;                       Miscellaneous variables\r
+;       \r
+PubSym@         _C0argc,        <dw     0>,             __CDECL__\r
+dPtrPub@        _C0argv,        0,                      __CDECL__\r
+dPtrPub@        _C0environ,     0,                      __CDECL__\r
+PubSym@         _envLng,        <dw     0>,             __CDECL__\r
+PubSym@         _envseg,        <dw     0>,             __CDECL__\r
+PubSym@         _envSize,       <dw     0>,             __CDECL__\r
+PubSym@         _psp,           <dw     0>,             __CDECL__\r
+PubSym@         _version,       <label word>,           __CDECL__\r
+PubSym@         _osversion,     <label word>,           __CDECL__\r
+PubSym@         _osmajor,       <db     0>,             __CDECL__\r
+PubSym@         _osminor,       <db     0>,             __CDECL__\r
+PubSym@         errno,          <dw     0>,             __CDECL__\r
+PubSym@         _StartTime,     <dw   0,0>,             __CDECL__\r
+\r
+\r
+IFDEF __BOSS__\r
+PubSym@                _protected      <dw    0>,              __CDECL__\r
+PubSym@        _shiftcount,    <dw    12>,             __CDECL__\r
+PubSym@        _hugeincval,    <dw    1000h>,          __CDECL__\r
+ENDIF\r
+\r
+;       Memory management variables\r
+\r
+IF      LDATA EQ false\r
+PubSym@         __heapbase,     <dw   DGROUP:edata@>,   __CDECL__\r
+ENDIF\r
+IFNDEF __HUGE__\r
+PubSym@         __brklvl,       <dw   DGROUP:edata@>,   __CDECL__\r
+ENDIF\r
+PubSym@         _heapbase,      <dd   0>,       __CDECL__\r
+PubSym@         _brklvl,        <dd   0>,       __CDECL__\r
+PubSym@         _heaptop,       <dd   0>,       __CDECL__\r
+\r
+;       If stack in DS and Large data model then override location of __emu\r
+\r
+IFDEF   _DSSTACK_\r
+IF      LDATA\r
+public  __emu\r
+__emu   db      044h    DUP (0)\r
+        db      0CCh    DUP (?)\r
+ENDIF\r
+ENDIF\r
+\r
+_DATA           ENDS\r
+\r
+\r
+_CVTSEG         SEGMENT\r
+PubSym@         _RealCvtVector, <label  word>,  __CDECL__\r
+                ENDS\r
+\r
+_SCNSEG         SEGMENT\r
+PubSym@         _ScanTodVector,  <label word>,  __CDECL__\r
+                ENDS\r
+\r
+IFNDEF __HUGE__\r
+_BSS            SEGMENT\r
+bdata@          label   byte\r
+                ENDS\r
+\r
+_BSSEND         SEGMENT\r
+edata@          label   byte\r
+                ENDS\r
+ENDIF\r
+\r
+IFNDEF __TINY__\r
+_STACK          SEGMENT\r
+IFDEF __BOSS__\r
+    IF LDATA\r
+                db      1400h dup(?)\r
+    ENDIF\r
+ELSE\r
+                db      128 dup(?)               ;minimum stack size\r
+ENDIF  ; __BOSS__\r
+                ENDS\r
+ENDIF  ; __TINY__\r
+                END     STARTX\r
diff --git a/16/wf3d8086/contigsc.c b/16/wf3d8086/contigsc.c
new file mode 100755 (executable)
index 0000000..a1b0edc
--- /dev/null
@@ -0,0 +1,745 @@
+// WL_SCALE.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+#define OP_RETF        0xcb\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                 GLOBALS\r
+\r
+=============================================================================\r
+*/\r
+\r
+t_compscale far *scaledirectory[MAXSCALEHEIGHT+1];\r
+long                   fullscalefarcall[MAXSCALEHEIGHT+1];\r
+\r
+int                    maxscale,maxscaleshl2;\r
+\r
+byte far       *scalermemory;\r
+byte _seg      *endscalermemory;\r
+long           freescalermemory;\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                 LOCALS\r
+\r
+=============================================================================\r
+*/\r
+\r
+unsigned BuildCompScale (int height, byte far *code);\r
+\r
+int                    stepbytwo;\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==============\r
+=\r
+= BadScale\r
+=\r
+==============\r
+*/\r
+\r
+void far BadScale (void)\r
+{\r
+       Quit ("BadScale called!");\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= SetupScaling\r
+=\r
+==========================\r
+*/\r
+\r
+long SetupScaling (int maxscaleheight)\r
+{\r
+       int             i,x,y;\r
+       byte    far *dest;\r
+       unsigned        seg,ofs;\r
+       long    size;\r
+\r
+\r
+       maxscaleheight/=2;                      // one scaler every two pixels\r
+\r
+       maxscale = maxscaleheight-1;\r
+       maxscaleshl2 = maxscale<<2;\r
+\r
+       dest = scalermemory;\r
+\r
+//\r
+// build the compiled scalers\r
+//\r
+       stepbytwo = viewheight/2;       // save space by double stepping\r
+\r
+       for (i=1;i<=maxscaleheight;i++)\r
+       {\r
+               seg = FP_SEG(dest);\r
+               ofs = (FP_OFF(dest)+15)&~15;\r
+               dest = MK_FP(seg+ofs/16,0);\r
+\r
+               scaledirectory[i] = (t_compscale far *)dest;\r
+               size = BuildCompScale (i*2,dest);\r
+               dest += size;\r
+\r
+               if ((byte huge *)dest-(byte huge *)scalermemory > MAXSCALERMEMORY)\r
+                       Quit ("Compiled scalars exceeded allocated space!");\r
+\r
+               if (i>=stepbytwo)\r
+                       i+= 2;\r
+       }\r
+\r
+//\r
+// get far call addresses\r
+//\r
+       for (i=1;i<=maxscaleheight;i++)\r
+       {\r
+               fullscalefarcall[i] = (long)scaledirectory[i] + scaledirectory[i]->codeofs[0];\r
+               if (i>=stepbytwo)\r
+               {\r
+                       scaledirectory[i+1] = scaledirectory[i];\r
+                       fullscalefarcall[i+1] = (long)scaledirectory[i] + scaledirectory[i]->codeofs[0];\r
+                       scaledirectory[i+2] = scaledirectory[i];\r
+                       fullscalefarcall[i+2] = (long)scaledirectory[i] + scaledirectory[i]->codeofs[0];\r
+                       i+=2;\r
+               }\r
+       }\r
+       scaledirectory[0] = scaledirectory[1];\r
+       fullscalefarcall[0] = fullscalefarcall[1];\r
+\r
+//\r
+// check for oversize wall drawing\r
+//\r
+       for (i=maxscaleheight;i<MAXSCALEHEIGHT;i++)\r
+               fullscalefarcall[i] = (long)BadScale;\r
+\r
+       seg = FP_SEG(dest);\r
+       ofs = (FP_OFF(dest)+15)&~15;\r
+       endscalermemory = (void _seg *)(seg+ofs/16);\r
+       size = (byte huge *)dest-(byte huge *)scalermemory;\r
+       freescalermemory = MAXSCALERMEMORY-16-size;\r
+\r
+       return size;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+========================\r
+=\r
+= BuildCompScale\r
+=\r
+= Builds a compiled scaler object that will scale a 64 tall object to\r
+= the given height (centered vertically on the screen)\r
+=\r
+= height should be even\r
+=\r
+= Call with\r
+= ---------\r
+= DS:SI                Source for scale\r
+= ES:DI                Dest for scale\r
+=\r
+= Calling the compiled scaler only destroys AL\r
+=\r
+========================\r
+*/\r
+\r
+unsigned BuildCompScale (int height, byte far *code)\r
+{\r
+       t_compscale     far *work;\r
+\r
+       int                     i;\r
+       long            fix,step;\r
+       unsigned        src,totalscaled,totalsize;\r
+       int                     startpix,endpix,toppix;\r
+\r
+       work = (t_compscale far *)code;\r
+\r
+       step = ((long)height<<16) / 64;\r
+       code = &work->code[0];\r
+       toppix = (viewheight-height)/2;\r
+       fix = 0;\r
+\r
+       for (src=0;src<=64;src++)\r
+       {\r
+               startpix = fix>>16;\r
+               fix += step;\r
+               endpix = fix>>16;\r
+\r
+               if (endpix>startpix)\r
+                       work->width[src] = endpix-startpix;\r
+               else\r
+                       work->width[src] = 0;\r
+\r
+//\r
+// mark the start of the code\r
+//\r
+               work->codeofs[src] = FP_OFF(code);\r
+\r
+//\r
+// compile some code if the source pixel generates any screen pixels\r
+//\r
+               startpix+=toppix;\r
+               endpix+=toppix;\r
+\r
+               if (startpix == endpix || endpix < 0 || startpix >= viewheight || src == 64)\r
+                       continue;\r
+\r
+       //\r
+       // mov al,[si+src]\r
+       //\r
+               *code++ = 0x8a;\r
+               *code++ = 0x44;\r
+               *code++ = src;\r
+\r
+               for (;startpix<endpix;startpix++)\r
+               {\r
+                       if (startpix >= viewheight)\r
+                               break;                                          // off the bottom of the view area\r
+                       if (startpix < 0)\r
+                               continue;                                       // not into the view area\r
+\r
+               //\r
+               // mov [es:di+heightofs],al\r
+               //\r
+                       *code++ = 0x26;\r
+                       *code++ = 0x88;\r
+                       *code++ = 0x85;\r
+                       *((unsigned far *)code)++ = startpix*SCREENBWIDE;\r
+               }\r
+\r
+       }\r
+\r
+//\r
+// retf\r
+//\r
+       *code++ = 0xcb;\r
+\r
+       totalsize = FP_OFF(code);\r
+\r
+       return totalsize;\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= ScaleLine\r
+=\r
+= linescale should have the high word set to the segment of the scaler\r
+=\r
+=======================\r
+*/\r
+\r
+extern int                     slinex,slinewidth;\r
+extern unsigned        far *linecmds;\r
+extern long            linescale;\r
+extern unsigned        maskword;\r
+\r
+byte   mask1,mask2,mask3;\r
+\r
+\r
+void near ScaleLine (void)\r
+{\r
+asm    mov     cx,WORD PTR [linescale+2]\r
+asm    mov     es,cx                                           // segment of scaler\r
+\r
+asm    mov bp,WORD PTR [linecmds]\r
+asm    mov     dx,SC_INDEX+1                           // to set SC_MAPMASK\r
+\r
+asm    mov     bx,[slinex]\r
+asm    mov     di,bx\r
+/* begin 8086 hack\r
+asm    shr     di,2                                            // X in bytes\r
+*/\r
+asm    shr     di,1                                            // X in bytes\r
+asm    shr     di,1\r
+/* end 8086 hack */\r
+asm    add     di,[bufferofs]\r
+asm    and     bx,3\r
+/* begin 8086 hack\r
+asm    shl     bx,3\r
+*/\r
+asm push cx\r
+asm mov cl,3\r
+asm shl bx,cl\r
+asm pop cx\r
+/* end 8086 hack */\r
+asm    add     bx,[slinewidth]                         // bx = (pixel*8+pixwidth)\r
+asm    mov     al,BYTE [mapmasks3-1+bx]        // -1 because pixwidth of 1 is first\r
+asm    mov     ds,WORD PTR [linecmds+2]\r
+asm    or      al,al\r
+asm    jz      notthreebyte                            // scale across three bytes\r
+asm    jmp     threebyte\r
+notthreebyte:\r
+asm    mov     al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first\r
+asm    or      al,al\r
+asm    jnz     twobyte                                         // scale across two bytes\r
+\r
+//\r
+// one byte scaling\r
+//\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    out     dx,al                                           // set map mask register\r
+\r
+scalesingle:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     dl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+\r
+asm    mov     es,cx                                           // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],dl                     // unpatch the RETF\r
+asm    jmp     scalesingle                                     // do the next segment\r
+\r
+\r
+//\r
+// done\r
+//\r
+linedone:\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+return;\r
+\r
+//\r
+// two byte scaling\r
+//\r
+twobyte:\r
+asm    mov     ss:[mask2],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask1],al\r
+\r
+scaledouble:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     cl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    mov     al,ss:[mask1]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask2]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    dec     di\r
+\r
+asm    mov     es,WORD PTR ss:[linescale+2] // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],cl                     // unpatch the RETF\r
+asm    jmp     scaledouble                                     // do the next segment\r
+\r
+\r
+//\r
+// three byte scaling\r
+//\r
+threebyte:\r
+asm    mov     ss:[mask3],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask2],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask1],al\r
+\r
+scaletriple:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     cl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    mov     al,ss:[mask1]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask2]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask3]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    dec     di\r
+asm    dec     di\r
+\r
+asm    mov     es,WORD PTR ss:[linescale+2] // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],cl                     // unpatch the RETF\r
+asm    jmp     scaletriple                                     // do the next segment\r
+\r
+\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= ScaleShape\r
+=\r
+= Draws a compiled shape at [scale] pixels high\r
+=\r
+= each vertical line of the shape has a pointer to segment data:\r
+=      end of segment pixel*2 (0 terminates line) used to patch rtl in scaler\r
+=      top of virtual line with segment in proper place\r
+=      start of segment pixel*2, used to jsl into compiled scaler\r
+=      <repeat>\r
+=\r
+= Setup for call\r
+= --------------\r
+= GC_MODE                      read mode 1, write mode 2\r
+= GC_COLORDONTCARE  set to 0, so all reads from video memory return 0xff\r
+= GC_INDEX                     pointing at GC_BITMASK\r
+=\r
+=======================\r
+*/\r
+\r
+static long            longtemp;\r
+\r
+void ScaleShape (int xcenter, int shapenum, unsigned height)\r
+{\r
+       t_compshape     _seg *shape;\r
+       t_compscale far *comptable;\r
+       unsigned        scale,srcx,stopx,tempx;\r
+       int                     t;\r
+       unsigned        far *cmdptr;\r
+       boolean         leftvis,rightvis;\r
+\r
+\r
+       shape = PM_GetSpritePage (shapenum);\r
+\r
+       scale = height>>3;                                              // low three bits are fractional\r
+       if (!scale || scale>maxscale)\r
+               return;                                                         // too close or far away\r
+       comptable = scaledirectory[scale];\r
+\r
+       *(((unsigned *)&linescale)+1)=FP_SEG(comptable);        // seg of far call\r
+       *(((unsigned *)&linecmds)+1)=(unsigned)shape;           // seg of shape\r
+\r
+//\r
+// scale to the left (from pixel 31 to shape->leftpix)\r
+//\r
+       srcx = 32;\r
+       slinex = xcenter;\r
+       stopx = shape->leftpix;\r
+       cmdptr = &shape->dataofs[31-stopx];\r
+\r
+       while ( --srcx >=stopx && slinex>0)\r
+       {\r
+               (unsigned)linecmds = *cmdptr--;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               if (slinewidth == 1)\r
+               {\r
+                       slinex--;\r
+                       if (slinex<viewwidth)\r
+                       {\r
+                               if (wallheight[slinex] >= height)\r
+                                       continue;               // obscured by closer wall\r
+                               ScaleLine ();\r
+                       }\r
+                       continue;\r
+               }\r
+\r
+               //\r
+               // handle multi pixel lines\r
+               //\r
+               if (slinex>viewwidth)\r
+               {\r
+                       slinex -= slinewidth;\r
+                       slinewidth = viewwidth-slinex;\r
+                       if (slinewidth<1)\r
+                               continue;               // still off the right side\r
+               }\r
+               else\r
+               {\r
+                       if (slinewidth>slinex)\r
+                               slinewidth = slinex;\r
+                       slinex -= slinewidth;\r
+               }\r
+\r
+\r
+               leftvis = (wallheight[slinex] < height);\r
+               rightvis = (wallheight[slinex+slinewidth-1] < height);\r
+\r
+               if (leftvis)\r
+               {\r
+                       if (rightvis)\r
+                               ScaleLine ();\r
+                       else\r
+                       {\r
+                               while (wallheight[slinex+slinewidth-1] >= height)\r
+                                       slinewidth--;\r
+                               ScaleLine ();\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       if (!rightvis)\r
+                               continue;               // totally obscured\r
+\r
+                       while (wallheight[slinex] >= height)\r
+                       {\r
+                               slinex++;\r
+                               slinewidth--;\r
+                       }\r
+                       ScaleLine ();\r
+                       break;                  // the rest of the shape is gone\r
+               }\r
+       }\r
+\r
+\r
+//\r
+// scale to the right\r
+//\r
+       slinex = xcenter;\r
+       stopx = shape->rightpix;\r
+       if (shape->leftpix<31)\r
+       {\r
+               srcx = 31;\r
+               cmdptr = &shape->dataofs[32-shape->leftpix];\r
+       }\r
+       else\r
+       {\r
+               srcx = shape->leftpix-1;\r
+               cmdptr = &shape->dataofs[0];\r
+       }\r
+       slinewidth = 0;\r
+\r
+       while ( ++srcx <= stopx && (slinex+=slinewidth)<viewwidth)\r
+       {\r
+               (unsigned)linecmds = *cmdptr++;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               if (slinewidth == 1)\r
+               {\r
+                       if (slinex>=0 && wallheight[slinex] < height)\r
+                       {\r
+                               ScaleLine ();\r
+                       }\r
+                       continue;\r
+               }\r
+\r
+               //\r
+               // handle multi pixel lines\r
+               //\r
+               if (slinex<0)\r
+               {\r
+                       if (slinewidth <= -slinex)\r
+                               continue;               // still off the left edge\r
+\r
+                       slinewidth += slinex;\r
+                       slinex = 0;\r
+               }\r
+               else\r
+               {\r
+                       if (slinex + slinewidth > viewwidth)\r
+                               slinewidth = viewwidth-slinex;\r
+               }\r
+\r
+\r
+               leftvis = (wallheight[slinex] < height);\r
+               rightvis = (wallheight[slinex+slinewidth-1] < height);\r
+\r
+               if (leftvis)\r
+               {\r
+                       if (rightvis)\r
+                       {\r
+                               ScaleLine ();\r
+                       }\r
+                       else\r
+                       {\r
+                               while (wallheight[slinex+slinewidth-1] >= height)\r
+                                       slinewidth--;\r
+                               ScaleLine ();\r
+                               break;                  // the rest of the shape is gone\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       if (rightvis)\r
+                       {\r
+                               while (wallheight[slinex] >= height)\r
+                               {\r
+                                       slinex++;\r
+                                       slinewidth--;\r
+                               }\r
+                               ScaleLine ();\r
+                       }\r
+                       else\r
+                               continue;               // totally obscured\r
+               }\r
+       }\r
+}\r
+\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= SimpleScaleShape\r
+=\r
+= NO CLIPPING, height in pixels\r
+=\r
+= Draws a compiled shape at [scale] pixels high\r
+=\r
+= each vertical line of the shape has a pointer to segment data:\r
+=      end of segment pixel*2 (0 terminates line) used to patch rtl in scaler\r
+=      top of virtual line with segment in proper place\r
+=      start of segment pixel*2, used to jsl into compiled scaler\r
+=      <repeat>\r
+=\r
+= Setup for call\r
+= --------------\r
+= GC_MODE                      read mode 1, write mode 2\r
+= GC_COLORDONTCARE  set to 0, so all reads from video memory return 0xff\r
+= GC_INDEX                     pointing at GC_BITMASK\r
+=\r
+=======================\r
+*/\r
+\r
+void SimpleScaleShape (int xcenter, int shapenum, unsigned height)\r
+{\r
+       t_compshape     _seg *shape;\r
+       t_compscale far *comptable;\r
+       unsigned        scale,srcx,stopx,tempx;\r
+       int                     t;\r
+       unsigned        far *cmdptr;\r
+       boolean         leftvis,rightvis;\r
+\r
+\r
+       shape = PM_GetSpritePage (shapenum);\r
+\r
+       scale = height>>1;\r
+       comptable = scaledirectory[scale];\r
+\r
+       *(((unsigned *)&linescale)+1)=FP_SEG(comptable);        // seg of far call\r
+       *(((unsigned *)&linecmds)+1)=(unsigned)shape;           // seg of shape\r
+\r
+//\r
+// scale to the left (from pixel 31 to shape->leftpix)\r
+//\r
+       srcx = 32;\r
+       slinex = xcenter;\r
+       stopx = shape->leftpix;\r
+       cmdptr = &shape->dataofs[31-stopx];\r
+\r
+       while ( --srcx >=stopx )\r
+       {\r
+               (unsigned)linecmds = *cmdptr--;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               slinex -= slinewidth;\r
+               ScaleLine ();\r
+       }\r
+\r
+\r
+//\r
+// scale to the right\r
+//\r
+       slinex = xcenter;\r
+       stopx = shape->rightpix;\r
+       if (shape->leftpix<31)\r
+       {\r
+               srcx = 31;\r
+               cmdptr = &shape->dataofs[32-shape->leftpix];\r
+       }\r
+       else\r
+       {\r
+               srcx = shape->leftpix-1;\r
+               cmdptr = &shape->dataofs[0];\r
+       }\r
+       slinewidth = 0;\r
+\r
+       while ( ++srcx <= stopx )\r
+       {\r
+               (unsigned)linecmds = *cmdptr++;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               ScaleLine ();\r
+               slinex+=slinewidth;\r
+       }\r
+}\r
+\r
+\r
+\r
+\r
+//\r
+// bit mask tables for drawing scaled strips up to eight pixels wide\r
+//\r
+// down here so the STUPID inline assembler doesn't get confused!\r
+//\r
+\r
+\r
+byte   mapmasks1[4][8] = {\r
+{1 ,3 ,7 ,15,15,15,15,15},\r
+{2 ,6 ,14,14,14,14,14,14},\r
+{4 ,12,12,12,12,12,12,12},\r
+{8 ,8 ,8 ,8 ,8 ,8 ,8 ,8} };\r
+\r
+byte   mapmasks2[4][8] = {\r
+{0 ,0 ,0 ,0 ,1 ,3 ,7 ,15},\r
+{0 ,0 ,0 ,1 ,3 ,7 ,15,15},\r
+{0 ,0 ,1 ,3 ,7 ,15,15,15},\r
+{0 ,1 ,3 ,7 ,15,15,15,15} };\r
+\r
+byte   mapmasks3[4][8] = {\r
+{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0},\r
+{0 ,0 ,0 ,0 ,0 ,0 ,0 ,1},\r
+{0 ,0 ,0 ,0 ,0 ,0 ,1 ,3},\r
+{0 ,0 ,0 ,0 ,0 ,1 ,3 ,7} };\r
+\r
+\r
+unsigned       wordmasks[8][8] = {\r
+{0x0080,0x00c0,0x00e0,0x00f0,0x00f8,0x00fc,0x00fe,0x00ff},\r
+{0x0040,0x0060,0x0070,0x0078,0x007c,0x007e,0x007f,0x807f},\r
+{0x0020,0x0030,0x0038,0x003c,0x003e,0x003f,0x803f,0xc03f},\r
+{0x0010,0x0018,0x001c,0x001e,0x001f,0x801f,0xc01f,0xe01f},\r
+{0x0008,0x000c,0x000e,0x000f,0x800f,0xc00f,0xe00f,0xf00f},\r
+{0x0004,0x0006,0x0007,0x8007,0xc007,0xe007,0xf007,0xf807},\r
+{0x0002,0x0003,0x8003,0xc003,0xe003,0xf003,0xf803,0xfc03},\r
+{0x0001,0x8001,0xc001,0xe001,0xf001,0xf801,0xfc01,0xfe01} };\r
+\r
+int                    slinex,slinewidth;\r
+unsigned       far *linecmds;\r
+long           linescale;\r
+unsigned       maskword;\r
+\r
diff --git a/16/wf3d8086/detect.c b/16/wf3d8086/detect.c
new file mode 100755 (executable)
index 0000000..c56f4bd
--- /dev/null
@@ -0,0 +1,87 @@
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_CheckSB() - Checks to see if a SoundBlaster resides at a\r
+//             particular I/O location\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+SDL_CheckSB(int port)\r
+{\r
+       int     i;\r
+\r
+       sbLocation = port << 4;         // Initialize stuff for later use\r
+\r
+       sbOut(sbReset,true);            // Reset the SoundBlaster DSP\r
+asm    mov     dx,0x388                                // Wait >4usec\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+\r
+       sbOut(sbReset,false);           // Turn off sb DSP reset\r
+asm    mov     dx,0x388                                // Wait >100usec\r
+asm    mov     cx,100\r
+usecloop:\r
+asm    in      al,dx\r
+asm    loop usecloop\r
+\r
+       for (i = 0;i < 100;i++)\r
+       {\r
+               if (sbIn(sbDataAvail) & 0x80)           // If data is available...\r
+               {\r
+                       if (sbIn(sbReadData) == 0xaa)   // If it matches correct value\r
+                               return(true);\r
+                       else\r
+                       {\r
+                               sbLocation = -1;                        // Otherwise not a SoundBlaster\r
+                               return(false);\r
+                       }\r
+               }\r
+       }\r
+       sbLocation = -1;                                                // Retry count exceeded - fail\r
+       return(false);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     Checks to see if a SoundBlaster is in the system. If the port passed is\r
+//             -1, then it scans through all possible I/O locations. If the port\r
+//             passed is 0, then it uses the default (2). If the port is >0, then\r
+//             it just passes it directly to SDL_CheckSB()\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+SDL_DetectSoundBlaster(int port)\r
+{\r
+       int     i;\r
+\r
+       if (port == 0)                                  // If user specifies default, use 2\r
+               port = 2;\r
+       if (port == -1)\r
+       {\r
+               if (SDL_CheckSB(2))                     // Check default before scanning\r
+                       return(true);\r
+\r
+               if (SDL_CheckSB(4))                     // Check other SB Pro location before scan\r
+                       return(true);\r
+\r
+               for (i = 1;i <= 6;i++)          // Scan through possible SB locations\r
+               {\r
+                       if ((i == 2) || (i == 4))\r
+                               continue;\r
+\r
+                       if (SDL_CheckSB(i))             // If found at this address,\r
+                               return(true);           //      return success\r
+               }\r
+               return(false);                          // All addresses failed, return failure\r
+       }\r
+       else\r
+               return(SDL_CheckSB(port));      // User specified address or default\r
+}\r
+\r
+\1a
\ No newline at end of file
diff --git a/16/wf3d8086/f_spear.h b/16/wf3d8086/f_spear.h
new file mode 100755 (executable)
index 0000000..d365657
--- /dev/null
@@ -0,0 +1,87 @@
+#define ENDSTR1        "Heroes don't quit, but\ngo ahead and press Y\nif you aren't one."\r
+#define ENDSTR2        "Press Y to quit,\nor press N to enjoy\nmore violent diversion."\r
+#define ENDSTR3        "Depressing the Y key means\nyou must return to the\nhumdrum workday world."\r
+#define ENDSTR4        "Hey, quit or play,\nY or N:\nit's your choice."\r
+#define ENDSTR5        "Sure you don't want to\nwaste a few more\nproductive hours?"\r
+#define ENDSTR6        "I think you had better\nplay some more. Please\npress N...please?"\r
+#define ENDSTR7        "If you are tough, press N.\nIf not, press Y daintily."\r
+#define ENDSTR8        "I'm thinkin' that\nyou might wanna press N\nto play more. You do it."\r
+#define ENDSTR9        "Sure. Fine. Quit.\nSee if we care.\nGet it over with.\nPress Y."\r
+\r
+#define STR_ENDGAME1   "We owe you a great debt, Mr. Blazkowicz."\r
+#define STR_ENDGAME2   "You have served your country well."\r
+#define STR_ENDGAME3   "With the spear gone, the Allies will finally"\r
+#define STR_ENDGAME4   "by able to destroy Hitler..."\r
+\r
+#define STR_COPY1              "That's close, but not close enough to get"\r
+#define STR_COPY2              "you into the game."\r
+\r
+#define STR_COPY3              "Wow, you must have the early version of the"\r
+#define STR_COPY4              "manual with the totally false information in it."\r
+\r
+#define STR_COPY5              "I would let you into the game, but seeing"\r
+#define STR_COPY6              "as that was not at all the right answer..."\r
+\r
+#define STR_COPY7              "It's just too bad we can't get together on"\r
+#define STR_COPY8              "this one.  Sorry."\r
+\r
+#define STR_COPY9              "Hey, you're just SO off base!"\r
+\r
+#define STR_COPY10             "You know, I once typed that myself when"\r
+#define STR_COPY11             "I was your age."\r
+\r
+#define STR_COPY12             "Nops.  Zero points.  Zugga."\r
+\r
+#define STR_COPY13             "Yeah...right."\r
+\r
+#define STR_COPY14             "You must like these quizzes."\r
+\r
+#define STR_COPY15             "Could be called \"PixelMeister\"?"\r
+\r
+#define STR_COPY16             "Might engineer some software?"\r
+\r
+#define STR_COPY17             "Would be found"\r
+#define STR_COPY18             "directing creatively?"\r
+\r
+#define STR_COPY19             "Might be found"\r
+#define STR_COPY20             "handling operations?"\r
+\r
+#define STR_COPY21             "Has a name familiar"\r
+#define STR_COPY22             "to your weatherman?"\r
+\r
+#define STR_NOPE1              "Welcome to the DOS prompt, pirate!"\r
+#define STR_NOPE2              "Eat hot DOS prompt, goober!"\r
+#define STR_NOPE3              "Ya know, this program doesn't cost that much."\r
+#define STR_NOPE4              "Hey...weren't you just AT this DOS prompt?"\r
+#define STR_NOPE5              "What's a nice user like you doin' at a DOS prompt like this?"\r
+#define STR_NOPE6              "Well, I'm sure you just \"misplaced\" the manual..."\r
+#define STR_NOPE7              "Run me again when you've boned up on your manual a bit."\r
+#define STR_NOPE8              "Nice try, but no Spear."\r
+#define STR_NOPE9              "That information is in the Spear of Destiny manual, by the way."\r
+\r
+#define STR_MISC1              "Under \"Killing the Enemy\", what"\r
+#define STR_MISC2              "type of enemy is pictured?"\r
+\r
+#define STR_MISC3              "How many eyelets are on B.J.'s"\r
+#define STR_MISC4              "boots? (see page 2)"\r
+\r
+#define STR_MISC5              "The word \"minister\" appears in"\r
+#define STR_MISC6              "what gray shape on page 2?"\r
+\r
+#define STR_MISC7              "How many bullets does B.J. have"\r
+#define STR_MISC8              "on the screen-shot in the middle"\r
+#define STR_MISC9              "of page 9?"\r
+\r
+#define STR_STAR       "star"\r
+#define STR_DEBRIEF    " DEBRIEFING\n SESSION\n"\r
+#define STR_ENEMY1     "Name the member of the"\r
+#define STR_ENEMY2     "enemy forces shown above"\r
+\r
+#define STR_CHECKMAN   "CHECK YER MANUAL!"\r
+#define STR_MAN1       "Which manual page"\r
+#define STR_MAN2       "is the Options Menu"\r
+#define STR_MAN3       "function"\r
+#define STR_MAN4       "on?"\r
+\r
+#define STR_ID1                "Which member of Id Software:"\r
+\1a
\ No newline at end of file
diff --git a/16/wf3d8086/foreign.h b/16/wf3d8086/foreign.h
new file mode 100755 (executable)
index 0000000..ff29912
--- /dev/null
@@ -0,0 +1,110 @@
+#define QUITSUR        "Are you sure you want\n"\\r
+               "to quit this great game?"\r
+\r
+#define CURGAME        "You are currently in\n"\\r
+               "a game. Continuing will\n"\\r
+               "erase old game. Ok?"\r
+\r
+#define GAMESVD        "There's already a game\n"\\r
+               "saved at this position.\n"\\r
+               "      Overwrite?"\r
+\r
+#define ENDGAMESTR     "Are you sure you want\n"\\r
+                                       "to end the game you\n"\\r
+                                       "are playing? (Y or N):"\r
+\r
+#define STR_NG "New Game"\r
+#define        STR_SD  "Sound"\r
+#define        STR_CL  "Control"\r
+#define        STR_LG  "Load Game"\r
+#define        STR_SG  "Save Game"\r
+#define        STR_CV  "Change View"\r
+#define        STR_VS  "View Scores"\r
+#define STR_EG "End Game"\r
+#define        STR_BD  "Back to Demo"\r
+#define STR_QT "Quit"\r
+\r
+#define STR_LOADING    "Loading"\r
+#define STR_SAVING     "Saving"\r
+\r
+#define STR_GAME       "Game"\r
+#define STR_DEMO       "Demo"\r
+#define STR_LGC                "Load Game called\n\""\r
+#define STR_EMPTY      "empty"\r
+#define STR_CALIB      "Calibrate"\r
+#define STR_JOYST      "Joystick"\r
+#define STR_MOVEJOY    "Move joystick to\nupper left and\npress button 0\n"\r
+#define STR_MOVEJOY2 "Move joystick to\nlower right and\npress button 1\n"\r
+#define STR_ESCEXIT    "ESC to exit"\r
+\r
+#define STR_NONE       "None"\r
+#define        STR_PC          "PC Speaker"\r
+#define        STR_ALSB        "AdLib/Sound Blaster"\r
+#define        STR_DISNEY      "Disney Sound Source"\r
+#define        STR_SB          "Sound Blaster"\r
+\r
+#define        STR_MOUSEEN     "Mouse Enabled"\r
+#define        STR_JOYEN       "Joystick Enabled"\r
+#define        STR_PORT2       "Use joystick port 2"\r
+#define        STR_GAMEPAD     "Gravis GamePad Enabled"\r
+#define        STR_SENS        "Mouse Sensitivity"\r
+#define        STR_CUSTOM      "Customize controls"\r
+\r
+#define        STR_DADDY       "Can I play, Daddy?"\r
+#define        STR_HURTME      "Don't hurt me."\r
+#define        STR_BRINGEM     "Bring 'em on!"\r
+#define        STR_DEATH       "I am Death incarnate!"\r
+\r
+#define        STR_MOUSEADJ    "Adjust Mouse Sensitivity"\r
+#define STR_SLOW       "Slow"\r
+#define STR_FAST       "Fast"\r
+\r
+#define        STR_CRUN        "Run"\r
+#define STR_COPEN      "Open"\r
+#define STR_CFIRE      "Fire"\r
+#define STR_CSTRAFE    "Strafe"\r
+\r
+#define        STR_LEFT        "Left"\r
+#define        STR_RIGHT       "Right"\r
+#define        STR_FRWD        "Frwd"\r
+#define        STR_BKWD        "Bkwrd"\r
+#define        STR_THINK       "Thinking"\r
+\r
+#define STR_SIZE1      "Use arrows to size"\r
+#define STR_SIZE2      "ENTER to accept"\r
+#define STR_SIZE3      "ESC to cancel"\r
+\r
+#define STR_YOUWIN     "you win!"\r
+\r
+#define STR_TOTALTIME  "total time"\r
+\r
+#define STR_RATKILL                "kill    %"\r
+#define STR_RATSECRET            "secret    %"\r
+#define STR_RATTREASURE        "treasure    %"\r
+\r
+#define STR_BONUS      "bonus"\r
+#define STR_TIME       "time"\r
+#define STR_PAR                " par"\r
+\r
+#define STR_RAT2KILL            "kill ratio    %"\r
+#define STR_RAT2SECRET           "secret ratio    %"\r
+#define STR_RAT2TREASURE       "treasure ratio    %"\r
+\r
+#define STR_DEFEATED   "defeated!"\r
+\r
+#define STR_CHEATER1   "You now have 100% Health,"\r
+#define STR_CHEATER2    "99 Ammo and both Keys!"\r
+#define STR_CHEATER3   "Note that you have basically"\r
+#define STR_CHEATER4   "eliminated your chances of"\r
+#define STR_CHEATER5   "getting a high score!"\r
+\r
+#define STR_NOSPACE1   "There is not enough space"\r
+#define STR_NOSPACE2   "on your disk to Save Game!"\r
+\r
+#define STR_SAVECHT1   "Your Save Game file is,"\r
+#define STR_SAVECHT2   "shall we say, \"corrupted\"."\r
+#define STR_SAVECHT3   "But I'll let you go on and"\r
+#define STR_SAVECHT4   "play anyway...."\r
+\r
+#define        STR_SEEAGAIN    "Let's see that again!"\r
+\1a
\ No newline at end of file
diff --git a/16/wf3d8086/gfxe_sod.equ b/16/wf3d8086/gfxe_sod.equ
new file mode 100755 (executable)
index 0000000..9b078fd
--- /dev/null
@@ -0,0 +1,47 @@
+;=====================================\r
+;\r
+; Graphics .EQU file for .SOD\r
+; IGRAB-ed on Fri Jul 31 18:31:00 1992\r
+;\r
+;=====================================\r
+\r
+\r
+\r
+\r
+\r
+\r
+;\r
+; Amount of each data item\r
+;\r
+NUMCHUNKS      =       414\r
+NUMFONT        =       0\r
+NUMFONTM       =       0\r
+NUMPICS        =       0\r
+NUMPICM        =       0\r
+NUMSPRITES     =       0\r
+NUMTILE8       =       0\r
+NUMTILE8M      =       0\r
+NUMTILE16      =       144\r
+NUMTILE16M     =       270\r
+NUMTILE32      =       0\r
+NUMTILE32M     =       0\r
+NUMEXTERN      =       0\r
+;\r
+; File offsets for data items\r
+;\r
+STARTFONT      =       0\r
+STARTFONTM     =       0\r
+STARTPICS      =       0\r
+STARTPICM      =       0\r
+STARTSPRITES   =       0\r
+STARTTILE8     =       0\r
+STARTTILE8M    =       0\r
+STARTTILE16    =       0\r
+STARTTILE16M   =       144\r
+STARTTILE32    =       414\r
+STARTTILE32M   =       414\r
+STARTEXTERN    =       414\r
+\r
+;\r
+; Thank you for using IGRAB!\r
+;\r
diff --git a/16/wf3d8086/gfxe_sod.h b/16/wf3d8086/gfxe_sod.h
new file mode 100755 (executable)
index 0000000..ae5c8cc
--- /dev/null
@@ -0,0 +1,53 @@
+//////////////////////////////////////\r
+//\r
+// Graphics .H file for .SOD\r
+// IGRAB-ed on Fri Jul 31 18:31:00 1992\r
+//\r
+//////////////////////////////////////\r
+\r
+typedef enum {\r
+\r
+\r
+\r
+               ENUMEND\r
+            } graphicnums;\r
+\r
+//\r
+// Data LUMPs\r
+//\r
+\r
+//\r
+// Amount of each data item\r
+//\r
+#define NUMCHUNKS    414\r
+#define NUMFONT      0\r
+#define NUMFONTM     0\r
+#define NUMPICS      0\r
+#define NUMPICM      0\r
+#define NUMSPRITES   0\r
+#define NUMTILE8     0\r
+#define NUMTILE8M    0\r
+#define NUMTILE16    144\r
+#define NUMTILE16M   270\r
+#define NUMTILE32    0\r
+#define NUMTILE32M   0\r
+#define NUMEXTERNS   0\r
+//\r
+// File offsets for data items\r
+//\r
+#define STARTFONT    0\r
+#define STARTFONTM   0\r
+#define STARTPICS    0\r
+#define STARTPICM    0\r
+#define STARTSPRITES 0\r
+#define STARTTILE8   0\r
+#define STARTTILE8M  0\r
+#define STARTTILE16  0\r
+#define STARTTILE16M 144\r
+#define STARTTILE32  414\r
+#define STARTTILE32M 414\r
+#define STARTEXTERNS 414\r
+\r
+//\r
+// Thank you for using IGRAB!\r
+//\r
diff --git a/16/wf3d8086/gfxe_wl1.equ b/16/wf3d8086/gfxe_wl1.equ
new file mode 100755 (executable)
index 0000000..30c25d1
--- /dev/null
@@ -0,0 +1,201 @@
+;=====================================\r
+;\r
+; Graphics .EQU file for .WL1\r
+; IGRAB-ed on Sat May 02 02:16:56 1992\r
+;\r
+;=====================================\r
+\r
+H_BJPIC                                =       3\r
+H_CASTLEPIC                    =       4\r
+H_KEYBOARDPIC                  =       5\r
+H_JOYPIC                       =       6\r
+H_MOUSEPIC                     =       7\r
+H_BOTHPIC                      =       8\r
+H_GAMEPADPIC                   =       9\r
+H_HEALPIC                      =       10\r
+H_TREASUREPIC                  =       11\r
+H_GUNPIC                       =       12\r
+H_KEYPIC                       =       13\r
+H_BLAZEPIC                     =       14\r
+H_WEAPON1234PIC                        =       15\r
+H_WOLFLOGOPIC                  =       16\r
+H_VISAPIC                      =       17\r
+H_MCPIC                                =       18\r
+H_IDLOGOPIC                    =       19\r
+H_FAXPIC                       =       20\r
+H_GALACTIXPIC                  =       21\r
+H_FGODMOMPIC                   =       22\r
+H_AUSTRALIAPIC                 =       23\r
+H_CANADAPIC                    =       24\r
+H_UKPIC                                =       25\r
+C_OPTIONSPIC                   =       26\r
+C_CURSOR1PIC                   =       27\r
+C_CURSOR2PIC                   =       28\r
+C_NOTSELECTEDPIC               =       29\r
+C_SELECTEDPIC                  =       30\r
+C_FXTITLEPIC                   =       31\r
+C_DIGITITLEPIC                 =       32\r
+C_MUSICTITLEPIC                        =       33\r
+C_MOUSELBACKPIC                        =       34\r
+C_BABYMODEPIC                  =       35\r
+C_EASYPIC                      =       36\r
+C_NORMALPIC                    =       37\r
+C_HARDPIC                      =       38\r
+C_LOADSAVEDISKPIC              =       39\r
+C_DISKLOADING1PIC              =       40\r
+C_DISKLOADING2PIC              =       41\r
+C_CONTROLPIC                   =       42\r
+C_CUSTOMIZEPIC                 =       43\r
+C_LOADGAMEPIC                  =       44\r
+C_SAVEGAMEPIC                  =       45\r
+C_EPISODE1PIC                  =       46\r
+C_EPISODE2PIC                  =       47\r
+C_EPISODE3PIC                  =       48\r
+C_EPISODE4PIC                  =       49\r
+C_EPISODE5PIC                  =       50\r
+C_EPISODE6PIC                  =       51\r
+C_CODEPIC                      =       52\r
+L_GUYPIC                       =       53\r
+L_COLONPIC                     =       54\r
+L_NUM0PIC                      =       55\r
+L_NUM1PIC                      =       56\r
+L_NUM2PIC                      =       57\r
+L_NUM3PIC                      =       58\r
+L_NUM4PIC                      =       59\r
+L_NUM5PIC                      =       60\r
+L_NUM6PIC                      =       61\r
+L_NUM7PIC                      =       62\r
+L_NUM8PIC                      =       63\r
+L_NUM9PIC                      =       64\r
+L_PERCENTPIC                   =       65\r
+L_APIC                         =       66\r
+L_BPIC                         =       67\r
+L_CPIC                         =       68\r
+L_DPIC                         =       69\r
+L_EPIC                         =       70\r
+L_FPIC                         =       71\r
+L_GPIC                         =       72\r
+L_HPIC                         =       73\r
+L_IPIC                         =       74\r
+L_JPIC                         =       75\r
+L_KPIC                         =       76\r
+L_LPIC                         =       77\r
+L_MPIC                         =       78\r
+L_NPIC                         =       79\r
+L_OPIC                         =       80\r
+L_PPIC                         =       81\r
+L_QPIC                         =       82\r
+L_RPIC                         =       83\r
+L_SPIC                         =       84\r
+L_TPIC                         =       85\r
+L_UPIC                         =       86\r
+L_VPIC                         =       87\r
+L_WPIC                         =       88\r
+L_XPIC                         =       89\r
+L_YPIC                         =       90\r
+L_ZPIC                         =       91\r
+L_GUY2PIC                      =       92\r
+L_BJWINSPIC                    =       93\r
+STATUSBARPIC                   =       94\r
+TITLEPIC                       =       95\r
+PG13PIC                                =       96\r
+CREDITSPIC                     =       97\r
+HIGHSCORESPIC                  =       98\r
+KNIFEPIC                       =       99\r
+GUNPIC                         =       100\r
+MACHINEGUNPIC                  =       101\r
+GATLINGGUNPIC                  =       102\r
+NOKEYPIC                       =       103\r
+GOLDKEYPIC                     =       104\r
+SILVERKEYPIC                   =       105\r
+N_BLANKPIC                     =       106\r
+N_0PIC                         =       107\r
+N_1PIC                         =       108\r
+N_2PIC                         =       109\r
+N_3PIC                         =       110\r
+N_4PIC                         =       111\r
+N_5PIC                         =       112\r
+N_6PIC                         =       113\r
+N_7PIC                         =       114\r
+N_8PIC                         =       115\r
+N_9PIC                         =       116\r
+FACE1APIC                      =       117\r
+FACE1BPIC                      =       118\r
+FACE1CPIC                      =       119\r
+FACE2APIC                      =       120\r
+FACE2BPIC                      =       121\r
+FACE2CPIC                      =       122\r
+FACE3APIC                      =       123\r
+FACE3BPIC                      =       124\r
+FACE3CPIC                      =       125\r
+FACE4APIC                      =       126\r
+FACE4BPIC                      =       127\r
+FACE4CPIC                      =       128\r
+FACE5APIC                      =       129\r
+FACE5BPIC                      =       130\r
+FACE5CPIC                      =       131\r
+FACE6APIC                      =       132\r
+FACE6BPIC                      =       133\r
+FACE6CPIC                      =       134\r
+FACE7APIC                      =       135\r
+FACE7BPIC                      =       136\r
+FACE7CPIC                      =       137\r
+FACE8APIC                      =       138\r
+GOTGATLINGPIC                  =       139\r
+PAUSEDPIC                      =       140\r
+GETPSYCHEDPIC                  =       141\r
+\r
+\r
+\r
+ORDERSCREEN                    =       557\r
+\r
+README_LUMP_START              =       3\r
+README_LUMP_END                        =       25\r
+\r
+CONTROLS_LUMP_START            =       26\r
+CONTROLS_LUMP_END              =       52\r
+\r
+LEVELEND_LUMP_START            =       53\r
+LEVELEND_LUMP_END              =       93\r
+\r
+LATCHPICS_LUMP_START           =       99\r
+LATCHPICS_LUMP_END             =       141\r
+\r
+\r
+;\r
+; Amount of each data item\r
+;\r
+NUMCHUNKS      =       558\r
+NUMFONT        =       2\r
+NUMFONTM       =       0\r
+NUMPICS        =       139\r
+NUMPICM        =       0\r
+NUMSPRITES     =       0\r
+NUMTILE8       =       72\r
+NUMTILE8M      =       0\r
+NUMTILE16      =       144\r
+NUMTILE16M     =       270\r
+NUMTILE32      =       0\r
+NUMTILE32M     =       0\r
+NUMEXTERN      =       1\r
+;\r
+; File offsets for data items\r
+;\r
+STRUCTPIC      =       0\r
+\r
+STARTFONT      =       1\r
+STARTFONTM     =       3\r
+STARTPICS      =       3\r
+STARTPICM      =       142\r
+STARTSPRITES   =       142\r
+STARTTILE8     =       142\r
+STARTTILE8M    =       143\r
+STARTTILE16    =       143\r
+STARTTILE16M   =       287\r
+STARTTILE32    =       557\r
+STARTTILE32M   =       557\r
+STARTEXTERN    =       557\r
+\r
+;\r
+; Thank you for using IGRAB!\r
+;\r
diff --git a/16/wf3d8086/gfxe_wl1.h b/16/wf3d8086/gfxe_wl1.h
new file mode 100755 (executable)
index 0000000..95b8131
--- /dev/null
@@ -0,0 +1,211 @@
+//////////////////////////////////////\r
+//\r
+// Graphics .H file for .WL1\r
+// IGRAB-ed on Sat May 02 02:16:56 1992\r
+//\r
+//////////////////////////////////////\r
+\r
+typedef enum {\r
+               // Lump Start\r
+               H_BJPIC=3,\r
+               H_CASTLEPIC,                 // 4\r
+               H_KEYBOARDPIC,               // 5\r
+               H_JOYPIC,                    // 6\r
+               H_MOUSEPIC,                  // 7\r
+               H_BOTHPIC,                   // 8\r
+               H_GAMEPADPIC,                // 9\r
+               H_HEALPIC,                   // 10\r
+               H_TREASUREPIC,               // 11\r
+               H_GUNPIC,                    // 12\r
+               H_KEYPIC,                    // 13\r
+               H_BLAZEPIC,                  // 14\r
+               H_WEAPON1234PIC,             // 15\r
+               H_WOLFLOGOPIC,               // 16\r
+               H_VISAPIC,                   // 17\r
+               H_MCPIC,                     // 18\r
+               H_IDLOGOPIC,                 // 19\r
+               H_FAXPIC,                    // 20\r
+               H_GALACTIXPIC,               // 21\r
+               H_FGODMOMPIC,                // 22\r
+               H_AUSTRALIAPIC,              // 23\r
+               H_CANADAPIC,                 // 24\r
+               H_UKPIC,                     // 25\r
+               // Lump Start\r
+               C_OPTIONSPIC,                // 26\r
+               C_CURSOR1PIC,                // 27\r
+               C_CURSOR2PIC,                // 28\r
+               C_NOTSELECTEDPIC,            // 29\r
+               C_SELECTEDPIC,               // 30\r
+               C_FXTITLEPIC,                // 31\r
+               C_DIGITITLEPIC,              // 32\r
+               C_MUSICTITLEPIC,             // 33\r
+               C_MOUSELBACKPIC,             // 34\r
+               C_BABYMODEPIC,               // 35\r
+               C_EASYPIC,                   // 36\r
+               C_NORMALPIC,                 // 37\r
+               C_HARDPIC,                   // 38\r
+               C_LOADSAVEDISKPIC,           // 39\r
+               C_DISKLOADING1PIC,           // 40\r
+               C_DISKLOADING2PIC,           // 41\r
+               C_CONTROLPIC,                // 42\r
+               C_CUSTOMIZEPIC,              // 43\r
+               C_LOADGAMEPIC,               // 44\r
+               C_SAVEGAMEPIC,               // 45\r
+               C_EPISODE1PIC,               // 46\r
+               C_EPISODE2PIC,               // 47\r
+               C_EPISODE3PIC,               // 48\r
+               C_EPISODE4PIC,               // 49\r
+               C_EPISODE5PIC,               // 50\r
+               C_EPISODE6PIC,               // 51\r
+               C_CODEPIC,                   // 52\r
+               // Lump Start\r
+               L_GUYPIC,                    // 53\r
+               L_COLONPIC,                  // 54\r
+               L_NUM0PIC,                   // 55\r
+               L_NUM1PIC,                   // 56\r
+               L_NUM2PIC,                   // 57\r
+               L_NUM3PIC,                   // 58\r
+               L_NUM4PIC,                   // 59\r
+               L_NUM5PIC,                   // 60\r
+               L_NUM6PIC,                   // 61\r
+               L_NUM7PIC,                   // 62\r
+               L_NUM8PIC,                   // 63\r
+               L_NUM9PIC,                   // 64\r
+               L_PERCENTPIC,                // 65\r
+               L_APIC,                      // 66\r
+               L_BPIC,                      // 67\r
+               L_CPIC,                      // 68\r
+               L_DPIC,                      // 69\r
+               L_EPIC,                      // 70\r
+               L_FPIC,                      // 71\r
+               L_GPIC,                      // 72\r
+               L_HPIC,                      // 73\r
+               L_IPIC,                      // 74\r
+               L_JPIC,                      // 75\r
+               L_KPIC,                      // 76\r
+               L_LPIC,                      // 77\r
+               L_MPIC,                      // 78\r
+               L_NPIC,                      // 79\r
+               L_OPIC,                      // 80\r
+               L_PPIC,                      // 81\r
+               L_QPIC,                      // 82\r
+               L_RPIC,                      // 83\r
+               L_SPIC,                      // 84\r
+               L_TPIC,                      // 85\r
+               L_UPIC,                      // 86\r
+               L_VPIC,                      // 87\r
+               L_WPIC,                      // 88\r
+               L_XPIC,                      // 89\r
+               L_YPIC,                      // 90\r
+               L_ZPIC,                      // 91\r
+               L_GUY2PIC,                   // 92\r
+               L_BJWINSPIC,                 // 93\r
+               STATUSBARPIC,                // 94\r
+               TITLEPIC,                    // 95\r
+               PG13PIC,                     // 96\r
+               CREDITSPIC,                  // 97\r
+               HIGHSCORESPIC,               // 98\r
+               // Lump Start\r
+               KNIFEPIC,                    // 99\r
+               GUNPIC,                      // 100\r
+               MACHINEGUNPIC,               // 101\r
+               GATLINGGUNPIC,               // 102\r
+               NOKEYPIC,                    // 103\r
+               GOLDKEYPIC,                  // 104\r
+               SILVERKEYPIC,                // 105\r
+               N_BLANKPIC,                  // 106\r
+               N_0PIC,                      // 107\r
+               N_1PIC,                      // 108\r
+               N_2PIC,                      // 109\r
+               N_3PIC,                      // 110\r
+               N_4PIC,                      // 111\r
+               N_5PIC,                      // 112\r
+               N_6PIC,                      // 113\r
+               N_7PIC,                      // 114\r
+               N_8PIC,                      // 115\r
+               N_9PIC,                      // 116\r
+               FACE1APIC,                   // 117\r
+               FACE1BPIC,                   // 118\r
+               FACE1CPIC,                   // 119\r
+               FACE2APIC,                   // 120\r
+               FACE2BPIC,                   // 121\r
+               FACE2CPIC,                   // 122\r
+               FACE3APIC,                   // 123\r
+               FACE3BPIC,                   // 124\r
+               FACE3CPIC,                   // 125\r
+               FACE4APIC,                   // 126\r
+               FACE4BPIC,                   // 127\r
+               FACE4CPIC,                   // 128\r
+               FACE5APIC,                   // 129\r
+               FACE5BPIC,                   // 130\r
+               FACE5CPIC,                   // 131\r
+               FACE6APIC,                   // 132\r
+               FACE6BPIC,                   // 133\r
+               FACE6CPIC,                   // 134\r
+               FACE7APIC,                   // 135\r
+               FACE7BPIC,                   // 136\r
+               FACE7CPIC,                   // 137\r
+               FACE8APIC,                   // 138\r
+               GOTGATLINGPIC,               // 139\r
+               PAUSEDPIC,                   // 140\r
+               GETPSYCHEDPIC,               // 141\r
+\r
+\r
+\r
+               ORDERSCREEN=557,\r
+               ENUMEND\r
+            } graphicnums;\r
+\r
+//\r
+// Data LUMPs\r
+//\r
+#define README_LUMP_START              3\r
+#define README_LUMP_END                        25\r
+\r
+#define CONTROLS_LUMP_START            26\r
+#define CONTROLS_LUMP_END              52\r
+\r
+#define LEVELEND_LUMP_START            53\r
+#define LEVELEND_LUMP_END              93\r
+\r
+#define LATCHPICS_LUMP_START           99\r
+#define LATCHPICS_LUMP_END             141\r
+\r
+\r
+//\r
+// Amount of each data item\r
+//\r
+#define NUMCHUNKS    558\r
+#define NUMFONT      2\r
+#define NUMFONTM     0\r
+#define NUMPICS      139\r
+#define NUMPICM      0\r
+#define NUMSPRITES   0\r
+#define NUMTILE8     72\r
+#define NUMTILE8M    0\r
+#define NUMTILE16    144\r
+#define NUMTILE16M   270\r
+#define NUMTILE32    0\r
+#define NUMTILE32M   0\r
+#define NUMEXTERNS   1\r
+//\r
+// File offsets for data items\r
+//\r
+#define STRUCTPIC    0\r
+\r
+#define STARTFONT    1\r
+#define STARTFONTM   3\r
+#define STARTPICS    3\r
+#define STARTPICM    142\r
+#define STARTSPRITES 142\r
+#define STARTTILE8   142\r
+#define STARTTILE8M  143\r
+#define STARTTILE16  143\r
+#define STARTTILE16M 287\r
+#define STARTTILE32  557\r
+#define STARTTILE32M 557\r
+#define STARTEXTERNS 557\r
+\r
+//\r
+// Thank you for using IGRAB!\r
+//\r
diff --git a/16/wf3d8086/gfxe_wl6.equ b/16/wf3d8086/gfxe_wl6.equ
new file mode 100755 (executable)
index 0000000..4b01c2f
--- /dev/null
@@ -0,0 +1,47 @@
+;=====================================\r
+;\r
+; Graphics .EQU file for .WL6\r
+; IGRAB-ed on Sun Aug 09 22:17:20 1992\r
+;\r
+;=====================================\r
+\r
+\r
+\r
+\r
+\r
+\r
+;\r
+; Amount of each data item\r
+;\r
+NUMCHUNKS      =       414\r
+NUMFONT        =       0\r
+NUMFONTM       =       0\r
+NUMPICS        =       0\r
+NUMPICM        =       0\r
+NUMSPRITES     =       0\r
+NUMTILE8       =       0\r
+NUMTILE8M      =       0\r
+NUMTILE16      =       144\r
+NUMTILE16M     =       270\r
+NUMTILE32      =       0\r
+NUMTILE32M     =       0\r
+NUMEXTERN      =       0\r
+;\r
+; File offsets for data items\r
+;\r
+STARTFONT      =       0\r
+STARTFONTM     =       0\r
+STARTPICS      =       0\r
+STARTPICM      =       0\r
+STARTSPRITES   =       0\r
+STARTTILE8     =       0\r
+STARTTILE8M    =       0\r
+STARTTILE16    =       0\r
+STARTTILE16M   =       144\r
+STARTTILE32    =       414\r
+STARTTILE32M   =       414\r
+STARTEXTERN    =       414\r
+\r
+;\r
+; Thank you for using IGRAB!\r
+;\r
diff --git a/16/wf3d8086/gfxe_wl6.h b/16/wf3d8086/gfxe_wl6.h
new file mode 100755 (executable)
index 0000000..55f1d31
--- /dev/null
@@ -0,0 +1,53 @@
+//////////////////////////////////////\r
+//\r
+// Graphics .H file for .WL6\r
+// IGRAB-ed on Sun Aug 09 22:17:20 1992\r
+//\r
+//////////////////////////////////////\r
+\r
+typedef enum {\r
+\r
+\r
+\r
+               ENUMEND\r
+            } graphicnums;\r
+\r
+//\r
+// Data LUMPs\r
+//\r
+\r
+//\r
+// Amount of each data item\r
+//\r
+#define NUMCHUNKS    414\r
+#define NUMFONT      0\r
+#define NUMFONTM     0\r
+#define NUMPICS      0\r
+#define NUMPICM      0\r
+#define NUMSPRITES   0\r
+#define NUMTILE8     0\r
+#define NUMTILE8M    0\r
+#define NUMTILE16    144\r
+#define NUMTILE16M   270\r
+#define NUMTILE32    0\r
+#define NUMTILE32M   0\r
+#define NUMEXTERNS   0\r
+//\r
+// File offsets for data items\r
+//\r
+#define STARTFONT    0\r
+#define STARTFONTM   0\r
+#define STARTPICS    0\r
+#define STARTPICM    0\r
+#define STARTSPRITES 0\r
+#define STARTTILE8   0\r
+#define STARTTILE8M  0\r
+#define STARTTILE16  0\r
+#define STARTTILE16M 144\r
+#define STARTTILE32  414\r
+#define STARTTILE32M 414\r
+#define STARTEXTERNS 414\r
+\r
+//\r
+// Thank you for using IGRAB!\r
+//\r
diff --git a/16/wf3d8086/gfxv_sdm.equ b/16/wf3d8086/gfxv_sdm.equ
new file mode 100755 (executable)
index 0000000..e586b2d
--- /dev/null
@@ -0,0 +1,208 @@
+;=====================================\r
+;\r
+; Graphics .EQU file for .SDM\r
+; IGRAB-ed on Mon Sep 21 14:20:19 1992\r
+;\r
+;=====================================\r
+\r
+C_BACKDROPPIC                  =       3\r
+C_MOUSELBACKPIC                        =       4\r
+C_CURSOR1PIC                   =       5\r
+C_CURSOR2PIC                   =       6\r
+C_NOTSELECTEDPIC               =       7\r
+C_SELECTEDPIC                  =       8\r
+C_CUSTOMIZEPIC                 =       9\r
+C_JOY1PIC                      =       10\r
+C_JOY2PIC                      =       11\r
+C_MOUSEPIC                     =       12\r
+C_JOYSTICKPIC                  =       13\r
+C_KEYBOARDPIC                  =       14\r
+C_CONTROLPIC                   =       15\r
+C_OPTIONSPIC                   =       16\r
+C_FXTITLEPIC                   =       17\r
+C_DIGITITLEPIC                 =       18\r
+C_MUSICTITLEPIC                        =       19\r
+C_HOWTOUGHPIC                  =       20\r
+C_BABYMODEPIC                  =       21\r
+C_EASYPIC                      =       22\r
+C_NORMALPIC                    =       23\r
+C_HARDPIC                      =       24\r
+C_DISKLOADING1PIC              =       25\r
+C_DISKLOADING2PIC              =       26\r
+C_LOADGAMEPIC                  =       27\r
+C_SAVEGAMEPIC                  =       28\r
+HIGHSCORESPIC                  =       29\r
+C_WONSPEARPIC                  =       30\r
+L_GUYPIC                       =       31\r
+L_COLONPIC                     =       32\r
+L_NUM0PIC                      =       33\r
+L_NUM1PIC                      =       34\r
+L_NUM2PIC                      =       35\r
+L_NUM3PIC                      =       36\r
+L_NUM4PIC                      =       37\r
+L_NUM5PIC                      =       38\r
+L_NUM6PIC                      =       39\r
+L_NUM7PIC                      =       40\r
+L_NUM8PIC                      =       41\r
+L_NUM9PIC                      =       42\r
+L_PERCENTPIC                   =       43\r
+L_APIC                         =       44\r
+L_BPIC                         =       45\r
+L_CPIC                         =       46\r
+L_DPIC                         =       47\r
+L_EPIC                         =       48\r
+L_FPIC                         =       49\r
+L_GPIC                         =       50\r
+L_HPIC                         =       51\r
+L_IPIC                         =       52\r
+L_JPIC                         =       53\r
+L_KPIC                         =       54\r
+L_LPIC                         =       55\r
+L_MPIC                         =       56\r
+L_NPIC                         =       57\r
+L_OPIC                         =       58\r
+L_PPIC                         =       59\r
+L_QPIC                         =       60\r
+L_RPIC                         =       61\r
+L_SPIC                         =       62\r
+L_TPIC                         =       63\r
+L_UPIC                         =       64\r
+L_VPIC                         =       65\r
+L_WPIC                         =       66\r
+L_XPIC                         =       67\r
+L_YPIC                         =       68\r
+L_ZPIC                         =       69\r
+L_EXPOINTPIC                   =       70\r
+L_APOSTROPHEPIC                        =       71\r
+L_GUY2PIC                      =       72\r
+L_BJWINSPIC                    =       73\r
+TITLE1PIC                      =       74\r
+TITLE2PIC                      =       75\r
+STATUSBARPIC                   =       76\r
+PG13PIC                                =       77\r
+CREDITSPIC                     =       78\r
+KNIFEPIC                       =       79\r
+GUNPIC                         =       80\r
+MACHINEGUNPIC                  =       81\r
+GATLINGGUNPIC                  =       82\r
+NOKEYPIC                       =       83\r
+GOLDKEYPIC                     =       84\r
+SILVERKEYPIC                   =       85\r
+N_BLANKPIC                     =       86\r
+N_0PIC                         =       87\r
+N_1PIC                         =       88\r
+N_2PIC                         =       89\r
+N_3PIC                         =       90\r
+N_4PIC                         =       91\r
+N_5PIC                         =       92\r
+N_6PIC                         =       93\r
+N_7PIC                         =       94\r
+N_8PIC                         =       95\r
+N_9PIC                         =       96\r
+FACE1APIC                      =       97\r
+FACE1BPIC                      =       98\r
+FACE1CPIC                      =       99\r
+FACE2APIC                      =       100\r
+FACE2BPIC                      =       101\r
+FACE2CPIC                      =       102\r
+FACE3APIC                      =       103\r
+FACE3BPIC                      =       104\r
+FACE3CPIC                      =       105\r
+FACE4APIC                      =       106\r
+FACE4BPIC                      =       107\r
+FACE4CPIC                      =       108\r
+FACE5APIC                      =       109\r
+FACE5BPIC                      =       110\r
+FACE5CPIC                      =       111\r
+FACE6APIC                      =       112\r
+FACE6BPIC                      =       113\r
+FACE6CPIC                      =       114\r
+FACE7APIC                      =       115\r
+FACE7BPIC                      =       116\r
+FACE7CPIC                      =       117\r
+FACE8APIC                      =       118\r
+GOTGATLINGPIC                  =       119\r
+GODMODEFACE1PIC                        =       120\r
+GODMODEFACE2PIC                        =       121\r
+GODMODEFACE3PIC                        =       122\r
+BJWAITING1PIC                  =       123\r
+BJWAITING2PIC                  =       124\r
+BJOUCHPIC                      =       125\r
+PAUSEDPIC                      =       126\r
+GETPSYCHEDPIC                  =       127\r
+\r
+\r
+\r
+ORDERSCREEN                    =       129\r
+ERRORSCREEN                    =       130\r
+TITLEPALETTE                   =       131\r
+T_DEMO0                                =       132\r
+\r
+BACKDROP_LUMP_START            =       3\r
+BACKDROP_LUMP_END              =       8\r
+\r
+CONTROL_LUMP_START             =       9\r
+CONTROL_LUMP_END               =       15\r
+\r
+OPTIONS_LUMP_START             =       16\r
+OPTIONS_LUMP_END               =       16\r
+\r
+SOUND_LUMP_START               =       17\r
+SOUND_LUMP_END                 =       19\r
+\r
+NEWGAME_LUMP_START             =       20\r
+NEWGAME_LUMP_END               =       24\r
+\r
+LOADSAVE_LUMP_START            =       25\r
+LOADSAVE_LUMP_END              =       28\r
+\r
+HIGHSCORES_LUMP_START          =       29\r
+HIGHSCORES_LUMP_END            =       30\r
+\r
+LEVELEND_LUMP_START            =       31\r
+LEVELEND_LUMP_END              =       73\r
+\r
+TITLESCREEN_LUMP_START         =       74\r
+TITLESCREEN_LUMP_END           =       75\r
+\r
+LATCHPICS_LUMP_START           =       79\r
+LATCHPICS_LUMP_END             =       127\r
+\r
+\r
+;\r
+; Amount of each data item\r
+;\r
+NUMCHUNKS      =       133\r
+NUMFONT        =       2\r
+NUMFONTM       =       0\r
+NUMPICS        =       125\r
+NUMPICM        =       0\r
+NUMSPRITES     =       0\r
+NUMTILE8       =       72\r
+NUMTILE8M      =       0\r
+NUMTILE16      =       0\r
+NUMTILE16M     =       0\r
+NUMTILE32      =       0\r
+NUMTILE32M     =       0\r
+NUMEXTERN      =       4\r
+;\r
+; File offsets for data items\r
+;\r
+STRUCTPIC      =       0\r
+\r
+STARTFONT      =       1\r
+STARTFONTM     =       3\r
+STARTPICS      =       3\r
+STARTPICM      =       128\r
+STARTSPRITES   =       128\r
+STARTTILE8     =       128\r
+STARTTILE8M    =       129\r
+STARTTILE16    =       129\r
+STARTTILE16M   =       129\r
+STARTTILE32    =       129\r
+STARTTILE32M   =       129\r
+STARTEXTERN    =       129\r
+\r
+;\r
+; Thank you for using IGRAB!\r
+;\r
diff --git a/16/wf3d8086/gfxv_sdm.h b/16/wf3d8086/gfxv_sdm.h
new file mode 100755 (executable)
index 0000000..b9bb476
--- /dev/null
@@ -0,0 +1,224 @@
+//////////////////////////////////////\r
+//\r
+// Graphics .H file for .SDM\r
+// IGRAB-ed on Mon Sep 21 14:20:19 1992\r
+//\r
+//////////////////////////////////////\r
+\r
+typedef enum {\r
+               // Lump Start\r
+               C_BACKDROPPIC=3,\r
+               C_MOUSELBACKPIC,                     // 4\r
+               C_CURSOR1PIC,                        // 5\r
+               C_CURSOR2PIC,                        // 6\r
+               C_NOTSELECTEDPIC,                    // 7\r
+               C_SELECTEDPIC,                       // 8\r
+               // Lump Start\r
+               C_CUSTOMIZEPIC,                      // 9\r
+               C_JOY1PIC,                           // 10\r
+               C_JOY2PIC,                           // 11\r
+               C_MOUSEPIC,                          // 12\r
+               C_JOYSTICKPIC,                       // 13\r
+               C_KEYBOARDPIC,                       // 14\r
+               C_CONTROLPIC,                        // 15\r
+               // Lump Start\r
+               C_OPTIONSPIC,                        // 16\r
+               // Lump Start\r
+               C_FXTITLEPIC,                        // 17\r
+               C_DIGITITLEPIC,                      // 18\r
+               C_MUSICTITLEPIC,                     // 19\r
+               // Lump Start\r
+               C_HOWTOUGHPIC,                       // 20\r
+               C_BABYMODEPIC,                       // 21\r
+               C_EASYPIC,                           // 22\r
+               C_NORMALPIC,                         // 23\r
+               C_HARDPIC,                           // 24\r
+               // Lump Start\r
+               C_DISKLOADING1PIC,                   // 25\r
+               C_DISKLOADING2PIC,                   // 26\r
+               C_LOADGAMEPIC,                       // 27\r
+               C_SAVEGAMEPIC,                       // 28\r
+               // Lump Start\r
+               HIGHSCORESPIC,                       // 29\r
+               C_WONSPEARPIC,                       // 30\r
+               // Lump Start\r
+               L_GUYPIC,                            // 31\r
+               L_COLONPIC,                          // 32\r
+               L_NUM0PIC,                           // 33\r
+               L_NUM1PIC,                           // 34\r
+               L_NUM2PIC,                           // 35\r
+               L_NUM3PIC,                           // 36\r
+               L_NUM4PIC,                           // 37\r
+               L_NUM5PIC,                           // 38\r
+               L_NUM6PIC,                           // 39\r
+               L_NUM7PIC,                           // 40\r
+               L_NUM8PIC,                           // 41\r
+               L_NUM9PIC,                           // 42\r
+               L_PERCENTPIC,                        // 43\r
+               L_APIC,                              // 44\r
+               L_BPIC,                              // 45\r
+               L_CPIC,                              // 46\r
+               L_DPIC,                              // 47\r
+               L_EPIC,                              // 48\r
+               L_FPIC,                              // 49\r
+               L_GPIC,                              // 50\r
+               L_HPIC,                              // 51\r
+               L_IPIC,                              // 52\r
+               L_JPIC,                              // 53\r
+               L_KPIC,                              // 54\r
+               L_LPIC,                              // 55\r
+               L_MPIC,                              // 56\r
+               L_NPIC,                              // 57\r
+               L_OPIC,                              // 58\r
+               L_PPIC,                              // 59\r
+               L_QPIC,                              // 60\r
+               L_RPIC,                              // 61\r
+               L_SPIC,                              // 62\r
+               L_TPIC,                              // 63\r
+               L_UPIC,                              // 64\r
+               L_VPIC,                              // 65\r
+               L_WPIC,                              // 66\r
+               L_XPIC,                              // 67\r
+               L_YPIC,                              // 68\r
+               L_ZPIC,                              // 69\r
+               L_EXPOINTPIC,                        // 70\r
+               L_APOSTROPHEPIC,                     // 71\r
+               L_GUY2PIC,                           // 72\r
+               L_BJWINSPIC,                         // 73\r
+               // Lump Start\r
+               TITLE1PIC,                           // 74\r
+               TITLE2PIC,                           // 75\r
+               STATUSBARPIC,                        // 76\r
+               PG13PIC,                             // 77\r
+               CREDITSPIC,                          // 78\r
+               // Lump Start\r
+               KNIFEPIC,                            // 79\r
+               GUNPIC,                              // 80\r
+               MACHINEGUNPIC,                       // 81\r
+               GATLINGGUNPIC,                       // 82\r
+               NOKEYPIC,                            // 83\r
+               GOLDKEYPIC,                          // 84\r
+               SILVERKEYPIC,                        // 85\r
+               N_BLANKPIC,                          // 86\r
+               N_0PIC,                              // 87\r
+               N_1PIC,                              // 88\r
+               N_2PIC,                              // 89\r
+               N_3PIC,                              // 90\r
+               N_4PIC,                              // 91\r
+               N_5PIC,                              // 92\r
+               N_6PIC,                              // 93\r
+               N_7PIC,                              // 94\r
+               N_8PIC,                              // 95\r
+               N_9PIC,                              // 96\r
+               FACE1APIC,                           // 97\r
+               FACE1BPIC,                           // 98\r
+               FACE1CPIC,                           // 99\r
+               FACE2APIC,                           // 100\r
+               FACE2BPIC,                           // 101\r
+               FACE2CPIC,                           // 102\r
+               FACE3APIC,                           // 103\r
+               FACE3BPIC,                           // 104\r
+               FACE3CPIC,                           // 105\r
+               FACE4APIC,                           // 106\r
+               FACE4BPIC,                           // 107\r
+               FACE4CPIC,                           // 108\r
+               FACE5APIC,                           // 109\r
+               FACE5BPIC,                           // 110\r
+               FACE5CPIC,                           // 111\r
+               FACE6APIC,                           // 112\r
+               FACE6BPIC,                           // 113\r
+               FACE6CPIC,                           // 114\r
+               FACE7APIC,                           // 115\r
+               FACE7BPIC,                           // 116\r
+               FACE7CPIC,                           // 117\r
+               FACE8APIC,                           // 118\r
+               GOTGATLINGPIC,                       // 119\r
+               GODMODEFACE1PIC,                     // 120\r
+               GODMODEFACE2PIC,                     // 121\r
+               GODMODEFACE3PIC,                     // 122\r
+               BJWAITING1PIC,                       // 123\r
+               BJWAITING2PIC,                       // 124\r
+               BJOUCHPIC,                           // 125\r
+               PAUSEDPIC,                           // 126\r
+               GETPSYCHEDPIC,                       // 127\r
+\r
+\r
+\r
+               ORDERSCREEN=129,\r
+               ERRORSCREEN,                         // 130\r
+               TITLEPALETTE,                        // 131\r
+               T_DEMO0,                             // 132\r
+               ENUMEND\r
+            } graphicnums;\r
+\r
+//\r
+// Data LUMPs\r
+//\r
+#define BACKDROP_LUMP_START            3\r
+#define BACKDROP_LUMP_END              8\r
+\r
+#define CONTROL_LUMP_START             9\r
+#define CONTROL_LUMP_END               15\r
+\r
+#define OPTIONS_LUMP_START             16\r
+#define OPTIONS_LUMP_END               16\r
+\r
+#define SOUND_LUMP_START               17\r
+#define SOUND_LUMP_END                 19\r
+\r
+#define NEWGAME_LUMP_START             20\r
+#define NEWGAME_LUMP_END               24\r
+\r
+#define LOADSAVE_LUMP_START            25\r
+#define LOADSAVE_LUMP_END              28\r
+\r
+#define HIGHSCORES_LUMP_START          29\r
+#define HIGHSCORES_LUMP_END            30\r
+\r
+#define LEVELEND_LUMP_START            31\r
+#define LEVELEND_LUMP_END              73\r
+\r
+#define TITLESCREEN_LUMP_START         74\r
+#define TITLESCREEN_LUMP_END           75\r
+\r
+#define LATCHPICS_LUMP_START           79\r
+#define LATCHPICS_LUMP_END             127\r
+\r
+\r
+//\r
+// Amount of each data item\r
+//\r
+#define NUMCHUNKS    133\r
+#define NUMFONT      2\r
+#define NUMFONTM     0\r
+#define NUMPICS      125\r
+#define NUMPICM      0\r
+#define NUMSPRITES   0\r
+#define NUMTILE8     72\r
+#define NUMTILE8M    0\r
+#define NUMTILE16    0\r
+#define NUMTILE16M   0\r
+#define NUMTILE32    0\r
+#define NUMTILE32M   0\r
+#define NUMEXTERNS   4\r
+//\r
+// File offsets for data items\r
+//\r
+#define STRUCTPIC    0\r
+\r
+#define STARTFONT    1\r
+#define STARTFONTM   3\r
+#define STARTPICS    3\r
+#define STARTPICM    128\r
+#define STARTSPRITES 128\r
+#define STARTTILE8   128\r
+#define STARTTILE8M  129\r
+#define STARTTILE16  129\r
+#define STARTTILE16M 129\r
+#define STARTTILE32  129\r
+#define STARTTILE32M 129\r
+#define STARTEXTERNS 129\r
+\r
+//\r
+// Thank you for using IGRAB!\r
+//\r
diff --git a/16/wf3d8086/gfxv_sod.equ b/16/wf3d8086/gfxv_sod.equ
new file mode 100755 (executable)
index 0000000..ec6dece
--- /dev/null
@@ -0,0 +1,259 @@
+;=====================================\r
+;\r
+; Graphics .EQU file for .SOD\r
+; IGRAB-ed on Thu Oct 08 20:38:29 1992\r
+;\r
+;=====================================\r
+\r
+C_BACKDROPPIC                  =       3\r
+C_MOUSELBACKPIC                        =       4\r
+C_CURSOR1PIC                   =       5\r
+C_CURSOR2PIC                   =       6\r
+C_NOTSELECTEDPIC               =       7\r
+C_SELECTEDPIC                  =       8\r
+C_CUSTOMIZEPIC                 =       9\r
+C_JOY1PIC                      =       10\r
+C_JOY2PIC                      =       11\r
+C_MOUSEPIC                     =       12\r
+C_JOYSTICKPIC                  =       13\r
+C_KEYBOARDPIC                  =       14\r
+C_CONTROLPIC                   =       15\r
+C_OPTIONSPIC                   =       16\r
+C_FXTITLEPIC                   =       17\r
+C_DIGITITLEPIC                 =       18\r
+C_MUSICTITLEPIC                        =       19\r
+C_HOWTOUGHPIC                  =       20\r
+C_BABYMODEPIC                  =       21\r
+C_EASYPIC                      =       22\r
+C_NORMALPIC                    =       23\r
+C_HARDPIC                      =       24\r
+C_DISKLOADING1PIC              =       25\r
+C_DISKLOADING2PIC              =       26\r
+C_LOADGAMEPIC                  =       27\r
+C_SAVEGAMEPIC                  =       28\r
+HIGHSCORESPIC                  =       29\r
+C_WONSPEARPIC                  =       30\r
+BJCOLLAPSE1PIC                 =       31\r
+BJCOLLAPSE2PIC                 =       32\r
+BJCOLLAPSE3PIC                 =       33\r
+BJCOLLAPSE4PIC                 =       34\r
+ENDPICPIC                      =       35\r
+L_GUYPIC                       =       36\r
+L_COLONPIC                     =       37\r
+L_NUM0PIC                      =       38\r
+L_NUM1PIC                      =       39\r
+L_NUM2PIC                      =       40\r
+L_NUM3PIC                      =       41\r
+L_NUM4PIC                      =       42\r
+L_NUM5PIC                      =       43\r
+L_NUM6PIC                      =       44\r
+L_NUM7PIC                      =       45\r
+L_NUM8PIC                      =       46\r
+L_NUM9PIC                      =       47\r
+L_PERCENTPIC                   =       48\r
+L_APIC                         =       49\r
+L_BPIC                         =       50\r
+L_CPIC                         =       51\r
+L_DPIC                         =       52\r
+L_EPIC                         =       53\r
+L_FPIC                         =       54\r
+L_GPIC                         =       55\r
+L_HPIC                         =       56\r
+L_IPIC                         =       57\r
+L_JPIC                         =       58\r
+L_KPIC                         =       59\r
+L_LPIC                         =       60\r
+L_MPIC                         =       61\r
+L_NPIC                         =       62\r
+L_OPIC                         =       63\r
+L_PPIC                         =       64\r
+L_QPIC                         =       65\r
+L_RPIC                         =       66\r
+L_SPIC                         =       67\r
+L_TPIC                         =       68\r
+L_UPIC                         =       69\r
+L_VPIC                         =       70\r
+L_WPIC                         =       71\r
+L_XPIC                         =       72\r
+L_YPIC                         =       73\r
+L_ZPIC                         =       74\r
+L_EXPOINTPIC                   =       75\r
+L_APOSTROPHEPIC                        =       76\r
+L_GUY2PIC                      =       77\r
+L_BJWINSPIC                    =       78\r
+TITLE1PIC                      =       79\r
+TITLE2PIC                      =       80\r
+ENDSCREEN11PIC                 =       81\r
+ENDSCREEN12PIC                 =       82\r
+ENDSCREEN3PIC                  =       83\r
+ENDSCREEN4PIC                  =       84\r
+ENDSCREEN5PIC                  =       85\r
+ENDSCREEN6PIC                  =       86\r
+ENDSCREEN7PIC                  =       87\r
+ENDSCREEN8PIC                  =       88\r
+ENDSCREEN9PIC                  =       89\r
+STATUSBARPIC                   =       90\r
+PG13PIC                                =       91\r
+CREDITSPIC                     =       92\r
+IDGUYS1PIC                     =       93\r
+IDGUYS2PIC                     =       94\r
+COPYPROTTOPPIC                 =       95\r
+COPYPROTBOXPIC                 =       96\r
+BOSSPIC1PIC                    =       97\r
+BOSSPIC2PIC                    =       98\r
+BOSSPIC3PIC                    =       99\r
+BOSSPIC4PIC                    =       100\r
+KNIFEPIC                       =       101\r
+GUNPIC                         =       102\r
+MACHINEGUNPIC                  =       103\r
+GATLINGGUNPIC                  =       104\r
+NOKEYPIC                       =       105\r
+GOLDKEYPIC                     =       106\r
+SILVERKEYPIC                   =       107\r
+N_BLANKPIC                     =       108\r
+N_0PIC                         =       109\r
+N_1PIC                         =       110\r
+N_2PIC                         =       111\r
+N_3PIC                         =       112\r
+N_4PIC                         =       113\r
+N_5PIC                         =       114\r
+N_6PIC                         =       115\r
+N_7PIC                         =       116\r
+N_8PIC                         =       117\r
+N_9PIC                         =       118\r
+FACE1APIC                      =       119\r
+FACE1BPIC                      =       120\r
+FACE1CPIC                      =       121\r
+FACE2APIC                      =       122\r
+FACE2BPIC                      =       123\r
+FACE2CPIC                      =       124\r
+FACE3APIC                      =       125\r
+FACE3BPIC                      =       126\r
+FACE3CPIC                      =       127\r
+FACE4APIC                      =       128\r
+FACE4BPIC                      =       129\r
+FACE4CPIC                      =       130\r
+FACE5APIC                      =       131\r
+FACE5BPIC                      =       132\r
+FACE5CPIC                      =       133\r
+FACE6APIC                      =       134\r
+FACE6BPIC                      =       135\r
+FACE6CPIC                      =       136\r
+FACE7APIC                      =       137\r
+FACE7BPIC                      =       138\r
+FACE7CPIC                      =       139\r
+FACE8APIC                      =       140\r
+GOTGATLINGPIC                  =       141\r
+GODMODEFACE1PIC                        =       142\r
+GODMODEFACE2PIC                        =       143\r
+GODMODEFACE3PIC                        =       144\r
+BJWAITING1PIC                  =       145\r
+BJWAITING2PIC                  =       146\r
+BJOUCHPIC                      =       147\r
+PAUSEDPIC                      =       148\r
+GETPSYCHEDPIC                  =       149\r
+\r
+\r
+\r
+ORDERSCREEN                    =       151\r
+ERRORSCREEN                    =       152\r
+TITLEPALETTE                   =       153\r
+END1PALETTE                    =       154\r
+END2PALETTE                    =       155\r
+END3PALETTE                    =       156\r
+END4PALETTE                    =       157\r
+END5PALETTE                    =       158\r
+END6PALETTE                    =       159\r
+END7PALETTE                    =       160\r
+END8PALETTE                    =       161\r
+END9PALETTE                    =       162\r
+IDGUYSPALETTE                  =       163\r
+T_DEMO0                                =       164\r
+T_DEMO1                                =       165\r
+T_DEMO2                                =       166\r
+T_DEMO3                                =       167\r
+T_ENDART1                      =       168\r
+\r
+BACKDROP_LUMP_START            =       3\r
+BACKDROP_LUMP_END              =       8\r
+\r
+CONTROL_LUMP_START             =       9\r
+CONTROL_LUMP_END               =       15\r
+\r
+OPTIONS_LUMP_START             =       16\r
+OPTIONS_LUMP_END               =       16\r
+\r
+SOUND_LUMP_START               =       17\r
+SOUND_LUMP_END                 =       19\r
+\r
+NEWGAME_LUMP_START             =       20\r
+NEWGAME_LUMP_END               =       24\r
+\r
+LOADSAVE_LUMP_START            =       25\r
+LOADSAVE_LUMP_END              =       28\r
+\r
+HIGHSCORES_LUMP_START          =       29\r
+HIGHSCORES_LUMP_END            =       30\r
+\r
+ENDGAME_LUMP_START             =       31\r
+ENDGAME_LUMP_END               =       35\r
+\r
+LEVELEND_LUMP_START            =       36\r
+LEVELEND_LUMP_END              =       78\r
+\r
+TITLESCREEN_LUMP_START         =       79\r
+TITLESCREEN_LUMP_END           =       80\r
+\r
+ENDGAME1_LUMP_START            =       81\r
+ENDGAME1_LUMP_END              =       81\r
+\r
+ENDGAME2_LUMP_START            =       82\r
+ENDGAME2_LUMP_END              =       82\r
+\r
+EASTEREGG_LUMP_START           =       93\r
+EASTEREGG_LUMP_END             =       94\r
+\r
+COPYPROT_LUMP_START            =       95\r
+COPYPROT_LUMP_END              =       100\r
+\r
+LATCHPICS_LUMP_START           =       101\r
+LATCHPICS_LUMP_END             =       149\r
+\r
+\r
+;\r
+; Amount of each data item\r
+;\r
+NUMCHUNKS      =       169\r
+NUMFONT        =       2\r
+NUMFONTM       =       0\r
+NUMPICS        =       147\r
+NUMPICM        =       0\r
+NUMSPRITES     =       0\r
+NUMTILE8       =       72\r
+NUMTILE8M      =       0\r
+NUMTILE16      =       0\r
+NUMTILE16M     =       0\r
+NUMTILE32      =       0\r
+NUMTILE32M     =       0\r
+NUMEXTERN      =       18\r
+;\r
+; File offsets for data items\r
+;\r
+STRUCTPIC      =       0\r
+\r
+STARTFONT      =       1\r
+STARTFONTM     =       3\r
+STARTPICS      =       3\r
+STARTPICM      =       150\r
+STARTSPRITES   =       150\r
+STARTTILE8     =       150\r
+STARTTILE8M    =       151\r
+STARTTILE16    =       151\r
+STARTTILE16M   =       151\r
+STARTTILE32    =       151\r
+STARTTILE32M   =       151\r
+STARTEXTERN    =       151\r
+\r
+;\r
+; Thank you for using IGRAB!\r
+;\r
diff --git a/16/wf3d8086/gfxv_sod.h b/16/wf3d8086/gfxv_sod.h
new file mode 100755 (executable)
index 0000000..cfc92d6
--- /dev/null
@@ -0,0 +1,280 @@
+//////////////////////////////////////\r
+//\r
+// Graphics .H file for .SOD\r
+// IGRAB-ed on Thu Oct 08 20:38:29 1992\r
+//\r
+//////////////////////////////////////\r
+\r
+typedef enum {\r
+               // Lump Start\r
+               C_BACKDROPPIC=3,\r
+               C_MOUSELBACKPIC,                     // 4\r
+               C_CURSOR1PIC,                        // 5\r
+               C_CURSOR2PIC,                        // 6\r
+               C_NOTSELECTEDPIC,                    // 7\r
+               C_SELECTEDPIC,                       // 8\r
+               // Lump Start\r
+               C_CUSTOMIZEPIC,                      // 9\r
+               C_JOY1PIC,                           // 10\r
+               C_JOY2PIC,                           // 11\r
+               C_MOUSEPIC,                          // 12\r
+               C_JOYSTICKPIC,                       // 13\r
+               C_KEYBOARDPIC,                       // 14\r
+               C_CONTROLPIC,                        // 15\r
+               // Lump Start\r
+               C_OPTIONSPIC,                        // 16\r
+               // Lump Start\r
+               C_FXTITLEPIC,                        // 17\r
+               C_DIGITITLEPIC,                      // 18\r
+               C_MUSICTITLEPIC,                     // 19\r
+               // Lump Start\r
+               C_HOWTOUGHPIC,                       // 20\r
+               C_BABYMODEPIC,                       // 21\r
+               C_EASYPIC,                           // 22\r
+               C_NORMALPIC,                         // 23\r
+               C_HARDPIC,                           // 24\r
+               // Lump Start\r
+               C_DISKLOADING1PIC,                   // 25\r
+               C_DISKLOADING2PIC,                   // 26\r
+               C_LOADGAMEPIC,                       // 27\r
+               C_SAVEGAMEPIC,                       // 28\r
+               // Lump Start\r
+               HIGHSCORESPIC,                       // 29\r
+               C_WONSPEARPIC,                       // 30\r
+               // Lump Start\r
+               BJCOLLAPSE1PIC,                      // 31\r
+               BJCOLLAPSE2PIC,                      // 32\r
+               BJCOLLAPSE3PIC,                      // 33\r
+               BJCOLLAPSE4PIC,                      // 34\r
+               ENDPICPIC,                           // 35\r
+               // Lump Start\r
+               L_GUYPIC,                            // 36\r
+               L_COLONPIC,                          // 37\r
+               L_NUM0PIC,                           // 38\r
+               L_NUM1PIC,                           // 39\r
+               L_NUM2PIC,                           // 40\r
+               L_NUM3PIC,                           // 41\r
+               L_NUM4PIC,                           // 42\r
+               L_NUM5PIC,                           // 43\r
+               L_NUM6PIC,                           // 44\r
+               L_NUM7PIC,                           // 45\r
+               L_NUM8PIC,                           // 46\r
+               L_NUM9PIC,                           // 47\r
+               L_PERCENTPIC,                        // 48\r
+               L_APIC,                              // 49\r
+               L_BPIC,                              // 50\r
+               L_CPIC,                              // 51\r
+               L_DPIC,                              // 52\r
+               L_EPIC,                              // 53\r
+               L_FPIC,                              // 54\r
+               L_GPIC,                              // 55\r
+               L_HPIC,                              // 56\r
+               L_IPIC,                              // 57\r
+               L_JPIC,                              // 58\r
+               L_KPIC,                              // 59\r
+               L_LPIC,                              // 60\r
+               L_MPIC,                              // 61\r
+               L_NPIC,                              // 62\r
+               L_OPIC,                              // 63\r
+               L_PPIC,                              // 64\r
+               L_QPIC,                              // 65\r
+               L_RPIC,                              // 66\r
+               L_SPIC,                              // 67\r
+               L_TPIC,                              // 68\r
+               L_UPIC,                              // 69\r
+               L_VPIC,                              // 70\r
+               L_WPIC,                              // 71\r
+               L_XPIC,                              // 72\r
+               L_YPIC,                              // 73\r
+               L_ZPIC,                              // 74\r
+               L_EXPOINTPIC,                        // 75\r
+               L_APOSTROPHEPIC,                     // 76\r
+               L_GUY2PIC,                           // 77\r
+               L_BJWINSPIC,                         // 78\r
+               // Lump Start\r
+               TITLE1PIC,                           // 79\r
+               TITLE2PIC,                           // 80\r
+               // Lump Start\r
+               ENDSCREEN11PIC,                      // 81\r
+               // Lump Start\r
+               ENDSCREEN12PIC,                      // 82\r
+               ENDSCREEN3PIC,                       // 83\r
+               ENDSCREEN4PIC,                       // 84\r
+               ENDSCREEN5PIC,                       // 85\r
+               ENDSCREEN6PIC,                       // 86\r
+               ENDSCREEN7PIC,                       // 87\r
+               ENDSCREEN8PIC,                       // 88\r
+               ENDSCREEN9PIC,                       // 89\r
+               STATUSBARPIC,                        // 90\r
+               PG13PIC,                             // 91\r
+               CREDITSPIC,                          // 92\r
+               // Lump Start\r
+               IDGUYS1PIC,                          // 93\r
+               IDGUYS2PIC,                          // 94\r
+               // Lump Start\r
+               COPYPROTTOPPIC,                      // 95\r
+               COPYPROTBOXPIC,                      // 96\r
+               BOSSPIC1PIC,                         // 97\r
+               BOSSPIC2PIC,                         // 98\r
+               BOSSPIC3PIC,                         // 99\r
+               BOSSPIC4PIC,                         // 100\r
+               // Lump Start\r
+               KNIFEPIC,                            // 101\r
+               GUNPIC,                              // 102\r
+               MACHINEGUNPIC,                       // 103\r
+               GATLINGGUNPIC,                       // 104\r
+               NOKEYPIC,                            // 105\r
+               GOLDKEYPIC,                          // 106\r
+               SILVERKEYPIC,                        // 107\r
+               N_BLANKPIC,                          // 108\r
+               N_0PIC,                              // 109\r
+               N_1PIC,                              // 110\r
+               N_2PIC,                              // 111\r
+               N_3PIC,                              // 112\r
+               N_4PIC,                              // 113\r
+               N_5PIC,                              // 114\r
+               N_6PIC,                              // 115\r
+               N_7PIC,                              // 116\r
+               N_8PIC,                              // 117\r
+               N_9PIC,                              // 118\r
+               FACE1APIC,                           // 119\r
+               FACE1BPIC,                           // 120\r
+               FACE1CPIC,                           // 121\r
+               FACE2APIC,                           // 122\r
+               FACE2BPIC,                           // 123\r
+               FACE2CPIC,                           // 124\r
+               FACE3APIC,                           // 125\r
+               FACE3BPIC,                           // 126\r
+               FACE3CPIC,                           // 127\r
+               FACE4APIC,                           // 128\r
+               FACE4BPIC,                           // 129\r
+               FACE4CPIC,                           // 130\r
+               FACE5APIC,                           // 131\r
+               FACE5BPIC,                           // 132\r
+               FACE5CPIC,                           // 133\r
+               FACE6APIC,                           // 134\r
+               FACE6BPIC,                           // 135\r
+               FACE6CPIC,                           // 136\r
+               FACE7APIC,                           // 137\r
+               FACE7BPIC,                           // 138\r
+               FACE7CPIC,                           // 139\r
+               FACE8APIC,                           // 140\r
+               GOTGATLINGPIC,                       // 141\r
+               GODMODEFACE1PIC,                     // 142\r
+               GODMODEFACE2PIC,                     // 143\r
+               GODMODEFACE3PIC,                     // 144\r
+               BJWAITING1PIC,                       // 145\r
+               BJWAITING2PIC,                       // 146\r
+               BJOUCHPIC,                           // 147\r
+               PAUSEDPIC,                           // 148\r
+               GETPSYCHEDPIC,                       // 149\r
+\r
+\r
+\r
+               ORDERSCREEN=151,\r
+               ERRORSCREEN,                         // 152\r
+               TITLEPALETTE,                        // 153\r
+               END1PALETTE,                         // 154\r
+               END2PALETTE,                         // 155\r
+               END3PALETTE,                         // 156\r
+               END4PALETTE,                         // 157\r
+               END5PALETTE,                         // 158\r
+               END6PALETTE,                         // 159\r
+               END7PALETTE,                         // 160\r
+               END8PALETTE,                         // 161\r
+               END9PALETTE,                         // 162\r
+               IDGUYSPALETTE,                       // 163\r
+               T_DEMO0,                             // 164\r
+               T_DEMO1,                             // 165\r
+               T_DEMO2,                             // 166\r
+               T_DEMO3,                             // 167\r
+               T_ENDART1,                           // 168\r
+               ENUMEND\r
+            } graphicnums;\r
+\r
+//\r
+// Data LUMPs\r
+//\r
+#define BACKDROP_LUMP_START            3\r
+#define BACKDROP_LUMP_END              8\r
+\r
+#define CONTROL_LUMP_START             9\r
+#define CONTROL_LUMP_END               15\r
+\r
+#define OPTIONS_LUMP_START             16\r
+#define OPTIONS_LUMP_END               16\r
+\r
+#define SOUND_LUMP_START               17\r
+#define SOUND_LUMP_END                 19\r
+\r
+#define NEWGAME_LUMP_START             20\r
+#define NEWGAME_LUMP_END               24\r
+\r
+#define LOADSAVE_LUMP_START            25\r
+#define LOADSAVE_LUMP_END              28\r
+\r
+#define HIGHSCORES_LUMP_START          29\r
+#define HIGHSCORES_LUMP_END            30\r
+\r
+#define ENDGAME_LUMP_START             31\r
+#define ENDGAME_LUMP_END               35\r
+\r
+#define LEVELEND_LUMP_START            36\r
+#define LEVELEND_LUMP_END              78\r
+\r
+#define TITLESCREEN_LUMP_START         79\r
+#define TITLESCREEN_LUMP_END           80\r
+\r
+#define ENDGAME1_LUMP_START            81\r
+#define ENDGAME1_LUMP_END              81\r
+\r
+#define ENDGAME2_LUMP_START            82\r
+#define ENDGAME2_LUMP_END              82\r
+\r
+#define EASTEREGG_LUMP_START           93\r
+#define EASTEREGG_LUMP_END             94\r
+\r
+#define COPYPROT_LUMP_START            95\r
+#define COPYPROT_LUMP_END              100\r
+\r
+#define LATCHPICS_LUMP_START           101\r
+#define LATCHPICS_LUMP_END             149\r
+\r
+\r
+//\r
+// Amount of each data item\r
+//\r
+#define NUMCHUNKS    169\r
+#define NUMFONT      2\r
+#define NUMFONTM     0\r
+#define NUMPICS      147\r
+#define NUMPICM      0\r
+#define NUMSPRITES   0\r
+#define NUMTILE8     72\r
+#define NUMTILE8M    0\r
+#define NUMTILE16    0\r
+#define NUMTILE16M   0\r
+#define NUMTILE32    0\r
+#define NUMTILE32M   0\r
+#define NUMEXTERNS   18\r
+//\r
+// File offsets for data items\r
+//\r
+#define STRUCTPIC    0\r
+\r
+#define STARTFONT    1\r
+#define STARTFONTM   3\r
+#define STARTPICS    3\r
+#define STARTPICM    150\r
+#define STARTSPRITES 150\r
+#define STARTTILE8   150\r
+#define STARTTILE8M  151\r
+#define STARTTILE16  151\r
+#define STARTTILE16M 151\r
+#define STARTTILE32  151\r
+#define STARTTILE32M 151\r
+#define STARTEXTERNS 151\r
+\r
+//\r
+// Thank you for using IGRAB!\r
+//\r
diff --git a/16/wf3d8086/gfxv_wl1.equ b/16/wf3d8086/gfxv_wl1.equ
new file mode 100755 (executable)
index 0000000..795873e
--- /dev/null
@@ -0,0 +1,199 @@
+;=====================================\r
+;\r
+; Graphics .EQU file for .WL1\r
+; IGRAB-ed on Sun May 03 01:19:32 1992\r
+;\r
+;=====================================\r
+\r
+H_BJPIC                                =       3\r
+H_CASTLEPIC                    =       4\r
+H_KEYBOARDPIC                  =       5\r
+H_JOYPIC                       =       6\r
+H_HEALPIC                      =       7\r
+H_TREASUREPIC                  =       8\r
+H_GUNPIC                       =       9\r
+H_KEYPIC                       =       10\r
+H_BLAZEPIC                     =       11\r
+H_WEAPON1234PIC                        =       12\r
+H_WOLFLOGOPIC                  =       13\r
+H_VISAPIC                      =       14\r
+H_MCPIC                                =       15\r
+H_IDLOGOPIC                    =       16\r
+H_TOPWINDOWPIC                 =       17\r
+H_LEFTWINDOWPIC                        =       18\r
+H_RIGHTWINDOWPIC               =       19\r
+H_BOTTOMINFOPIC                        =       20\r
+C_OPTIONSPIC                   =       21\r
+C_CURSOR1PIC                   =       22\r
+C_CURSOR2PIC                   =       23\r
+C_NOTSELECTEDPIC               =       24\r
+C_SELECTEDPIC                  =       25\r
+C_FXTITLEPIC                   =       26\r
+C_DIGITITLEPIC                 =       27\r
+C_MUSICTITLEPIC                        =       28\r
+C_MOUSELBACKPIC                        =       29\r
+C_BABYMODEPIC                  =       30\r
+C_EASYPIC                      =       31\r
+C_NORMALPIC                    =       32\r
+C_HARDPIC                      =       33\r
+C_LOADSAVEDISKPIC              =       34\r
+C_DISKLOADING1PIC              =       35\r
+C_DISKLOADING2PIC              =       36\r
+C_CONTROLPIC                   =       37\r
+C_CUSTOMIZEPIC                 =       38\r
+C_LOADGAMEPIC                  =       39\r
+C_SAVEGAMEPIC                  =       40\r
+C_EPISODE1PIC                  =       41\r
+C_EPISODE2PIC                  =       42\r
+C_EPISODE3PIC                  =       43\r
+C_EPISODE4PIC                  =       44\r
+C_EPISODE5PIC                  =       45\r
+C_EPISODE6PIC                  =       46\r
+C_CODEPIC                      =       47\r
+L_GUYPIC                       =       48\r
+L_COLONPIC                     =       49\r
+L_NUM0PIC                      =       50\r
+L_NUM1PIC                      =       51\r
+L_NUM2PIC                      =       52\r
+L_NUM3PIC                      =       53\r
+L_NUM4PIC                      =       54\r
+L_NUM5PIC                      =       55\r
+L_NUM6PIC                      =       56\r
+L_NUM7PIC                      =       57\r
+L_NUM8PIC                      =       58\r
+L_NUM9PIC                      =       59\r
+L_PERCENTPIC                   =       60\r
+L_APIC                         =       61\r
+L_BPIC                         =       62\r
+L_CPIC                         =       63\r
+L_DPIC                         =       64\r
+L_EPIC                         =       65\r
+L_FPIC                         =       66\r
+L_GPIC                         =       67\r
+L_HPIC                         =       68\r
+L_IPIC                         =       69\r
+L_JPIC                         =       70\r
+L_KPIC                         =       71\r
+L_LPIC                         =       72\r
+L_MPIC                         =       73\r
+L_NPIC                         =       74\r
+L_OPIC                         =       75\r
+L_PPIC                         =       76\r
+L_QPIC                         =       77\r
+L_RPIC                         =       78\r
+L_SPIC                         =       79\r
+L_TPIC                         =       80\r
+L_UPIC                         =       81\r
+L_VPIC                         =       82\r
+L_WPIC                         =       83\r
+L_XPIC                         =       84\r
+L_YPIC                         =       85\r
+L_ZPIC                         =       86\r
+L_EXPOINTPIC                   =       87\r
+L_GUY2PIC                      =       88\r
+L_BJWINSPIC                    =       89\r
+STATUSBARPIC                   =       90\r
+TITLEPIC                       =       91\r
+PG13PIC                                =       92\r
+CREDITSPIC                     =       93\r
+HIGHSCORESPIC                  =       94\r
+KNIFEPIC                       =       95\r
+GUNPIC                         =       96\r
+MACHINEGUNPIC                  =       97\r
+GATLINGGUNPIC                  =       98\r
+NOKEYPIC                       =       99\r
+GOLDKEYPIC                     =       100\r
+SILVERKEYPIC                   =       101\r
+N_BLANKPIC                     =       102\r
+N_0PIC                         =       103\r
+N_1PIC                         =       104\r
+N_2PIC                         =       105\r
+N_3PIC                         =       106\r
+N_4PIC                         =       107\r
+N_5PIC                         =       108\r
+N_6PIC                         =       109\r
+N_7PIC                         =       110\r
+N_8PIC                         =       111\r
+N_9PIC                         =       112\r
+FACE1APIC                      =       113\r
+FACE1BPIC                      =       114\r
+FACE1CPIC                      =       115\r
+FACE2APIC                      =       116\r
+FACE2BPIC                      =       117\r
+FACE2CPIC                      =       118\r
+FACE3APIC                      =       119\r
+FACE3BPIC                      =       120\r
+FACE3CPIC                      =       121\r
+FACE4APIC                      =       122\r
+FACE4BPIC                      =       123\r
+FACE4CPIC                      =       124\r
+FACE5APIC                      =       125\r
+FACE5BPIC                      =       126\r
+FACE5CPIC                      =       127\r
+FACE6APIC                      =       128\r
+FACE6BPIC                      =       129\r
+FACE6CPIC                      =       130\r
+FACE7APIC                      =       131\r
+FACE7BPIC                      =       132\r
+FACE7CPIC                      =       133\r
+FACE8APIC                      =       134\r
+GOTGATLINGPIC                  =       135\r
+MUTANTBJPIC                    =       136\r
+PAUSEDPIC                      =       137\r
+GETPSYCHEDPIC                  =       138\r
+\r
+\r
+\r
+ORDERSCREEN                    =       554\r
+ERRORSCREEN                    =       555\r
+\r
+README_LUMP_START              =       3\r
+README_LUMP_END                        =       20\r
+\r
+CONTROLS_LUMP_START            =       21\r
+CONTROLS_LUMP_END              =       47\r
+\r
+LEVELEND_LUMP_START            =       48\r
+LEVELEND_LUMP_END              =       89\r
+\r
+LATCHPICS_LUMP_START           =       95\r
+LATCHPICS_LUMP_END             =       138\r
+\r
+\r
+;\r
+; Amount of each data item\r
+;\r
+NUMCHUNKS      =       556\r
+NUMFONT        =       2\r
+NUMFONTM       =       0\r
+NUMPICS        =       136\r
+NUMPICM        =       0\r
+NUMSPRITES     =       0\r
+NUMTILE8       =       72\r
+NUMTILE8M      =       0\r
+NUMTILE16      =       144\r
+NUMTILE16M     =       270\r
+NUMTILE32      =       0\r
+NUMTILE32M     =       0\r
+NUMEXTERN      =       2\r
+;\r
+; File offsets for data items\r
+;\r
+STRUCTPIC      =       0\r
+\r
+STARTFONT      =       1\r
+STARTFONTM     =       3\r
+STARTPICS      =       3\r
+STARTPICM      =       139\r
+STARTSPRITES   =       139\r
+STARTTILE8     =       139\r
+STARTTILE8M    =       140\r
+STARTTILE16    =       140\r
+STARTTILE16M   =       284\r
+STARTTILE32    =       554\r
+STARTTILE32M   =       554\r
+STARTEXTERN    =       554\r
+\r
+;\r
+; Thank you for using IGRAB!\r
+;\r
diff --git a/16/wf3d8086/gfxv_wl1.h b/16/wf3d8086/gfxv_wl1.h
new file mode 100755 (executable)
index 0000000..0ddfb69
--- /dev/null
@@ -0,0 +1,209 @@
+//////////////////////////////////////\r
+//\r
+// Graphics .H file for .WL1\r
+// IGRAB-ed on Sun May 03 01:19:32 1992\r
+//\r
+//////////////////////////////////////\r
+\r
+typedef enum {\r
+               // Lump Start\r
+               H_BJPIC=3,\r
+               H_CASTLEPIC,                 // 4\r
+               H_KEYBOARDPIC,               // 5\r
+               H_JOYPIC,                    // 6\r
+               H_HEALPIC,                   // 7\r
+               H_TREASUREPIC,               // 8\r
+               H_GUNPIC,                    // 9\r
+               H_KEYPIC,                    // 10\r
+               H_BLAZEPIC,                  // 11\r
+               H_WEAPON1234PIC,             // 12\r
+               H_WOLFLOGOPIC,               // 13\r
+               H_VISAPIC,                   // 14\r
+               H_MCPIC,                     // 15\r
+               H_IDLOGOPIC,                 // 16\r
+               H_TOPWINDOWPIC,              // 17\r
+               H_LEFTWINDOWPIC,             // 18\r
+               H_RIGHTWINDOWPIC,            // 19\r
+               H_BOTTOMINFOPIC,             // 20\r
+               // Lump Start\r
+               C_OPTIONSPIC,                // 21\r
+               C_CURSOR1PIC,                // 22\r
+               C_CURSOR2PIC,                // 23\r
+               C_NOTSELECTEDPIC,            // 24\r
+               C_SELECTEDPIC,               // 25\r
+               C_FXTITLEPIC,                // 26\r
+               C_DIGITITLEPIC,              // 27\r
+               C_MUSICTITLEPIC,             // 28\r
+               C_MOUSELBACKPIC,             // 29\r
+               C_BABYMODEPIC,               // 30\r
+               C_EASYPIC,                   // 31\r
+               C_NORMALPIC,                 // 32\r
+               C_HARDPIC,                   // 33\r
+               C_LOADSAVEDISKPIC,           // 34\r
+               C_DISKLOADING1PIC,           // 35\r
+               C_DISKLOADING2PIC,           // 36\r
+               C_CONTROLPIC,                // 37\r
+               C_CUSTOMIZEPIC,              // 38\r
+               C_LOADGAMEPIC,               // 39\r
+               C_SAVEGAMEPIC,               // 40\r
+               C_EPISODE1PIC,               // 41\r
+               C_EPISODE2PIC,               // 42\r
+               C_EPISODE3PIC,               // 43\r
+               C_EPISODE4PIC,               // 44\r
+               C_EPISODE5PIC,               // 45\r
+               C_EPISODE6PIC,               // 46\r
+               C_CODEPIC,                   // 47\r
+               // Lump Start\r
+               L_GUYPIC,                    // 48\r
+               L_COLONPIC,                  // 49\r
+               L_NUM0PIC,                   // 50\r
+               L_NUM1PIC,                   // 51\r
+               L_NUM2PIC,                   // 52\r
+               L_NUM3PIC,                   // 53\r
+               L_NUM4PIC,                   // 54\r
+               L_NUM5PIC,                   // 55\r
+               L_NUM6PIC,                   // 56\r
+               L_NUM7PIC,                   // 57\r
+               L_NUM8PIC,                   // 58\r
+               L_NUM9PIC,                   // 59\r
+               L_PERCENTPIC,                // 60\r
+               L_APIC,                      // 61\r
+               L_BPIC,                      // 62\r
+               L_CPIC,                      // 63\r
+               L_DPIC,                      // 64\r
+               L_EPIC,                      // 65\r
+               L_FPIC,                      // 66\r
+               L_GPIC,                      // 67\r
+               L_HPIC,                      // 68\r
+               L_IPIC,                      // 69\r
+               L_JPIC,                      // 70\r
+               L_KPIC,                      // 71\r
+               L_LPIC,                      // 72\r
+               L_MPIC,                      // 73\r
+               L_NPIC,                      // 74\r
+               L_OPIC,                      // 75\r
+               L_PPIC,                      // 76\r
+               L_QPIC,                      // 77\r
+               L_RPIC,                      // 78\r
+               L_SPIC,                      // 79\r
+               L_TPIC,                      // 80\r
+               L_UPIC,                      // 81\r
+               L_VPIC,                      // 82\r
+               L_WPIC,                      // 83\r
+               L_XPIC,                      // 84\r
+               L_YPIC,                      // 85\r
+               L_ZPIC,                      // 86\r
+               L_EXPOINTPIC,                // 87\r
+               L_GUY2PIC,                   // 88\r
+               L_BJWINSPIC,                 // 89\r
+               STATUSBARPIC,                // 90\r
+               TITLEPIC,                    // 91\r
+               PG13PIC,                     // 92\r
+               CREDITSPIC,                  // 93\r
+               HIGHSCORESPIC,               // 94\r
+               // Lump Start\r
+               KNIFEPIC,                    // 95\r
+               GUNPIC,                      // 96\r
+               MACHINEGUNPIC,               // 97\r
+               GATLINGGUNPIC,               // 98\r
+               NOKEYPIC,                    // 99\r
+               GOLDKEYPIC,                  // 100\r
+               SILVERKEYPIC,                // 101\r
+               N_BLANKPIC,                  // 102\r
+               N_0PIC,                      // 103\r
+               N_1PIC,                      // 104\r
+               N_2PIC,                      // 105\r
+               N_3PIC,                      // 106\r
+               N_4PIC,                      // 107\r
+               N_5PIC,                      // 108\r
+               N_6PIC,                      // 109\r
+               N_7PIC,                      // 110\r
+               N_8PIC,                      // 111\r
+               N_9PIC,                      // 112\r
+               FACE1APIC,                   // 113\r
+               FACE1BPIC,                   // 114\r
+               FACE1CPIC,                   // 115\r
+               FACE2APIC,                   // 116\r
+               FACE2BPIC,                   // 117\r
+               FACE2CPIC,                   // 118\r
+               FACE3APIC,                   // 119\r
+               FACE3BPIC,                   // 120\r
+               FACE3CPIC,                   // 121\r
+               FACE4APIC,                   // 122\r
+               FACE4BPIC,                   // 123\r
+               FACE4CPIC,                   // 124\r
+               FACE5APIC,                   // 125\r
+               FACE5BPIC,                   // 126\r
+               FACE5CPIC,                   // 127\r
+               FACE6APIC,                   // 128\r
+               FACE6BPIC,                   // 129\r
+               FACE6CPIC,                   // 130\r
+               FACE7APIC,                   // 131\r
+               FACE7BPIC,                   // 132\r
+               FACE7CPIC,                   // 133\r
+               FACE8APIC,                   // 134\r
+               GOTGATLINGPIC,               // 135\r
+               MUTANTBJPIC,                 // 136\r
+               PAUSEDPIC,                   // 137\r
+               GETPSYCHEDPIC,               // 138\r
+\r
+\r
+\r
+               ORDERSCREEN=554,\r
+               ERRORSCREEN,                 // 555\r
+               ENUMEND\r
+            } graphicnums;\r
+\r
+//\r
+// Data LUMPs\r
+//\r
+#define README_LUMP_START              3\r
+#define README_LUMP_END                        20\r
+\r
+#define CONTROLS_LUMP_START            21\r
+#define CONTROLS_LUMP_END              47\r
+\r
+#define LEVELEND_LUMP_START            48\r
+#define LEVELEND_LUMP_END              89\r
+\r
+#define LATCHPICS_LUMP_START           95\r
+#define LATCHPICS_LUMP_END             138\r
+\r
+\r
+//\r
+// Amount of each data item\r
+//\r
+#define NUMCHUNKS    556\r
+#define NUMFONT      2\r
+#define NUMFONTM     0\r
+#define NUMPICS      136\r
+#define NUMPICM      0\r
+#define NUMSPRITES   0\r
+#define NUMTILE8     72\r
+#define NUMTILE8M    0\r
+#define NUMTILE16    144\r
+#define NUMTILE16M   270\r
+#define NUMTILE32    0\r
+#define NUMTILE32M   0\r
+#define NUMEXTERNS   2\r
+//\r
+// File offsets for data items\r
+//\r
+#define STRUCTPIC    0\r
+\r
+#define STARTFONT    1\r
+#define STARTFONTM   3\r
+#define STARTPICS    3\r
+#define STARTPICM    139\r
+#define STARTSPRITES 139\r
+#define STARTTILE8   139\r
+#define STARTTILE8M  140\r
+#define STARTTILE16  140\r
+#define STARTTILE16M 284\r
+#define STARTTILE32  554\r
+#define STARTTILE32M 554\r
+#define STARTEXTERNS 554\r
+\r
+//\r
+// Thank you for using IGRAB!\r
+//\r
diff --git a/16/wf3d8086/gfxv_wl6.equ b/16/wf3d8086/gfxv_wl6.equ
new file mode 100755 (executable)
index 0000000..1951dd3
--- /dev/null
@@ -0,0 +1,206 @@
+;=====================================\r
+;\r
+; Graphics .EQU file for .WL6\r
+; IGRAB-ed on Wed Apr 13 06:58:44 1994\r
+;\r
+;=====================================\r
+\r
+H_BJPIC                                =       3\r
+H_CASTLEPIC                    =       4\r
+H_BLAZEPIC                     =       5\r
+H_TOPWINDOWPIC                 =       6\r
+H_LEFTWINDOWPIC                        =       7\r
+H_RIGHTWINDOWPIC               =       8\r
+H_BOTTOMINFOPIC                        =       9\r
+C_OPTIONSPIC                   =       10\r
+C_CURSOR1PIC                   =       11\r
+C_CURSOR2PIC                   =       12\r
+C_NOTSELECTEDPIC               =       13\r
+C_SELECTEDPIC                  =       14\r
+C_FXTITLEPIC                   =       15\r
+C_DIGITITLEPIC                 =       16\r
+C_MUSICTITLEPIC                        =       17\r
+C_MOUSELBACKPIC                        =       18\r
+C_BABYMODEPIC                  =       19\r
+C_EASYPIC                      =       20\r
+C_NORMALPIC                    =       21\r
+C_HARDPIC                      =       22\r
+C_LOADSAVEDISKPIC              =       23\r
+C_DISKLOADING1PIC              =       24\r
+C_DISKLOADING2PIC              =       25\r
+C_CONTROLPIC                   =       26\r
+C_CUSTOMIZEPIC                 =       27\r
+C_LOADGAMEPIC                  =       28\r
+C_SAVEGAMEPIC                  =       29\r
+C_EPISODE1PIC                  =       30\r
+C_EPISODE2PIC                  =       31\r
+C_EPISODE3PIC                  =       32\r
+C_EPISODE4PIC                  =       33\r
+C_EPISODE5PIC                  =       34\r
+C_EPISODE6PIC                  =       35\r
+C_CODEPIC                      =       36\r
+C_TIMECODEPIC                  =       37\r
+C_LEVELPIC                     =       38\r
+C_NAMEPIC                      =       39\r
+C_SCOREPIC                     =       40\r
+C_JOY1PIC                      =       41\r
+C_JOY2PIC                      =       42\r
+L_GUYPIC                       =       43\r
+L_COLONPIC                     =       44\r
+L_NUM0PIC                      =       45\r
+L_NUM1PIC                      =       46\r
+L_NUM2PIC                      =       47\r
+L_NUM3PIC                      =       48\r
+L_NUM4PIC                      =       49\r
+L_NUM5PIC                      =       50\r
+L_NUM6PIC                      =       51\r
+L_NUM7PIC                      =       52\r
+L_NUM8PIC                      =       53\r
+L_NUM9PIC                      =       54\r
+L_PERCENTPIC                   =       55\r
+L_APIC                         =       56\r
+L_BPIC                         =       57\r
+L_CPIC                         =       58\r
+L_DPIC                         =       59\r
+L_EPIC                         =       60\r
+L_FPIC                         =       61\r
+L_GPIC                         =       62\r
+L_HPIC                         =       63\r
+L_IPIC                         =       64\r
+L_JPIC                         =       65\r
+L_KPIC                         =       66\r
+L_LPIC                         =       67\r
+L_MPIC                         =       68\r
+L_NPIC                         =       69\r
+L_OPIC                         =       70\r
+L_PPIC                         =       71\r
+L_QPIC                         =       72\r
+L_RPIC                         =       73\r
+L_SPIC                         =       74\r
+L_TPIC                         =       75\r
+L_UPIC                         =       76\r
+L_VPIC                         =       77\r
+L_WPIC                         =       78\r
+L_XPIC                         =       79\r
+L_YPIC                         =       80\r
+L_ZPIC                         =       81\r
+L_EXPOINTPIC                   =       82\r
+L_APOSTROPHEPIC                        =       83\r
+L_GUY2PIC                      =       84\r
+L_BJWINSPIC                    =       85\r
+STATUSBARPIC                   =       86\r
+TITLEPIC                       =       87\r
+PG13PIC                                =       88\r
+CREDITSPIC                     =       89\r
+HIGHSCORESPIC                  =       90\r
+KNIFEPIC                       =       91\r
+GUNPIC                         =       92\r
+MACHINEGUNPIC                  =       93\r
+GATLINGGUNPIC                  =       94\r
+NOKEYPIC                       =       95\r
+GOLDKEYPIC                     =       96\r
+SILVERKEYPIC                   =       97\r
+N_BLANKPIC                     =       98\r
+N_0PIC                         =       99\r
+N_1PIC                         =       100\r
+N_2PIC                         =       101\r
+N_3PIC                         =       102\r
+N_4PIC                         =       103\r
+N_5PIC                         =       104\r
+N_6PIC                         =       105\r
+N_7PIC                         =       106\r
+N_8PIC                         =       107\r
+N_9PIC                         =       108\r
+FACE1APIC                      =       109\r
+FACE1BPIC                      =       110\r
+FACE1CPIC                      =       111\r
+FACE2APIC                      =       112\r
+FACE2BPIC                      =       113\r
+FACE2CPIC                      =       114\r
+FACE3APIC                      =       115\r
+FACE3BPIC                      =       116\r
+FACE3CPIC                      =       117\r
+FACE4APIC                      =       118\r
+FACE4BPIC                      =       119\r
+FACE4CPIC                      =       120\r
+FACE5APIC                      =       121\r
+FACE5BPIC                      =       122\r
+FACE5CPIC                      =       123\r
+FACE6APIC                      =       124\r
+FACE6BPIC                      =       125\r
+FACE6CPIC                      =       126\r
+FACE7APIC                      =       127\r
+FACE7BPIC                      =       128\r
+FACE7CPIC                      =       129\r
+FACE8APIC                      =       130\r
+GOTGATLINGPIC                  =       131\r
+MUTANTBJPIC                    =       132\r
+PAUSEDPIC                      =       133\r
+GETPSYCHEDPIC                  =       134\r
+\r
+\r
+\r
+ORDERSCREEN                    =       136\r
+ERRORSCREEN                    =       137\r
+T_HELPART                      =       138\r
+T_DEMO0                                =       139\r
+T_DEMO1                                =       140\r
+T_DEMO2                                =       141\r
+T_DEMO3                                =       142\r
+T_ENDART1                      =       143\r
+T_ENDART2                      =       144\r
+T_ENDART3                      =       145\r
+T_ENDART4                      =       146\r
+T_ENDART5                      =       147\r
+T_ENDART6                      =       148\r
+\r
+README_LUMP_START              =       3\r
+README_LUMP_END                        =       9\r
+\r
+CONTROLS_LUMP_START            =       10\r
+CONTROLS_LUMP_END              =       42\r
+\r
+LEVELEND_LUMP_START            =       43\r
+LEVELEND_LUMP_END              =       85\r
+\r
+LATCHPICS_LUMP_START           =       91\r
+LATCHPICS_LUMP_END             =       134\r
+\r
+\r
+;\r
+; Amount of each data item\r
+;\r
+NUMCHUNKS      =       149\r
+NUMFONT        =       2\r
+NUMFONTM       =       0\r
+NUMPICS        =       132\r
+NUMPICM        =       0\r
+NUMSPRITES     =       0\r
+NUMTILE8       =       72\r
+NUMTILE8M      =       0\r
+NUMTILE16      =       0\r
+NUMTILE16M     =       0\r
+NUMTILE32      =       0\r
+NUMTILE32M     =       0\r
+NUMEXTERN      =       13\r
+;\r
+; File offsets for data items\r
+;\r
+STRUCTPIC      =       0\r
+\r
+STARTFONT      =       1\r
+STARTFONTM     =       3\r
+STARTPICS      =       3\r
+STARTPICM      =       135\r
+STARTSPRITES   =       135\r
+STARTTILE8     =       135\r
+STARTTILE8M    =       136\r
+STARTTILE16    =       136\r
+STARTTILE16M   =       136\r
+STARTTILE32    =       136\r
+STARTTILE32M   =       136\r
+STARTEXTERN    =       136\r
+\r
+;\r
+; Thank you for using IGRAB!\r
+;\r
diff --git a/16/wf3d8086/gfxv_wl6.h b/16/wf3d8086/gfxv_wl6.h
new file mode 100755 (executable)
index 0000000..1e56297
--- /dev/null
@@ -0,0 +1,216 @@
+//////////////////////////////////////\r
+//\r
+// Graphics .H file for .WL6\r
+// IGRAB-ed on Wed Apr 13 06:58:44 1994\r
+//\r
+//////////////////////////////////////\r
+\r
+typedef enum {\r
+               // Lump Start\r
+               H_BJPIC=3,\r
+               H_CASTLEPIC,                         // 4\r
+               H_BLAZEPIC,                          // 5\r
+               H_TOPWINDOWPIC,                      // 6\r
+               H_LEFTWINDOWPIC,                     // 7\r
+               H_RIGHTWINDOWPIC,                    // 8\r
+               H_BOTTOMINFOPIC,                     // 9\r
+               // Lump Start\r
+               C_OPTIONSPIC,                        // 10\r
+               C_CURSOR1PIC,                        // 11\r
+               C_CURSOR2PIC,                        // 12\r
+               C_NOTSELECTEDPIC,                    // 13\r
+               C_SELECTEDPIC,                       // 14\r
+               C_FXTITLEPIC,                        // 15\r
+               C_DIGITITLEPIC,                      // 16\r
+               C_MUSICTITLEPIC,                     // 17\r
+               C_MOUSELBACKPIC,                     // 18\r
+               C_BABYMODEPIC,                       // 19\r
+               C_EASYPIC,                           // 20\r
+               C_NORMALPIC,                         // 21\r
+               C_HARDPIC,                           // 22\r
+               C_LOADSAVEDISKPIC,                   // 23\r
+               C_DISKLOADING1PIC,                   // 24\r
+               C_DISKLOADING2PIC,                   // 25\r
+               C_CONTROLPIC,                        // 26\r
+               C_CUSTOMIZEPIC,                      // 27\r
+               C_LOADGAMEPIC,                       // 28\r
+               C_SAVEGAMEPIC,                       // 29\r
+               C_EPISODE1PIC,                       // 30\r
+               C_EPISODE2PIC,                       // 31\r
+               C_EPISODE3PIC,                       // 32\r
+               C_EPISODE4PIC,                       // 33\r
+               C_EPISODE5PIC,                       // 34\r
+               C_EPISODE6PIC,                       // 35\r
+               C_CODEPIC,                           // 36\r
+               C_TIMECODEPIC,                       // 37\r
+               C_LEVELPIC,                          // 38\r
+               C_NAMEPIC,                           // 39\r
+               C_SCOREPIC,                          // 40\r
+               C_JOY1PIC,                           // 41\r
+               C_JOY2PIC,                           // 42\r
+               // Lump Start\r
+               L_GUYPIC,                            // 43\r
+               L_COLONPIC,                          // 44\r
+               L_NUM0PIC,                           // 45\r
+               L_NUM1PIC,                           // 46\r
+               L_NUM2PIC,                           // 47\r
+               L_NUM3PIC,                           // 48\r
+               L_NUM4PIC,                           // 49\r
+               L_NUM5PIC,                           // 50\r
+               L_NUM6PIC,                           // 51\r
+               L_NUM7PIC,                           // 52\r
+               L_NUM8PIC,                           // 53\r
+               L_NUM9PIC,                           // 54\r
+               L_PERCENTPIC,                        // 55\r
+               L_APIC,                              // 56\r
+               L_BPIC,                              // 57\r
+               L_CPIC,                              // 58\r
+               L_DPIC,                              // 59\r
+               L_EPIC,                              // 60\r
+               L_FPIC,                              // 61\r
+               L_GPIC,                              // 62\r
+               L_HPIC,                              // 63\r
+               L_IPIC,                              // 64\r
+               L_JPIC,                              // 65\r
+               L_KPIC,                              // 66\r
+               L_LPIC,                              // 67\r
+               L_MPIC,                              // 68\r
+               L_NPIC,                              // 69\r
+               L_OPIC,                              // 70\r
+               L_PPIC,                              // 71\r
+               L_QPIC,                              // 72\r
+               L_RPIC,                              // 73\r
+               L_SPIC,                              // 74\r
+               L_TPIC,                              // 75\r
+               L_UPIC,                              // 76\r
+               L_VPIC,                              // 77\r
+               L_WPIC,                              // 78\r
+               L_XPIC,                              // 79\r
+               L_YPIC,                              // 80\r
+               L_ZPIC,                              // 81\r
+               L_EXPOINTPIC,                        // 82\r
+               L_APOSTROPHEPIC,                     // 83\r
+               L_GUY2PIC,                           // 84\r
+               L_BJWINSPIC,                         // 85\r
+               STATUSBARPIC,                        // 86\r
+               TITLEPIC,                            // 87\r
+               PG13PIC,                             // 88\r
+               CREDITSPIC,                          // 89\r
+               HIGHSCORESPIC,                       // 90\r
+               // Lump Start\r
+               KNIFEPIC,                            // 91\r
+               GUNPIC,                              // 92\r
+               MACHINEGUNPIC,                       // 93\r
+               GATLINGGUNPIC,                       // 94\r
+               NOKEYPIC,                            // 95\r
+               GOLDKEYPIC,                          // 96\r
+               SILVERKEYPIC,                        // 97\r
+               N_BLANKPIC,                          // 98\r
+               N_0PIC,                              // 99\r
+               N_1PIC,                              // 100\r
+               N_2PIC,                              // 101\r
+               N_3PIC,                              // 102\r
+               N_4PIC,                              // 103\r
+               N_5PIC,                              // 104\r
+               N_6PIC,                              // 105\r
+               N_7PIC,                              // 106\r
+               N_8PIC,                              // 107\r
+               N_9PIC,                              // 108\r
+               FACE1APIC,                           // 109\r
+               FACE1BPIC,                           // 110\r
+               FACE1CPIC,                           // 111\r
+               FACE2APIC,                           // 112\r
+               FACE2BPIC,                           // 113\r
+               FACE2CPIC,                           // 114\r
+               FACE3APIC,                           // 115\r
+               FACE3BPIC,                           // 116\r
+               FACE3CPIC,                           // 117\r
+               FACE4APIC,                           // 118\r
+               FACE4BPIC,                           // 119\r
+               FACE4CPIC,                           // 120\r
+               FACE5APIC,                           // 121\r
+               FACE5BPIC,                           // 122\r
+               FACE5CPIC,                           // 123\r
+               FACE6APIC,                           // 124\r
+               FACE6BPIC,                           // 125\r
+               FACE6CPIC,                           // 126\r
+               FACE7APIC,                           // 127\r
+               FACE7BPIC,                           // 128\r
+               FACE7CPIC,                           // 129\r
+               FACE8APIC,                           // 130\r
+               GOTGATLINGPIC,                       // 131\r
+               MUTANTBJPIC,                         // 132\r
+               PAUSEDPIC,                           // 133\r
+               GETPSYCHEDPIC,                       // 134\r
+\r
+\r
+\r
+               ORDERSCREEN=136,\r
+               ERRORSCREEN,                         // 137\r
+               T_HELPART,                           // 138\r
+               T_DEMO0,                             // 139\r
+               T_DEMO1,                             // 140\r
+               T_DEMO2,                             // 141\r
+               T_DEMO3,                             // 142\r
+               T_ENDART1,                           // 143\r
+               T_ENDART2,                           // 144\r
+               T_ENDART3,                           // 145\r
+               T_ENDART4,                           // 146\r
+               T_ENDART5,                           // 147\r
+               T_ENDART6,                           // 148\r
+               ENUMEND\r
+            } graphicnums;\r
+\r
+//\r
+// Data LUMPs\r
+//\r
+#define README_LUMP_START              3\r
+#define README_LUMP_END                        9\r
+\r
+#define CONTROLS_LUMP_START            10\r
+#define CONTROLS_LUMP_END              42\r
+\r
+#define LEVELEND_LUMP_START            43\r
+#define LEVELEND_LUMP_END              85\r
+\r
+#define LATCHPICS_LUMP_START           91\r
+#define LATCHPICS_LUMP_END             134\r
+\r
+\r
+//\r
+// Amount of each data item\r
+//\r
+#define NUMCHUNKS    149\r
+#define NUMFONT      2\r
+#define NUMFONTM     0\r
+#define NUMPICS      132\r
+#define NUMPICM      0\r
+#define NUMSPRITES   0\r
+#define NUMTILE8     72\r
+#define NUMTILE8M    0\r
+#define NUMTILE16    0\r
+#define NUMTILE16M   0\r
+#define NUMTILE32    0\r
+#define NUMTILE32M   0\r
+#define NUMEXTERNS   13\r
+//\r
+// File offsets for data items\r
+//\r
+#define STRUCTPIC    0\r
+\r
+#define STARTFONT    1\r
+#define STARTFONTM   3\r
+#define STARTPICS    3\r
+#define STARTPICM    135\r
+#define STARTSPRITES 135\r
+#define STARTTILE8   135\r
+#define STARTTILE8M  136\r
+#define STARTTILE16  136\r
+#define STARTTILE16M 136\r
+#define STARTTILE32  136\r
+#define STARTTILE32M 136\r
+#define STARTEXTERNS 136\r
+\r
+//\r
+// Thank you for using IGRAB!\r
+//\r
diff --git a/16/wf3d8086/go.bat b/16/wf3d8086/go.bat
new file mode 100755 (executable)
index 0000000..f98216c
--- /dev/null
@@ -0,0 +1,5 @@
+sv readme\license.doc\r
+sv readme\release.txt\r
+sv readme\readme.txt\r
+@ECHO Get to Work!\r
+\r
diff --git a/16/wf3d8086/goodstuf.txt b/16/wf3d8086/goodstuf.txt
new file mode 100755 (executable)
index 0000000..bc7b9a4
--- /dev/null
@@ -0,0 +1,56 @@
+To:             ROMERO,TOM\r
+From:           LOTHAR/JAY\r
+Date:           9 Aug 92 21:06:46\r
+Subject:        AOL Message\r
+X-mailer:       Pegasus Mail v2.3 (R2).\r
+\r
+Subj:   DREAMS, FLASHBACKS\r
+Date:   92-08-09 03:59:55 EDT\r
+From:   Tug Hill 2\r
+Posted on: America Online\r
+\r
+On a serious note...\r
+\r
+As a former POW (Vietnam), I hesitated to play WOLF for over a\r
+month after downloading as I feared flashbacks.  I didn't want to\r
+remember all that I had been through all those years ago, when, as\r
+POW's, my friend and I decided an escape attempt would be better than\r
+a slow death by torture and starvation.\r
+\r
+My friend and I made crude maps and hoarded food. The day of the\r
+escape we clubbed the guard with stones, took his gun and fought our\r
+way through two levels of underground tunnels (only a few guards and\r
+had to crawl).  I made it, my friend didn't.\r
+\r
+Dreams...NO!  NIGHTMARES...YES!!  However, the more I play\r
+WOLF the less frequently I have nightmares.  The chilling part is\r
+turning a corner and seeing a guard with his gun drawn.\r
+\r
+WOLF is a powerful game.  Fearful as well.  I believe that a\r
+person should face the past.  So... when I can play EPISODE 1\r
+comfortably (no nightmares), I plan on ordering the full series.\r
+\r
+Don't let a few bad dreams make you discard this game.\r
+\r
+-------------------------------------------------------------------------\r
+\r
+Subj:   Wolf-3D                 Section: Action/Arcade Games\r
+From:   Ty Graham 72350,2636    # 191387, * No Replies *\r
+To:     Id Software 72600,1333  Date: 24-Jul-92 18:27:27\r
+\r
+Jay, just thought I'd drop a note to let you know how popular Wolf3D is\r
+here at Microsoft.  It seems like I can't walk down a hall without hearing\r
+'Mein Leben' from someone's office.  I hope you guys are getting revenue\r
+from all this.\r
+\r
+Anyway, we were sitting around talking the other day, discussing games for\r
+Windows, and someone said 'What are those cool guys at Id doing?'.  So how\r
+about it.  Are you guys looking at Win games at all?  Win32?\r
+\r
+In a perfect world, I'd have you guys port the Wolf engine to a multiuser\r
+maze game for Windows for Workgroups.  We need a good M'user Win game.\r
+\r
+Anyway some thoughts.\r
+\r
+Ty Graham (Microsoft)\r
+\r
diff --git a/16/wf3d8086/h_ldiv.asm b/16/wf3d8086/h_ldiv.asm
new file mode 100755 (executable)
index 0000000..91916fa
--- /dev/null
@@ -0,0 +1,227 @@
+;[]-----------------------------------------------------------------[]\r
+;|      H_LDIV.ASM -- long division routine                          |\r
+;|                                                                   |\r
+;|      C/C++ Run Time Library        Version 4.0                    |\r
+;|                                                                   |\r
+;|      Copyright (c) 1987, 1991 by Borland International Inc.       |\r
+;|      All Rights Reserved.                                         |\r
+;[]-----------------------------------------------------------------[]\r
+.model medium\r
+       INCLUDE RULES.ASI\r
+.386C   ;JAB - we use 386 instructions\r
+\r
+_TEXT   segment public byte 'CODE'\r
+       assume  cs:_TEXT\r
+       public  LDIV@\r
+       public  F_LDIV@\r
+       public  N_LDIV@\r
+       public  LUDIV@\r
+       public  F_LUDIV@\r
+               public  N_LUDIV@\r
+       public  LMOD@\r
+       public  F_LMOD@\r
+               public  N_LMOD@\r
+       public  LUMOD@\r
+       public  F_LUMOD@\r
+               public  N_LUMOD@\r
+\r
+N_LDIV@:\r
+               pop     cx                      ;fix up far return\r
+               push    cs\r
+               push    cx\r
+LDIV@:\r
+F_LDIV@:\r
+       xor     cx,cx                   ; signed divide\r
+       jmp     short common\r
+\r
+;       JAB\r
+;\r
+;       If we're using a 386 or better, the two instructions above get patched\r
+;               to be NOP's (4 of them). So, instead of using the looping code,\r
+;               we use the 386's long divide instruction.\r
+;\r
+;       The stack after setting up the stack frame:\r
+;               12[bp]: divisor (high word)\r
+;               10[bp]: divisor (low word)\r
+;                8[bp]: dividend (high word)\r
+;                6[bp]: dividend (low word)\r
+;                4[bp]: return CS\r
+;                2[bp]: return IP\r
+;                0[bp]: previous BP\r
+;\r
+       IDEAL\r
+\r
+       push bp\r
+       mov     bp,sp   ;Save BP, and set it equal to stack\r
+\r
+       mov     eax,[DWORD PTR bp+6]\r
+       cdq\r
+       idiv [DWORD PTR bp+10]\r
+       mov     edx,eax\r
+       shr     edx,16\r
+\r
+       pop     bp              ;Restore BP\r
+       retf    8       ;Return to original caller\r
+\r
+       MASM\r
+\r
+N_LUDIV@:\r
+               pop     cx                      ;fix up far return\r
+               push    cs\r
+               push    cx\r
+LUDIV@:\r
+F_LUDIV@:\r
+       mov     cx,1                    ; unsigned divide\r
+       jmp     short common\r
+\r
+N_LMOD@:\r
+               pop     cx                      ;fix up far return\r
+               push    cs\r
+               push    cx\r
+LMOD@:\r
+F_LMOD@:\r
+       mov     cx,2                    ; signed remainder\r
+       jmp     short   common\r
+\r
+N_LUMOD@:\r
+               pop     cx                      ;fix up far return\r
+               push    cs\r
+               push    cx\r
+LUMOD@:\r
+F_LUMOD@:\r
+       mov     cx,3                    ; unsigned remainder\r
+\r
+;\r
+;       di now contains a two bit control value.  The low order\r
+;       bit (test mask of 1) is on if the operation is unsigned,\r
+;       signed otherwise.  The next bit (test mask of 2) is on if\r
+;       the operation returns the remainder, quotient otherwise.\r
+;\r
+common:\r
+       push    bp\r
+       push    si\r
+       push    di\r
+       mov     bp,sp                   ; set up frame\r
+       mov     di,cx\r
+;\r
+;       dividend is pushed last, therefore the first in the args\r
+;       divisor next.\r
+;\r
+       mov     ax,10[bp]               ; get the first low word\r
+       mov     dx,12[bp]               ; get the first high word\r
+       mov     bx,14[bp]               ; get the second low word\r
+       mov     cx,16[bp]               ; get the second high word\r
+\r
+       or      cx,cx\r
+       jnz     slow@ldiv               ; both high words are zero\r
+\r
+       or      dx,dx\r
+       jz      quick@ldiv\r
+\r
+       or      bx,bx\r
+       jz      quick@ldiv              ; if cx:bx == 0 force a zero divide\r
+                                       ; we don't expect this to actually\r
+                                       ; work\r
+\r
+slow@ldiv:\r
+\r
+       test    di,1                    ; signed divide?\r
+       jnz     positive                ; no: skip\r
+;\r
+;               Signed division should be done.  Convert negative\r
+;               values to positive and do an unsigned division.\r
+;               Store the sign value in the next higher bit of\r
+;               di (test mask of 4).  Thus when we are done, testing\r
+;               that bit will determine the sign of the result.\r
+;\r
+       or      dx,dx                   ; test sign of dividend\r
+       jns     onepos\r
+       neg     dx\r
+       neg     ax\r
+       sbb     dx,0                    ; negate dividend\r
+       or      di,0Ch\r
+onepos:\r
+       or      cx,cx                   ; test sign of divisor\r
+       jns     positive\r
+       neg     cx\r
+       neg     bx\r
+       sbb     cx,0                    ; negate divisor\r
+       xor     di,4\r
+positive:\r
+       mov     bp,cx\r
+       mov     cx,32                   ; shift counter\r
+       push    di                      ; save the flags\r
+;\r
+;       Now the stack looks something like this:\r
+;\r
+;               16[bp]: divisor (high word)\r
+;               14[bp]: divisor (low word)\r
+;               12[bp]: dividend (high word)\r
+;               10[bp]: dividend (low word)\r
+;                8[bp]: return CS\r
+;                6[bp]: return IP\r
+;                4[bp]: previous BP\r
+;                2[bp]: previous SI\r
+;                 [bp]: previous DI\r
+;               -2[bp]: control bits\r
+;                       01 - Unsigned divide\r
+;                       02 - Remainder wanted\r
+;                       04 - Negative quotient\r
+;                       08 - Negative remainder\r
+;\r
+       xor     di,di                   ; fake a 64 bit dividend\r
+       xor     si,si                   ;\r
+xloop:\r
+       shl     ax,1                    ; shift dividend left one bit\r
+       rcl     dx,1\r
+       rcl     si,1\r
+       rcl     di,1\r
+       cmp     di,bp                   ; dividend larger?\r
+       jb      nosub\r
+       ja      subtract\r
+       cmp     si,bx                   ; maybe\r
+       jb      nosub\r
+subtract:\r
+       sub     si,bx\r
+       sbb     di,bp                   ; subtract the divisor\r
+       inc     ax                      ; build quotient\r
+nosub:\r
+       loop    xloop\r
+;\r
+;       When done with the loop the four register value look like:\r
+;\r
+;       |     di     |     si     |     dx     |     ax     |\r
+;       |        remainder        |         quotient        |\r
+;\r
+       pop     bx                      ; get control bits\r
+       test    bx,2                    ; remainder?\r
+       jz      usequo\r
+       mov     ax,si\r
+       mov     dx,di                   ; use remainder\r
+       shr     bx,1                    ; shift in the remainder sign bit\r
+usequo:\r
+       test    bx,4                    ; needs negative\r
+       jz      finish\r
+       neg     dx\r
+       neg     ax\r
+       sbb     dx,0                    ; negate\r
+finish:\r
+       pop     di\r
+       pop     si\r
+       pop     bp\r
+       retf    8\r
+\r
+quick@ldiv:\r
+       div     bx                      ; unsigned divide\r
+                                       ; DX = remainder AX = quotient\r
+       test    di,2                    ; want remainder?\r
+       jz      quick@quo\r
+               xchg    ax,dx\r
+\r
+quick@quo:\r
+\r
+       xor     dx,dx\r
+               jmp     short finish\r
+\r
+_TEXT   ends\r
+       end\r
diff --git a/16/wf3d8086/id_ca.c b/16/wf3d8086/id_ca.c
new file mode 100755 (executable)
index 0000000..142296b
--- /dev/null
@@ -0,0 +1,1768 @@
+// ID_CA.C\r
+\r
+// this has been customized for WOLF\r
+\r
+/*\r
+=============================================================================\r
+\r
+Id Software Caching Manager\r
+---------------------------\r
+\r
+Must be started BEFORE the memory manager, because it needs to get the headers\r
+loaded into the data segment\r
+\r
+=============================================================================\r
+*/\r
+\r
+#include "ID_HEADS.H"\r
+#pragma hdrstop\r
+\r
+#pragma warn -pro\r
+#pragma warn -use\r
+\r
+#define THREEBYTEGRSTARTS\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+typedef struct\r
+{\r
+  unsigned bit0,bit1;  // 0-255 is a character, > is a pointer to a node\r
+} huffnode;\r
+\r
+\r
+typedef struct\r
+{\r
+       unsigned        RLEWtag;\r
+       long            headeroffsets[100];\r
+       byte            tileinfo[];\r
+} mapfiletype;\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+byte           _seg    *tinf;\r
+int                    mapon;\r
+\r
+unsigned       _seg    *mapsegs[MAPPLANES];\r
+maptype                _seg    *mapheaderseg[NUMMAPS];\r
+byte           _seg    *audiosegs[NUMSNDCHUNKS];\r
+void           _seg    *grsegs[NUMCHUNKS];\r
+\r
+byte           far     grneeded[NUMCHUNKS];\r
+byte           ca_levelbit,ca_levelnum;\r
+\r
+int                    profilehandle,debughandle;\r
+\r
+char           audioname[13]="AUDIO.";\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern long    far     CGAhead;\r
+extern long    far     EGAhead;\r
+extern byte    CGAdict;\r
+extern byte    EGAdict;\r
+extern byte    far     maphead;\r
+extern byte    mapdict;\r
+extern byte    far     audiohead;\r
+extern byte    audiodict;\r
+\r
+\r
+char extension[5],     // Need a string, not constant to change cache files\r
+     gheadname[10]=GREXT"HEAD.",\r
+     gfilename[10]=GREXT"GRAPH.",\r
+     gdictname[10]=GREXT"DICT.",\r
+     mheadname[10]="MAPHEAD.",\r
+     mfilename[10]="MAPTEMP.",\r
+     aheadname[10]="AUDIOHED.",\r
+     afilename[10]="AUDIOT.";\r
+\r
+void CA_CannotOpen(char *string);\r
+\r
+long           _seg *grstarts; // array of offsets in egagraph, -1 for sparse\r
+long           _seg *audiostarts;      // array of offsets in audio / audiot\r
+\r
+#ifdef GRHEADERLINKED\r
+huffnode       *grhuffman;\r
+#else\r
+huffnode       grhuffman[255];\r
+#endif\r
+\r
+#ifdef AUDIOHEADERLINKED\r
+huffnode       *audiohuffman;\r
+#else\r
+huffnode       audiohuffman[255];\r
+#endif\r
+\r
+\r
+int                    grhandle;               // handle to EGAGRAPH\r
+int                    maphandle;              // handle to MAPTEMP / GAMEMAPS\r
+int                    audiohandle;    // handle to AUDIOT / AUDIO\r
+\r
+long           chunkcomplen,chunkexplen;\r
+\r
+SDMode         oldsoundmode;\r
+\r
+\r
+\r
+void   CAL_CarmackExpand (unsigned far *source, unsigned far *dest,\r
+               unsigned length);\r
+\r
+\r
+#ifdef THREEBYTEGRSTARTS\r
+#define FILEPOSSIZE    3\r
+//#define      GRFILEPOS(c) (*(long far *)(((byte far *)grstarts)+(c)*3)&0xffffff)\r
+long GRFILEPOS(int c)\r
+{\r
+       long value;\r
+       int     offset;\r
+\r
+       offset = c*3;\r
+\r
+       value = *(long far *)(((byte far *)grstarts)+offset);\r
+\r
+       value &= 0x00ffffffl;\r
+\r
+       if (value == 0xffffffl)\r
+               value = -1;\r
+\r
+       return value;\r
+};\r
+#else\r
+#define FILEPOSSIZE    4\r
+#define        GRFILEPOS(c) (grstarts[c])\r
+#endif\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                          LOW LEVEL ROUTINES\r
+\r
+=============================================================================\r
+*/\r
+\r
+/*\r
+============================\r
+=\r
+= CA_OpenDebug / CA_CloseDebug\r
+=\r
+= Opens a binary file with the handle "debughandle"\r
+=\r
+============================\r
+*/\r
+\r
+void CA_OpenDebug (void)\r
+{\r
+       unlink ("DEBUG.TXT");\r
+       debughandle = open("DEBUG.TXT", O_CREAT | O_WRONLY | O_TEXT);\r
+}\r
+\r
+void CA_CloseDebug (void)\r
+{\r
+       close (debughandle);\r
+}\r
+\r
+\r
+\r
+/*\r
+============================\r
+=\r
+= CAL_GetGrChunkLength\r
+=\r
+= Gets the length of an explicit length chunk (not tiles)\r
+= The file pointer is positioned so the compressed data can be read in next.\r
+=\r
+============================\r
+*/\r
+\r
+void CAL_GetGrChunkLength (int chunk)\r
+{\r
+       lseek(grhandle,GRFILEPOS(chunk),SEEK_SET);\r
+       read(grhandle,&chunkexplen,sizeof(chunkexplen));\r
+       chunkcomplen = GRFILEPOS(chunk+1)-GRFILEPOS(chunk)-4;\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= CA_FarRead\r
+=\r
+= Read from a file to a far pointer\r
+=\r
+==========================\r
+*/\r
+\r
+boolean CA_FarRead (int handle, byte far *dest, long length)\r
+{\r
+       if (length>0xffffl)\r
+               Quit ("CA_FarRead doesn't support 64K reads yet!");\r
+\r
+asm            push    ds\r
+asm            mov     bx,[handle]\r
+asm            mov     cx,[WORD PTR length]\r
+asm            mov     dx,[WORD PTR dest]\r
+asm            mov     ds,[WORD PTR dest+2]\r
+asm            mov     ah,0x3f                         // READ w/handle\r
+asm            int     21h\r
+asm            pop     ds\r
+asm            jnc     good\r
+       errno = _AX;\r
+       return  false;\r
+good:\r
+asm            cmp     ax,[WORD PTR length]\r
+asm            je      done\r
+       errno = EINVFMT;                        // user manager knows this is bad read\r
+       return  false;\r
+done:\r
+       return  true;\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= CA_SegWrite\r
+=\r
+= Write from a file to a far pointer\r
+=\r
+==========================\r
+*/\r
+\r
+boolean CA_FarWrite (int handle, byte far *source, long length)\r
+{\r
+       if (length>0xffffl)\r
+               Quit ("CA_FarWrite doesn't support 64K reads yet!");\r
+\r
+asm            push    ds\r
+asm            mov     bx,[handle]\r
+asm            mov     cx,[WORD PTR length]\r
+asm            mov     dx,[WORD PTR source]\r
+asm            mov     ds,[WORD PTR source+2]\r
+asm            mov     ah,0x40                 // WRITE w/handle\r
+asm            int     21h\r
+asm            pop     ds\r
+asm            jnc     good\r
+       errno = _AX;\r
+       return  false;\r
+good:\r
+asm            cmp     ax,[WORD PTR length]\r
+asm            je      done\r
+       errno = ENOMEM;                         // user manager knows this is bad write\r
+       return  false;\r
+\r
+done:\r
+       return  true;\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= CA_ReadFile\r
+=\r
+= Reads a file into an allready allocated buffer\r
+=\r
+==========================\r
+*/\r
+\r
+boolean CA_ReadFile (char *filename, memptr *ptr)\r
+{\r
+       int handle;\r
+       long size;\r
+\r
+       if ((handle = open(filename,O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               return false;\r
+\r
+       size = filelength (handle);\r
+       if (!CA_FarRead (handle,*ptr,size))\r
+       {\r
+               close (handle);\r
+               return false;\r
+       }\r
+       close (handle);\r
+       return true;\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= CA_WriteFile\r
+=\r
+= Writes a file from a memory buffer\r
+=\r
+==========================\r
+*/\r
+\r
+boolean CA_WriteFile (char *filename, void far *ptr, long length)\r
+{\r
+       int handle;\r
+       long size;\r
+\r
+       handle = open(filename,O_CREAT | O_BINARY | O_WRONLY,\r
+                               S_IREAD | S_IWRITE | S_IFREG);\r
+\r
+       if (handle == -1)\r
+               return false;\r
+\r
+       if (!CA_FarWrite (handle,ptr,length))\r
+       {\r
+               close (handle);\r
+               return false;\r
+       }\r
+       close (handle);\r
+       return true;\r
+}\r
+\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= CA_LoadFile\r
+=\r
+= Allocate space for and load a file\r
+=\r
+==========================\r
+*/\r
+\r
+boolean CA_LoadFile (char *filename, memptr *ptr)\r
+{\r
+       int handle;\r
+       long size;\r
+\r
+       if ((handle = open(filename,O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               return false;\r
+\r
+       size = filelength (handle);\r
+       MM_GetPtr (ptr,size);\r
+       if (!CA_FarRead (handle,*ptr,size))\r
+       {\r
+               close (handle);\r
+               return false;\r
+       }\r
+       close (handle);\r
+       return true;\r
+}\r
+\r
+/*\r
+============================================================================\r
+\r
+               COMPRESSION routines, see JHUFF.C for more\r
+\r
+============================================================================\r
+*/\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= CAL_OptimizeNodes\r
+=\r
+= Goes through a huffman table and changes the 256-511 node numbers to the\r
+= actular address of the node.  Must be called before CAL_HuffExpand\r
+=\r
+===============\r
+*/\r
+\r
+void CAL_OptimizeNodes (huffnode *table)\r
+{\r
+  huffnode *node;\r
+  int i;\r
+\r
+  node = table;\r
+\r
+  for (i=0;i<255;i++)\r
+  {\r
+       if (node->bit0 >= 256)\r
+         node->bit0 = (unsigned)(table+(node->bit0-256));\r
+       if (node->bit1 >= 256)\r
+         node->bit1 = (unsigned)(table+(node->bit1-256));\r
+       node++;\r
+  }\r
+}\r
+\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CAL_HuffExpand\r
+=\r
+= Length is the length of the EXPANDED data\r
+= If screenhack, the data is decompressed in four planes directly\r
+= to the screen\r
+=\r
+======================\r
+*/\r
+\r
+void CAL_HuffExpand (byte huge *source, byte huge *dest,\r
+  long length,huffnode *hufftable, boolean screenhack)\r
+{\r
+//  unsigned bit,byte,node,code;\r
+  unsigned sourceseg,sourceoff,destseg,destoff,endoff;\r
+  huffnode *headptr;\r
+  byte         mapmask;\r
+//  huffnode *nodeon;\r
+\r
+  headptr = hufftable+254;     // head node is allways node 254\r
+\r
+  source++;    // normalize\r
+  source--;\r
+  dest++;\r
+  dest--;\r
+\r
+  if (screenhack)\r
+  {\r
+       mapmask = 1;\r
+asm    mov     dx,SC_INDEX\r
+asm    mov     ax,SC_MAPMASK + 256\r
+asm    out     dx,ax\r
+       length >>= 2;\r
+  }\r
+\r
+  sourceseg = FP_SEG(source);\r
+  sourceoff = FP_OFF(source);\r
+  destseg = FP_SEG(dest);\r
+  destoff = FP_OFF(dest);\r
+  endoff = destoff+length;\r
+\r
+//\r
+// ds:si source\r
+// es:di dest\r
+// ss:bx node pointer\r
+//\r
+\r
+       if (length <0xfff0)\r
+       {\r
+\r
+//--------------------------\r
+// expand less than 64k of data\r
+//--------------------------\r
+\r
+asm mov        bx,[headptr]\r
+\r
+asm    mov     si,[sourceoff]\r
+asm    mov     di,[destoff]\r
+asm    mov     es,[destseg]\r
+asm    mov     ds,[sourceseg]\r
+asm    mov     ax,[endoff]\r
+\r
+asm    mov     ch,[si]                         // load first byte\r
+asm    inc     si\r
+asm    mov     cl,1\r
+\r
+expandshort:\r
+asm    test    ch,cl                   // bit set?\r
+asm    jnz     bit1short\r
+asm    mov     dx,[ss:bx]                      // take bit0 path from node\r
+asm    shl     cl,1                            // advance to next bit position\r
+asm    jc      newbyteshort\r
+asm    jnc     sourceupshort\r
+\r
+bit1short:\r
+asm    mov     dx,[ss:bx+2]            // take bit1 path\r
+asm    shl     cl,1                            // advance to next bit position\r
+asm    jnc     sourceupshort\r
+\r
+newbyteshort:\r
+asm    mov     ch,[si]                         // load next byte\r
+asm    inc     si\r
+asm    mov     cl,1                            // back to first bit\r
+\r
+sourceupshort:\r
+asm    or      dh,dh                           // if dx<256 its a byte, else move node\r
+asm    jz      storebyteshort\r
+asm    mov     bx,dx                           // next node = (huffnode *)code\r
+asm    jmp     expandshort\r
+\r
+storebyteshort:\r
+asm    mov     [es:di],dl\r
+asm    inc     di                                      // write a decopmpressed byte out\r
+asm    mov     bx,[headptr]            // back to the head node for next bit\r
+\r
+asm    cmp     di,ax                           // done?\r
+asm    jne     expandshort\r
+\r
+//\r
+// perform screenhack if needed\r
+//\r
+asm    test    [screenhack],1\r
+asm    jz      notscreen\r
+asm    shl     [mapmask],1\r
+asm    mov     ah,[mapmask]\r
+asm    cmp     ah,16\r
+asm    je      notscreen                       // all four planes done\r
+asm    mov     dx,SC_INDEX\r
+asm    mov     al,SC_MAPMASK\r
+asm    out     dx,ax\r
+asm    mov     di,[destoff]\r
+asm    mov     ax,[endoff]\r
+asm    jmp     expandshort\r
+\r
+notscreen:;\r
+       }\r
+       else\r
+       {\r
+\r
+//--------------------------\r
+// expand more than 64k of data\r
+//--------------------------\r
+\r
+  length--;\r
+\r
+asm mov        bx,[headptr]\r
+asm    mov     cl,1\r
+\r
+asm    mov     si,[sourceoff]\r
+asm    mov     di,[destoff]\r
+asm    mov     es,[destseg]\r
+asm    mov     ds,[sourceseg]\r
+\r
+asm    lodsb                   // load first byte\r
+\r
+expand:\r
+asm    test    al,cl           // bit set?\r
+asm    jnz     bit1\r
+asm    mov     dx,[ss:bx]      // take bit0 path from node\r
+asm    jmp     gotcode\r
+bit1:\r
+asm    mov     dx,[ss:bx+2]    // take bit1 path\r
+\r
+gotcode:\r
+asm    shl     cl,1            // advance to next bit position\r
+asm    jnc     sourceup\r
+asm    lodsb\r
+asm    cmp     si,0x10         // normalize ds:si\r
+asm    jb      sinorm\r
+asm    mov     cx,ds\r
+asm    inc     cx\r
+asm    mov     ds,cx\r
+asm    xor     si,si\r
+sinorm:\r
+asm    mov     cl,1            // back to first bit\r
+\r
+sourceup:\r
+asm    or      dh,dh           // if dx<256 its a byte, else move node\r
+asm    jz      storebyte\r
+asm    mov     bx,dx           // next node = (huffnode *)code\r
+asm    jmp     expand\r
+\r
+storebyte:\r
+asm    mov     [es:di],dl\r
+asm    inc     di              // write a decopmpressed byte out\r
+asm    mov     bx,[headptr]    // back to the head node for next bit\r
+\r
+asm    cmp     di,0x10         // normalize es:di\r
+asm    jb      dinorm\r
+asm    mov     dx,es\r
+asm    inc     dx\r
+asm    mov     es,dx\r
+asm    xor     di,di\r
+dinorm:\r
+\r
+asm    sub     [WORD PTR ss:length],1\r
+asm    jnc     expand\r
+asm    dec     [WORD PTR ss:length+2]\r
+asm    jns     expand          // when length = ffff ffff, done\r
+\r
+       }\r
+\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+}\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CAL_CarmackExpand\r
+=\r
+= Length is the length of the EXPANDED data\r
+=\r
+======================\r
+*/\r
+\r
+#define NEARTAG        0xa7\r
+#define FARTAG 0xa8\r
+\r
+void CAL_CarmackExpand (unsigned far *source, unsigned far *dest, unsigned length)\r
+{\r
+       unsigned        ch,chhigh,count,offset;\r
+       unsigned        far *copyptr, far *inptr, far *outptr;\r
+\r
+       length/=2;\r
+\r
+       inptr = source;\r
+       outptr = dest;\r
+\r
+       while (length)\r
+       {\r
+               ch = *inptr++;\r
+               chhigh = ch>>8;\r
+               if (chhigh == NEARTAG)\r
+               {\r
+                       count = ch&0xff;\r
+                       if (!count)\r
+                       {                               // have to insert a word containing the tag byte\r
+                               ch |= *((unsigned char far *)inptr)++;\r
+                               *outptr++ = ch;\r
+                               length--;\r
+                       }\r
+                       else\r
+                       {\r
+                               offset = *((unsigned char far *)inptr)++;\r
+                               copyptr = outptr - offset;\r
+                               length -= count;\r
+                               while (count--)\r
+                                       *outptr++ = *copyptr++;\r
+                       }\r
+               }\r
+               else if (chhigh == FARTAG)\r
+               {\r
+                       count = ch&0xff;\r
+                       if (!count)\r
+                       {                               // have to insert a word containing the tag byte\r
+                               ch |= *((unsigned char far *)inptr)++;\r
+                               *outptr++ = ch;\r
+                               length --;\r
+                       }\r
+                       else\r
+                       {\r
+                               offset = *inptr++;\r
+                               copyptr = dest + offset;\r
+                               length -= count;\r
+                               while (count--)\r
+                                       *outptr++ = *copyptr++;\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       *outptr++ = ch;\r
+                       length --;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CA_RLEWcompress\r
+=\r
+======================\r
+*/\r
+\r
+long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,\r
+  unsigned rlewtag)\r
+{\r
+  long complength;\r
+  unsigned value,count,i;\r
+  unsigned huge *start,huge *end;\r
+\r
+  start = dest;\r
+\r
+  end = source + (length+1)/2;\r
+\r
+//\r
+// compress it\r
+//\r
+  do\r
+  {\r
+       count = 1;\r
+       value = *source++;\r
+       while (*source == value && source<end)\r
+       {\r
+         count++;\r
+         source++;\r
+       }\r
+       if (count>3 || value == rlewtag)\r
+       {\r
+    //\r
+    // send a tag / count / value string\r
+    //\r
+      *dest++ = rlewtag;\r
+      *dest++ = count;\r
+      *dest++ = value;\r
+    }\r
+    else\r
+    {\r
+    //\r
+    // send word without compressing\r
+    //\r
+      for (i=1;i<=count;i++)\r
+       *dest++ = value;\r
+       }\r
+\r
+  } while (source<end);\r
+\r
+  complength = 2*(dest-start);\r
+  return complength;\r
+}\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CA_RLEWexpand\r
+= length is EXPANDED length\r
+=\r
+======================\r
+*/\r
+\r
+void CA_RLEWexpand (unsigned huge *source, unsigned huge *dest,long length,\r
+  unsigned rlewtag)\r
+{\r
+//  unsigned value,count,i;\r
+  unsigned huge *end;\r
+  unsigned sourceseg,sourceoff,destseg,destoff,endseg,endoff;\r
+\r
+\r
+//\r
+// expand it\r
+//\r
+#if 0\r
+  do\r
+  {\r
+       value = *source++;\r
+       if (value != rlewtag)\r
+       //\r
+       // uncompressed\r
+       //\r
+         *dest++=value;\r
+       else\r
+       {\r
+       //\r
+       // compressed string\r
+       //\r
+         count = *source++;\r
+         value = *source++;\r
+         for (i=1;i<=count;i++)\r
+       *dest++ = value;\r
+       }\r
+  } while (dest<end);\r
+#endif\r
+\r
+  end = dest + (length)/2;\r
+  sourceseg = FP_SEG(source);\r
+  sourceoff = FP_OFF(source);\r
+  destseg = FP_SEG(dest);\r
+  destoff = FP_OFF(dest);\r
+  endseg = FP_SEG(end);\r
+  endoff = FP_OFF(end);\r
+\r
+\r
+//\r
+// ax = source value\r
+// bx = tag value\r
+// cx = repeat counts\r
+// dx = scratch\r
+//\r
+// NOTE: A repeat count that produces 0xfff0 bytes can blow this!\r
+//\r
+\r
+asm    mov     bx,rlewtag\r
+asm    mov     si,sourceoff\r
+asm    mov     di,destoff\r
+asm    mov     es,destseg\r
+asm    mov     ds,sourceseg\r
+\r
+expand:\r
+asm    lodsw\r
+asm    cmp     ax,bx\r
+asm    je      repeat\r
+asm    stosw\r
+asm    jmp     next\r
+\r
+repeat:\r
+asm    lodsw\r
+asm    mov     cx,ax           // repeat count\r
+asm    lodsw                   // repeat value\r
+asm    rep stosw\r
+\r
+next:\r
+\r
+asm    cmp     si,0x10         // normalize ds:si\r
+asm    jb      sinorm\r
+asm    mov     ax,si\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    mov     dx,ds\r
+asm    add     dx,ax\r
+asm    mov     ds,dx\r
+asm    and     si,0xf\r
+sinorm:\r
+asm    cmp     di,0x10         // normalize es:di\r
+asm    jb      dinorm\r
+asm    mov     ax,di\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    mov     dx,es\r
+asm    add     dx,ax\r
+asm    mov     es,dx\r
+asm    and     di,0xf\r
+dinorm:\r
+\r
+asm    cmp     di,ss:endoff\r
+asm    jne     expand\r
+asm    mov     ax,es\r
+asm    cmp     ax,ss:endseg\r
+asm    jb      expand\r
+\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                        CACHE MANAGER ROUTINES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CAL_SetupGrFile\r
+=\r
+======================\r
+*/\r
+\r
+void CAL_SetupGrFile (void)\r
+{\r
+       char fname[13];\r
+       int handle;\r
+       memptr compseg;\r
+\r
+#ifdef GRHEADERLINKED\r
+\r
+       grhuffman = (huffnode *)&EGAdict;\r
+       grstarts = (long _seg *)FP_SEG(&EGAhead);\r
+\r
+       CAL_OptimizeNodes (grhuffman);\r
+\r
+#else\r
+\r
+//\r
+// load ???dict.ext (huffman dictionary for graphics files)\r
+//\r
+\r
+       strcpy(fname,gdictname);\r
+       strcat(fname,extension);\r
+\r
+       if ((handle = open(fname,\r
+                O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               CA_CannotOpen(fname);\r
+\r
+       read(handle, &grhuffman, sizeof(grhuffman));\r
+       close(handle);\r
+       CAL_OptimizeNodes (grhuffman);\r
+//\r
+// load the data offsets from ???head.ext\r
+//\r
+       MM_GetPtr (&(memptr)grstarts,(NUMCHUNKS+1)*FILEPOSSIZE);\r
+\r
+       strcpy(fname,gheadname);\r
+       strcat(fname,extension);\r
+\r
+       if ((handle = open(fname,\r
+                O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               CA_CannotOpen(fname);\r
+\r
+       CA_FarRead(handle, (memptr)grstarts, (NUMCHUNKS+1)*FILEPOSSIZE);\r
+\r
+       close(handle);\r
+\r
+\r
+#endif\r
+\r
+//\r
+// Open the graphics file, leaving it open until the game is finished\r
+//\r
+       strcpy(fname,gfilename);\r
+       strcat(fname,extension);\r
+\r
+       grhandle = open(fname, O_RDONLY | O_BINARY);\r
+       if (grhandle == -1)\r
+               CA_CannotOpen(fname);\r
+\r
+\r
+//\r
+// load the pic and sprite headers into the arrays in the data segment\r
+//\r
+       MM_GetPtr(&(memptr)pictable,NUMPICS*sizeof(pictabletype));\r
+       CAL_GetGrChunkLength(STRUCTPIC);                // position file pointer\r
+       MM_GetPtr(&compseg,chunkcomplen);\r
+       CA_FarRead (grhandle,compseg,chunkcomplen);\r
+       CAL_HuffExpand (compseg, (byte huge *)pictable,NUMPICS*sizeof(pictabletype),grhuffman,false);\r
+       MM_FreePtr(&compseg);\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CAL_SetupMapFile\r
+=\r
+======================\r
+*/\r
+\r
+void CAL_SetupMapFile (void)\r
+{\r
+       int     i;\r
+       int handle;\r
+       long length,pos;\r
+       char fname[13];\r
+\r
+//\r
+// load maphead.ext (offsets and tileinfo for map file)\r
+//\r
+#ifndef MAPHEADERLINKED\r
+       strcpy(fname,mheadname);\r
+       strcat(fname,extension);\r
+\r
+       if ((handle = open(fname,\r
+                O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               CA_CannotOpen(fname);\r
+\r
+       length = filelength(handle);\r
+       MM_GetPtr (&(memptr)tinf,length);\r
+       CA_FarRead(handle, tinf, length);\r
+       close(handle);\r
+#else\r
+\r
+       tinf = (byte _seg *)FP_SEG(&maphead);\r
+\r
+#endif\r
+\r
+//\r
+// open the data file\r
+//\r
+#ifdef CARMACIZED\r
+       strcpy(fname,"GAMEMAPS.");\r
+       strcat(fname,extension);\r
+\r
+       if ((maphandle = open(fname,\r
+                O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               CA_CannotOpen(fname);\r
+#else\r
+       strcpy(fname,mfilename);\r
+       strcat(fname,extension);\r
+\r
+       if ((maphandle = open(fname,\r
+                O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               CA_CannotOpen(fname);\r
+#endif\r
+\r
+//\r
+// load all map header\r
+//\r
+       for (i=0;i<NUMMAPS;i++)\r
+       {\r
+               pos = ((mapfiletype     _seg *)tinf)->headeroffsets[i];\r
+               if (pos<0)                                              // $FFFFFFFF start is a sparse map\r
+                       continue;\r
+\r
+               MM_GetPtr(&(memptr)mapheaderseg[i],sizeof(maptype));\r
+               MM_SetLock(&(memptr)mapheaderseg[i],true);\r
+               lseek(maphandle,pos,SEEK_SET);\r
+               CA_FarRead (maphandle,(memptr)mapheaderseg[i],sizeof(maptype));\r
+       }\r
+\r
+//\r
+// allocate space for 3 64*64 planes\r
+//\r
+       for (i=0;i<MAPPLANES;i++)\r
+       {\r
+               MM_GetPtr (&(memptr)mapsegs[i],64*64*2);\r
+               MM_SetLock (&(memptr)mapsegs[i],true);\r
+       }\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CAL_SetupAudioFile\r
+=\r
+======================\r
+*/\r
+\r
+void CAL_SetupAudioFile (void)\r
+{\r
+       int handle;\r
+       long length;\r
+       char fname[13];\r
+\r
+//\r
+// load maphead.ext (offsets and tileinfo for map file)\r
+//\r
+#ifndef AUDIOHEADERLINKED\r
+       strcpy(fname,aheadname);\r
+       strcat(fname,extension);\r
+\r
+       if ((handle = open(fname,\r
+                O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               CA_CannotOpen(fname);\r
+\r
+       length = filelength(handle);\r
+       MM_GetPtr (&(memptr)audiostarts,length);\r
+       CA_FarRead(handle, (byte far *)audiostarts, length);\r
+       close(handle);\r
+#else\r
+       audiohuffman = (huffnode *)&audiodict;\r
+       CAL_OptimizeNodes (audiohuffman);\r
+       audiostarts = (long _seg *)FP_SEG(&audiohead);\r
+#endif\r
+\r
+//\r
+// open the data file\r
+//\r
+#ifndef AUDIOHEADERLINKED\r
+       strcpy(fname,afilename);\r
+       strcat(fname,extension);\r
+\r
+       if ((audiohandle = open(fname,\r
+                O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               CA_CannotOpen(fname);\r
+#else\r
+       if ((audiohandle = open("AUDIO."EXTENSION,\r
+                O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+               Quit ("Can't open AUDIO."EXTENSION"!");\r
+#endif\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CA_Startup\r
+=\r
+= Open all files and load in headers\r
+=\r
+======================\r
+*/\r
+\r
+void CA_Startup (void)\r
+{\r
+#ifdef PROFILE\r
+       unlink ("PROFILE.TXT");\r
+       profilehandle = open("PROFILE.TXT", O_CREAT | O_WRONLY | O_TEXT);\r
+#endif\r
+\r
+       CAL_SetupMapFile ();\r
+       CAL_SetupGrFile ();\r
+       CAL_SetupAudioFile ();\r
+\r
+       mapon = -1;\r
+       ca_levelbit = 1;\r
+       ca_levelnum = 0;\r
+\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CA_Shutdown\r
+=\r
+= Closes all files\r
+=\r
+======================\r
+*/\r
+\r
+void CA_Shutdown (void)\r
+{\r
+#ifdef PROFILE\r
+       close (profilehandle);\r
+#endif\r
+\r
+       close (maphandle);\r
+       close (grhandle);\r
+       close (audiohandle);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_CacheAudioChunk\r
+=\r
+======================\r
+*/\r
+\r
+void CA_CacheAudioChunk (int chunk)\r
+{\r
+       long    pos,compressed;\r
+#ifdef AUDIOHEADERLINKED\r
+       long    expanded;\r
+       memptr  bigbufferseg;\r
+       byte    far *source;\r
+#endif\r
+\r
+       if (audiosegs[chunk])\r
+       {\r
+               MM_SetPurge (&(memptr)audiosegs[chunk],0);\r
+               return;                                                 // allready in memory\r
+       }\r
+\r
+//\r
+// load the chunk into a buffer, either the miscbuffer if it fits, or allocate\r
+// a larger buffer\r
+//\r
+       pos = audiostarts[chunk];\r
+       compressed = audiostarts[chunk+1]-pos;\r
+\r
+       lseek(audiohandle,pos,SEEK_SET);\r
+\r
+#ifndef AUDIOHEADERLINKED\r
+\r
+       MM_GetPtr (&(memptr)audiosegs[chunk],compressed);\r
+       if (mmerror)\r
+               return;\r
+\r
+       CA_FarRead(audiohandle,audiosegs[chunk],compressed);\r
+\r
+#else\r
+\r
+       if (compressed<=BUFFERSIZE)\r
+       {\r
+               CA_FarRead(audiohandle,bufferseg,compressed);\r
+               source = bufferseg;\r
+       }\r
+       else\r
+       {\r
+               MM_GetPtr(&bigbufferseg,compressed);\r
+               if (mmerror)\r
+                       return;\r
+               MM_SetLock (&bigbufferseg,true);\r
+               CA_FarRead(audiohandle,bigbufferseg,compressed);\r
+               source = bigbufferseg;\r
+       }\r
+\r
+       expanded = *(long far *)source;\r
+       source += 4;                    // skip over length\r
+       MM_GetPtr (&(memptr)audiosegs[chunk],expanded);\r
+       if (mmerror)\r
+               goto done;\r
+       CAL_HuffExpand (source,audiosegs[chunk],expanded,audiohuffman,false);\r
+\r
+done:\r
+       if (compressed>BUFFERSIZE)\r
+               MM_FreePtr(&bigbufferseg);\r
+#endif\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_LoadAllSounds\r
+=\r
+= Purges all sounds, then loads all new ones (mode switch)\r
+=\r
+======================\r
+*/\r
+\r
+void CA_LoadAllSounds (void)\r
+{\r
+       unsigned        start,i;\r
+\r
+       switch (oldsoundmode)\r
+       {\r
+       case sdm_Off:\r
+               goto cachein;\r
+       case sdm_PC:\r
+               start = STARTPCSOUNDS;\r
+               break;\r
+       case sdm_AdLib:\r
+               start = STARTADLIBSOUNDS;\r
+               break;\r
+       }\r
+\r
+       for (i=0;i<NUMSOUNDS;i++,start++)\r
+               if (audiosegs[start])\r
+                       MM_SetPurge (&(memptr)audiosegs[start],3);              // make purgable\r
+\r
+cachein:\r
+\r
+       switch (SoundMode)\r
+       {\r
+       case sdm_Off:\r
+               return;\r
+       case sdm_PC:\r
+               start = STARTPCSOUNDS;\r
+               break;\r
+       case sdm_AdLib:\r
+               start = STARTADLIBSOUNDS;\r
+               break;\r
+       }\r
+\r
+       for (i=0;i<NUMSOUNDS;i++,start++)\r
+               CA_CacheAudioChunk (start);\r
+\r
+       oldsoundmode = SoundMode;\r
+}\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CAL_ExpandGrChunk\r
+=\r
+= Does whatever is needed with a pointer to a compressed chunk\r
+=\r
+======================\r
+*/\r
+\r
+void CAL_ExpandGrChunk (int chunk, byte far *source)\r
+{\r
+       long    expanded;\r
+\r
+\r
+       if (chunk >= STARTTILE8 && chunk < STARTEXTERNS)\r
+       {\r
+       //\r
+       // expanded sizes of tile8/16/32 are implicit\r
+       //\r
+\r
+#define BLOCK          64\r
+#define MASKBLOCK      128\r
+\r
+               if (chunk<STARTTILE8M)                  // tile 8s are all in one chunk!\r
+                       expanded = BLOCK*NUMTILE8;\r
+               else if (chunk<STARTTILE16)\r
+                       expanded = MASKBLOCK*NUMTILE8M;\r
+               else if (chunk<STARTTILE16M)    // all other tiles are one/chunk\r
+                       expanded = BLOCK*4;\r
+               else if (chunk<STARTTILE32)\r
+                       expanded = MASKBLOCK*4;\r
+               else if (chunk<STARTTILE32M)\r
+                       expanded = BLOCK*16;\r
+               else\r
+                       expanded = MASKBLOCK*16;\r
+       }\r
+       else\r
+       {\r
+       //\r
+       // everything else has an explicit size longword\r
+       //\r
+               expanded = *(long far *)source;\r
+               source += 4;                    // skip over length\r
+       }\r
+\r
+//\r
+// allocate final space, decompress it, and free bigbuffer\r
+// Sprites need to have shifts made and various other junk\r
+//\r
+       MM_GetPtr (&grsegs[chunk],expanded);\r
+       if (mmerror)\r
+               return;\r
+       CAL_HuffExpand (source,grsegs[chunk],expanded,grhuffman,false);\r
+}\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CA_CacheGrChunk\r
+=\r
+= Makes sure a given chunk is in memory, loadiing it if needed\r
+=\r
+======================\r
+*/\r
+\r
+void CA_CacheGrChunk (int chunk)\r
+{\r
+       long    pos,compressed;\r
+       memptr  bigbufferseg;\r
+       byte    far *source;\r
+       int             next;\r
+\r
+       grneeded[chunk] |= ca_levelbit;         // make sure it doesn't get removed\r
+       if (grsegs[chunk])\r
+       {\r
+               MM_SetPurge (&grsegs[chunk],0);\r
+               return;                                                 // allready in memory\r
+       }\r
+\r
+//\r
+// load the chunk into a buffer, either the miscbuffer if it fits, or allocate\r
+// a larger buffer\r
+//\r
+       pos = GRFILEPOS(chunk);\r
+       if (pos<0)                                                      // $FFFFFFFF start is a sparse tile\r
+         return;\r
+\r
+       next = chunk +1;\r
+       while (GRFILEPOS(next) == -1)           // skip past any sparse tiles\r
+               next++;\r
+\r
+       compressed = GRFILEPOS(next)-pos;\r
+\r
+       lseek(grhandle,pos,SEEK_SET);\r
+\r
+       if (compressed<=BUFFERSIZE)\r
+       {\r
+               CA_FarRead(grhandle,bufferseg,compressed);\r
+               source = bufferseg;\r
+       }\r
+       else\r
+       {\r
+               MM_GetPtr(&bigbufferseg,compressed);\r
+               MM_SetLock (&bigbufferseg,true);\r
+               CA_FarRead(grhandle,bigbufferseg,compressed);\r
+               source = bigbufferseg;\r
+       }\r
+\r
+       CAL_ExpandGrChunk (chunk,source);\r
+\r
+       if (compressed>BUFFERSIZE)\r
+               MM_FreePtr(&bigbufferseg);\r
+}\r
+\r
+\r
+\r
+//==========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_CacheScreen\r
+=\r
+= Decompresses a chunk from disk straight onto the screen\r
+=\r
+======================\r
+*/\r
+\r
+void CA_CacheScreen (int chunk)\r
+{\r
+       long    pos,compressed,expanded;\r
+       memptr  bigbufferseg;\r
+       byte    far *source;\r
+       int             next;\r
+\r
+//\r
+// load the chunk into a buffer\r
+//\r
+       pos = GRFILEPOS(chunk);\r
+       next = chunk +1;\r
+       while (GRFILEPOS(next) == -1)           // skip past any sparse tiles\r
+               next++;\r
+       compressed = GRFILEPOS(next)-pos;\r
+\r
+       lseek(grhandle,pos,SEEK_SET);\r
+\r
+       MM_GetPtr(&bigbufferseg,compressed);\r
+       MM_SetLock (&bigbufferseg,true);\r
+       CA_FarRead(grhandle,bigbufferseg,compressed);\r
+       source = bigbufferseg;\r
+\r
+       expanded = *(long far *)source;\r
+       source += 4;                    // skip over length\r
+\r
+//\r
+// allocate final space, decompress it, and free bigbuffer\r
+// Sprites need to have shifts made and various other junk\r
+//\r
+       CAL_HuffExpand (source,MK_FP(SCREENSEG,bufferofs),expanded,grhuffman,true);\r
+       VW_MarkUpdateBlock (0,0,319,199);\r
+       MM_FreePtr(&bigbufferseg);\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_CacheMap\r
+=\r
+= WOLF: This is specialized for a 64*64 map size\r
+=\r
+======================\r
+*/\r
+\r
+void CA_CacheMap (int mapnum)\r
+{\r
+       long    pos,compressed;\r
+       int             plane;\r
+       memptr  *dest,bigbufferseg;\r
+       unsigned        size;\r
+       unsigned        far     *source;\r
+#ifdef CARMACIZED\r
+       memptr  buffer2seg;\r
+       long    expanded;\r
+#endif\r
+\r
+       mapon = mapnum;\r
+\r
+//\r
+// load the planes into the allready allocated buffers\r
+//\r
+       size = 64*64*2;\r
+\r
+       for (plane = 0; plane<MAPPLANES; plane++)\r
+       {\r
+               pos = mapheaderseg[mapnum]->planestart[plane];\r
+               compressed = mapheaderseg[mapnum]->planelength[plane];\r
+\r
+               dest = &(memptr)mapsegs[plane];\r
+\r
+               lseek(maphandle,pos,SEEK_SET);\r
+               if (compressed<=BUFFERSIZE)\r
+                       source = bufferseg;\r
+               else\r
+               {\r
+                       MM_GetPtr(&bigbufferseg,compressed);\r
+                       MM_SetLock (&bigbufferseg,true);\r
+                       source = bigbufferseg;\r
+               }\r
+\r
+               CA_FarRead(maphandle,(byte far *)source,compressed);\r
+#ifdef CARMACIZED\r
+               //\r
+               // unhuffman, then unRLEW\r
+               // The huffman'd chunk has a two byte expanded length first\r
+               // The resulting RLEW chunk also does, even though it's not really\r
+               // needed\r
+               //\r
+               expanded = *source;\r
+               source++;\r
+               MM_GetPtr (&buffer2seg,expanded);\r
+               CAL_CarmackExpand (source, (unsigned far *)buffer2seg,expanded);\r
+               CA_RLEWexpand (((unsigned far *)buffer2seg)+1,*dest,size,\r
+               ((mapfiletype _seg *)tinf)->RLEWtag);\r
+               MM_FreePtr (&buffer2seg);\r
+\r
+#else\r
+               //\r
+               // unRLEW, skipping expanded length\r
+               //\r
+               CA_RLEWexpand (source+1, *dest,size,\r
+               ((mapfiletype _seg *)tinf)->RLEWtag);\r
+#endif\r
+\r
+               if (compressed>BUFFERSIZE)\r
+                       MM_FreePtr(&bigbufferseg);\r
+       }\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_UpLevel\r
+=\r
+= Goes up a bit level in the needed lists and clears it out.\r
+= Everything is made purgable\r
+=\r
+======================\r
+*/\r
+\r
+void CA_UpLevel (void)\r
+{\r
+       int     i;\r
+\r
+       if (ca_levelnum==7)\r
+               Quit ("CA_UpLevel: Up past level 7!");\r
+\r
+       for (i=0;i<NUMCHUNKS;i++)\r
+               if (grsegs[i])\r
+                       MM_SetPurge (&(memptr)grsegs[i],3);\r
+       ca_levelbit<<=1;\r
+       ca_levelnum++;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_DownLevel\r
+=\r
+= Goes down a bit level in the needed lists and recaches\r
+= everything from the lower level\r
+=\r
+======================\r
+*/\r
+\r
+void CA_DownLevel (void)\r
+{\r
+       if (!ca_levelnum)\r
+               Quit ("CA_DownLevel: Down past level 0!");\r
+       ca_levelbit>>=1;\r
+       ca_levelnum--;\r
+       CA_CacheMarks();\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_ClearMarks\r
+=\r
+= Clears out all the marks at the current level\r
+=\r
+======================\r
+*/\r
+\r
+void CA_ClearMarks (void)\r
+{\r
+       int i;\r
+\r
+       for (i=0;i<NUMCHUNKS;i++)\r
+               grneeded[i]&=~ca_levelbit;\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_ClearAllMarks\r
+=\r
+= Clears out all the marks on all the levels\r
+=\r
+======================\r
+*/\r
+\r
+void CA_ClearAllMarks (void)\r
+{\r
+       _fmemset (grneeded,0,sizeof(grneeded));\r
+       ca_levelbit = 1;\r
+       ca_levelnum = 0;\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CA_FreeGraphics\r
+=\r
+======================\r
+*/\r
+\r
+\r
+void CA_SetGrPurge (void)\r
+{\r
+       int i;\r
+\r
+//\r
+// free graphics\r
+//\r
+       CA_ClearMarks ();\r
+\r
+       for (i=0;i<NUMCHUNKS;i++)\r
+               if (grsegs[i])\r
+                       MM_SetPurge (&(memptr)grsegs[i],3);\r
+}\r
+\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= CA_SetAllPurge\r
+=\r
+= Make everything possible purgable\r
+=\r
+======================\r
+*/\r
+\r
+void CA_SetAllPurge (void)\r
+{\r
+       int i;\r
+\r
+\r
+//\r
+// free sounds\r
+//\r
+       for (i=0;i<NUMSNDCHUNKS;i++)\r
+               if (audiosegs[i])\r
+                       MM_SetPurge (&(memptr)audiosegs[i],3);\r
+\r
+//\r
+// free graphics\r
+//\r
+       CA_SetGrPurge ();\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= CA_CacheMarks\r
+=\r
+======================\r
+*/\r
+#define MAXEMPTYREAD   1024\r
+\r
+void CA_CacheMarks (void)\r
+{\r
+       int     i,next,numcache;\r
+       long    pos,endpos,nextpos,nextendpos,compressed;\r
+       long    bufferstart,bufferend;  // file position of general buffer\r
+       byte    far *source;\r
+       memptr  bigbufferseg;\r
+\r
+       numcache = 0;\r
+//\r
+// go through and make everything not needed purgable\r
+//\r
+       for (i=0;i<NUMCHUNKS;i++)\r
+               if (grneeded[i]&ca_levelbit)\r
+               {\r
+                       if (grsegs[i])                                  // its allready in memory, make\r
+                               MM_SetPurge(&grsegs[i],0);      // sure it stays there!\r
+                       else\r
+                               numcache++;\r
+               }\r
+               else\r
+               {\r
+                       if (grsegs[i])                                  // not needed, so make it purgeable\r
+                               MM_SetPurge(&grsegs[i],3);\r
+               }\r
+\r
+       if (!numcache)                  // nothing to cache!\r
+               return;\r
+\r
+\r
+//\r
+// go through and load in anything still needed\r
+//\r
+       bufferstart = bufferend = 0;            // nothing good in buffer now\r
+\r
+       for (i=0;i<NUMCHUNKS;i++)\r
+               if ( (grneeded[i]&ca_levelbit) && !grsegs[i])\r
+               {\r
+                       pos = GRFILEPOS(i);\r
+                       if (pos<0)\r
+                               continue;\r
+\r
+                       next = i +1;\r
+                       while (GRFILEPOS(next) == -1)           // skip past any sparse tiles\r
+                               next++;\r
+\r
+                       compressed = GRFILEPOS(next)-pos;\r
+                       endpos = pos+compressed;\r
+\r
+                       if (compressed<=BUFFERSIZE)\r
+                       {\r
+                               if (bufferstart<=pos\r
+                               && bufferend>= endpos)\r
+                               {\r
+                               // data is allready in buffer\r
+                                       source = (byte _seg *)bufferseg+(pos-bufferstart);\r
+                               }\r
+                               else\r
+                               {\r
+                               // load buffer with a new block from disk\r
+                               // try to get as many of the needed blocks in as possible\r
+                                       while ( next < NUMCHUNKS )\r
+                                       {\r
+                                               while (next < NUMCHUNKS &&\r
+                                               !(grneeded[next]&ca_levelbit && !grsegs[next]))\r
+                                                       next++;\r
+                                               if (next == NUMCHUNKS)\r
+                                                       continue;\r
+\r
+                                               nextpos = GRFILEPOS(next);\r
+                                               while (GRFILEPOS(++next) == -1) // skip past any sparse tiles\r
+                                                       ;\r
+                                               nextendpos = GRFILEPOS(next);\r
+                                               if (nextpos - endpos <= MAXEMPTYREAD\r
+                                               && nextendpos-pos <= BUFFERSIZE)\r
+                                                       endpos = nextendpos;\r
+                                               else\r
+                                                       next = NUMCHUNKS;                       // read pos to posend\r
+                                       }\r
+\r
+                                       lseek(grhandle,pos,SEEK_SET);\r
+                                       CA_FarRead(grhandle,bufferseg,endpos-pos);\r
+                                       bufferstart = pos;\r
+                                       bufferend = endpos;\r
+                                       source = bufferseg;\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                       // big chunk, allocate temporary buffer\r
+                               MM_GetPtr(&bigbufferseg,compressed);\r
+                               if (mmerror)\r
+                                       return;\r
+                               MM_SetLock (&bigbufferseg,true);\r
+                               lseek(grhandle,pos,SEEK_SET);\r
+                               CA_FarRead(grhandle,bigbufferseg,compressed);\r
+                               source = bigbufferseg;\r
+                       }\r
+\r
+                       CAL_ExpandGrChunk (i,source);\r
+                       if (mmerror)\r
+                               return;\r
+\r
+                       if (compressed>BUFFERSIZE)\r
+                               MM_FreePtr(&bigbufferseg);\r
+\r
+               }\r
+}\r
+\r
+void CA_CannotOpen(char *string)\r
+{\r
+ char str[30];\r
+\r
+ strcpy(str,"Can't open ");\r
+ strcat(str,string);\r
+ strcat(str,"!\n");\r
+ Quit (str);\r
+}
\ No newline at end of file
diff --git a/16/wf3d8086/id_ca.h b/16/wf3d8086/id_ca.h
new file mode 100755 (executable)
index 0000000..f8b1460
--- /dev/null
@@ -0,0 +1,101 @@
+// ID_CA.H\r
+//===========================================================================\r
+\r
+#define NUMMAPS                60\r
+#define MAPPLANES      2\r
+\r
+#define UNCACHEGRCHUNK(chunk)  {MM_FreePtr(&grsegs[chunk]);grneeded[chunk]&=~ca_levelbit;}\r
+\r
+//===========================================================================\r
+\r
+typedef        struct\r
+{\r
+       long            planestart[3];\r
+       unsigned        planelength[3];\r
+       unsigned        width,height;\r
+       char            name[16];\r
+} maptype;\r
+\r
+//===========================================================================\r
+\r
+extern char            audioname[13];\r
+\r
+extern byte            _seg    *tinf;\r
+extern int                     mapon;\r
+\r
+extern unsigned        _seg    *mapsegs[MAPPLANES];\r
+extern maptype         _seg    *mapheaderseg[NUMMAPS];\r
+extern byte            _seg    *audiosegs[NUMSNDCHUNKS];\r
+extern void            _seg    *grsegs[NUMCHUNKS];\r
+\r
+extern byte            far     grneeded[NUMCHUNKS];\r
+extern byte            ca_levelbit,ca_levelnum;\r
+\r
+extern char            *titleptr[8];\r
+\r
+extern int                     profilehandle,debughandle;\r
+\r
+extern char            extension[5],\r
+                       gheadname[10],\r
+                       gfilename[10],\r
+                       gdictname[10],\r
+                       mheadname[10],\r
+                       mfilename[10],\r
+                       aheadname[10],\r
+                       afilename[10];\r
+\r
+extern long            _seg *grstarts; // array of offsets in egagraph, -1 for sparse\r
+extern long            _seg *audiostarts;      // array of offsets in audio / audiot\r
+//\r
+// hooks for custom cache dialogs\r
+//\r
+extern void    (*drawcachebox)         (char *title, unsigned numcache);\r
+extern void    (*updatecachebox)       (void);\r
+extern void    (*finishcachebox)       (void);\r
+\r
+//===========================================================================\r
+\r
+// just for the score box reshifting\r
+\r
+void CAL_ShiftSprite (unsigned segment,unsigned source,unsigned dest,\r
+       unsigned width, unsigned height, unsigned pixshift);\r
+\r
+//===========================================================================\r
+\r
+void CA_OpenDebug (void);\r
+void CA_CloseDebug (void);\r
+boolean CA_FarRead (int handle, byte far *dest, long length);\r
+boolean CA_FarWrite (int handle, byte far *source, long length);\r
+boolean CA_ReadFile (char *filename, memptr *ptr);\r
+boolean CA_LoadFile (char *filename, memptr *ptr);\r
+boolean CA_WriteFile (char *filename, void far *ptr, long length);\r
+\r
+long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,\r
+  unsigned rlewtag);\r
+\r
+void CA_RLEWexpand (unsigned huge *source, unsigned huge *dest,long length,\r
+  unsigned rlewtag);\r
+\r
+void CA_Startup (void);\r
+void CA_Shutdown (void);\r
+\r
+void CA_SetGrPurge (void);\r
+void CA_CacheAudioChunk (int chunk);\r
+void CA_LoadAllSounds (void);\r
+\r
+void CA_UpLevel (void);\r
+void CA_DownLevel (void);\r
+\r
+void CA_SetAllPurge (void);\r
+\r
+void CA_ClearMarks (void);\r
+void CA_ClearAllMarks (void);\r
+\r
+#define CA_MarkGrChunk(chunk)  grneeded[chunk]|=ca_levelbit\r
+\r
+void CA_CacheGrChunk (int chunk);\r
+void CA_CacheMap (int mapnum);\r
+\r
+void CA_CacheMarks (void);\r
+\r
+void CA_CacheScreen (int chunk);\r
diff --git a/16/wf3d8086/id_head.h b/16/wf3d8086/id_head.h
new file mode 100755 (executable)
index 0000000..788dd6e
--- /dev/null
@@ -0,0 +1,34 @@
+// ID_HEAD.H\r
+\r
+\r
+#define        EXTENSION       "WLF"\r
+#define WOLF\r
+\r
+#define        TEXTGR  0\r
+#define        CGAGR   1\r
+#define        EGAGR   2\r
+#define        VGAGR   3\r
+\r
+#define GRMODE VGAGR\r
+\r
+#include "VERSION.H"\r
+\r
+typedef        enum    {false,true}    boolean;\r
+typedef        unsigned        char            byte;\r
+typedef        unsigned        int                     word;\r
+typedef        unsigned        long            longword;\r
+typedef        byte *                                  Ptr;\r
+\r
+typedef        struct\r
+               {\r
+                       int     x,y;\r
+               } Point;\r
+\r
+typedef        struct\r
+               {\r
+                       Point   ul,lr;\r
+               } Rect;\r
+\r
+\r
+void   Quit (char *error);             // defined in user program\r
+\r
diff --git a/16/wf3d8086/id_heads.h b/16/wf3d8086/id_heads.h
new file mode 100755 (executable)
index 0000000..1f32ae5
--- /dev/null
@@ -0,0 +1,123 @@
+// ID_GLOB.H\r
+\r
+\r
+#include <ALLOC.H>\r
+#include <CTYPE.H>\r
+#include <DOS.H>\r
+#include <ERRNO.H>\r
+#include <FCNTL.H>\r
+#include <IO.H>\r
+#include <MEM.H>\r
+#include <PROCESS.H>\r
+#include <STDIO.H>\r
+#include <STDLIB.H>\r
+#include <STRING.H>\r
+#include <SYS\STAT.H>\r
+#include <VALUES.H>\r
+#include <DIR.H>\r
+#define __ID_GLOB__\r
+#include "VERSION.H"\r
+\r
+//--------------------------------------------------------------------------\r
+\r
+extern char            far signon;\r
+\r
+#define        introscn        signon\r
+\r
+#ifdef JAPAN\r
+#ifdef JAPDEMO\r
+#include "FOREIGN\JAPAN\GFXV_WJ1.H"\r
+#else\r
+#include "FOREIGN\JAPAN\GFXV_WJ6.H"\r
+#endif\r
+#include "AUDIOWL6.H"\r
+#include "MAPSWL6.H"\r
+#else\r
+\r
+#ifndef SPEAR\r
+\r
+#include "GFXV_WL6.H"\r
+#include "AUDIOWL6.H"\r
+#include "MAPSWL6.H"\r
+\r
+#else\r
+\r
+#ifndef SPEARDEMO\r
+#include "GFXV_SOD.H"\r
+#include "AUDIOSOD.H"\r
+#include "MAPSSOD.H"\r
+#else\r
+#include "GFXV_SDM.H"\r
+#include "AUDIOSDM.H"\r
+#include "MAPSSDM.H"\r
+#endif\r
+\r
+#endif\r
+#endif\r
+//-----------------\r
+\r
+\r
+#define GREXT  "VGA"\r
+\r
+//\r
+//     ID Engine\r
+//     Types.h - Generic types, #defines, etc.\r
+//     v1.0d1\r
+//\r
+\r
+typedef        enum    {false,true}    boolean;\r
+typedef        unsigned        char            byte;\r
+typedef        unsigned        int                     word;\r
+typedef        unsigned        long            longword;\r
+typedef        byte *                                  Ptr;\r
+\r
+typedef        struct\r
+               {\r
+                       int     x,y;\r
+               } Point;\r
+typedef        struct\r
+               {\r
+                       Point   ul,lr;\r
+               } Rect;\r
+\r
+#define        nil     ((void *)0)\r
+\r
+\r
+#include "ID_MM.H"\r
+#include "ID_PM.H"\r
+#include "ID_CA.H"\r
+#include "ID_VL.H"\r
+#include "ID_VH.H"\r
+#include "ID_IN.H"\r
+#include "ID_SD.H"\r
+#include "ID_US.H"\r
+\r
+\r
+void   Quit (char *error);             // defined in user program\r
+\r
+//\r
+// replacing refresh manager with custom routines\r
+//\r
+\r
+#define        PORTTILESWIDE           20      // all drawing takes place inside a\r
+#define        PORTTILESHIGH           13              // non displayed port of this size\r
+\r
+#define UPDATEWIDE                     PORTTILESWIDE\r
+#define UPDATEHIGH                     PORTTILESHIGH\r
+\r
+#define        MAXTICS                         10\r
+#define DEMOTICS                       4\r
+\r
+#define        UPDATETERMINATE 0x0301\r
+\r
+extern unsigned        mapwidth,mapheight,tics;\r
+extern boolean         compatability;\r
+\r
+extern byte            *updateptr;\r
+extern unsigned        uwidthtable[UPDATEHIGH];\r
+extern unsigned        blockstarts[UPDATEWIDE*UPDATEHIGH];\r
+\r
+extern byte            fontcolor,backcolor;\r
+\r
+#define SETFONTCOLOR(f,b) fontcolor=f;backcolor=b;\r
+\r
diff --git a/16/wf3d8086/id_in.c b/16/wf3d8086/id_in.c
new file mode 100755 (executable)
index 0000000..3f7c89d
--- /dev/null
@@ -0,0 +1,990 @@
+//\r
+//     ID Engine\r
+//     ID_IN.c - Input Manager\r
+//     v1.0d1\r
+//     By Jason Blochowiak\r
+//\r
+\r
+//\r
+//     This module handles dealing with the various input devices\r
+//\r
+//     Depends on: Memory Mgr (for demo recording), Sound Mgr (for timing stuff),\r
+//                             User Mgr (for command line parms)\r
+//\r
+//     Globals:\r
+//             LastScan - The keyboard scan code of the last key pressed\r
+//             LastASCII - The ASCII value of the last key pressed\r
+//     DEBUG - there are more globals\r
+//\r
+\r
+#include "ID_HEADS.H"\r
+#pragma        hdrstop\r
+\r
+#define        KeyInt          9       // The keyboard ISR number\r
+\r
+//\r
+// mouse constants\r
+//\r
+#define        MReset          0\r
+#define        MButtons        3\r
+#define        MDelta          11\r
+\r
+#define        MouseInt        0x33\r
+#define        Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
+\r
+//\r
+// joystick constants\r
+//\r
+#define        JoyScaleMax             32768\r
+#define        JoyScaleShift   8\r
+#define        MaxJoyValue             5000\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+//\r
+// configuration variables\r
+//\r
+boolean                        MousePresent;\r
+boolean                        JoysPresent[MaxJoys];\r
+boolean                        JoyPadPresent;\r
+\r
+\r
+//     Global variables\r
+               boolean         Keyboard[NumCodes];\r
+               boolean         Paused;\r
+               char            LastASCII;\r
+               ScanCode        LastScan;\r
+\r
+               KeyboardDef     KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};\r
+               JoystickDef     JoyDefs[MaxJoys];\r
+               ControlType     Controls[MaxPlayers];\r
+\r
+               longword        MouseDownCount;\r
+\r
+               Demo            DemoMode = demo_Off;\r
+               byte _seg       *DemoBuffer;\r
+               word            DemoOffset,DemoSize;\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+static byte        far ASCIINames[] =          // Unshifted ASCII for scan codes\r
+                                       {\r
+//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
+       0  ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8  ,9  ,        // 0\r
+       'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0  ,'a','s',        // 1\r
+       'd','f','g','h','j','k','l',';',39 ,'`',0  ,92 ,'z','x','c','v',        // 2\r
+       'b','n','m',',','.','/',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',        // 4\r
+       '2','3','0',127,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
+                                       },\r
+                                       far ShiftNames[] =              // Shifted ASCII for scan codes\r
+                                       {\r
+//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
+       0  ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',8  ,9  ,        // 0\r
+       'Q','W','E','R','T','Y','U','I','O','P','{','}',13 ,0  ,'A','S',        // 1\r
+       'D','F','G','H','J','K','L',':',34 ,'~',0  ,'|','Z','X','C','V',        // 2\r
+       'B','N','M','<','>','?',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',        // 4\r
+       '2','3','0',127,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
+                                       },\r
+                                       far SpecialNames[] =    // ASCII for 0xe0 prefixed codes\r
+                                       {\r
+//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 0\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,13 ,0  ,0  ,0  ,        // 1\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 2\r
+       0  ,0  ,0  ,0  ,0  ,'/',0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 4\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
+                                       };\r
+\r
+\r
+static boolean         IN_Started;\r
+static boolean         CapsLock;\r
+static ScanCode        CurCode,LastCode;\r
+\r
+static Direction       DirTable[] =            // Quick lookup for total direction\r
+                                       {\r
+                                               dir_NorthWest,  dir_North,      dir_NorthEast,\r
+                                               dir_West,               dir_None,       dir_East,\r
+                                               dir_SouthWest,  dir_South,      dir_SouthEast\r
+                                       };\r
+\r
+static void                    (*INL_KeyHook)(void);\r
+static void interrupt  (*OldKeyVect)(void);\r
+\r
+static char                    *ParmStrings[] = {"nojoys","nomouse",nil};\r
+\r
+//     Internal routines\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_KeyService() - Handles a keyboard interrupt (key up/down)\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void interrupt\r
+INL_KeyService(void)\r
+{\r
+static boolean special;\r
+               byte    k,c,\r
+                               temp;\r
+               int             i;\r
+\r
+       k = inportb(0x60);      // Get the scan code\r
+\r
+       // Tell the XT keyboard controller to clear the key\r
+       outportb(0x61,(temp = inportb(0x61)) | 0x80);\r
+       outportb(0x61,temp);\r
+\r
+       if (k == 0xe0)          // Special key prefix\r
+               special = true;\r
+       else if (k == 0xe1)     // Handle Pause key\r
+               Paused = true;\r
+       else\r
+       {\r
+               if (k & 0x80)   // Break code\r
+               {\r
+                       k &= 0x7f;\r
+\r
+// DEBUG - handle special keys: ctl-alt-delete, print scrn\r
+\r
+                       Keyboard[k] = false;\r
+               }\r
+               else                    // Make code\r
+               {\r
+                       LastCode = CurCode;\r
+                       CurCode = LastScan = k;\r
+                       Keyboard[k] = true;\r
+\r
+                       if (special)\r
+                               c = SpecialNames[k];\r
+                       else\r
+                       {\r
+                               if (k == sc_CapsLock)\r
+                               {\r
+                                       CapsLock ^= true;\r
+                                       // DEBUG - make caps lock light work\r
+                               }\r
+\r
+                               if (Keyboard[sc_LShift] || Keyboard[sc_RShift]) // If shifted\r
+                               {\r
+                                       c = ShiftNames[k];\r
+                                       if ((c >= 'A') && (c <= 'Z') && CapsLock)\r
+                                               c += 'a' - 'A';\r
+                               }\r
+                               else\r
+                               {\r
+                                       c = ASCIINames[k];\r
+                                       if ((c >= 'a') && (c <= 'z') && CapsLock)\r
+                                               c -= 'a' - 'A';\r
+                               }\r
+                       }\r
+                       if (c)\r
+                               LastASCII = c;\r
+               }\r
+\r
+               special = false;\r
+       }\r
+\r
+       if (INL_KeyHook && !special)\r
+               INL_KeyHook();\r
+       outportb(0x20,0x20);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_GetMouseDelta() - Gets the amount that the mouse has moved from the\r
+//             mouse driver\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_GetMouseDelta(int *x,int *y)\r
+{\r
+       Mouse(MDelta);\r
+       *x = _CX;\r
+       *y = _DX;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_GetMouseButtons() - Gets the status of the mouse buttons from the\r
+//             mouse driver\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static word\r
+INL_GetMouseButtons(void)\r
+{\r
+       word    buttons;\r
+\r
+       Mouse(MButtons);\r
+       buttons = _BX;\r
+       return(buttons);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_GetJoyAbs() - Reads the absolute position of the specified joystick\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_GetJoyAbs(word joy,word *xp,word *yp)\r
+{\r
+       byte    xb,yb,\r
+                       xs,ys;\r
+       word    x,y;\r
+\r
+       x = y = 0;\r
+       xs = joy? 2 : 0;                // Find shift value for x axis\r
+       xb = 1 << xs;                   // Use shift value to get x bit mask\r
+       ys = joy? 3 : 1;                // Do the same for y axis\r
+       yb = 1 << ys;\r
+\r
+// Read the absolute joystick values\r
+asm            pushf                           // Save some registers\r
+asm            push    si\r
+asm            push    di\r
+asm            cli                                     // Make sure an interrupt doesn't screw the timings\r
+\r
+\r
+asm            mov             dx,0x201\r
+asm            in              al,dx\r
+asm            out             dx,al           // Clear the resistors\r
+\r
+asm            mov             ah,[xb]         // Get masks into registers\r
+asm            mov             ch,[yb]\r
+\r
+asm            xor             si,si           // Clear count registers\r
+asm            xor             di,di\r
+asm            xor             bh,bh           // Clear high byte of bx for later\r
+\r
+asm            push    bp                      // Don't mess up stack frame\r
+asm            mov             bp,MaxJoyValue\r
+\r
+loop:\r
+asm            in              al,dx           // Get bits indicating whether all are finished\r
+\r
+asm            dec             bp                      // Check bounding register\r
+asm            jz              done            // We have a silly value - abort\r
+\r
+asm            mov             bl,al           // Duplicate the bits\r
+asm            and             bl,ah           // Mask off useless bits (in [xb])\r
+asm            add             si,bx           // Possibly increment count register\r
+asm            mov             cl,bl           // Save for testing later\r
+\r
+asm            mov             bl,al\r
+asm            and             bl,ch           // [yb]\r
+asm            add             di,bx\r
+\r
+asm            add             cl,bl\r
+asm            jnz             loop            // If both bits were 0, drop out\r
+\r
+done:\r
+asm     pop            bp\r
+\r
+asm            mov             cl,[xs]         // Get the number of bits to shift\r
+asm            shr             si,cl           //  and shift the count that many times\r
+\r
+asm            mov             cl,[ys]\r
+asm            shr             di,cl\r
+\r
+asm            mov             [x],si          // Store the values into the variables\r
+asm            mov             [y],di\r
+\r
+asm            pop             di\r
+asm            pop             si\r
+asm            popf                            // Restore the registers\r
+\r
+       *xp = x;\r
+       *yp = y;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_GetJoyDelta() - Returns the relative movement of the specified\r
+//             joystick (from +/-127)\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void INL_GetJoyDelta(word joy,int *dx,int *dy)\r
+{\r
+       word            x,y;\r
+       longword        time;\r
+       JoystickDef     *def;\r
+static longword        lasttime;\r
+\r
+       IN_GetJoyAbs(joy,&x,&y);\r
+       def = JoyDefs + joy;\r
+\r
+       if (x < def->threshMinX)\r
+       {\r
+               if (x < def->joyMinX)\r
+                       x = def->joyMinX;\r
+\r
+               x = -(x - def->threshMinX);\r
+               x *= def->joyMultXL;\r
+               x >>= JoyScaleShift;\r
+               *dx = (x > 127)? -127 : -x;\r
+       }\r
+       else if (x > def->threshMaxX)\r
+       {\r
+               if (x > def->joyMaxX)\r
+                       x = def->joyMaxX;\r
+\r
+               x = x - def->threshMaxX;\r
+               x *= def->joyMultXH;\r
+               x >>= JoyScaleShift;\r
+               *dx = (x > 127)? 127 : x;\r
+       }\r
+       else\r
+               *dx = 0;\r
+\r
+       if (y < def->threshMinY)\r
+       {\r
+               if (y < def->joyMinY)\r
+                       y = def->joyMinY;\r
+\r
+               y = -(y - def->threshMinY);\r
+               y *= def->joyMultYL;\r
+               y >>= JoyScaleShift;\r
+               *dy = (y > 127)? -127 : -y;\r
+       }\r
+       else if (y > def->threshMaxY)\r
+       {\r
+               if (y > def->joyMaxY)\r
+                       y = def->joyMaxY;\r
+\r
+               y = y - def->threshMaxY;\r
+               y *= def->joyMultYH;\r
+               y >>= JoyScaleShift;\r
+               *dy = (y > 127)? 127 : y;\r
+       }\r
+       else\r
+               *dy = 0;\r
+\r
+       lasttime = TimeCount;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_GetJoyButtons() - Returns the button status of the specified\r
+//             joystick\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static word\r
+INL_GetJoyButtons(word joy)\r
+{\r
+register       word    result;\r
+\r
+       result = inportb(0x201);        // Get all the joystick buttons\r
+       result >>= joy? 6 : 4;  // Shift into bits 0-1\r
+       result &= 3;                            // Mask off the useless bits\r
+       result ^= 3;\r
+       return(result);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_GetJoyButtonsDB() - Returns the de-bounced button status of the\r
+//             specified joystick\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+word\r
+IN_GetJoyButtonsDB(word joy)\r
+{\r
+       longword        lasttime;\r
+       word            result1,result2;\r
+\r
+       do\r
+       {\r
+               result1 = INL_GetJoyButtons(joy);\r
+               lasttime = TimeCount;\r
+               while (TimeCount == lasttime)\r
+                       ;\r
+               result2 = INL_GetJoyButtons(joy);\r
+       } while (result1 != result2);\r
+       return(result1);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_StartKbd() - Sets up my keyboard stuff for use\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_StartKbd(void)\r
+{\r
+       INL_KeyHook = NULL;                     // no key hook routine\r
+\r
+       IN_ClearKeysDown();\r
+\r
+       OldKeyVect = getvect(KeyInt);\r
+       setvect(KeyInt,INL_KeyService);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_ShutKbd() - Restores keyboard control to the BIOS\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_ShutKbd(void)\r
+{\r
+       poke(0x40,0x17,peek(0x40,0x17) & 0xfaf0);       // Clear ctrl/alt/shift flags\r
+\r
+       setvect(KeyInt,OldKeyVect);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_StartMouse() - Detects and sets up the mouse\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+INL_StartMouse(void)\r
+{\r
+#if 0\r
+       if (getvect(MouseInt))\r
+       {\r
+               Mouse(MReset);\r
+               if (_AX == 0xffff)\r
+                       return(true);\r
+       }\r
+       return(false);\r
+#endif\r
+ union REGS regs;\r
+ unsigned char far *vector;\r
+\r
+\r
+ if ((vector=MK_FP(peek(0,0x33*4+2),peek(0,0x33*4)))==NULL)\r
+   return false;\r
+\r
+ if (*vector == 207)\r
+   return false;\r
+\r
+ Mouse(MReset);\r
+ return true;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_ShutMouse() - Cleans up after the mouse\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_ShutMouse(void)\r
+{\r
+}\r
+\r
+//\r
+//     INL_SetJoyScale() - Sets up scaling values for the specified joystick\r
+//\r
+static void\r
+INL_SetJoyScale(word joy)\r
+{\r
+       JoystickDef     *def;\r
+\r
+       def = &JoyDefs[joy];\r
+       def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX);\r
+       def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX);\r
+       def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY);\r
+       def->joyMultYH = JoyScaleMax / (def->joyMaxY - def->threshMaxY);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale()\r
+//             to set up scaling values\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)\r
+{\r
+       word            d,r;\r
+       JoystickDef     *def;\r
+\r
+       def = &JoyDefs[joy];\r
+\r
+       def->joyMinX = minx;\r
+       def->joyMaxX = maxx;\r
+       r = maxx - minx;\r
+       d = r / 3;\r
+       def->threshMinX = ((r / 2) - d) + minx;\r
+       def->threshMaxX = ((r / 2) + d) + minx;\r
+\r
+       def->joyMinY = miny;\r
+       def->joyMaxY = maxy;\r
+       r = maxy - miny;\r
+       d = r / 3;\r
+       def->threshMinY = ((r / 2) - d) + miny;\r
+       def->threshMaxY = ((r / 2) + d) + miny;\r
+\r
+       INL_SetJoyScale(joy);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_StartJoy() - Detects & auto-configures the specified joystick\r
+//                                     The auto-config assumes the joystick is centered\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+INL_StartJoy(word joy)\r
+{\r
+       word            x,y;\r
+\r
+       IN_GetJoyAbs(joy,&x,&y);\r
+\r
+       if\r
+       (\r
+               ((x == 0) || (x > MaxJoyValue - 10))\r
+       ||      ((y == 0) || (y > MaxJoyValue - 10))\r
+       )\r
+               return(false);\r
+       else\r
+       {\r
+               IN_SetupJoy(joy,0,x * 2,0,y * 2);\r
+               return(true);\r
+       }\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_ShutJoy() - Cleans up the joystick stuff\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_ShutJoy(word joy)\r
+{\r
+       JoysPresent[joy] = false;\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_Startup() - Starts up the Input Mgr\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_Startup(void)\r
+{\r
+       boolean checkjoys,checkmouse;\r
+       word    i;\r
+\r
+       if (IN_Started)\r
+               return;\r
+\r
+       checkjoys = true;\r
+       checkmouse = true;\r
+       for (i = 1;i < _argc;i++)\r
+       {\r
+               switch (US_CheckParm(_argv[i],ParmStrings))\r
+               {\r
+               case 0:\r
+                       checkjoys = false;\r
+                       break;\r
+               case 1:\r
+                       checkmouse = false;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       INL_StartKbd();\r
+       MousePresent = checkmouse? INL_StartMouse() : false;\r
+\r
+       for (i = 0;i < MaxJoys;i++)\r
+               JoysPresent[i] = checkjoys? INL_StartJoy(i) : false;\r
+\r
+       IN_Started = true;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_Default() - Sets up default conditions for the Input Mgr\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_Default(boolean gotit,ControlType in)\r
+{\r
+       if\r
+       (\r
+               (!gotit)\r
+       ||      ((in == ctrl_Joystick1) && !JoysPresent[0])\r
+       ||      ((in == ctrl_Joystick2) && !JoysPresent[1])\r
+       ||      ((in == ctrl_Mouse) && !MousePresent)\r
+       )\r
+               in = ctrl_Keyboard1;\r
+       IN_SetControlType(0,in);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_Shutdown() - Shuts down the Input Mgr\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_Shutdown(void)\r
+{\r
+       word    i;\r
+\r
+       if (!IN_Started)\r
+               return;\r
+\r
+       INL_ShutMouse();\r
+       for (i = 0;i < MaxJoys;i++)\r
+               INL_ShutJoy(i);\r
+       INL_ShutKbd();\r
+\r
+       IN_Started = false;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_SetKeyHook() - Sets the routine that gets called by INL_KeyService()\r
+//                     everytime a real make/break code gets hit\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_SetKeyHook(void (*hook)())\r
+{\r
+       INL_KeyHook = hook;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_ClearKeysDown() - Clears the keyboard array\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_ClearKeysDown(void)\r
+{\r
+       int     i;\r
+\r
+       LastScan = sc_None;\r
+       LastASCII = key_None;\r
+       memset (Keyboard,0,sizeof(Keyboard));\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_ReadControl() - Reads the device associated with the specified\r
+//             player and fills in the control info struct\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_ReadControl(int player,ControlInfo *info)\r
+{\r
+                       boolean         realdelta;\r
+                       byte            dbyte;\r
+                       word            buttons;\r
+                       int                     dx,dy;\r
+                       Motion          mx,my;\r
+                       ControlType     type;\r
+register       KeyboardDef     *def;\r
+\r
+       dx = dy = 0;\r
+       mx = my = motion_None;\r
+       buttons = 0;\r
+\r
+       if (DemoMode == demo_Playback)\r
+       {\r
+               dbyte = DemoBuffer[DemoOffset + 1];\r
+               my = (dbyte & 3) - 1;\r
+               mx = ((dbyte >> 2) & 3) - 1;\r
+               buttons = (dbyte >> 4) & 3;\r
+\r
+               if (!(--DemoBuffer[DemoOffset]))\r
+               {\r
+                       DemoOffset += 2;\r
+                       if (DemoOffset >= DemoSize)\r
+                               DemoMode = demo_PlayDone;\r
+               }\r
+\r
+               realdelta = false;\r
+       }\r
+       else if (DemoMode == demo_PlayDone)\r
+               Quit("Demo playback exceeded");\r
+       else\r
+       {\r
+               switch (type = Controls[player])\r
+               {\r
+               case ctrl_Keyboard:\r
+                       def = &KbdDefs;\r
+\r
+                       if (Keyboard[def->upleft])\r
+                               mx = motion_Left,my = motion_Up;\r
+                       else if (Keyboard[def->upright])\r
+                               mx = motion_Right,my = motion_Up;\r
+                       else if (Keyboard[def->downleft])\r
+                               mx = motion_Left,my = motion_Down;\r
+                       else if (Keyboard[def->downright])\r
+                               mx = motion_Right,my = motion_Down;\r
+\r
+                       if (Keyboard[def->up])\r
+                               my = motion_Up;\r
+                       else if (Keyboard[def->down])\r
+                               my = motion_Down;\r
+\r
+                       if (Keyboard[def->left])\r
+                               mx = motion_Left;\r
+                       else if (Keyboard[def->right])\r
+                               mx = motion_Right;\r
+\r
+                       if (Keyboard[def->button0])\r
+                               buttons += 1 << 0;\r
+                       if (Keyboard[def->button1])\r
+                               buttons += 1 << 1;\r
+                       realdelta = false;\r
+                       break;\r
+               case ctrl_Joystick1:\r
+               case ctrl_Joystick2:\r
+                       INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy);\r
+                       buttons = INL_GetJoyButtons(type - ctrl_Joystick);\r
+                       realdelta = true;\r
+                       break;\r
+               case ctrl_Mouse:\r
+                       INL_GetMouseDelta(&dx,&dy);\r
+                       buttons = INL_GetMouseButtons();\r
+                       realdelta = true;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       if (realdelta)\r
+       {\r
+               mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None);\r
+               my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None);\r
+       }\r
+       else\r
+       {\r
+               dx = mx * 127;\r
+               dy = my * 127;\r
+       }\r
+\r
+       info->x = dx;\r
+       info->xaxis = mx;\r
+       info->y = dy;\r
+       info->yaxis = my;\r
+       info->button0 = buttons & (1 << 0);\r
+       info->button1 = buttons & (1 << 1);\r
+       info->button2 = buttons & (1 << 2);\r
+       info->button3 = buttons & (1 << 3);\r
+       info->dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
+\r
+       if (DemoMode == demo_Record)\r
+       {\r
+               // Pack the control info into a byte\r
+               dbyte = (buttons << 4) | ((mx + 1) << 2) | (my + 1);\r
+\r
+               if\r
+               (\r
+                       (DemoBuffer[DemoOffset + 1] == dbyte)\r
+               &&      (DemoBuffer[DemoOffset] < 255)\r
+               )\r
+                       (DemoBuffer[DemoOffset])++;\r
+               else\r
+               {\r
+                       if (DemoOffset || DemoBuffer[DemoOffset])\r
+                               DemoOffset += 2;\r
+\r
+                       if (DemoOffset >= DemoSize)\r
+                               Quit("Demo buffer overflow");\r
+\r
+                       DemoBuffer[DemoOffset] = 1;\r
+                       DemoBuffer[DemoOffset + 1] = dbyte;\r
+               }\r
+       }\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_SetControlType() - Sets the control type to be used by the specified\r
+//             player\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_SetControlType(int player,ControlType type)\r
+{\r
+       // DEBUG - check that requested type is present?\r
+       Controls[player] = type;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_WaitForKey() - Waits for a scan code, then clears LastScan and\r
+//             returns the scan code\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+ScanCode\r
+IN_WaitForKey(void)\r
+{\r
+       ScanCode        result;\r
+\r
+       while (!(result = LastScan))\r
+               ;\r
+       LastScan = 0;\r
+       return(result);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and\r
+//             returns the ASCII value\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+char\r
+IN_WaitForASCII(void)\r
+{\r
+       char            result;\r
+\r
+       while (!(result = LastASCII))\r
+               ;\r
+       LastASCII = '\0';\r
+       return(result);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_Ack() - waits for a button or key press.  If a button is down, upon\r
+// calling, it must be released for it to be recognized\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+\r
+boolean        btnstate[8];\r
+\r
+void IN_StartAck(void)\r
+{\r
+       unsigned        i,buttons;\r
+\r
+//\r
+// get initial state of everything\r
+//\r
+       IN_ClearKeysDown();\r
+       memset (btnstate,0,sizeof(btnstate));\r
+\r
+       buttons = IN_JoyButtons () << 4;\r
+       if (MousePresent)\r
+               buttons |= IN_MouseButtons ();\r
+\r
+       for (i=0;i<8;i++,buttons>>=1)\r
+               if (buttons&1)\r
+                       btnstate[i] = true;\r
+}\r
+\r
+\r
+boolean IN_CheckAck (void)\r
+{\r
+       unsigned        i,buttons;\r
+\r
+//\r
+// see if something has been pressed\r
+//\r
+       if (LastScan)\r
+               return true;\r
+\r
+       buttons = IN_JoyButtons () << 4;\r
+       if (MousePresent)\r
+               buttons |= IN_MouseButtons ();\r
+\r
+       for (i=0;i<8;i++,buttons>>=1)\r
+               if ( buttons&1 )\r
+               {\r
+                       if (!btnstate[i])\r
+                               return true;\r
+               }\r
+               else\r
+                       btnstate[i]=false;\r
+\r
+       return false;\r
+}\r
+\r
+\r
+void IN_Ack (void)\r
+{\r
+       IN_StartAck ();\r
+\r
+       while (!IN_CheckAck ())\r
+       ;\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_UserInput() - Waits for the specified delay time (in ticks) or the\r
+//             user pressing a key or a mouse button. If the clear flag is set, it\r
+//             then either clears the key or waits for the user to let the mouse\r
+//             button up.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+boolean IN_UserInput(longword delay)\r
+{\r
+       longword        lasttime;\r
+\r
+       lasttime = TimeCount;\r
+       IN_StartAck ();\r
+       do\r
+       {\r
+               if (IN_CheckAck())\r
+                       return true;\r
+       } while (TimeCount - lasttime < delay);\r
+       return(false);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= IN_MouseButtons\r
+=\r
+===================\r
+*/\r
+\r
+byte   IN_MouseButtons (void)\r
+{\r
+       if (MousePresent)\r
+       {\r
+               Mouse(MButtons);\r
+               return _BX;\r
+       }\r
+       else\r
+               return 0;\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= IN_JoyButtons\r
+=\r
+===================\r
+*/\r
+\r
+byte   IN_JoyButtons (void)\r
+{\r
+       unsigned joybits;\r
+\r
+       joybits = inportb(0x201);       // Get all the joystick buttons\r
+       joybits >>= 4;                          // only the high bits are useful\r
+       joybits ^= 15;                          // return with 1=pressed\r
+\r
+       return joybits;\r
+}\r
+\r
+\r
diff --git a/16/wf3d8086/id_in.h b/16/wf3d8086/id_in.h
new file mode 100755 (executable)
index 0000000..0e92484
--- /dev/null
@@ -0,0 +1,202 @@
+//\r
+//     ID Engine\r
+//     ID_IN.h - Header file for Input Manager\r
+//     v1.0d1\r
+//     By Jason Blochowiak\r
+//\r
+\r
+#ifndef        __ID_IN__\r
+#define        __ID_IN__\r
+\r
+#ifdef __DEBUG__\r
+#define        __DEBUG_InputMgr__\r
+#endif\r
+\r
+#define        MaxPlayers      4\r
+#define        MaxKbds         2\r
+#define        MaxJoys         2\r
+#define        NumCodes        128\r
+\r
+typedef        byte            ScanCode;\r
+#define        sc_None                 0\r
+#define        sc_Bad                  0xff\r
+#define        sc_Return               0x1c\r
+#define        sc_Enter                sc_Return\r
+#define        sc_Escape               0x01\r
+#define        sc_Space                0x39\r
+#define        sc_BackSpace    0x0e\r
+#define        sc_Tab                  0x0f\r
+#define        sc_Alt                  0x38\r
+#define        sc_Control              0x1d\r
+#define        sc_CapsLock             0x3a\r
+#define        sc_LShift               0x2a\r
+#define        sc_RShift               0x36\r
+#define        sc_UpArrow              0x48\r
+#define        sc_DownArrow    0x50\r
+#define        sc_LeftArrow    0x4b\r
+#define        sc_RightArrow   0x4d\r
+#define        sc_Insert               0x52\r
+#define        sc_Delete               0x53\r
+#define        sc_Home                 0x47\r
+#define        sc_End                  0x4f\r
+#define        sc_PgUp                 0x49\r
+#define        sc_PgDn                 0x51\r
+#define        sc_F1                   0x3b\r
+#define        sc_F2                   0x3c\r
+#define        sc_F3                   0x3d\r
+#define        sc_F4                   0x3e\r
+#define        sc_F5                   0x3f\r
+#define        sc_F6                   0x40\r
+#define        sc_F7                   0x41\r
+#define        sc_F8                   0x42\r
+#define        sc_F9                   0x43\r
+#define        sc_F10                  0x44\r
+#define        sc_F11                  0x57\r
+#define        sc_F12                  0x59\r
+\r
+#define        sc_1                    0x02\r
+#define        sc_2                    0x03\r
+#define        sc_3                    0x04\r
+#define        sc_4                    0x05\r
+#define        sc_5                    0x06\r
+#define        sc_6                    0x07\r
+#define        sc_7                    0x08\r
+#define        sc_8                    0x09\r
+#define        sc_9                    0x0a\r
+#define        sc_0                    0x0b\r
+\r
+#define        sc_A                    0x1e\r
+#define        sc_B                    0x30\r
+#define        sc_C                    0x2e\r
+#define        sc_D                    0x20\r
+#define        sc_E                    0x12\r
+#define        sc_F                    0x21\r
+#define        sc_G                    0x22\r
+#define        sc_H                    0x23\r
+#define        sc_I                    0x17\r
+#define        sc_J                    0x24\r
+#define        sc_K                    0x25\r
+#define        sc_L                    0x26\r
+#define        sc_M                    0x32\r
+#define        sc_N                    0x31\r
+#define        sc_O                    0x18\r
+#define        sc_P                    0x19\r
+#define        sc_Q                    0x10\r
+#define        sc_R                    0x13\r
+#define        sc_S                    0x1f\r
+#define        sc_T                    0x14\r
+#define        sc_U                    0x16\r
+#define        sc_V                    0x2f\r
+#define        sc_W                    0x11\r
+#define        sc_X                    0x2d\r
+#define        sc_Y                    0x15\r
+#define        sc_Z                    0x2c\r
+\r
+#define        key_None                0\r
+#define        key_Return              0x0d\r
+#define        key_Enter               key_Return\r
+#define        key_Escape              0x1b\r
+#define        key_Space               0x20\r
+#define        key_BackSpace   0x08\r
+#define        key_Tab                 0x09\r
+#define        key_Delete              0x7f\r
+\r
+//     Stuff for the mouse\r
+#define        MReset          0\r
+#define        MButtons        3\r
+#define        MDelta          11\r
+\r
+#define        MouseInt        0x33\r
+#define        Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
+\r
+typedef        enum            {\r
+                                               demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
+                                       } Demo;\r
+typedef        enum            {\r
+                                               ctrl_Keyboard,\r
+                                                       ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
+                                               ctrl_Joystick,\r
+                                                       ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
+                                               ctrl_Mouse\r
+                                       } ControlType;\r
+typedef        enum            {\r
+                                               motion_Left = -1,motion_Up = -1,\r
+                                               motion_None = 0,\r
+                                               motion_Right = 1,motion_Down = 1\r
+                                       } Motion;\r
+typedef        enum            {\r
+                                               dir_North,dir_NorthEast,\r
+                                               dir_East,dir_SouthEast,\r
+                                               dir_South,dir_SouthWest,\r
+                                               dir_West,dir_NorthWest,\r
+                                               dir_None\r
+                                       } Direction;\r
+typedef        struct          {\r
+                                               boolean         button0,button1,button2,button3;\r
+                                               int                     x,y;\r
+                                               Motion          xaxis,yaxis;\r
+                                               Direction       dir;\r
+                                       } CursorInfo;\r
+typedef        CursorInfo      ControlInfo;\r
+typedef        struct          {\r
+                                               ScanCode        button0,button1,\r
+                                                                       upleft,         up,             upright,\r
+                                                                       left,                           right,\r
+                                                                       downleft,       down,   downright;\r
+                                       } KeyboardDef;\r
+typedef        struct          {\r
+                                               word            joyMinX,joyMinY,\r
+                                                                       threshMinX,threshMinY,\r
+                                                                       threshMaxX,threshMaxY,\r
+                                                                       joyMaxX,joyMaxY,\r
+                                                                       joyMultXL,joyMultYL,\r
+                                                                       joyMultXH,joyMultYH;\r
+                                       } JoystickDef;\r
+// Global variables\r
+extern boolean         Keyboard[],\r
+                                       MousePresent,\r
+                                       JoysPresent[];\r
+extern boolean         Paused;\r
+extern char            LastASCII;\r
+extern ScanCode        LastScan;\r
+extern KeyboardDef     KbdDefs;\r
+extern JoystickDef     JoyDefs[];\r
+extern ControlType     Controls[MaxPlayers];\r
+\r
+extern Demo            DemoMode;\r
+extern byte _seg       *DemoBuffer;\r
+extern word            DemoOffset,DemoSize;\r
+\r
+// Function prototypes\r
+#define        IN_KeyDown(code)        (Keyboard[(code)])\r
+#define        IN_ClearKey(code)       {Keyboard[code] = false;\\r
+                                                       if (code == LastScan) LastScan = sc_None;}\r
+\r
+// DEBUG - put names in prototypes\r
+extern void            IN_Startup(void),IN_Shutdown(void),\r
+                                       IN_Default(boolean gotit,ControlType in),\r
+                                       IN_SetKeyHook(void (*)()),\r
+                                       IN_ClearKeysDown(void),\r
+                                       IN_ReadCursor(CursorInfo *),\r
+                                       IN_ReadControl(int,ControlInfo *),\r
+                                       IN_SetControlType(int,ControlType),\r
+                                       IN_GetJoyAbs(word joy,word *xp,word *yp),\r
+                                       IN_SetupJoy(word joy,word minx,word maxx,\r
+                                                               word miny,word maxy),\r
+                                       IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
+                                       IN_Ack(void),IN_AckBack(void);\r
+extern boolean         IN_UserInput(longword delay);\r
+extern char            IN_WaitForASCII(void);\r
+extern ScanCode        IN_WaitForKey(void);\r
+extern word            IN_GetJoyButtonsDB(word joy);\r
+extern byte            *IN_GetScanName(ScanCode);\r
+\r
+\r
+byte   IN_MouseButtons (void);\r
+byte   IN_JoyButtons (void);\r
+\r
+void INL_GetJoyDelta(word joy,int *dx,int *dy);\r
+void IN_StartAck(void);\r
+boolean IN_CheckAck (void);\r
+\r
+#endif\r
diff --git a/16/wf3d8086/id_mm.c b/16/wf3d8086/id_mm.c
new file mode 100755 (executable)
index 0000000..8d44c05
--- /dev/null
@@ -0,0 +1,953 @@
+// NEWMM.C\r
+\r
+/*\r
+=============================================================================\r
+\r
+                  ID software memory manager\r
+                  --------------------------\r
+\r
+Primary coder: John Carmack\r
+\r
+RELIES ON\r
+---------\r
+Quit (char *error) function\r
+\r
+\r
+WORK TO DO\r
+----------\r
+MM_SizePtr to change the size of a given pointer\r
+\r
+Multiple purge levels utilized\r
+\r
+EMS / XMS unmanaged routines\r
+\r
+=============================================================================\r
+*/\r
+\r
+#include "ID_HEADS.H"\r
+#pragma hdrstop\r
+\r
+#pragma warn -pro\r
+#pragma warn -use\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       LOCAL INFO\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define LOCKBIT                0x80    // if set in attributes, block cannot be moved\r
+#define PURGEBITS      3               // 0-3 level, 0= unpurgable, 3= purge first\r
+#define PURGEMASK      0xfffc\r
+#define BASEATTRIBUTES 0       // unlocked, non purgable\r
+\r
+#define MAXUMBS                10\r
+\r
+typedef struct mmblockstruct\r
+{\r
+       unsigned        start,length;\r
+       unsigned        attributes;\r
+       memptr          *useptr;        // pointer to the segment start\r
+       struct mmblockstruct far *next;\r
+} mmblocktype;\r
+\r
+\r
+//#define GETNEWBLOCK {if(!(mmnew=mmfree))Quit("MM_GETNEWBLOCK: No free blocks!")\\r
+//     ;mmfree=mmfree->next;}\r
+\r
+#define GETNEWBLOCK {if(!mmfree)MML_ClearBlock();mmnew=mmfree;mmfree=mmfree->next;}\r
+\r
+#define FREEBLOCK(x) {*x->useptr=NULL;x->next=mmfree;mmfree=x;}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+mminfotype     mminfo;\r
+memptr         bufferseg;\r
+boolean                mmerror;\r
+\r
+void           (* beforesort) (void);\r
+void           (* aftersort) (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+boolean                mmstarted;\r
+\r
+void far       *farheap;\r
+void           *nearheap;\r
+\r
+mmblocktype    far mmblocks[MAXBLOCKS]\r
+                       ,far *mmhead,far *mmfree,far *mmrover,far *mmnew;\r
+\r
+boolean                bombonerror;\r
+\r
+//unsigned     totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle;\r
+\r
+void           (* XMSaddr) (void);             // far pointer to XMS driver\r
+\r
+unsigned       numUMBs,UMBbase[MAXUMBS];\r
+\r
+//==========================================================================\r
+\r
+//\r
+// local prototypes\r
+//\r
+\r
+boolean                MML_CheckForEMS (void);\r
+void           MML_ShutdownEMS (void);\r
+void           MM_MapEMS (void);\r
+boolean        MML_CheckForXMS (void);\r
+void           MML_ShutdownXMS (void);\r
+void           MML_UseSpace (unsigned segstart, unsigned seglength);\r
+void           MML_ClearBlock (void);\r
+\r
+//==========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= MML_CheckForXMS\r
+=\r
+= Check for XMM driver\r
+=\r
+=======================\r
+*/\r
+\r
+boolean MML_CheckForXMS (void)\r
+{\r
+       numUMBs = 0;\r
+\r
+asm {\r
+       mov     ax,0x4300\r
+       int     0x2f                            // query status of installed diver\r
+       cmp     al,0x80\r
+       je      good\r
+       }\r
+\r
+       return false;\r
+good:\r
+       return true;\r
+}\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= MML_SetupXMS\r
+=\r
+= Try to allocate all upper memory block\r
+=\r
+=======================\r
+*/\r
+\r
+void MML_SetupXMS (void)\r
+{\r
+       unsigned        base,size;\r
+\r
+asm    {\r
+       mov     ax,0x4310\r
+       int     0x2f\r
+       mov     [WORD PTR XMSaddr],bx\r
+       mov     [WORD PTR XMSaddr+2],es         // function pointer to XMS driver\r
+       }\r
+\r
+getmemory:\r
+asm    {\r
+       mov     ah,XMS_ALLOCUMB\r
+       mov     dx,0xffff                                       // try for largest block possible\r
+       call    [DWORD PTR XMSaddr]\r
+       or      ax,ax\r
+       jnz     gotone\r
+\r
+       cmp     bl,0xb0                                         // error: smaller UMB is available\r
+       jne     done;\r
+\r
+       mov     ah,XMS_ALLOCUMB\r
+       call    [DWORD PTR XMSaddr]             // DX holds largest available UMB\r
+       or      ax,ax\r
+       jz      done                                            // another error...\r
+       }\r
+\r
+gotone:\r
+asm    {\r
+       mov     [base],bx\r
+       mov     [size],dx\r
+       }\r
+       MML_UseSpace (base,size);\r
+       mminfo.XMSmem += size*16;\r
+       UMBbase[numUMBs] = base;\r
+       numUMBs++;\r
+       if (numUMBs < MAXUMBS)\r
+               goto getmemory;\r
+\r
+done:;\r
+}\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= MML_ShutdownXMS\r
+=\r
+======================\r
+*/\r
+\r
+void MML_ShutdownXMS (void)\r
+{\r
+       int     i;\r
+       unsigned        base;\r
+\r
+       for (i=0;i<numUMBs;i++)\r
+       {\r
+               base = UMBbase[i];\r
+\r
+asm    mov     ah,XMS_FREEUMB\r
+asm    mov     dx,[base]\r
+asm    call    [DWORD PTR XMSaddr]\r
+       }\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+======================\r
+=\r
+= MML_UseSpace\r
+=\r
+= Marks a range of paragraphs as usable by the memory manager\r
+= This is used to mark space for the near heap, far heap, ems page frame,\r
+= and upper memory blocks\r
+=\r
+======================\r
+*/\r
+\r
+void MML_UseSpace (unsigned segstart, unsigned seglength)\r
+{\r
+       mmblocktype far *scan,far *last;\r
+       unsigned        oldend;\r
+       long            extra;\r
+\r
+       scan = last = mmhead;\r
+       mmrover = mmhead;               // reset rover to start of memory\r
+\r
+//\r
+// search for the block that contains the range of segments\r
+//\r
+       while (scan->start+scan->length < segstart)\r
+       {\r
+               last = scan;\r
+               scan = scan->next;\r
+       }\r
+\r
+//\r
+// take the given range out of the block\r
+//\r
+       oldend = scan->start + scan->length;\r
+       extra = oldend - (segstart+seglength);\r
+       if (extra < 0)\r
+               Quit ("MML_UseSpace: Segment spans two blocks!");\r
+\r
+       if (segstart == scan->start)\r
+       {\r
+               last->next = scan->next;                        // unlink block\r
+               FREEBLOCK(scan);\r
+               scan = last;\r
+       }\r
+       else\r
+               scan->length = segstart-scan->start;    // shorten block\r
+\r
+       if (extra > 0)\r
+       {\r
+               GETNEWBLOCK;\r
+               mmnew->useptr = NULL;\r
+\r
+               mmnew->next = scan->next;\r
+               scan->next = mmnew;\r
+               mmnew->start = segstart+seglength;\r
+               mmnew->length = extra;\r
+               mmnew->attributes = LOCKBIT;\r
+       }\r
+\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= MML_ClearBlock\r
+=\r
+= We are out of blocks, so free a purgable block\r
+=\r
+====================\r
+*/\r
+\r
+void MML_ClearBlock (void)\r
+{\r
+       mmblocktype far *scan,far *last;\r
+\r
+       scan = mmhead->next;\r
+\r
+       while (scan)\r
+       {\r
+               if (!(scan->attributes&LOCKBIT) && (scan->attributes&PURGEBITS) )\r
+               {\r
+                       MM_FreePtr(scan->useptr);\r
+                       return;\r
+               }\r
+               scan = scan->next;\r
+       }\r
+\r
+       Quit ("MM_ClearBlock: No purgable blocks!");\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= MM_Startup\r
+=\r
+= Grabs all space from turbo with malloc/farmalloc\r
+= Allocates bufferseg misc buffer\r
+=\r
+===================\r
+*/\r
+\r
+static char *ParmStrings[] = {"noems","noxms",""};\r
+\r
+void MM_Startup (void)\r
+{\r
+       int i;\r
+       unsigned        long length;\r
+       void far        *start;\r
+       unsigned        segstart,seglength,endfree;\r
+\r
+       if (mmstarted)\r
+               MM_Shutdown ();\r
+\r
+\r
+       mmstarted = true;\r
+       bombonerror = true;\r
+//\r
+// set up the linked list (everything in the free list;\r
+//\r
+       mmhead = NULL;\r
+       mmfree = &mmblocks[0];\r
+       for (i=0;i<MAXBLOCKS-1;i++)\r
+               mmblocks[i].next = &mmblocks[i+1];\r
+       mmblocks[i].next = NULL;\r
+\r
+//\r
+// locked block of all memory until we punch out free space\r
+//\r
+       GETNEWBLOCK;\r
+       mmhead = mmnew;                         // this will allways be the first node\r
+       mmnew->start = 0;\r
+       mmnew->length = 0xffff;\r
+       mmnew->attributes = LOCKBIT;\r
+       mmnew->next = NULL;\r
+       mmrover = mmhead;\r
+\r
+\r
+//\r
+// get all available near conventional memory segments\r
+//\r
+       length=coreleft();\r
+       start = (void far *)(nearheap = malloc(length));\r
+\r
+       length -= 16-(FP_OFF(start)&15);\r
+       length -= SAVENEARHEAP;\r
+       seglength = length / 16;                        // now in paragraphs\r
+       segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;\r
+       MML_UseSpace (segstart,seglength);\r
+       mminfo.nearheap = length;\r
+\r
+//\r
+// get all available far conventional memory segments\r
+//\r
+       length=farcoreleft();\r
+       start = farheap = farmalloc(length);\r
+       length -= 16-(FP_OFF(start)&15);\r
+       length -= SAVEFARHEAP;\r
+       seglength = length / 16;                        // now in paragraphs\r
+       segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;\r
+       MML_UseSpace (segstart,seglength);\r
+       mminfo.farheap = length;\r
+       mminfo.mainmem = mminfo.nearheap + mminfo.farheap;\r
+\r
+//\r
+// allocate the misc buffer\r
+//\r
+       mmrover = mmhead;               // start looking for space after low block\r
+\r
+       MM_GetPtr (&bufferseg,BUFFERSIZE);\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= MM_Shutdown\r
+=\r
+= Frees all conventional, EMS, and XMS allocated\r
+=\r
+====================\r
+*/\r
+\r
+void MM_Shutdown (void)\r
+{\r
+  if (!mmstarted)\r
+       return;\r
+\r
+  farfree (farheap);\r
+  free (nearheap);\r
+//  MML_ShutdownXMS ();\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= MM_GetPtr\r
+=\r
+= Allocates an unlocked, unpurgable block\r
+=\r
+====================\r
+*/\r
+\r
+void MM_GetPtr (memptr *baseptr,unsigned long size)\r
+{\r
+       mmblocktype far *scan,far *lastscan,far *endscan\r
+                               ,far *purge,far *next;\r
+       int                     search;\r
+       unsigned        needed,startseg;\r
+\r
+       needed = (size+15)/16;          // convert size from bytes to paragraphs\r
+\r
+       GETNEWBLOCK;                            // fill in start and next after a spot is found\r
+       mmnew->length = needed;\r
+       mmnew->useptr = baseptr;\r
+       mmnew->attributes = BASEATTRIBUTES;\r
+\r
+tryagain:\r
+       for (search = 0; search<3; search++)\r
+       {\r
+       //\r
+       // first search:        try to allocate right after the rover, then on up\r
+       // second search:       search from the head pointer up to the rover\r
+       // third search:        compress memory, then scan from start\r
+               if (search == 1 && mmrover == mmhead)\r
+                       search++;\r
+\r
+               switch (search)\r
+               {\r
+               case 0:\r
+                       lastscan = mmrover;\r
+                       scan = mmrover->next;\r
+                       endscan = NULL;\r
+                       break;\r
+               case 1:\r
+                       lastscan = mmhead;\r
+                       scan = mmhead->next;\r
+                       endscan = mmrover;\r
+                       break;\r
+               case 2:\r
+                       MM_SortMem ();\r
+                       lastscan = mmhead;\r
+                       scan = mmhead->next;\r
+                       endscan = NULL;\r
+                       break;\r
+               }\r
+\r
+               startseg = lastscan->start + lastscan->length;\r
+\r
+               while (scan != endscan)\r
+               {\r
+                       if (scan->start - startseg >= needed)\r
+                       {\r
+                       //\r
+                       // got enough space between the end of lastscan and\r
+                       // the start of scan, so throw out anything in the middle\r
+                       // and allocate the new block\r
+                       //\r
+                               purge = lastscan->next;\r
+                               lastscan->next = mmnew;\r
+                               mmnew->start = *(unsigned *)baseptr = startseg;\r
+                               mmnew->next = scan;\r
+                               while ( purge != scan)\r
+                               {       // free the purgable block\r
+                                       next = purge->next;\r
+                                       FREEBLOCK(purge);\r
+                                       purge = next;           // purge another if not at scan\r
+                               }\r
+                               mmrover = mmnew;\r
+                               return; // good allocation!\r
+                       }\r
+\r
+                       //\r
+                       // if this block is purge level zero or locked, skip past it\r
+                       //\r
+                       if ( (scan->attributes & LOCKBIT)\r
+                               || !(scan->attributes & PURGEBITS) )\r
+                       {\r
+                               lastscan = scan;\r
+                               startseg = lastscan->start + lastscan->length;\r
+                       }\r
+\r
+\r
+                       scan=scan->next;                // look at next line\r
+               }\r
+       }\r
+\r
+       if (bombonerror)\r
+       {\r
+\r
+extern char configname[];\r
+extern boolean insetupscaling;\r
+extern int     viewsize;\r
+boolean SetViewSize (unsigned width, unsigned height);\r
+#define HEIGHTRATIO            0.50\r
+//\r
+// wolf hack -- size the view down\r
+//\r
+               if (!insetupscaling && viewsize>10)\r
+               {\r
+mmblocktype    far *savedmmnew;\r
+                       savedmmnew = mmnew;\r
+                       viewsize -= 2;\r
+                       SetViewSize (viewsize*16,viewsize*16*HEIGHTRATIO);\r
+                       mmnew = savedmmnew;\r
+                       goto tryagain;\r
+               }\r
+\r
+//             unlink(configname);\r
+               Quit ("MM_GetPtr: Out of memory!");\r
+       }\r
+       else\r
+               mmerror = true;\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= MM_FreePtr\r
+=\r
+= Deallocates an unlocked, purgable block\r
+=\r
+====================\r
+*/\r
+\r
+void MM_FreePtr (memptr *baseptr)\r
+{\r
+       mmblocktype far *scan,far *last;\r
+\r
+       last = mmhead;\r
+       scan = last->next;\r
+\r
+       if (baseptr == mmrover->useptr) // removed the last allocated block\r
+               mmrover = mmhead;\r
+\r
+       while (scan->useptr != baseptr && scan)\r
+       {\r
+               last = scan;\r
+               scan = scan->next;\r
+       }\r
+\r
+       if (!scan)\r
+               Quit ("MM_FreePtr: Block not found!");\r
+\r
+       last->next = scan->next;\r
+\r
+       FREEBLOCK(scan);\r
+}\r
+//==========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= MM_SetPurge\r
+=\r
+= Sets the purge level for a block (locked blocks cannot be made purgable)\r
+=\r
+=====================\r
+*/\r
+\r
+void MM_SetPurge (memptr *baseptr, int purge)\r
+{\r
+       mmblocktype far *start;\r
+\r
+       start = mmrover;\r
+\r
+       do\r
+       {\r
+               if (mmrover->useptr == baseptr)\r
+                       break;\r
+\r
+               mmrover = mmrover->next;\r
+\r
+               if (!mmrover)\r
+                       mmrover = mmhead;\r
+               else if (mmrover == start)\r
+                       Quit ("MM_SetPurge: Block not found!");\r
+\r
+       } while (1);\r
+\r
+       mmrover->attributes &= ~PURGEBITS;\r
+       mmrover->attributes |= purge;\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= MM_SetLock\r
+=\r
+= Locks / unlocks the block\r
+=\r
+=====================\r
+*/\r
+\r
+void MM_SetLock (memptr *baseptr, boolean locked)\r
+{\r
+       mmblocktype far *start;\r
+\r
+       start = mmrover;\r
+\r
+       do\r
+       {\r
+               if (mmrover->useptr == baseptr)\r
+                       break;\r
+\r
+               mmrover = mmrover->next;\r
+\r
+               if (!mmrover)\r
+                       mmrover = mmhead;\r
+               else if (mmrover == start)\r
+                       Quit ("MM_SetLock: Block not found!");\r
+\r
+       } while (1);\r
+\r
+       mmrover->attributes &= ~LOCKBIT;\r
+       mmrover->attributes |= locked*LOCKBIT;\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= MM_SortMem\r
+=\r
+= Throws out all purgable stuff and compresses movable blocks\r
+=\r
+=====================\r
+*/\r
+\r
+void MM_SortMem (void)\r
+{\r
+       mmblocktype far *scan,far *last,far *next;\r
+       unsigned        start,length,source,dest;\r
+       int                     playing;\r
+\r
+       //\r
+       // lock down a currently playing sound\r
+       //\r
+       playing = SD_SoundPlaying ();\r
+       if (playing)\r
+       {\r
+               switch (SoundMode)\r
+               {\r
+               case sdm_PC:\r
+                       playing += STARTPCSOUNDS;\r
+                       break;\r
+               case sdm_AdLib:\r
+                       playing += STARTADLIBSOUNDS;\r
+                       break;\r
+               }\r
+               MM_SetLock(&(memptr)audiosegs[playing],true);\r
+       }\r
+\r
+\r
+       SD_StopSound();\r
+\r
+       if (beforesort)\r
+               beforesort();\r
+\r
+       scan = mmhead;\r
+\r
+       last = NULL;            // shut up compiler warning\r
+\r
+       while (scan)\r
+       {\r
+               if (scan->attributes & LOCKBIT)\r
+               {\r
+               //\r
+               // block is locked, so try to pile later blocks right after it\r
+               //\r
+                       start = scan->start + scan->length;\r
+               }\r
+               else\r
+               {\r
+                       if (scan->attributes & PURGEBITS)\r
+                       {\r
+                       //\r
+                       // throw out the purgable block\r
+                       //\r
+                               next = scan->next;\r
+                               FREEBLOCK(scan);\r
+                               last->next = next;\r
+                               scan = next;\r
+                               continue;\r
+                       }\r
+                       else\r
+                       {\r
+                       //\r
+                       // push the non purgable block on top of the last moved block\r
+                       //\r
+                               if (scan->start != start)\r
+                               {\r
+                                       length = scan->length;\r
+                                       source = scan->start;\r
+                                       dest = start;\r
+                                       while (length > 0xf00)\r
+                                       {\r
+                                               movedata(source,0,dest,0,0xf00*16);\r
+                                               length -= 0xf00;\r
+                                               source += 0xf00;\r
+                                               dest += 0xf00;\r
+                                       }\r
+                                       movedata(source,0,dest,0,length*16);\r
+\r
+                                       scan->start = start;\r
+                                       *(unsigned *)scan->useptr = start;\r
+                               }\r
+                               start = scan->start + scan->length;\r
+                       }\r
+               }\r
+\r
+               last = scan;\r
+               scan = scan->next;              // go to next block\r
+       }\r
+\r
+       mmrover = mmhead;\r
+\r
+       if (aftersort)\r
+               aftersort();\r
+\r
+       if (playing)\r
+               MM_SetLock(&(memptr)audiosegs[playing],false);\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= MM_ShowMemory\r
+=\r
+=====================\r
+*/\r
+\r
+void MM_ShowMemory (void)\r
+{\r
+       mmblocktype far *scan;\r
+       unsigned color,temp,x,y;\r
+       long    end,owner;\r
+       char    scratch[80],str[10];\r
+\r
+       temp = bufferofs;\r
+       bufferofs = displayofs;\r
+       scan = mmhead;\r
+\r
+       end = -1;\r
+\r
+       while (scan)\r
+       {\r
+               if (scan->attributes & PURGEBITS)\r
+                       color = 5;              // dark purple = purgable\r
+               else\r
+                       color = 9;              // medium blue = non purgable\r
+               if (scan->attributes & LOCKBIT)\r
+                       color = 12;             // red = locked\r
+               if (scan->start<=end)\r
+                       Quit ("MM_ShowMemory: Memory block order currupted!");\r
+               end = scan->length-1;\r
+               y = scan->start/320;\r
+               x = scan->start%320;\r
+               VW_Hlin(x,x+end,y,color);\r
+               VW_Plot(x,y,15);\r
+               if (scan->next && scan->next->start > end+1)\r
+                       VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,0); // black = free\r
+\r
+               scan = scan->next;\r
+       }\r
+\r
+       VW_FadeIn ();\r
+       IN_Ack();\r
+\r
+       bufferofs = temp;\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= MM_DumpData\r
+=\r
+=====================\r
+*/\r
+\r
+void MM_DumpData (void)\r
+{\r
+       mmblocktype far *scan,far *best;\r
+       long    lowest,oldlowest;\r
+       unsigned        owner;\r
+       char    lock,purge;\r
+       FILE    *dumpfile;\r
+\r
+\r
+       free (nearheap);\r
+       dumpfile = fopen ("MMDUMP.TXT","w");\r
+       if (!dumpfile)\r
+               Quit ("MM_DumpData: Couldn't open MMDUMP.TXT!");\r
+\r
+       lowest = -1;\r
+       do\r
+       {\r
+               oldlowest = lowest;\r
+               lowest = 0xffff;\r
+\r
+               scan = mmhead;\r
+               while (scan)\r
+               {\r
+                       owner = (unsigned)scan->useptr;\r
+\r
+                       if (owner && owner<lowest && owner > oldlowest)\r
+                       {\r
+                               best = scan;\r
+                               lowest = owner;\r
+                       }\r
+\r
+                       scan = scan->next;\r
+               }\r
+\r
+               if (lowest != 0xffff)\r
+               {\r
+                       if (best->attributes & PURGEBITS)\r
+                               purge = 'P';\r
+                       else\r
+                               purge = '-';\r
+                       if (best->attributes & LOCKBIT)\r
+                               lock = 'L';\r
+                       else\r
+                               lock = '-';\r
+                       fprintf (dumpfile,"0x%p (%c%c) = %u\n"\r
+                       ,(unsigned)lowest,lock,purge,best->length);\r
+               }\r
+\r
+       } while (lowest != 0xffff);\r
+\r
+       fclose (dumpfile);\r
+       Quit ("MMDUMP.TXT created.");\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= MM_UnusedMemory\r
+=\r
+= Returns the total free space without purging\r
+=\r
+======================\r
+*/\r
+\r
+long MM_UnusedMemory (void)\r
+{\r
+       unsigned free;\r
+       mmblocktype far *scan;\r
+\r
+       free = 0;\r
+       scan = mmhead;\r
+\r
+       while (scan->next)\r
+       {\r
+               free += scan->next->start - (scan->start + scan->length);\r
+               scan = scan->next;\r
+       }\r
+\r
+       return free*16l;\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+======================\r
+=\r
+= MM_TotalFree\r
+=\r
+= Returns the total free space with purging\r
+=\r
+======================\r
+*/\r
+\r
+long MM_TotalFree (void)\r
+{\r
+       unsigned free;\r
+       mmblocktype far *scan;\r
+\r
+       free = 0;\r
+       scan = mmhead;\r
+\r
+       while (scan->next)\r
+       {\r
+               if ((scan->attributes&PURGEBITS) && !(scan->attributes&LOCKBIT))\r
+                       free += scan->length;\r
+               free += scan->next->start - (scan->start + scan->length);\r
+               scan = scan->next;\r
+       }\r
+\r
+       return free*16l;\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= MM_BombOnError\r
+=\r
+=====================\r
+*/\r
+\r
+void MM_BombOnError (boolean bomb)\r
+{\r
+       bombonerror = bomb;\r
+}\r
+\r
+\r
diff --git a/16/wf3d8086/id_mm.h b/16/wf3d8086/id_mm.h
new file mode 100755 (executable)
index 0000000..a3e4daa
--- /dev/null
@@ -0,0 +1,96 @@
+// ID_MM.H\r
+\r
+#ifndef __ID_CA__\r
+\r
+#define __ID_CA__\r
+\r
+#define SAVENEARHEAP   0x400           // space to leave in data segment\r
+#define SAVEFARHEAP            0                       // space to leave in far heap\r
+\r
+#define        BUFFERSIZE              0x1000          // miscelanious, allways available buffer\r
+\r
+#define MAXBLOCKS              700\r
+\r
+\r
+//--------\r
+\r
+#define        EMS_INT                 0x67\r
+\r
+#define        EMS_STATUS              0x40\r
+#define        EMS_GETFRAME    0x41\r
+#define        EMS_GETPAGES    0x42\r
+#define        EMS_ALLOCPAGES  0x43\r
+#define        EMS_MAPPAGE             0x44\r
+#define        EMS_FREEPAGES   0x45\r
+#define        EMS_VERSION             0x46\r
+\r
+//--------\r
+\r
+#define        XMS_INT                 0x2f\r
+#define        XMS_CALL(v)             _AH = (v);\\r
+                                               asm call [DWORD PTR XMSDriver]\r
+\r
+#define        XMS_VERSION             0x00\r
+\r
+#define        XMS_ALLOCHMA    0x01\r
+#define        XMS_FREEHMA             0x02\r
+\r
+#define        XMS_GENABLEA20  0x03\r
+#define        XMS_GDISABLEA20 0x04\r
+#define        XMS_LENABLEA20  0x05\r
+#define        XMS_LDISABLEA20 0x06\r
+#define        XMS_QUERYA20    0x07\r
+\r
+#define        XMS_QUERYFREE   0x08\r
+#define        XMS_ALLOC               0x09\r
+#define        XMS_FREE                0x0A\r
+#define        XMS_MOVE                0x0B\r
+#define        XMS_LOCK                0x0C\r
+#define        XMS_UNLOCK              0x0D\r
+#define        XMS_GETINFO             0x0E\r
+#define        XMS_RESIZE              0x0F\r
+\r
+#define        XMS_ALLOCUMB    0x10\r
+#define        XMS_FREEUMB             0x11\r
+\r
+//==========================================================================\r
+\r
+typedef void _seg * memptr;\r
+\r
+typedef struct\r
+{\r
+       long    nearheap,farheap,EMSmem,XMSmem,mainmem;\r
+} mminfotype;\r
+\r
+//==========================================================================\r
+\r
+extern mminfotype      mminfo;\r
+extern memptr          bufferseg;\r
+extern boolean         mmerror;\r
+\r
+extern void            (* beforesort) (void);\r
+extern void            (* aftersort) (void);\r
+\r
+//==========================================================================\r
+\r
+void MM_Startup (void);\r
+void MM_Shutdown (void);\r
+void MM_MapEMS (void);\r
+\r
+void MM_GetPtr (memptr *baseptr,unsigned long size);\r
+void MM_FreePtr (memptr *baseptr);\r
+\r
+void MM_SetPurge (memptr *baseptr, int purge);\r
+void MM_SetLock (memptr *baseptr, boolean locked);\r
+void MM_SortMem (void);\r
+\r
+void MM_ShowMemory (void);\r
+\r
+long MM_UnusedMemory (void);\r
+long MM_TotalFree (void);\r
+\r
+void MM_BombOnError (boolean bomb);\r
+\r
+void MML_UseSpace (unsigned segstart, unsigned seglength);\r
+\r
+#endif
\ No newline at end of file
diff --git a/16/wf3d8086/id_pm.c b/16/wf3d8086/id_pm.c
new file mode 100755 (executable)
index 0000000..57c15aa
--- /dev/null
@@ -0,0 +1,1199 @@
+//\r
+//     ID_PM.C\r
+//     Id Engine's Page Manager v1.0\r
+//     Primary coder: Jason Blochowiak\r
+//\r
+\r
+#include "ID_HEADS.H"\r
+#pragma hdrstop\r
+\r
+//     Main Mem specific variables\r
+       boolean                 MainPresent;\r
+       memptr                  MainMemPages[PMMaxMainMem];\r
+       PMBlockAttr             MainMemUsed[PMMaxMainMem];\r
+       int                             MainPagesAvail;\r
+\r
+//     EMS specific variables\r
+       boolean                 EMSPresent;\r
+       word                    EMSAvail,EMSPagesAvail,EMSHandle,\r
+                                       EMSPageFrame,EMSPhysicalPage;\r
+       EMSListStruct   EMSList[EMSFrameCount];\r
+\r
+//     XMS specific variables\r
+       boolean                 XMSPresent;\r
+       word                    XMSAvail,XMSPagesAvail,XMSHandle;\r
+       longword                XMSDriver;\r
+       int                             XMSProtectPage = -1;\r
+\r
+//     File specific variables\r
+       char                    PageFileName[13] = {"VSWAP."};\r
+       int                             PageFile = -1;\r
+       word                    ChunksInFile;\r
+       word                    PMSpriteStart,PMSoundStart;\r
+\r
+//     General usage variables\r
+       boolean                 PMStarted,\r
+                                       PMPanicMode,\r
+                                       PMThrashing;\r
+       word                    XMSPagesUsed,\r
+                                       EMSPagesUsed,\r
+                                       MainPagesUsed,\r
+                                       PMNumBlocks;\r
+       long                    PMFrameCount;\r
+       PageListStruct  far *PMPages,\r
+                                       _seg *PMSegPages;\r
+\r
+static char            *ParmStrings[] = {"nomain","noems","noxms",nil};\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     EMS Management code\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+//\r
+//     PML_MapEMS() - Maps a logical page to a physical page\r
+//\r
+void\r
+PML_MapEMS(word logical,word physical)\r
+{\r
+       _AL = physical;\r
+       _BX = logical;\r
+       _DX = EMSHandle;\r
+       _AH = EMS_MAPPAGE;\r
+asm    int     EMS_INT\r
+\r
+       if (_AH)\r
+               Quit("PML_MapEMS: Page mapping failed");\r
+}\r
+\r
+//\r
+//     PML_StartupEMS() - Sets up EMS for Page Mgr's use\r
+//             Checks to see if EMS driver is present\r
+//      Verifies that EMS hardware is present\r
+//             Make sure that EMS version is 3.2 or later\r
+//             If there's more than our minimum (2 pages) available, allocate it (up\r
+//                     to the maximum we need)\r
+//\r
+\r
+       char    EMMDriverName[9] = "EMMXXXX0";\r
+\r
+boolean\r
+PML_StartupEMS(void)\r
+{\r
+       int             i;\r
+       long    size;\r
+\r
+       EMSPresent = false;                     // Assume that we'll fail\r
+       EMSAvail = 0;\r
+\r
+       _DX = (word)EMMDriverName;\r
+       _AX = 0x3d00;\r
+       geninterrupt(0x21);                     // try to open EMMXXXX0 device\r
+asm    jnc     gothandle\r
+       goto error;\r
+\r
+gothandle:\r
+       _BX = _AX;\r
+       _AX = 0x4400;\r
+       geninterrupt(0x21);                     // get device info\r
+asm    jnc     gotinfo;\r
+       goto error;\r
+\r
+gotinfo:\r
+asm    and     dx,0x80\r
+       if (!_DX)\r
+               goto error;\r
+\r
+       _AX = 0x4407;\r
+       geninterrupt(0x21);                     // get status\r
+asm    jc      error\r
+       if (!_AL)\r
+               goto error;\r
+\r
+       _AH = 0x3e;\r
+       geninterrupt(0x21);                     // close handle\r
+\r
+       _AH = EMS_STATUS;\r
+       geninterrupt(EMS_INT);\r
+       if (_AH)\r
+               goto error;                             // make sure EMS hardware is present\r
+\r
+       _AH = EMS_VERSION;\r
+       geninterrupt(EMS_INT);\r
+       if (_AH || (_AL < 0x32))        // only work on EMS 3.2 or greater (silly, but...)\r
+               goto error;\r
+\r
+       _AH = EMS_GETFRAME;\r
+       geninterrupt(EMS_INT);\r
+       if (_AH)\r
+               goto error;                             // find the page frame address\r
+       EMSPageFrame = _BX;\r
+\r
+       _AH = EMS_GETPAGES;\r
+       geninterrupt(EMS_INT);\r
+       if (_AH)\r
+               goto error;\r
+       if (_BX < 2)\r
+               goto error;             // Require at least 2 pages (32k)\r
+       EMSAvail = _BX;\r
+\r
+       // Don't hog all available EMS\r
+       size = EMSAvail * (long)EMSPageSize;\r
+       if (size - (EMSPageSize * 2) > (ChunksInFile * (long)PMPageSize))\r
+       {\r
+               size = (ChunksInFile * (long)PMPageSize) + EMSPageSize;\r
+               EMSAvail = size / EMSPageSize;\r
+       }\r
+\r
+       _AH = EMS_ALLOCPAGES;\r
+       _BX = EMSAvail;\r
+       geninterrupt(EMS_INT);\r
+       if (_AH)\r
+               goto error;\r
+       EMSHandle = _DX;\r
+\r
+       mminfo.EMSmem += EMSAvail * (long)EMSPageSize;\r
+\r
+       // Initialize EMS mapping cache\r
+       for (i = 0;i < EMSFrameCount;i++)\r
+               EMSList[i].baseEMSPage = -1;\r
+\r
+       EMSPresent = true;                      // We have EMS\r
+\r
+error:\r
+       return(EMSPresent);\r
+}\r
+\r
+//\r
+//     PML_ShutdownEMS() - If EMS was used, deallocate it\r
+//\r
+void\r
+PML_ShutdownEMS(void)\r
+{\r
+       if (EMSPresent)\r
+       {\r
+       asm     mov     ah,EMS_FREEPAGES\r
+       asm     mov     dx,[EMSHandle]\r
+       asm     int     EMS_INT\r
+               if (_AH)\r
+                       Quit ("PML_ShutdownEMS: Error freeing EMS");\r
+       }\r
+}\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     XMS Management code\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+//\r
+//     PML_StartupXMS() - Starts up XMS for the Page Mgr's use\r
+//             Checks for presence of an XMS driver\r
+//             Makes sure that there's at least a page of XMS available\r
+//             Allocates any remaining XMS (rounded down to the nearest page size)\r
+//\r
+boolean\r
+PML_StartupXMS(void)\r
+{\r
+       XMSPresent = false;                                     // Assume failure\r
+       XMSAvail = 0;\r
+\r
+asm    mov     ax,0x4300\r
+asm    int     XMS_INT                                         // Check for presence of XMS driver\r
+       if (_AL != 0x80)\r
+               goto error;\r
+\r
+\r
+asm    mov     ax,0x4310\r
+asm    int     XMS_INT                                                 // Get address of XMS driver\r
+asm    mov     [WORD PTR XMSDriver],bx\r
+asm    mov     [WORD PTR XMSDriver+2],es               // function pointer to XMS driver\r
+\r
+       XMS_CALL(XMS_QUERYFREE);                        // Find out how much XMS is available\r
+       XMSAvail = _AX;\r
+       if (!_AX)                               // AJR: bugfix 10/8/92\r
+               goto error;\r
+\r
+       XMSAvail &= ~(PMPageSizeKB - 1);        // Round off to nearest page size\r
+       if (XMSAvail < (PMPageSizeKB * 2))      // Need at least 2 pages\r
+               goto error;\r
+\r
+       _DX = XMSAvail;\r
+       XMS_CALL(XMS_ALLOC);                            // And do the allocation\r
+       XMSHandle = _DX;\r
+\r
+       if (!_AX)                               // AJR: bugfix 10/8/92\r
+       {\r
+               XMSAvail = 0;\r
+               goto error;\r
+       }\r
+\r
+       mminfo.XMSmem += XMSAvail * 1024;\r
+\r
+       XMSPresent = true;\r
+error:\r
+       return(XMSPresent);\r
+}\r
+\r
+//\r
+//     PML_XMSCopy() - Copies a main/EMS page to or from XMS\r
+//             Will round an odd-length request up to the next even value\r
+//\r
+void\r
+PML_XMSCopy(boolean toxms,byte far *addr,word xmspage,word length)\r
+{\r
+       longword        xoffset;\r
+       struct\r
+       {\r
+               longword        length;\r
+               word            source_handle;\r
+               longword        source_offset;\r
+               word            target_handle;\r
+               longword        target_offset;\r
+       } copy;\r
+\r
+       if (!addr)\r
+               Quit("PML_XMSCopy: zero address");\r
+\r
+       xoffset = (longword)xmspage * PMPageSize;\r
+\r
+       copy.length = (length + 1) & ~1;\r
+       copy.source_handle = toxms? 0 : XMSHandle;\r
+       copy.source_offset = toxms? (long)addr : xoffset;\r
+       copy.target_handle = toxms? XMSHandle : 0;\r
+       copy.target_offset = toxms? xoffset : (long)addr;\r
+\r
+asm    push si\r
+       _SI = (word)&copy;\r
+       XMS_CALL(XMS_MOVE);\r
+asm    pop     si\r
+       if (!_AX)\r
+               Quit("PML_XMSCopy: Error on copy");\r
+}\r
+\r
+#if 1\r
+#define        PML_CopyToXMS(s,t,l)    PML_XMSCopy(true,(s),(t),(l))\r
+#define        PML_CopyFromXMS(t,s,l)  PML_XMSCopy(false,(t),(s),(l))\r
+#else\r
+//\r
+//     PML_CopyToXMS() - Copies the specified number of bytes from the real mode\r
+//             segment address to the specified XMS page\r
+//\r
+void\r
+PML_CopyToXMS(byte far *source,int targetpage,word length)\r
+{\r
+       PML_XMSCopy(true,source,targetpage,length);\r
+}\r
+\r
+//\r
+//     PML_CopyFromXMS() - Copies the specified number of bytes from an XMS\r
+//             page to the specified real mode address\r
+//\r
+void\r
+PML_CopyFromXMS(byte far *target,int sourcepage,word length)\r
+{\r
+       PML_XMSCopy(false,target,sourcepage,length);\r
+}\r
+#endif\r
+\r
+//\r
+//     PML_ShutdownXMS()\r
+//\r
+void\r
+PML_ShutdownXMS(void)\r
+{\r
+       if (XMSPresent)\r
+       {\r
+               _DX = XMSHandle;\r
+               XMS_CALL(XMS_FREE);\r
+               if (_BL)\r
+                       Quit("PML_ShutdownXMS: Error freeing XMS");\r
+       }\r
+}\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     Main memory code\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+//\r
+//     PM_SetMainMemPurge() - Sets the purge level for all allocated main memory\r
+//             blocks. This shouldn't be called directly - the PM_LockMainMem() and\r
+//             PM_UnlockMainMem() macros should be used instead.\r
+//\r
+void\r
+PM_SetMainMemPurge(int level)\r
+{\r
+       int     i;\r
+\r
+       for (i = 0;i < PMMaxMainMem;i++)\r
+               if (MainMemPages[i])\r
+                       MM_SetPurge(&MainMemPages[i],level);\r
+}\r
+\r
+//\r
+//     PM_CheckMainMem() - If something besides the Page Mgr makes requests of\r
+//             the Memory Mgr, some of the Page Mgr's blocks may have been purged,\r
+//             so this function runs through the block list and checks to see if\r
+//             any of the blocks have been purged. If so, it marks the corresponding\r
+//             page as purged & unlocked, then goes through the block list and\r
+//             tries to reallocate any blocks that have been purged.\r
+//     This routine now calls PM_LockMainMem() to make sure that any allocation\r
+//             attempts made during the block reallocation sweep don't purge any\r
+//             of the other blocks. Because PM_LockMainMem() is called,\r
+//             PM_UnlockMainMem() needs to be called before any other part of the\r
+//             program makes allocation requests of the Memory Mgr.\r
+//\r
+void\r
+PM_CheckMainMem(void)\r
+{\r
+       boolean                 allocfailed;\r
+       int                             i,n;\r
+       memptr                  *p;\r
+       PMBlockAttr             *used;\r
+       PageListStruct  far *page;\r
+\r
+       if (!MainPresent)\r
+               return;\r
+\r
+       for (i = 0,page = PMPages;i < ChunksInFile;i++,page++)\r
+       {\r
+               n = page->mainPage;\r
+               if (n != -1)                                            // Is the page using main memory?\r
+               {\r
+                       if (!MainMemPages[n])                   // Yep, was the block purged?\r
+                       {\r
+                               page->mainPage = -1;            // Yes, mark page as purged & unlocked\r
+                               page->locked = pml_Unlocked;\r
+                       }\r
+               }\r
+       }\r
+\r
+       // Prevent allocation attempts from purging any of our other blocks\r
+       PM_LockMainMem();\r
+       allocfailed = false;\r
+       for (i = 0,p = MainMemPages,used = MainMemUsed;i < PMMaxMainMem;i++,p++,used++)\r
+       {\r
+               if (!*p)                                                        // If the page got purged\r
+               {\r
+                       if (*used & pmba_Allocated)             // If it was allocated\r
+                       {\r
+                               *used &= ~pmba_Allocated;       // Mark as unallocated\r
+                               MainPagesAvail--;                       // and decrease available count\r
+                       }\r
+\r
+                       if (*used & pmba_Used)                  // If it was used\r
+                       {\r
+                               *used &= ~pmba_Used;            // Mark as unused\r
+                               MainPagesUsed--;                        // and decrease used count\r
+                       }\r
+\r
+                       if (!allocfailed)\r
+                       {\r
+                               MM_BombOnError(false);\r
+                               MM_GetPtr(p,PMPageSize);                // Try to reallocate\r
+                               if (mmerror)                                    // If it failed,\r
+                                       allocfailed = true;                     //  don't try any more allocations\r
+                               else                                                    // If it worked,\r
+                               {\r
+                                       *used |= pmba_Allocated;        // Mark as allocated\r
+                                       MainPagesAvail++;                       // and increase available count\r
+                               }\r
+                               MM_BombOnError(true);\r
+                       }\r
+               }\r
+       }\r
+       if (mmerror)\r
+               mmerror = false;\r
+}\r
+\r
+//\r
+//     PML_StartupMainMem() - Allocates as much main memory as is possible for\r
+//             the Page Mgr. The memory is allocated as non-purgeable, so if it's\r
+//             necessary to make requests of the Memory Mgr, PM_UnlockMainMem()\r
+//             needs to be called.\r
+//\r
+void\r
+PML_StartupMainMem(void)\r
+{\r
+       int             i,n;\r
+       memptr  *p;\r
+\r
+       MainPagesAvail = 0;\r
+       MM_BombOnError(false);\r
+       for (i = 0,p = MainMemPages;i < PMMaxMainMem;i++,p++)\r
+       {\r
+               MM_GetPtr(p,PMPageSize);\r
+               if (mmerror)\r
+                       break;\r
+\r
+               MainPagesAvail++;\r
+               MainMemUsed[i] = pmba_Allocated;\r
+       }\r
+       MM_BombOnError(true);\r
+       if (mmerror)\r
+               mmerror = false;\r
+       if (MainPagesAvail < PMMinMainMem)\r
+               Quit("PM_SetupMainMem: Not enough main memory");\r
+       MainPresent = true;\r
+}\r
+\r
+//\r
+//     PML_ShutdownMainMem() - Frees all of the main memory blocks used by the\r
+//             Page Mgr.\r
+//\r
+void\r
+PML_ShutdownMainMem(void)\r
+{\r
+       int             i;\r
+       memptr  *p;\r
+\r
+       // DEBUG - mark pages as unallocated & decrease page count as appropriate\r
+       for (i = 0,p = MainMemPages;i < PMMaxMainMem;i++,p++)\r
+               if (*p)\r
+                       MM_FreePtr(p);\r
+}\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     File management code\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+//\r
+//     PML_ReadFromFile() - Reads some data in from the page file\r
+//\r
+void\r
+PML_ReadFromFile(byte far *buf,long offset,word length)\r
+{\r
+       if (!buf)\r
+               Quit("PML_ReadFromFile: Null pointer");\r
+       if (!offset)\r
+               Quit("PML_ReadFromFile: Zero offset");\r
+       if (lseek(PageFile,offset,SEEK_SET) != offset)\r
+               Quit("PML_ReadFromFile: Seek failed");\r
+       if (!CA_FarRead(PageFile,buf,length))\r
+               Quit("PML_ReadFromFile: Read failed");\r
+}\r
+\r
+//\r
+//     PML_OpenPageFile() - Opens the page file and sets up the page info\r
+//\r
+void\r
+PML_OpenPageFile(void)\r
+{\r
+       int                             i;\r
+       long                    size;\r
+       void                    _seg *buf;\r
+       longword                far *offsetptr;\r
+       word                    far *lengthptr;\r
+       PageListStruct  far *page;\r
+\r
+       PageFile = open(PageFileName,O_RDONLY + O_BINARY);\r
+       if (PageFile == -1)\r
+               Quit("PML_OpenPageFile: Unable to open page file");\r
+\r
+       // Read in header variables\r
+       read(PageFile,&ChunksInFile,sizeof(ChunksInFile));\r
+       read(PageFile,&PMSpriteStart,sizeof(PMSpriteStart));\r
+       read(PageFile,&PMSoundStart,sizeof(PMSoundStart));\r
+\r
+       // Allocate and clear the page list\r
+       PMNumBlocks = ChunksInFile;\r
+       MM_GetPtr(&(memptr)PMSegPages,sizeof(PageListStruct) * PMNumBlocks);\r
+       MM_SetLock(&(memptr)PMSegPages,true);\r
+       PMPages = (PageListStruct far *)PMSegPages;\r
+       _fmemset(PMPages,0,sizeof(PageListStruct) * PMNumBlocks);\r
+\r
+       // Read in the chunk offsets\r
+       size = sizeof(longword) * ChunksInFile;\r
+       MM_GetPtr(&buf,size);\r
+       if (!CA_FarRead(PageFile,(byte far *)buf,size))\r
+               Quit("PML_OpenPageFile: Offset read failed");\r
+       offsetptr = (longword far *)buf;\r
+       for (i = 0,page = PMPages;i < ChunksInFile;i++,page++)\r
+               page->offset = *offsetptr++;\r
+       MM_FreePtr(&buf);\r
+\r
+       // Read in the chunk lengths\r
+       size = sizeof(word) * ChunksInFile;\r
+       MM_GetPtr(&buf,size);\r
+       if (!CA_FarRead(PageFile,(byte far *)buf,size))\r
+               Quit("PML_OpenPageFile: Length read failed");\r
+       lengthptr = (word far *)buf;\r
+       for (i = 0,page = PMPages;i < ChunksInFile;i++,page++)\r
+               page->length = *lengthptr++;\r
+       MM_FreePtr(&buf);\r
+}\r
+\r
+//\r
+//  PML_ClosePageFile() - Closes the page file\r
+//\r
+void\r
+PML_ClosePageFile(void)\r
+{\r
+       if (PageFile != -1)\r
+               close(PageFile);\r
+       if (PMSegPages)\r
+       {\r
+               MM_SetLock(&(memptr)PMSegPages,false);\r
+               MM_FreePtr(&(void _seg *)PMSegPages);\r
+       }\r
+}\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     Allocation, etc., code\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+//\r
+//     PML_GetEMSAddress()\r
+//\r
+//             Page is in EMS, so figure out which EMS physical page should be used\r
+//             to map our page in. If normal page, use EMS physical page 3, else\r
+//             use the physical page specified by the lock type\r
+//\r
+#if 1\r
+#pragma argsused       // DEBUG - remove lock parameter\r
+memptr\r
+PML_GetEMSAddress(int page,PMLockType lock)\r
+{\r
+       int             i,emspage;\r
+       word    emsoff,emsbase,offset;\r
+\r
+       emsoff = page & (PMEMSSubPage - 1);\r
+       emsbase = page - emsoff;\r
+\r
+       emspage = -1;\r
+       // See if this page is already mapped in\r
+       for (i = 0;i < EMSFrameCount;i++)\r
+       {\r
+               if (EMSList[i].baseEMSPage == emsbase)\r
+               {\r
+                       emspage = i;    // Yep - don't do a redundant remapping\r
+                       break;\r
+               }\r
+       }\r
+\r
+       // If page isn't already mapped in, find LRU EMS frame, and use it\r
+       if (emspage == -1)\r
+       {\r
+               longword last = MAXLONG;\r
+               for (i = 0;i < EMSFrameCount;i++)\r
+               {\r
+                       if (EMSList[i].lastHit < last)\r
+                       {\r
+                               emspage = i;\r
+                               last = EMSList[i].lastHit;\r
+                       }\r
+               }\r
+\r
+               EMSList[emspage].baseEMSPage = emsbase;\r
+               PML_MapEMS(page / PMEMSSubPage,emspage);\r
+       }\r
+\r
+       if (emspage == -1)\r
+               Quit("PML_GetEMSAddress: EMS find failed");\r
+\r
+       EMSList[emspage].lastHit = PMFrameCount;\r
+       offset = emspage * EMSPageSizeSeg;\r
+       offset += emsoff * PMPageSizeSeg;\r
+       return((memptr)(EMSPageFrame + offset));\r
+}\r
+#else\r
+memptr\r
+PML_GetEMSAddress(int page,PMLockType lock)\r
+{\r
+       word    emspage;\r
+\r
+       emspage = (lock < pml_EMSLock)? 3 : (lock - pml_EMSLock);\r
+\r
+       PML_MapEMS(page / PMEMSSubPage,emspage);\r
+\r
+       return((memptr)(EMSPageFrame + (emspage * EMSPageSizeSeg)\r
+                       + ((page & (PMEMSSubPage - 1)) * PMPageSizeSeg)));\r
+}\r
+#endif\r
+\r
+//\r
+//     PM_GetPageAddress() - Returns the address of a given page\r
+//             Maps in EMS if necessary\r
+//             Returns nil if block isn't cached into Main Memory or EMS\r
+//\r
+//\r
+memptr\r
+PM_GetPageAddress(int pagenum)\r
+{\r
+       PageListStruct  far *page;\r
+\r
+       page = &PMPages[pagenum];\r
+       if (page->mainPage != -1)\r
+               return(MainMemPages[page->mainPage]);\r
+       else if (page->emsPage != -1)\r
+               return(PML_GetEMSAddress(page->emsPage,page->locked));\r
+       else\r
+               return(nil);\r
+}\r
+\r
+//\r
+//     PML_GiveLRUPage() - Returns the page # of the least recently used\r
+//             present & unlocked main/EMS page (or main page if mainonly is true)\r
+//\r
+int\r
+PML_GiveLRUPage(boolean mainonly)\r
+{\r
+       int                             i,lru;\r
+       long                    last;\r
+       PageListStruct  far *page;\r
+\r
+       for (i = 0,page = PMPages,lru = -1,last = MAXLONG;i < ChunksInFile;i++,page++)\r
+       {\r
+               if\r
+               (\r
+                       (page->lastHit < last)\r
+               &&      ((page->emsPage != -1) || (page->mainPage != -1))\r
+               &&      (page->locked == pml_Unlocked)\r
+               &&      (!(mainonly && (page->mainPage == -1)))\r
+               )\r
+               {\r
+                       last = page->lastHit;\r
+                       lru = i;\r
+               }\r
+       }\r
+\r
+       if (lru == -1)\r
+               Quit("PML_GiveLRUPage: LRU Search failed");\r
+       return(lru);\r
+}\r
+\r
+//\r
+//     PML_GiveLRUXMSPage() - Returns the page # of the least recently used\r
+//             (and present) XMS page.\r
+//     This routine won't return the XMS page protected (by XMSProtectPage)\r
+//\r
+int\r
+PML_GiveLRUXMSPage(void)\r
+{\r
+       int                             i,lru;\r
+       long                    last;\r
+       PageListStruct  far *page;\r
+\r
+       for (i = 0,page = PMPages,lru = -1,last = MAXLONG;i < ChunksInFile;i++,page++)\r
+       {\r
+               if\r
+               (\r
+                       (page->xmsPage != -1)\r
+               &&      (page->lastHit < last)\r
+               &&      (i != XMSProtectPage)\r
+               )\r
+               {\r
+                       last = page->lastHit;\r
+                       lru = i;\r
+               }\r
+       }\r
+       return(lru);\r
+}\r
+\r
+//\r
+//     PML_PutPageInXMS() - If page isn't in XMS, find LRU XMS page and replace\r
+//             it with the main/EMS page\r
+//\r
+void\r
+PML_PutPageInXMS(int pagenum)\r
+{\r
+       int                             usexms;\r
+       PageListStruct  far *page;\r
+\r
+       if (!XMSPresent)\r
+               return;\r
+\r
+       page = &PMPages[pagenum];\r
+       if (page->xmsPage != -1)\r
+               return;                                 // Already in XMS\r
+\r
+       if (XMSPagesUsed < XMSPagesAvail)\r
+               page->xmsPage = XMSPagesUsed++;\r
+       else\r
+       {\r
+               usexms = PML_GiveLRUXMSPage();\r
+               if (usexms == -1)\r
+                       Quit("PML_PutPageInXMS: No XMS LRU");\r
+               page->xmsPage = PMPages[usexms].xmsPage;\r
+               PMPages[usexms].xmsPage = -1;\r
+       }\r
+       PML_CopyToXMS(PM_GetPageAddress(pagenum),page->xmsPage,page->length);\r
+}\r
+\r
+//\r
+//     PML_TransferPageSpace() - A page is being replaced, so give the new page\r
+//             the old one's address space. Returns the address of the new page.\r
+//\r
+memptr\r
+PML_TransferPageSpace(int orig,int new)\r
+{\r
+       memptr                  addr;\r
+       PageListStruct  far *origpage,far *newpage;\r
+\r
+       if (orig == new)\r
+               Quit("PML_TransferPageSpace: Identity replacement");\r
+\r
+       origpage = &PMPages[orig];\r
+       newpage = &PMPages[new];\r
+\r
+       if (origpage->locked != pml_Unlocked)\r
+               Quit("PML_TransferPageSpace: Killing locked page");\r
+\r
+       if ((origpage->emsPage == -1) && (origpage->mainPage == -1))\r
+               Quit("PML_TransferPageSpace: Reusing non-existent page");\r
+\r
+       // Copy page that's about to be purged into XMS\r
+       PML_PutPageInXMS(orig);\r
+\r
+       // Get the address, and force EMS into a physical page if necessary\r
+       addr = PM_GetPageAddress(orig);\r
+\r
+       // Steal the address\r
+       newpage->emsPage = origpage->emsPage;\r
+       newpage->mainPage = origpage->mainPage;\r
+\r
+       // Mark replaced page as purged\r
+       origpage->mainPage = origpage->emsPage = -1;\r
+\r
+       if (!addr)\r
+               Quit("PML_TransferPageSpace: Zero replacement");\r
+\r
+       return(addr);\r
+}\r
+\r
+//\r
+//     PML_GetAPageBuffer() - A page buffer is needed. Either get it from the\r
+//             main/EMS free pool, or use PML_GiveLRUPage() to find which page to\r
+//             steal the buffer from. Returns a far pointer to the page buffer, and\r
+//             sets the fields inside the given page structure appropriately.\r
+//             If mainonly is true, free EMS will be ignored, and only main pages\r
+//             will be looked at by PML_GiveLRUPage().\r
+//\r
+byte far *\r
+PML_GetAPageBuffer(int pagenum,boolean mainonly)\r
+{\r
+       byte                    far *addr = nil;\r
+       int                             i,n;\r
+       PMBlockAttr             *used;\r
+       PageListStruct  far *page;\r
+\r
+       page = &PMPages[pagenum];\r
+       if ((EMSPagesUsed < EMSPagesAvail) && !mainonly)\r
+       {\r
+               // There's remaining EMS - use it\r
+               page->emsPage = EMSPagesUsed++;\r
+               addr = PML_GetEMSAddress(page->emsPage,page->locked);\r
+       }\r
+       else if (MainPagesUsed < MainPagesAvail)\r
+       {\r
+               // There's remaining main memory - use it\r
+               for (i = 0,n = -1,used = MainMemUsed;i < PMMaxMainMem;i++,used++)\r
+               {\r
+                       if ((*used & pmba_Allocated) && !(*used & pmba_Used))\r
+                       {\r
+                               n = i;\r
+                               *used |= pmba_Used;\r
+                               break;\r
+                       }\r
+               }\r
+               if (n == -1)\r
+                       Quit("PML_GetPageBuffer: MainPagesAvail lied");\r
+               addr = MainMemPages[n];\r
+               if (!addr)\r
+                       Quit("PML_GetPageBuffer: Purged main block");\r
+               page->mainPage = n;\r
+               MainPagesUsed++;\r
+       }\r
+       else\r
+               addr = PML_TransferPageSpace(PML_GiveLRUPage(mainonly),pagenum);\r
+\r
+       if (!addr)\r
+               Quit("PML_GetPageBuffer: Search failed");\r
+       return(addr);\r
+}\r
+\r
+//\r
+//     PML_GetPageFromXMS() - If page is in XMS, find LRU main/EMS page and\r
+//             replace it with the page from XMS. If mainonly is true, will only\r
+//             search for LRU main page.\r
+//     XMSProtectPage is set to the page to be retrieved from XMS, so that if\r
+//             the page from which we're stealing the main/EMS from isn't in XMS,\r
+//             it won't copy over the page that we're trying to get from XMS.\r
+//             (pages that are being purged are copied into XMS, if possible)\r
+//\r
+memptr\r
+PML_GetPageFromXMS(int pagenum,boolean mainonly)\r
+{\r
+       byte                    far *checkaddr;\r
+       memptr                  addr = nil;\r
+       PageListStruct  far *page;\r
+\r
+       page = &PMPages[pagenum];\r
+       if (XMSPresent && (page->xmsPage != -1))\r
+       {\r
+               XMSProtectPage = pagenum;\r
+               checkaddr = PML_GetAPageBuffer(pagenum,mainonly);\r
+               if (FP_OFF(checkaddr))\r
+                       Quit("PML_GetPageFromXMS: Non segment pointer");\r
+               addr = (memptr)FP_SEG(checkaddr);\r
+               PML_CopyFromXMS(addr,page->xmsPage,page->length);\r
+               XMSProtectPage = -1;\r
+       }\r
+\r
+       return(addr);\r
+}\r
+\r
+//\r
+//     PML_LoadPage() - A page is not in main/EMS memory, and it's not in XMS.\r
+//             Load it into either main or EMS. If mainonly is true, the page will\r
+//             only be loaded into main.\r
+//\r
+void\r
+PML_LoadPage(int pagenum,boolean mainonly)\r
+{\r
+       byte                    far *addr;\r
+       PageListStruct  far *page;\r
+\r
+       addr = PML_GetAPageBuffer(pagenum,mainonly);\r
+       page = &PMPages[pagenum];\r
+       PML_ReadFromFile(addr,page->offset,page->length);\r
+}\r
+\r
+//\r
+//     PM_GetPage() - Returns the address of the page, loading it if necessary\r
+//             First, check if in Main Memory or EMS\r
+//             Then, check XMS\r
+//             If not in XMS, load into Main Memory or EMS\r
+//\r
+#pragma warn -pia\r
+memptr\r
+PM_GetPage(int pagenum)\r
+{\r
+       memptr  result;\r
+\r
+       if (pagenum >= ChunksInFile)\r
+               Quit("PM_GetPage: Invalid page request");\r
+\r
+#if 0  // for debugging\r
+asm    mov     dx,STATUS_REGISTER_1\r
+asm    in      al,dx\r
+asm    mov     dx,ATR_INDEX\r
+asm    mov     al,ATR_OVERSCAN\r
+asm    out     dx,al\r
+asm    mov     al,10   // bright green\r
+asm    out     dx,al\r
+#endif\r
+\r
+       if (!(result = PM_GetPageAddress(pagenum)))\r
+       {\r
+               boolean mainonly = (pagenum >= PMSoundStart);\r
+if (!PMPages[pagenum].offset)  // JDC: sparse page\r
+       Quit ("Tried to load a sparse page!");\r
+               if (!(result = PML_GetPageFromXMS(pagenum,mainonly)))\r
+               {\r
+                       if (PMPages[pagenum].lastHit == PMFrameCount)\r
+                               PMThrashing++;\r
+\r
+                       PML_LoadPage(pagenum,mainonly);\r
+                       result = PM_GetPageAddress(pagenum);\r
+               }\r
+       }\r
+       PMPages[pagenum].lastHit = PMFrameCount;\r
+\r
+#if 0  // for debugging\r
+asm    mov     dx,STATUS_REGISTER_1\r
+asm    in      al,dx\r
+asm    mov     dx,ATR_INDEX\r
+asm    mov     al,ATR_OVERSCAN\r
+asm    out     dx,al\r
+asm    mov     al,3    // blue\r
+asm    out     dx,al\r
+asm    mov     al,0x20 // normal\r
+asm    out     dx,al\r
+#endif\r
+\r
+       return(result);\r
+}\r
+#pragma warn +pia\r
+\r
+//\r
+//     PM_SetPageLock() - Sets the lock type on a given page\r
+//             pml_Unlocked: Normal, page can be purged\r
+//             pml_Locked: Cannot be purged\r
+//             pml_EMS?: Same as pml_Locked, but if in EMS, use the physical page\r
+//                                     specified when returning the address. For sound stuff.\r
+//\r
+void\r
+PM_SetPageLock(int pagenum,PMLockType lock)\r
+{\r
+       if (pagenum < PMSoundStart)\r
+               Quit("PM_SetPageLock: Locking/unlocking non-sound page");\r
+\r
+       PMPages[pagenum].locked = lock;\r
+}\r
+\r
+//\r
+//     PM_Preload() - Loads as many pages as possible into all types of memory.\r
+//             Calls the update function after each load, indicating the current\r
+//             page, and the total pages that need to be loaded (for thermometer).\r
+//\r
+void\r
+PM_Preload(boolean (*update)(word current,word total))\r
+{\r
+       int                             i,j,\r
+                                       page,oogypage;\r
+       word                    current,total,\r
+                                       totalnonxms,totalxms,\r
+                                       mainfree,maintotal,\r
+                                       emsfree,emstotal,\r
+                                       xmsfree,xmstotal;\r
+       memptr                  addr;\r
+       PageListStruct  far *p;\r
+\r
+       mainfree = (MainPagesAvail - MainPagesUsed) + (EMSPagesAvail - EMSPagesUsed);\r
+       xmsfree = (XMSPagesAvail - XMSPagesUsed);\r
+\r
+       xmstotal = maintotal = 0;\r
+\r
+       for (i = 0;i < ChunksInFile;i++)\r
+       {\r
+               if (!PMPages[i].offset)\r
+                       continue;                       // sparse\r
+\r
+               if ( PMPages[i].emsPage != -1 || PMPages[i].mainPage != -1 )\r
+                       continue;                       // already in main mem\r
+\r
+               if ( mainfree )\r
+               {\r
+                       maintotal++;\r
+                       mainfree--;\r
+               }\r
+               else if ( xmsfree && (PMPages[i].xmsPage == -1) )\r
+               {\r
+                       xmstotal++;\r
+                       xmsfree--;\r
+               }\r
+       }\r
+\r
+\r
+       total = maintotal + xmstotal;\r
+\r
+       if (!total)\r
+               return;\r
+\r
+       page = 0;\r
+       current = 0;\r
+\r
+//\r
+// cache main/ems blocks\r
+//\r
+       while (maintotal)\r
+       {\r
+               while ( !PMPages[page].offset || PMPages[page].mainPage != -1\r
+                       ||      PMPages[page].emsPage != -1 )\r
+                       page++;\r
+\r
+               if (page >= ChunksInFile)\r
+                       Quit ("PM_Preload: Pages>=ChunksInFile");\r
+\r
+               PM_GetPage(page);\r
+\r
+               page++;\r
+               current++;\r
+               maintotal--;\r
+               update(current,total);\r
+       }\r
+\r
+//\r
+// load stuff to XMS\r
+//\r
+       if (xmstotal)\r
+       {\r
+               for (oogypage = 0 ; PMPages[oogypage].mainPage == -1 ; oogypage++)\r
+               ;\r
+               addr = PM_GetPage(oogypage);\r
+               if (!addr)\r
+                       Quit("PM_Preload: XMS buffer failed");\r
+\r
+               while (xmstotal)\r
+               {\r
+                       while ( !PMPages[page].offset || PMPages[page].xmsPage != -1 )\r
+                               page++;\r
+\r
+                       if (page >= ChunksInFile)\r
+                               Quit ("PM_Preload: Pages>=ChunksInFile");\r
+\r
+                       p = &PMPages[page];\r
+\r
+                       p->xmsPage = XMSPagesUsed++;\r
+                       if (XMSPagesUsed > XMSPagesAvail)\r
+                               Quit("PM_Preload: Exceeded XMS pages");\r
+                       if (p->length > PMPageSize)\r
+                               Quit("PM_Preload: Page too long");\r
+\r
+                       PML_ReadFromFile((byte far *)addr,p->offset,p->length);\r
+                       PML_CopyToXMS((byte far *)addr,p->xmsPage,p->length);\r
+\r
+                       page++;\r
+                       current++;\r
+                       xmstotal--;\r
+                       update(current,total);\r
+               }\r
+\r
+               p = &PMPages[oogypage];\r
+               PML_ReadFromFile((byte far *)addr,p->offset,p->length);\r
+       }\r
+\r
+       update(total,total);\r
+}\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     General code\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+//\r
+//     PM_NextFrame() - Increments the frame counter and adjusts the thrash\r
+//             avoidence variables\r
+//\r
+//             If currently in panic mode (to avoid thrashing), check to see if the\r
+//                     appropriate number of frames have passed since the last time that\r
+//                     we would have thrashed. If so, take us out of panic mode.\r
+//\r
+//\r
+void\r
+PM_NextFrame(void)\r
+{\r
+       int     i;\r
+\r
+       // Frame count overrun - kill the LRU hit entries & reset frame count\r
+       if (++PMFrameCount >= MAXLONG - 4)\r
+       {\r
+               for (i = 0;i < PMNumBlocks;i++)\r
+                       PMPages[i].lastHit = 0;\r
+               PMFrameCount = 0;\r
+       }\r
+\r
+#if 0\r
+       for (i = 0;i < PMSoundStart;i++)\r
+       {\r
+               if (PMPages[i].locked)\r
+               {\r
+                       char buf[40];\r
+                       sprintf(buf,"PM_NextFrame: Page %d is locked",i);\r
+                       Quit(buf);\r
+               }\r
+       }\r
+#endif\r
+\r
+       if (PMPanicMode)\r
+       {\r
+               // DEBUG - set border color\r
+               if ((!PMThrashing) && (!--PMPanicMode))\r
+               {\r
+                       // DEBUG - reset border color\r
+               }\r
+       }\r
+       if (PMThrashing >= PMThrashThreshold)\r
+               PMPanicMode = PMUnThrashThreshold;\r
+       PMThrashing = false;\r
+}\r
+\r
+//\r
+//     PM_Reset() - Sets up caching structures\r
+//\r
+void\r
+PM_Reset(void)\r
+{\r
+       int                             i;\r
+       PageListStruct  far *page;\r
+\r
+       XMSPagesAvail = XMSAvail / PMPageSizeKB;\r
+\r
+       EMSPagesAvail = EMSAvail * (EMSPageSizeKB / PMPageSizeKB);\r
+       EMSPhysicalPage = 0;\r
+\r
+       MainPagesUsed = EMSPagesUsed = XMSPagesUsed = 0;\r
+\r
+       PMPanicMode = false;\r
+\r
+       // Initialize page list\r
+       for (i = 0,page = PMPages;i < PMNumBlocks;i++,page++)\r
+       {\r
+               page->mainPage = -1;\r
+               page->emsPage = -1;\r
+               page->xmsPage = -1;\r
+               page->locked = false;\r
+       }\r
+}\r
+\r
+//\r
+//     PM_Startup() - Start up the Page Mgr\r
+//\r
+void\r
+PM_Startup(void)\r
+{\r
+       boolean nomain,noems,noxms;\r
+       int             i;\r
+\r
+       if (PMStarted)\r
+               return;\r
+\r
+       nomain = noems = noxms = false;\r
+       for (i = 1;i < _argc;i++)\r
+       {\r
+               switch (US_CheckParm(_argv[i],ParmStrings))\r
+               {\r
+               case 0:\r
+                       nomain = true;\r
+                       break;\r
+               case 1:\r
+                       noems = true;\r
+                       break;\r
+               case 2:\r
+                       noxms = true;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       PML_OpenPageFile();\r
+\r
+       if (!noems)\r
+               PML_StartupEMS();\r
+       if (!noxms)\r
+               PML_StartupXMS();\r
+\r
+       if (nomain && !EMSPresent)\r
+               Quit("PM_Startup: No main or EMS");\r
+       else\r
+               PML_StartupMainMem();\r
+\r
+       PM_Reset();\r
+\r
+       PMStarted = true;\r
+}\r
+\r
+//\r
+//     PM_Shutdown() - Shut down the Page Mgr\r
+//\r
+void\r
+PM_Shutdown(void)\r
+{\r
+       PML_ShutdownXMS();\r
+       PML_ShutdownEMS();\r
+\r
+       if (!PMStarted)\r
+               return;\r
+\r
+       PML_ClosePageFile();\r
+\r
+       PML_ShutdownMainMem();\r
+}\r
diff --git a/16/wf3d8086/id_pm.h b/16/wf3d8086/id_pm.h
new file mode 100755 (executable)
index 0000000..b3e7491
--- /dev/null
@@ -0,0 +1,83 @@
+//\r
+//     ID_PM.H\r
+//     Header file for Id Engine's Page Manager\r
+//\r
+\r
+//     NOTE! PMPageSize must be an even divisor of EMSPageSize, and >= 1024\r
+#define        EMSPageSize             16384\r
+#define        EMSPageSizeSeg  (EMSPageSize >> 4)\r
+#define        EMSPageSizeKB   (EMSPageSize >> 10)\r
+#define        EMSFrameCount   4\r
+#define        PMPageSize              4096\r
+#define        PMPageSizeSeg   (PMPageSize >> 4)\r
+#define        PMPageSizeKB    (PMPageSize >> 10)\r
+#define        PMEMSSubPage    (EMSPageSize / PMPageSize)\r
+\r
+#define        PMMinMainMem    10                      // Min acceptable # of pages from main\r
+#define        PMMaxMainMem    100                     // Max number of pages in main memory\r
+\r
+#define        PMThrashThreshold       1       // Number of page thrashes before panic mode\r
+#define        PMUnThrashThreshold     5       // Number of non-thrashing frames before leaving panic mode\r
+\r
+typedef        enum\r
+               {\r
+                       pml_Unlocked,\r
+                       pml_Locked\r
+               } PMLockType;\r
+\r
+typedef        enum\r
+               {\r
+                       pmba_Unused = 0,\r
+                       pmba_Used = 1,\r
+                       pmba_Allocated = 2\r
+               } PMBlockAttr;\r
+\r
+typedef        struct\r
+               {\r
+                       longword        offset;         // Offset of chunk into file\r
+                       word            length;         // Length of the chunk\r
+\r
+                       int                     xmsPage;        // If in XMS, (xmsPage * PMPageSize) gives offset into XMS handle\r
+\r
+                       PMLockType      locked;         // If set, this page can't be purged\r
+                       int                     emsPage;        // If in EMS, logical page/offset into page\r
+                       int                     mainPage;       // If in Main, index into handle array\r
+\r
+                       longword        lastHit;        // Last frame number of hit\r
+               } PageListStruct;\r
+\r
+typedef        struct\r
+               {\r
+                       int                     baseEMSPage;    // Base EMS page for this phys frame\r
+                       longword        lastHit;                // Last frame number of hit\r
+               } EMSListStruct;\r
+\r
+extern boolean                 XMSPresent,EMSPresent;\r
+extern word                    XMSPagesAvail,EMSPagesAvail;\r
+\r
+extern word                    ChunksInFile,\r
+                                               PMSpriteStart,PMSoundStart;\r
+extern PageListStruct  far *PMPages;\r
+\r
+#define        PM_GetSoundPage(v)      PM_GetPage(PMSoundStart + (v))\r
+#define        PM_GetSpritePage(v)     PM_GetPage(PMSpriteStart + (v))\r
+\r
+#define        PM_LockMainMem()        PM_SetMainMemPurge(0)\r
+#define        PM_UnlockMainMem()      PM_SetMainMemPurge(3)\r
+\r
+\r
+extern char    PageFileName[13];\r
+\r
+\r
+extern void    PM_Startup(void),\r
+                               PM_Shutdown(void),\r
+                               PM_Reset(void),\r
+                               PM_Preload(boolean (*update)(word current,word total)),\r
+                               PM_NextFrame(void),\r
+                               PM_SetPageLock(int pagenum,PMLockType lock),\r
+                               PM_SetMainPurge(int level),\r
+                               PM_CheckMainMem(void);\r
+extern memptr  PM_GetPageAddress(int pagenum),\r
+                               PM_GetPage(int pagenum);                // Use this one to cache page\r
+\r
+void PM_SetMainMemPurge(int level);\r
diff --git a/16/wf3d8086/id_sd.c b/16/wf3d8086/id_sd.c
new file mode 100755 (executable)
index 0000000..60136b7
--- /dev/null
@@ -0,0 +1,2367 @@
+//\r
+//     ID Engine\r
+//     ID_SD.c - Sound Manager for Wolfenstein 3D\r
+//     v1.2\r
+//     By Jason Blochowiak\r
+//\r
+\r
+//\r
+//     This module handles dealing with generating sound on the appropriate\r
+//             hardware\r
+//\r
+//     Depends on: User Mgr (for parm checking)\r
+//\r
+//     Globals:\r
+//             For User Mgr:\r
+//                     SoundSourcePresent - Sound Source thingie present?\r
+//                     SoundBlasterPresent - SoundBlaster card present?\r
+//                     AdLibPresent - AdLib card present?\r
+//                     SoundMode - What device is used for sound effects\r
+//                             (Use SM_SetSoundMode() to set)\r
+//                     MusicMode - What device is used for music\r
+//                             (Use SM_SetMusicMode() to set)\r
+//                     DigiMode - What device is used for digitized sound effects\r
+//                             (Use SM_SetDigiDevice() to set)\r
+//\r
+//             For Cache Mgr:\r
+//                     NeedsDigitized - load digitized sounds?\r
+//                     NeedsMusic - load music?\r
+//\r
+\r
+#pragma hdrstop                // Wierdo thing with MUSE\r
+\r
+#include <dos.h>\r
+\r
+#ifdef _MUSE_      // Will be defined in ID_Types.h\r
+#include "ID_SD.h"\r
+#else\r
+#include "ID_HEADS.H"\r
+#endif\r
+#pragma        hdrstop\r
+#pragma        warn    -pia\r
+\r
+#ifdef nil\r
+#undef nil\r
+#endif\r
+#define        nil     0\r
+\r
+#define        SDL_SoundFinished()     {SoundNumber = SoundPriority = 0;}\r
+\r
+// Macros for SoundBlaster stuff\r
+#define        sbOut(n,b)      outportb((n) + sbLocation,b)\r
+#define        sbIn(n)         inportb((n) + sbLocation)\r
+#define        sbWriteDelay()  while (sbIn(sbWriteStat) & 0x80);\r
+#define        sbReadDelay()   while (sbIn(sbDataAvail) & 0x80);\r
+\r
+// Macros for AdLib stuff\r
+#define        selreg(n)       outportb(alFMAddr,n)\r
+#define        writereg(n)     outportb(alFMData,n)\r
+#define        readstat()      inportb(alFMStatus)\r
+\r
+//     Imports from ID_SD_A.ASM\r
+extern void                    SDL_SetDS(void),\r
+                                               SDL_IndicatePC(boolean on);\r
+extern void interrupt  SDL_t0ExtremeAsmService(void),\r
+                                               SDL_t0FastAsmService(void),\r
+                                               SDL_t0SlowAsmService(void);\r
+\r
+//     Global variables\r
+       boolean         SoundSourcePresent,\r
+                               AdLibPresent,\r
+                               SoundBlasterPresent,SBProPresent,\r
+                               NeedsDigitized,NeedsMusic,\r
+                               SoundPositioned;\r
+       SDMode          SoundMode;\r
+       SMMode          MusicMode;\r
+       SDSMode         DigiMode;\r
+       longword        TimeCount;\r
+       word            HackCount;\r
+       word            *SoundTable;    // Really * _seg *SoundTable, but that don't work\r
+       boolean         ssIsTandy;\r
+       word            ssPort = 2;\r
+       int                     DigiMap[LASTSOUND];\r
+\r
+//     Internal variables\r
+static boolean                 SD_Started;\r
+               boolean                 nextsoundpos;\r
+               longword                TimerDivisor,TimerCount;\r
+static char                    *ParmStrings[] =\r
+                                               {\r
+                                                       "noal",\r
+                                                       "nosb",\r
+                                                       "nopro",\r
+                                                       "noss",\r
+                                                       "sst",\r
+                                                       "ss1",\r
+                                                       "ss2",\r
+                                                       "ss3",\r
+                                                       nil\r
+                                               };\r
+static void                    (*SoundUserHook)(void);\r
+               soundnames              SoundNumber,DigiNumber;\r
+               word                    SoundPriority,DigiPriority;\r
+               int                             LeftPosition,RightPosition;\r
+               void interrupt  (*t0OldService)(void);\r
+               long                    LocalTime;\r
+               word                    TimerRate;\r
+\r
+               word                    NumDigi,DigiLeft,DigiPage;\r
+               word                    _seg *DigiList;\r
+               word                    DigiLastStart,DigiLastEnd;\r
+               boolean                 DigiPlaying;\r
+static boolean                 DigiMissed,DigiLastSegment;\r
+static memptr                  DigiNextAddr;\r
+static word                    DigiNextLen;\r
+\r
+//     SoundBlaster variables\r
+static boolean                                 sbNoCheck,sbNoProCheck;\r
+static volatile boolean                sbSamplePlaying;\r
+static byte                                    sbOldIntMask = -1;\r
+static volatile byte                   huge *sbNextSegPtr;\r
+static byte                                    sbDMA = 1,\r
+                                                               sbDMAa1 = 0x83,sbDMAa2 = 2,sbDMAa3 = 3,\r
+                                                               sba1Vals[] = {0x87,0x83,0,0x82},\r
+                                                               sba2Vals[] = {0,2,0,6},\r
+                                                               sba3Vals[] = {1,3,0,7};\r
+static int                                             sbLocation = -1,sbInterrupt = 7,sbIntVec = 0xf,\r
+                                                               sbIntVectors[] = {-1,-1,0xa,0xb,-1,0xd,-1,0xf,-1,-1,-1};\r
+static volatile longword               sbNextSegLen;\r
+static volatile SampledSound   huge *sbSamples;\r
+static void interrupt                  (*sbOldIntHand)(void);\r
+static byte                                    sbpOldFMMix,sbpOldVOCMix;\r
+\r
+//     SoundSource variables\r
+               boolean                         ssNoCheck;\r
+               boolean                         ssActive;\r
+               word                            ssControl,ssStatus,ssData;\r
+               byte                            ssOn,ssOff;\r
+               volatile byte           far *ssSample;\r
+               volatile longword       ssLengthLeft;\r
+\r
+//     PC Sound variables\r
+               volatile byte   pcLastSample,far *pcSound;\r
+               longword                pcLengthLeft;\r
+               word                    pcSoundLookup[255];\r
+\r
+//     AdLib variables\r
+               boolean                 alNoCheck;\r
+               byte                    far *alSound;\r
+               word                    alBlock;\r
+               longword                alLengthLeft;\r
+               longword                alTimeCount;\r
+               Instrument              alZeroInst;\r
+\r
+// This table maps channel numbers to carrier and modulator op cells\r
+static byte                    carriers[9] =  { 3, 4, 5,11,12,13,19,20,21},\r
+                                               modifiers[9] = { 0, 1, 2, 8, 9,10,16,17,18},\r
+// This table maps percussive voice numbers to op cells\r
+                                               pcarriers[5] = {19,0xff,0xff,0xff,0xff},\r
+                                               pmodifiers[5] = {16,17,18,20,21};\r
+\r
+//     Sequencer variables\r
+               boolean                 sqActive;\r
+static word                    alFXReg;\r
+static ActiveTrack             *tracks[sqMaxTracks],\r
+                                               mytracks[sqMaxTracks];\r
+static word                    sqMode,sqFadeStep;\r
+               word                    far *sqHack,far *sqHackPtr,sqHackLen,sqHackSeqLen;\r
+               long                    sqHackTime;\r
+\r
+//     Internal routines\r
+               void                    SDL_DigitizedDone(void);\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SetTimer0() - Sets system timer 0 to the specified speed\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#pragma        argsused\r
+static void\r
+SDL_SetTimer0(word speed)\r
+{\r
+#ifndef TPROF  // If using Borland's profiling, don't screw with the timer\r
+asm    pushf\r
+asm    cli\r
+\r
+       outportb(0x43,0x36);                            // Change timer 0\r
+       outportb(0x40,speed);\r
+       outportb(0x40,speed >> 8);\r
+       // Kludge to handle special case for digitized PC sounds\r
+       if (TimerDivisor == (1192030 / (TickBase * 100)))\r
+               TimerDivisor = (1192030 / (TickBase * 10));\r
+       else\r
+               TimerDivisor = speed;\r
+\r
+asm    popf\r
+#else\r
+       TimerDivisor = 0x10000;\r
+#endif\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SetIntsPerSec() - Uses SDL_SetTimer0() to set the number of\r
+//             interrupts generated by system timer 0 per second\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_SetIntsPerSec(word ints)\r
+{\r
+       TimerRate = ints;\r
+       SDL_SetTimer0(1192030 / ints);\r
+}\r
+\r
+static void\r
+SDL_SetTimerSpeed(void)\r
+{\r
+       word    rate;\r
+       void interrupt  (*isr)(void);\r
+\r
+       if ((DigiMode == sds_PC) && DigiPlaying)\r
+       {\r
+               rate = TickBase * 100;\r
+               isr = SDL_t0ExtremeAsmService;\r
+       }\r
+       else if\r
+       (\r
+               (MusicMode == smm_AdLib)\r
+       ||      ((DigiMode == sds_SoundSource) && DigiPlaying)\r
+       )\r
+       {\r
+               rate = TickBase * 10;\r
+               isr = SDL_t0FastAsmService;\r
+       }\r
+       else\r
+       {\r
+               rate = TickBase * 2;\r
+               isr = SDL_t0SlowAsmService;\r
+       }\r
+\r
+       if (rate != TimerRate)\r
+       {\r
+               setvect(8,isr);\r
+               SDL_SetIntsPerSec(rate);\r
+               TimerRate = rate;\r
+       }\r
+}\r
+\r
+//\r
+//     SoundBlaster code\r
+//\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SBStopSample() - Stops any active sampled sound and causes DMA\r
+//             requests from the SoundBlaster to cease\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_SBStopSample(void)\r
+{\r
+       byte    is;\r
+\r
+asm    pushf\r
+asm    cli\r
+\r
+       if (sbSamplePlaying)\r
+       {\r
+               sbSamplePlaying = false;\r
+\r
+               sbWriteDelay();\r
+               sbOut(sbWriteCmd,0xd0); // Turn off DSP DMA\r
+\r
+               is = inportb(0x21);     // Restore interrupt mask bit\r
+               if (sbOldIntMask & (1 << sbInterrupt))\r
+                       is |= (1 << sbInterrupt);\r
+               else\r
+                       is &= ~(1 << sbInterrupt);\r
+               outportb(0x21,is);\r
+       }\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SBPlaySeg() - Plays a chunk of sampled sound on the SoundBlaster\r
+//     Insures that the chunk doesn't cross a bank boundary, programs the DMA\r
+//      controller, and tells the SB to start doing DMA requests for DAC\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static longword\r
+SDL_SBPlaySeg(volatile byte huge *data,longword length)\r
+{\r
+       unsigned                datapage;\r
+       longword                dataofs,uselen;\r
+\r
+       uselen = length;\r
+       datapage = FP_SEG(data) >> 12;\r
+       dataofs = ((FP_SEG(data) & 0xfff) << 4) + FP_OFF(data);\r
+       if (dataofs >= 0x10000)\r
+       {\r
+               datapage++;\r
+               dataofs -= 0x10000;\r
+       }\r
+\r
+       if (dataofs + uselen > 0x10000)\r
+               uselen = 0x10000 - dataofs;\r
+\r
+       uselen--;\r
+\r
+       // Program the DMA controller\r
+asm    pushf\r
+asm    cli\r
+       outportb(0x0a,sbDMA | 4);                                       // Mask off DMA on channel sbDMA\r
+       outportb(0x0c,0);                                                       // Clear byte ptr flip-flop to lower byte\r
+       outportb(0x0b,0x49);                                            // Set transfer mode for D/A conv\r
+       outportb(sbDMAa2,(byte)dataofs);                        // Give LSB of address\r
+       outportb(sbDMAa2,(byte)(dataofs >> 8));         // Give MSB of address\r
+       outportb(sbDMAa1,(byte)datapage);                       // Give page of address\r
+       outportb(sbDMAa3,(byte)uselen);                         // Give LSB of length\r
+       outportb(sbDMAa3,(byte)(uselen >> 8));          // Give MSB of length\r
+       outportb(0x0a,sbDMA);                                           // Re-enable DMA on channel sbDMA\r
+\r
+       // Start playing the thing\r
+       sbWriteDelay();\r
+       sbOut(sbWriteCmd,0x14);\r
+       sbWriteDelay();\r
+       sbOut(sbWriteData,(byte)uselen);\r
+       sbWriteDelay();\r
+       sbOut(sbWriteData,(byte)(uselen >> 8));\r
+asm    popf\r
+\r
+       return(uselen + 1);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SBService() - Services the SoundBlaster DMA interrupt\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void interrupt\r
+SDL_SBService(void)\r
+{\r
+       longword        used;\r
+\r
+       sbIn(sbDataAvail);      // Ack interrupt to SB\r
+\r
+       if (sbNextSegPtr)\r
+       {\r
+               used = SDL_SBPlaySeg(sbNextSegPtr,sbNextSegLen);\r
+               if (sbNextSegLen <= used)\r
+                       sbNextSegPtr = nil;\r
+               else\r
+               {\r
+                       sbNextSegPtr += used;\r
+                       sbNextSegLen -= used;\r
+               }\r
+       }\r
+       else\r
+       {\r
+               SDL_SBStopSample();\r
+               SDL_DigitizedDone();\r
+       }\r
+\r
+       outportb(0x20,0x20);    // Ack interrupt\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SBPlaySample() - Plays a sampled sound on the SoundBlaster. Sets up\r
+//             DMA to play the sound\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_SBPlaySample(byte huge *data,longword len)\r
+{\r
+       longword        used;\r
+\r
+       SDL_SBStopSample();\r
+\r
+asm    pushf\r
+asm    cli\r
+\r
+       used = SDL_SBPlaySeg(data,len);\r
+       if (len <= used)\r
+               sbNextSegPtr = nil;\r
+       else\r
+       {\r
+               sbNextSegPtr = data + used;\r
+               sbNextSegLen = len - used;\r
+       }\r
+\r
+       // Save old interrupt status and unmask ours\r
+       sbOldIntMask = inportb(0x21);\r
+       outportb(0x21,sbOldIntMask & ~(1 << sbInterrupt));\r
+\r
+       sbWriteDelay();\r
+       sbOut(sbWriteCmd,0xd4);                                         // Make sure DSP DMA is enabled\r
+\r
+       sbSamplePlaying = true;\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_PositionSBP() - Sets the attenuation levels for the left and right\r
+//             channels by using the mixer chip on the SB Pro. This hits a hole in\r
+//             the address map for normal SBs.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_PositionSBP(int leftpos,int rightpos)\r
+{\r
+       byte    v;\r
+\r
+       if (!SBProPresent)\r
+               return;\r
+\r
+       leftpos = 15 - leftpos;\r
+       rightpos = 15 - rightpos;\r
+       v = ((leftpos & 0x0f) << 4) | (rightpos & 0x0f);\r
+\r
+asm    pushf\r
+asm    cli\r
+\r
+       sbOut(sbpMixerAddr,sbpmVoiceVol);\r
+       sbOut(sbpMixerData,v);\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_CheckSB() - Checks to see if a SoundBlaster resides at a\r
+//             particular I/O location\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+SDL_CheckSB(int port)\r
+{\r
+       int     i;\r
+\r
+       sbLocation = port << 4;         // Initialize stuff for later use\r
+\r
+       sbOut(sbReset,true);            // Reset the SoundBlaster DSP\r
+asm    mov     dx,0x388                                // Wait >4usec\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+asm    in      al, dx\r
+\r
+       sbOut(sbReset,false);           // Turn off sb DSP reset\r
+asm    mov     dx,0x388                                // Wait >100usec\r
+asm    mov     cx,100\r
+usecloop:\r
+asm    in      al,dx\r
+asm    loop usecloop\r
+\r
+       for (i = 0;i < 100;i++)\r
+       {\r
+               if (sbIn(sbDataAvail) & 0x80)           // If data is available...\r
+               {\r
+                       if (sbIn(sbReadData) == 0xaa)   // If it matches correct value\r
+                               return(true);\r
+                       else\r
+                       {\r
+                               sbLocation = -1;                        // Otherwise not a SoundBlaster\r
+                               return(false);\r
+                       }\r
+               }\r
+       }\r
+       sbLocation = -1;                                                // Retry count exceeded - fail\r
+       return(false);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     Checks to see if a SoundBlaster is in the system. If the port passed is\r
+//             -1, then it scans through all possible I/O locations. If the port\r
+//             passed is 0, then it uses the default (2). If the port is >0, then\r
+//             it just passes it directly to SDL_CheckSB()\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+SDL_DetectSoundBlaster(int port)\r
+{\r
+       int     i;\r
+\r
+       if (port == 0)                                  // If user specifies default, use 2\r
+               port = 2;\r
+       if (port == -1)\r
+       {\r
+               if (SDL_CheckSB(2))                     // Check default before scanning\r
+                       return(true);\r
+\r
+               if (SDL_CheckSB(4))                     // Check other SB Pro location before scan\r
+                       return(true);\r
+\r
+               for (i = 1;i <= 6;i++)          // Scan through possible SB locations\r
+               {\r
+                       if ((i == 2) || (i == 4))\r
+                               continue;\r
+\r
+                       if (SDL_CheckSB(i))             // If found at this address,\r
+                               return(true);           //      return success\r
+               }\r
+               return(false);                          // All addresses failed, return failure\r
+       }\r
+       else\r
+               return(SDL_CheckSB(port));      // User specified address or default\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SBSetDMA() - Sets the DMA channel to be used by the SoundBlaster\r
+//             code. Sets up sbDMA, and sbDMAa1-sbDMAa3 (used by SDL_SBPlaySeg()).\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SDL_SBSetDMA(byte channel)\r
+{\r
+       if (channel > 3)\r
+               Quit("SDL_SBSetDMA() - invalid SoundBlaster DMA channel");\r
+\r
+       sbDMA = channel;\r
+       sbDMAa1 = sba1Vals[channel];\r
+       sbDMAa2 = sba2Vals[channel];\r
+       sbDMAa3 = sba3Vals[channel];\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_StartSB() - Turns on the SoundBlaster\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_StartSB(void)\r
+{\r
+       byte    timevalue,test;\r
+\r
+       sbIntVec = sbIntVectors[sbInterrupt];\r
+       if (sbIntVec < 0)\r
+               Quit("SDL_StartSB: Illegal or unsupported interrupt number for SoundBlaster");\r
+\r
+       sbOldIntHand = getvect(sbIntVec);       // Get old interrupt handler\r
+       setvect(sbIntVec,SDL_SBService);        // Set mine\r
+\r
+       sbWriteDelay();\r
+       sbOut(sbWriteCmd,0xd1);                         // Turn on DSP speaker\r
+\r
+       // Set the SoundBlaster DAC time constant for 7KHz\r
+       timevalue = 256 - (1000000 / 7000);\r
+       sbWriteDelay();\r
+       sbOut(sbWriteCmd,0x40);\r
+       sbWriteDelay();\r
+       sbOut(sbWriteData,timevalue);\r
+\r
+       SBProPresent = false;\r
+       if (sbNoProCheck)\r
+               return;\r
+\r
+       // Check to see if this is a SB Pro\r
+       sbOut(sbpMixerAddr,sbpmFMVol);\r
+       sbpOldFMMix = sbIn(sbpMixerData);\r
+       sbOut(sbpMixerData,0xbb);\r
+       test = sbIn(sbpMixerData);\r
+       if (test == 0xbb)\r
+       {\r
+               // Boost FM output levels to be equivilent with digitized output\r
+               sbOut(sbpMixerData,0xff);\r
+               test = sbIn(sbpMixerData);\r
+               if (test == 0xff)\r
+               {\r
+                       SBProPresent = true;\r
+\r
+                       // Save old Voice output levels (SB Pro)\r
+                       sbOut(sbpMixerAddr,sbpmVoiceVol);\r
+                       sbpOldVOCMix = sbIn(sbpMixerData);\r
+\r
+                       // Turn SB Pro stereo DAC off\r
+                       sbOut(sbpMixerAddr,sbpmControl);\r
+                       sbOut(sbpMixerData,0);                          // 0=off,2=on\r
+               }\r
+       }\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_ShutSB() - Turns off the SoundBlaster\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_ShutSB(void)\r
+{\r
+       SDL_SBStopSample();\r
+\r
+       if (SBProPresent)\r
+       {\r
+               // Restore FM output levels (SB Pro)\r
+               sbOut(sbpMixerAddr,sbpmFMVol);\r
+               sbOut(sbpMixerData,sbpOldFMMix);\r
+\r
+               // Restore Voice output levels (SB Pro)\r
+               sbOut(sbpMixerAddr,sbpmVoiceVol);\r
+               sbOut(sbpMixerData,sbpOldVOCMix);\r
+       }\r
+\r
+       setvect(sbIntVec,sbOldIntHand);         // Set vector back\r
+}\r
+\r
+//     Sound Source Code\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SSStopSample() - Stops a sample playing on the Sound Source\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_SSStopSample(void)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       (long)ssSample = 0;\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SSService() - Handles playing the next sample on the Sound Source\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_SSService(void)\r
+{\r
+       boolean gotit;\r
+       byte    v;\r
+\r
+       while (ssSample)\r
+       {\r
+       asm     mov             dx,[ssStatus]   // Check to see if FIFO is currently empty\r
+       asm     in              al,dx\r
+       asm     test    al,0x40\r
+       asm     jnz             done                    // Nope - don't push any more data out\r
+\r
+               v = *ssSample++;\r
+               if (!(--ssLengthLeft))\r
+               {\r
+                       (long)ssSample = 0;\r
+                       SDL_DigitizedDone();\r
+               }\r
+\r
+       asm     mov             dx,[ssData]             // Pump the value out\r
+       asm     mov             al,[v]\r
+       asm     out             dx,al\r
+\r
+       asm     mov             dx,[ssControl]  // Pulse printer select\r
+       asm     mov             al,[ssOff]\r
+       asm     out             dx,al\r
+       asm     push    ax\r
+       asm     pop             ax\r
+       asm     mov             al,[ssOn]\r
+       asm     out             dx,al\r
+\r
+       asm     push    ax                              // Delay a short while\r
+       asm     pop             ax\r
+       asm     push    ax\r
+       asm     pop             ax\r
+       }\r
+done:;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SSPlaySample() - Plays the specified sample on the Sound Source\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_SSPlaySample(byte huge *data,longword len)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       ssLengthLeft = len;\r
+       ssSample = (volatile byte far *)data;\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_StartSS() - Sets up for and turns on the Sound Source\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_StartSS(void)\r
+{\r
+       if (ssPort == 3)\r
+               ssControl = 0x27a;      // If using LPT3\r
+       else if (ssPort == 2)\r
+               ssControl = 0x37a;      // If using LPT2\r
+       else\r
+               ssControl = 0x3be;      // If using LPT1\r
+       ssStatus = ssControl - 1;\r
+       ssData = ssStatus - 1;\r
+\r
+       ssOn = 0x04;\r
+       if (ssIsTandy)\r
+               ssOff = 0x0e;                           // Tandy wierdness\r
+       else\r
+               ssOff = 0x0c;                           // For normal machines\r
+\r
+       outportb(ssControl,ssOn);               // Enable SS\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_ShutSS() - Turns off the Sound Source\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_ShutSS(void)\r
+{\r
+       outportb(ssControl,ssOff);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_CheckSS() - Checks to see if a Sound Source is present at the\r
+//             location specified by the sound source variables\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+SDL_CheckSS(void)\r
+{\r
+       boolean         present = false;\r
+       longword        lasttime;\r
+\r
+       // Turn the Sound Source on and wait awhile (4 ticks)\r
+       SDL_StartSS();\r
+\r
+       lasttime = TimeCount;\r
+       while (TimeCount < lasttime + 4)\r
+               ;\r
+\r
+asm    mov             dx,[ssStatus]   // Check to see if FIFO is currently empty\r
+asm    in              al,dx\r
+asm    test    al,0x40\r
+asm    jnz             checkdone               // Nope - Sound Source not here\r
+\r
+asm    mov             cx,32                   // Force FIFO overflow (FIFO is 16 bytes)\r
+outloop:\r
+asm    mov             dx,[ssData]             // Pump a neutral value out\r
+asm    mov             al,0x80\r
+asm    out             dx,al\r
+\r
+asm    mov             dx,[ssControl]  // Pulse printer select\r
+asm    mov             al,[ssOff]\r
+asm    out             dx,al\r
+asm    push    ax\r
+asm    pop             ax\r
+asm    mov             al,[ssOn]\r
+asm    out             dx,al\r
+\r
+asm    push    ax                              // Delay a short while before we do this again\r
+asm    pop             ax\r
+asm    push    ax\r
+asm    pop             ax\r
+\r
+asm    loop    outloop\r
+\r
+asm    mov             dx,[ssStatus]   // Is FIFO overflowed now?\r
+asm    in              al,dx\r
+asm    test    al,0x40\r
+asm    jz              checkdone               // Nope, still not - Sound Source not here\r
+\r
+       present = true;                 // Yes - it's here!\r
+\r
+checkdone:\r
+       SDL_ShutSS();\r
+       return(present);\r
+}\r
+\r
+static boolean\r
+SDL_DetectSoundSource(void)\r
+{\r
+       for (ssPort = 1;ssPort <= 3;ssPort++)\r
+               if (SDL_CheckSS())\r
+                       return(true);\r
+       return(false);\r
+}\r
+\r
+//\r
+//     PC Sound code\r
+//\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_PCPlaySample() - Plays the specified sample on the PC speaker\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_PCPlaySample(byte huge *data,longword len)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       SDL_IndicatePC(true);\r
+\r
+       pcLengthLeft = len;\r
+       pcSound = (volatile byte far *)data;\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_PCStopSample() - Stops a sample playing on the PC speaker\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_PCStopSample(void)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       (long)pcSound = 0;\r
+\r
+       SDL_IndicatePC(false);\r
+\r
+asm    in      al,0x61                 // Turn the speaker off\r
+asm    and     al,0xfd                 // ~2\r
+asm    out     0x61,al\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_PCPlaySound() - Plays the specified sound on the PC speaker\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_PCPlaySound(PCSound far *sound)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       pcLastSample = -1;\r
+       pcLengthLeft = sound->common.length;\r
+       pcSound = sound->data;\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_PCStopSound() - Stops the current sound playing on the PC Speaker\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_PCStopSound(void)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       (long)pcSound = 0;\r
+\r
+asm    in      al,0x61                 // Turn the speaker off\r
+asm    and     al,0xfd                 // ~2\r
+asm    out     0x61,al\r
+\r
+asm    popf\r
+}\r
+\r
+#if 0\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_PCService() - Handles playing the next sample in a PC sound\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_PCService(void)\r
+{\r
+       byte    s;\r
+       word    t;\r
+\r
+       if (pcSound)\r
+       {\r
+               s = *pcSound++;\r
+               if (s != pcLastSample)\r
+               {\r
+               asm     pushf\r
+               asm     cli\r
+\r
+                       pcLastSample = s;\r
+                       if (s)                                  // We have a frequency!\r
+                       {\r
+                               t = pcSoundLookup[s];\r
+                       asm     mov     bx,[t]\r
+\r
+                       asm     mov     al,0xb6                 // Write to channel 2 (speaker) timer\r
+                       asm     out     43h,al\r
+                       asm     mov     al,bl\r
+                       asm     out     42h,al                  // Low byte\r
+                       asm     mov     al,bh\r
+                       asm     out     42h,al                  // High byte\r
+\r
+                       asm     in      al,0x61                 // Turn the speaker & gate on\r
+                       asm     or      al,3\r
+                       asm     out     0x61,al\r
+                       }\r
+                       else                                    // Time for some silence\r
+                       {\r
+                       asm     in      al,0x61                 // Turn the speaker & gate off\r
+                       asm     and     al,0xfc                 // ~3\r
+                       asm     out     0x61,al\r
+                       }\r
+\r
+               asm     popf\r
+               }\r
+\r
+               if (!(--pcLengthLeft))\r
+               {\r
+                       SDL_PCStopSound();\r
+                       SDL_SoundFinished();\r
+               }\r
+       }\r
+}\r
+#endif\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_ShutPC() - Turns off the pc speaker\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_ShutPC(void)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       pcSound = 0;\r
+\r
+asm    in      al,0x61                 // Turn the speaker & gate off\r
+asm    and     al,0xfc                 // ~3\r
+asm    out     0x61,al\r
+\r
+asm    popf\r
+}\r
+\r
+//\r
+//     Stuff for digitized sounds\r
+//\r
+memptr\r
+SDL_LoadDigiSegment(word page)\r
+{\r
+       memptr  addr;\r
+\r
+#if 0  // for debugging\r
+asm    mov     dx,STATUS_REGISTER_1\r
+asm    in      al,dx\r
+asm    mov     dx,ATR_INDEX\r
+asm    mov     al,ATR_OVERSCAN\r
+asm    out     dx,al\r
+asm    mov     al,10   // bright green\r
+asm    out     dx,al\r
+#endif\r
+\r
+       addr = PM_GetSoundPage(page);\r
+       PM_SetPageLock(PMSoundStart + page,pml_Locked);\r
+\r
+#if 0  // for debugging\r
+asm    mov     dx,STATUS_REGISTER_1\r
+asm    in      al,dx\r
+asm    mov     dx,ATR_INDEX\r
+asm    mov     al,ATR_OVERSCAN\r
+asm    out     dx,al\r
+asm    mov     al,3    // blue\r
+asm    out     dx,al\r
+asm    mov     al,0x20 // normal\r
+asm    out     dx,al\r
+#endif\r
+\r
+       return(addr);\r
+}\r
+\r
+void\r
+SDL_PlayDigiSegment(memptr addr,word len)\r
+{\r
+       switch (DigiMode)\r
+       {\r
+       case sds_PC:\r
+       SDL_PCPlaySample(addr,len);\r
+               break;\r
+       case sds_SoundSource:\r
+               SDL_SSPlaySample(addr,len);\r
+               break;\r
+       case sds_SoundBlaster:\r
+               SDL_SBPlaySample(addr,len);\r
+               break;\r
+       }\r
+}\r
+\r
+void\r
+SD_StopDigitized(void)\r
+{\r
+       int     i;\r
+\r
+asm    pushf\r
+asm    cli\r
+\r
+       DigiLeft = 0;\r
+       DigiNextAddr = nil;\r
+       DigiNextLen = 0;\r
+       DigiMissed = false;\r
+       DigiPlaying = false;\r
+       DigiNumber = DigiPriority = 0;\r
+       SoundPositioned = false;\r
+       if ((DigiMode == sds_PC) && (SoundMode == sdm_PC))\r
+               SDL_SoundFinished();\r
+\r
+       switch (DigiMode)\r
+       {\r
+       case sds_PC:\r
+               SDL_PCStopSample();\r
+               break;\r
+       case sds_SoundSource:\r
+               SDL_SSStopSample();\r
+               break;\r
+       case sds_SoundBlaster:\r
+               SDL_SBStopSample();\r
+               break;\r
+       }\r
+\r
+asm    popf\r
+\r
+       for (i = DigiLastStart;i < DigiLastEnd;i++)\r
+               PM_SetPageLock(i + PMSoundStart,pml_Unlocked);\r
+       DigiLastStart = 1;\r
+       DigiLastEnd = 0;\r
+}\r
+\r
+void\r
+SD_Poll(void)\r
+{\r
+       if (DigiLeft && !DigiNextAddr)\r
+       {\r
+               DigiNextLen = (DigiLeft >= PMPageSize)? PMPageSize : (DigiLeft % PMPageSize);\r
+               DigiLeft -= DigiNextLen;\r
+               if (!DigiLeft)\r
+                       DigiLastSegment = true;\r
+               DigiNextAddr = SDL_LoadDigiSegment(DigiPage++);\r
+       }\r
+       if (DigiMissed && DigiNextAddr)\r
+       {\r
+               SDL_PlayDigiSegment(DigiNextAddr,DigiNextLen);\r
+               DigiNextAddr = nil;\r
+               DigiMissed = false;\r
+               if (DigiLastSegment)\r
+               {\r
+                       DigiPlaying = false;\r
+                       DigiLastSegment = false;\r
+               }\r
+       }\r
+       SDL_SetTimerSpeed();\r
+}\r
+\r
+void\r
+SD_SetPosition(int leftpos,int rightpos)\r
+{\r
+       if\r
+       (\r
+               (leftpos < 0)\r
+       ||      (leftpos > 15)\r
+       ||      (rightpos < 0)\r
+       ||      (rightpos > 15)\r
+       ||      ((leftpos == 15) && (rightpos == 15))\r
+       )\r
+               Quit("SD_SetPosition: Illegal position");\r
+\r
+       switch (DigiMode)\r
+       {\r
+       case sds_SoundBlaster:\r
+               SDL_PositionSBP(leftpos,rightpos);\r
+               break;\r
+       }\r
+}\r
+\r
+void\r
+SD_PlayDigitized(word which,int leftpos,int rightpos)\r
+{\r
+       word    len;\r
+       memptr  addr;\r
+\r
+       if (!DigiMode)\r
+               return;\r
+\r
+       SD_StopDigitized();\r
+       if (which >= NumDigi)\r
+               Quit("SD_PlayDigitized: bad sound number");\r
+\r
+       SD_SetPosition(leftpos,rightpos);\r
+\r
+       DigiPage = DigiList[(which * 2) + 0];\r
+       DigiLeft = DigiList[(which * 2) + 1];\r
+\r
+       DigiLastStart = DigiPage;\r
+       DigiLastEnd = DigiPage + ((DigiLeft + (PMPageSize - 1)) / PMPageSize);\r
+\r
+       len = (DigiLeft >= PMPageSize)? PMPageSize : (DigiLeft % PMPageSize);\r
+       addr = SDL_LoadDigiSegment(DigiPage++);\r
+\r
+       DigiPlaying = true;\r
+       DigiLastSegment = false;\r
+\r
+       SDL_PlayDigiSegment(addr,len);\r
+       DigiLeft -= len;\r
+       if (!DigiLeft)\r
+               DigiLastSegment = true;\r
+\r
+       SD_Poll();\r
+}\r
+\r
+void\r
+SDL_DigitizedDone(void)\r
+{\r
+       if (DigiNextAddr)\r
+       {\r
+               SDL_PlayDigiSegment(DigiNextAddr,DigiNextLen);\r
+               DigiNextAddr = nil;\r
+               DigiMissed = false;\r
+       }\r
+       else\r
+       {\r
+               if (DigiLastSegment)\r
+               {\r
+                       DigiPlaying = false;\r
+                       DigiLastSegment = false;\r
+                       if ((DigiMode == sds_PC) && (SoundMode == sdm_PC))\r
+                       {\r
+                               SDL_SoundFinished();\r
+                       }\r
+                       else\r
+                               DigiNumber = DigiPriority = 0;\r
+                       SoundPositioned = false;\r
+               }\r
+               else\r
+                       DigiMissed = true;\r
+       }\r
+}\r
+\r
+void\r
+SD_SetDigiDevice(SDSMode mode)\r
+{\r
+       boolean devicenotpresent;\r
+\r
+       if (mode == DigiMode)\r
+               return;\r
+\r
+       SD_StopDigitized();\r
+\r
+       devicenotpresent = false;\r
+       switch (mode)\r
+       {\r
+       case sds_SoundBlaster:\r
+               if (!SoundBlasterPresent)\r
+               {\r
+                       if (SoundSourcePresent)\r
+                               mode = sds_SoundSource;\r
+                       else\r
+                               devicenotpresent = true;\r
+               }\r
+               break;\r
+       case sds_SoundSource:\r
+               if (!SoundSourcePresent)\r
+                       devicenotpresent = true;\r
+               break;\r
+       }\r
+\r
+       if (!devicenotpresent)\r
+       {\r
+               if (DigiMode == sds_SoundSource)\r
+                       SDL_ShutSS();\r
+\r
+               DigiMode = mode;\r
+\r
+               if (mode == sds_SoundSource)\r
+                       SDL_StartSS();\r
+\r
+               SDL_SetTimerSpeed();\r
+       }\r
+}\r
+\r
+void\r
+SDL_SetupDigi(void)\r
+{\r
+       memptr  list;\r
+       word    far *p,\r
+                       pg;\r
+       int             i;\r
+\r
+       PM_UnlockMainMem();\r
+       MM_GetPtr(&list,PMPageSize);\r
+       PM_CheckMainMem();\r
+       p = (word far *)MK_FP(PM_GetPage(ChunksInFile - 1),0);\r
+       _fmemcpy((void far *)list,(void far *)p,PMPageSize);\r
+       pg = PMSoundStart;\r
+       for (i = 0;i < PMPageSize / (sizeof(word) * 2);i++,p += 2)\r
+       {\r
+               if (pg >= ChunksInFile - 1)\r
+                       break;\r
+               pg += (p[1] + (PMPageSize - 1)) / PMPageSize;\r
+       }\r
+       PM_UnlockMainMem();\r
+       MM_GetPtr((memptr *)&DigiList,i * sizeof(word) * 2);\r
+       _fmemcpy((void far *)DigiList,(void far *)list,i * sizeof(word) * 2);\r
+       MM_FreePtr(&list);\r
+       NumDigi = i;\r
+\r
+       for (i = 0;i < LASTSOUND;i++)\r
+               DigiMap[i] = -1;\r
+}\r
+\r
+//     AdLib Code\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     alOut(n,b) - Puts b in AdLib card register n\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+alOut(byte n,byte b)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+asm    mov     dx,0x388\r
+asm    mov     al,[n]\r
+asm    out     dx,al\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    inc     dx\r
+asm    mov     al,[b]\r
+asm    out     dx,al\r
+\r
+asm    popf\r
+\r
+asm    dec     dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+asm    in      al,dx\r
+}\r
+\r
+#if 0\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_SetInstrument() - Puts an instrument into a generator\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_SetInstrument(int track,int which,Instrument far *inst,boolean percussive)\r
+{\r
+       byte            c,m;\r
+\r
+       if (percussive)\r
+       {\r
+               c = pcarriers[which];\r
+               m = pmodifiers[which];\r
+       }\r
+       else\r
+       {\r
+               c = carriers[which];\r
+               m = modifiers[which];\r
+       }\r
+\r
+       tracks[track - 1]->inst = *inst;\r
+       tracks[track - 1]->percussive = percussive;\r
+\r
+       alOut(m + alChar,inst->mChar);\r
+       alOut(m + alScale,inst->mScale);\r
+       alOut(m + alAttack,inst->mAttack);\r
+       alOut(m + alSus,inst->mSus);\r
+       alOut(m + alWave,inst->mWave);\r
+\r
+       // Most percussive instruments only use one cell\r
+       if (c != 0xff)\r
+       {\r
+               alOut(c + alChar,inst->cChar);\r
+               alOut(c + alScale,inst->cScale);\r
+               alOut(c + alAttack,inst->cAttack);\r
+               alOut(c + alSus,inst->cSus);\r
+               alOut(c + alWave,inst->cWave);\r
+       }\r
+\r
+       alOut(which + alFeedCon,inst->nConn);   // DEBUG - I think this is right\r
+}\r
+#endif\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_ALStopSound() - Turns off any sound effects playing through the\r
+//             AdLib card\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_ALStopSound(void)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       (long)alSound = 0;\r
+       alOut(alFreqH + 0,0);\r
+\r
+asm    popf\r
+}\r
+\r
+static void\r
+SDL_AlSetFXInst(Instrument far *inst)\r
+{\r
+       byte            c,m;\r
+\r
+       m = modifiers[0];\r
+       c = carriers[0];\r
+       alOut(m + alChar,inst->mChar);\r
+       alOut(m + alScale,inst->mScale);\r
+       alOut(m + alAttack,inst->mAttack);\r
+       alOut(m + alSus,inst->mSus);\r
+       alOut(m + alWave,inst->mWave);\r
+       alOut(c + alChar,inst->cChar);\r
+       alOut(c + alScale,inst->cScale);\r
+       alOut(c + alAttack,inst->cAttack);\r
+       alOut(c + alSus,inst->cSus);\r
+       alOut(c + alWave,inst->cWave);\r
+\r
+       // Note: Switch commenting on these lines for old MUSE compatibility\r
+//     alOut(alFeedCon,inst->nConn);\r
+       alOut(alFeedCon,0);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_ALPlaySound() - Plays the specified sound on the AdLib card\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#ifdef _MUSE_\r
+void\r
+#else\r
+static void\r
+#endif\r
+SDL_ALPlaySound(AdLibSound far *sound)\r
+{\r
+       Instrument      far *inst;\r
+       byte            huge *data;\r
+\r
+       SDL_ALStopSound();\r
+\r
+asm    pushf\r
+asm    cli\r
+\r
+       alLengthLeft = sound->common.length;\r
+       data = sound->data;\r
+       data++;\r
+       data--;\r
+       alSound = (byte far *)data;\r
+       alBlock = ((sound->block & 7) << 2) | 0x20;\r
+       inst = &sound->inst;\r
+\r
+       if (!(inst->mSus | inst->cSus))\r
+       {\r
+       asm     popf\r
+               Quit("SDL_ALPlaySound() - Bad instrument");\r
+       }\r
+\r
+       SDL_AlSetFXInst(&alZeroInst);   // DEBUG\r
+       SDL_AlSetFXInst(inst);\r
+\r
+asm    popf\r
+}\r
+\r
+#if 0\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_ALSoundService() - Plays the next sample out through the AdLib card\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+//static void\r
+void\r
+SDL_ALSoundService(void)\r
+{\r
+       byte    s;\r
+\r
+       if (alSound)\r
+       {\r
+               s = *alSound++;\r
+               if (!s)\r
+                       alOut(alFreqH + 0,0);\r
+               else\r
+               {\r
+                       alOut(alFreqL + 0,s);\r
+                       alOut(alFreqH + 0,alBlock);\r
+               }\r
+\r
+               if (!(--alLengthLeft))\r
+               {\r
+                       (long)alSound = 0;\r
+                       alOut(alFreqH + 0,0);\r
+                       SDL_SoundFinished();\r
+               }\r
+       }\r
+}\r
+#endif\r
+\r
+#if 0\r
+void\r
+SDL_ALService(void)\r
+{\r
+       byte    a,v;\r
+       word    w;\r
+\r
+       if (!sqActive)\r
+               return;\r
+\r
+       while (sqHackLen && (sqHackTime <= alTimeCount))\r
+       {\r
+               w = *sqHackPtr++;\r
+               sqHackTime = alTimeCount + *sqHackPtr++;\r
+       asm     mov     dx,[w]\r
+       asm     mov     [a],dl\r
+       asm     mov     [v],dh\r
+               alOut(a,v);\r
+               sqHackLen -= 4;\r
+       }\r
+       alTimeCount++;\r
+       if (!sqHackLen)\r
+       {\r
+               sqHackPtr = (word far *)sqHack;\r
+               sqHackLen = sqHackSeqLen;\r
+               alTimeCount = sqHackTime = 0;\r
+       }\r
+}\r
+#endif\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_ShutAL() - Shuts down the AdLib card for sound effects\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_ShutAL(void)\r
+{\r
+asm    pushf\r
+asm    cli\r
+\r
+       alOut(alEffects,0);\r
+       alOut(alFreqH + 0,0);\r
+       SDL_AlSetFXInst(&alZeroInst);\r
+       alSound = 0;\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_CleanAL() - Totally shuts down the AdLib card\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_CleanAL(void)\r
+{\r
+       int     i;\r
+\r
+asm    pushf\r
+asm    cli\r
+\r
+       alOut(alEffects,0);\r
+       for (i = 1;i < 0xf5;i++)\r
+               alOut(i,0);\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_StartAL() - Starts up the AdLib card for sound effects\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_StartAL(void)\r
+{\r
+       alFXReg = 0;\r
+       alOut(alEffects,alFXReg);\r
+       SDL_AlSetFXInst(&alZeroInst);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_DetectAdLib() - Determines if there's an AdLib (or SoundBlaster\r
+//             emulating an AdLib) present\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+SDL_DetectAdLib(void)\r
+{\r
+       byte    status1,status2;\r
+       int             i;\r
+\r
+       alOut(4,0x60);  // Reset T1 & T2\r
+       alOut(4,0x80);  // Reset IRQ\r
+       status1 = readstat();\r
+       alOut(2,0xff);  // Set timer 1\r
+       alOut(4,0x21);  // Start timer 1\r
+#if 0\r
+       SDL_Delay(TimerDelay100);\r
+#else\r
+asm    mov     dx,0x388\r
+asm    mov     cx,100\r
+usecloop:\r
+asm    in      al,dx\r
+asm    loop usecloop\r
+#endif\r
+\r
+       status2 = readstat();\r
+       alOut(4,0x60);\r
+       alOut(4,0x80);\r
+\r
+       if (((status1 & 0xe0) == 0x00) && ((status2 & 0xe0) == 0xc0))\r
+       {\r
+               for (i = 1;i <= 0xf5;i++)       // Zero all the registers\r
+                       alOut(i,0);\r
+\r
+               alOut(1,0x20);  // Set WSE=1\r
+               alOut(8,0);             // Set CSM=0 & SEL=0\r
+\r
+               return(true);\r
+       }\r
+       else\r
+               return(false);\r
+}\r
+\r
+#if 0\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_t0Service() - My timer 0 ISR which handles the different timings and\r
+//             dispatches to whatever other routines are appropriate\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void interrupt\r
+SDL_t0Service(void)\r
+{\r
+static word    count = 1;\r
+\r
+#if 1  // for debugging\r
+asm    mov     dx,STATUS_REGISTER_1\r
+asm    in      al,dx\r
+asm    mov     dx,ATR_INDEX\r
+asm    mov     al,ATR_OVERSCAN\r
+asm    out     dx,al\r
+asm    mov     al,4    // red\r
+asm    out     dx,al\r
+#endif\r
+\r
+       HackCount++;\r
+\r
+       if ((MusicMode == smm_AdLib) || (DigiMode == sds_SoundSource))\r
+       {\r
+               SDL_ALService();\r
+               SDL_SSService();\r
+//             if (!(++count & 7))\r
+               if (!(++count % 10))\r
+               {\r
+                       LocalTime++;\r
+                       TimeCount++;\r
+                       if (SoundUserHook)\r
+                               SoundUserHook();\r
+               }\r
+//             if (!(count & 3))\r
+               if (!(count % 5))\r
+               {\r
+                       switch (SoundMode)\r
+                       {\r
+                       case sdm_PC:\r
+                               SDL_PCService();\r
+                               break;\r
+                       case sdm_AdLib:\r
+                               SDL_ALSoundService();\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+       else\r
+       {\r
+               if (!(++count & 1))\r
+               {\r
+                       LocalTime++;\r
+                       TimeCount++;\r
+                       if (SoundUserHook)\r
+                               SoundUserHook();\r
+               }\r
+               switch (SoundMode)\r
+               {\r
+               case sdm_PC:\r
+                       SDL_PCService();\r
+                       break;\r
+               case sdm_AdLib:\r
+                       SDL_ALSoundService();\r
+                       break;\r
+               }\r
+       }\r
+\r
+asm    mov     ax,[WORD PTR TimerCount]\r
+asm    add     ax,[WORD PTR TimerDivisor]\r
+asm    mov     [WORD PTR TimerCount],ax\r
+asm    jnc     myack\r
+       t0OldService();                 // If we overflow a word, time to call old int handler\r
+asm    jmp     olddone\r
+myack:;\r
+       outportb(0x20,0x20);    // Ack the interrupt\r
+olddone:;\r
+\r
+#if 1  // for debugging\r
+asm    mov     dx,STATUS_REGISTER_1\r
+asm    in      al,dx\r
+asm    mov     dx,ATR_INDEX\r
+asm    mov     al,ATR_OVERSCAN\r
+asm    out     dx,al\r
+asm    mov     al,3    // blue\r
+asm    out     dx,al\r
+asm    mov     al,0x20 // normal\r
+asm    out     dx,al\r
+#endif\r
+}\r
+#endif\r
+\r
+////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_ShutDevice() - turns off whatever device was being used for sound fx\r
+//\r
+////////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_ShutDevice(void)\r
+{\r
+       switch (SoundMode)\r
+       {\r
+       case sdm_PC:\r
+               SDL_ShutPC();\r
+               break;\r
+       case sdm_AdLib:\r
+               SDL_ShutAL();\r
+               break;\r
+       }\r
+       SoundMode = sdm_Off;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_CleanDevice() - totally shuts down all sound devices\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_CleanDevice(void)\r
+{\r
+       if ((SoundMode == sdm_AdLib) || (MusicMode == smm_AdLib))\r
+               SDL_CleanAL();\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SDL_StartDevice() - turns on whatever device is to be used for sound fx\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+SDL_StartDevice(void)\r
+{\r
+       switch (SoundMode)\r
+       {\r
+       case sdm_AdLib:\r
+               SDL_StartAL();\r
+               break;\r
+       }\r
+       SoundNumber = SoundPriority = 0;\r
+}\r
+\r
+//     Public routines\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_SetSoundMode() - Sets which sound hardware to use for sound effects\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+boolean\r
+SD_SetSoundMode(SDMode mode)\r
+{\r
+       boolean result = false;\r
+       word    tableoffset;\r
+\r
+       SD_StopSound();\r
+\r
+#ifndef        _MUSE_\r
+       if ((mode == sdm_AdLib) && !AdLibPresent)\r
+               mode = sdm_PC;\r
+\r
+       switch (mode)\r
+       {\r
+       case sdm_Off:\r
+               NeedsDigitized = false;\r
+               result = true;\r
+               break;\r
+       case sdm_PC:\r
+               tableoffset = STARTPCSOUNDS;\r
+               NeedsDigitized = false;\r
+               result = true;\r
+               break;\r
+       case sdm_AdLib:\r
+               if (AdLibPresent)\r
+               {\r
+                       tableoffset = STARTADLIBSOUNDS;\r
+                       NeedsDigitized = false;\r
+                       result = true;\r
+               }\r
+               break;\r
+       }\r
+#else\r
+       result = true;\r
+#endif\r
+\r
+       if (result && (mode != SoundMode))\r
+       {\r
+               SDL_ShutDevice();\r
+               SoundMode = mode;\r
+#ifndef        _MUSE_\r
+               SoundTable = (word *)(&audiosegs[tableoffset]);\r
+#endif\r
+               SDL_StartDevice();\r
+       }\r
+\r
+       SDL_SetTimerSpeed();\r
+\r
+       return(result);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_SetMusicMode() - sets the device to use for background music\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+boolean\r
+SD_SetMusicMode(SMMode mode)\r
+{\r
+       boolean result = false;\r
+\r
+       SD_FadeOutMusic();\r
+       while (SD_MusicPlaying())\r
+               ;\r
+\r
+       switch (mode)\r
+       {\r
+       case smm_Off:\r
+               NeedsMusic = false;\r
+               result = true;\r
+               break;\r
+       case smm_AdLib:\r
+               if (AdLibPresent)\r
+               {\r
+                       NeedsMusic = true;\r
+                       result = true;\r
+               }\r
+               break;\r
+       }\r
+\r
+       if (result)\r
+               MusicMode = mode;\r
+\r
+       SDL_SetTimerSpeed();\r
+\r
+       return(result);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_Startup() - starts up the Sound Mgr\r
+//             Detects all additional sound hardware and installs my ISR\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_Startup(void)\r
+{\r
+       int     i;\r
+\r
+       if (SD_Started)\r
+               return;\r
+\r
+       SDL_SetDS();\r
+\r
+       ssIsTandy = false;\r
+       ssNoCheck = false;\r
+       alNoCheck = false;\r
+       sbNoCheck = false;\r
+       sbNoProCheck = false;\r
+#ifndef        _MUSE_\r
+       for (i = 1;i < _argc;i++)\r
+       {\r
+               switch (US_CheckParm(_argv[i],ParmStrings))\r
+               {\r
+               case 0:                                         // No AdLib detection\r
+                       alNoCheck = true;\r
+                       break;\r
+               case 1:                                         // No SoundBlaster detection\r
+                       sbNoCheck = true;\r
+                       break;\r
+               case 2:                                         // No SoundBlaster Pro detection\r
+                       sbNoProCheck = true;\r
+                       break;\r
+               case 3:\r
+                       ssNoCheck = true;               // No Sound Source detection\r
+                       break;\r
+               case 4:                                         // Tandy Sound Source handling\r
+                       ssIsTandy = true;\r
+                       break;\r
+               case 5:                                         // Sound Source present at LPT1\r
+                       ssPort = 1;\r
+                       ssNoCheck = SoundSourcePresent = true;\r
+                       break;\r
+               case 6:                     // Sound Source present at LPT2\r
+                       ssPort = 2;\r
+                       ssNoCheck = SoundSourcePresent = true;\r
+                       break;\r
+               case 7:                     // Sound Source present at LPT3\r
+                       ssPort = 3;\r
+                       ssNoCheck = SoundSourcePresent = true;\r
+                       break;\r
+               }\r
+       }\r
+#endif\r
+\r
+       SoundUserHook = 0;\r
+\r
+       t0OldService = getvect(8);      // Get old timer 0 ISR\r
+\r
+       LocalTime = TimeCount = alTimeCount = 0;\r
+\r
+       SD_SetSoundMode(sdm_Off);\r
+       SD_SetMusicMode(smm_Off);\r
+\r
+       if (!ssNoCheck)\r
+               SoundSourcePresent = SDL_DetectSoundSource();\r
+\r
+       if (!alNoCheck)\r
+       {\r
+               AdLibPresent = SDL_DetectAdLib();\r
+               if (AdLibPresent && !sbNoCheck)\r
+               {\r
+                       int port = -1;\r
+                       char *env = getenv("BLASTER");\r
+                       if (env)\r
+                       {\r
+                               long temp;\r
+                               while (*env)\r
+                               {\r
+                                       while (isspace(*env))\r
+                                               env++;\r
+\r
+                                       switch (toupper(*env))\r
+                                       {\r
+                                       case 'A':\r
+                                               temp = strtol(env + 1,&env,16);\r
+                                               if\r
+                                               (\r
+                                                       (temp >= 0x210)\r
+                                               &&      (temp <= 0x260)\r
+                                               &&      (!(temp & 0x00f))\r
+                                               )\r
+                                                       port = (temp - 0x200) >> 4;\r
+                                               else\r
+                                                       Quit("SD_Startup: Unsupported address value in BLASTER");\r
+                                               break;\r
+                                       case 'I':\r
+                                               temp = strtol(env + 1,&env,10);\r
+                                               if\r
+                                               (\r
+                                                       (temp >= 0)\r
+                                               &&      (temp <= 10)\r
+                                               &&      (sbIntVectors[temp] != -1)\r
+                                               )\r
+                                               {\r
+                                                       sbInterrupt = temp;\r
+                                                       sbIntVec = sbIntVectors[sbInterrupt];\r
+                                               }\r
+                                               else\r
+                                                       Quit("SD_Startup: Unsupported interrupt value in BLASTER");\r
+                                               break;\r
+                                       case 'D':\r
+                                               temp = strtol(env + 1,&env,10);\r
+                                               if ((temp == 0) || (temp == 1) || (temp == 3))\r
+                                                       SDL_SBSetDMA(temp);\r
+                                               else\r
+                                                       Quit("SD_Startup: Unsupported DMA value in BLASTER");\r
+                                               break;\r
+                                       default:\r
+                                               while (isspace(*env))\r
+                                                       env++;\r
+                                               while (*env && !isspace(*env))\r
+                                                       env++;\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+                       SoundBlasterPresent = SDL_DetectSoundBlaster(port);\r
+               }\r
+       }\r
+\r
+       for (i = 0;i < 255;i++)\r
+               pcSoundLookup[i] = i * 60;\r
+\r
+       if (SoundBlasterPresent)\r
+               SDL_StartSB();\r
+\r
+       SDL_SetupDigi();\r
+\r
+       SD_Started = true;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_Default() - Sets up the default behaviour for the Sound Mgr whether\r
+//             the config file was present or not.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_Default(boolean gotit,SDMode sd,SMMode sm)\r
+{\r
+       boolean gotsd,gotsm;\r
+\r
+       gotsd = gotsm = gotit;\r
+\r
+       if (gotsd)      // Make sure requested sound hardware is available\r
+       {\r
+               switch (sd)\r
+               {\r
+               case sdm_AdLib:\r
+                       gotsd = AdLibPresent;\r
+                       break;\r
+               }\r
+       }\r
+       if (!gotsd)\r
+       {\r
+               if (AdLibPresent)\r
+                       sd = sdm_AdLib;\r
+               else\r
+                       sd = sdm_PC;\r
+       }\r
+       if (sd != SoundMode)\r
+               SD_SetSoundMode(sd);\r
+\r
+\r
+       if (gotsm)      // Make sure requested music hardware is available\r
+       {\r
+               switch (sm)\r
+               {\r
+               case sdm_AdLib:\r
+                       gotsm = AdLibPresent;\r
+                       break;\r
+               }\r
+       }\r
+       if (!gotsm)\r
+       {\r
+               if (AdLibPresent)\r
+                       sm = smm_AdLib;\r
+       }\r
+       if (sm != MusicMode)\r
+               SD_SetMusicMode(sm);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_Shutdown() - shuts down the Sound Mgr\r
+//             Removes sound ISR and turns off whatever sound hardware was active\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_Shutdown(void)\r
+{\r
+       if (!SD_Started)\r
+               return;\r
+\r
+       SD_MusicOff();\r
+       SD_StopSound();\r
+       SDL_ShutDevice();\r
+       SDL_CleanDevice();\r
+\r
+       if (SoundBlasterPresent)\r
+               SDL_ShutSB();\r
+\r
+       if (SoundSourcePresent)\r
+               SDL_ShutSS();\r
+\r
+       asm     pushf\r
+       asm     cli\r
+\r
+       SDL_SetTimer0(0);\r
+\r
+       setvect(8,t0OldService);\r
+\r
+       asm     popf\r
+\r
+       SD_Started = false;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_SetUserHook() - sets the routine that the Sound Mgr calls every 1/70th\r
+//             of a second from its timer 0 ISR\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_SetUserHook(void (* hook)(void))\r
+{\r
+       SoundUserHook = hook;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_PositionSound() - Sets up a stereo imaging location for the next\r
+//             sound to be played. Each channel ranges from 0 to 15.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_PositionSound(int leftvol,int rightvol)\r
+{\r
+       LeftPosition = leftvol;\r
+       RightPosition = rightvol;\r
+       nextsoundpos = true;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_PlaySound() - plays the specified sound on the appropriate hardware\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+boolean\r
+SD_PlaySound(soundnames sound)\r
+{\r
+       boolean         ispos;\r
+       SoundCommon     far *s;\r
+       int     lp,rp;\r
+\r
+       lp = LeftPosition;\r
+       rp = RightPosition;\r
+       LeftPosition = 0;\r
+       RightPosition = 0;\r
+\r
+       ispos = nextsoundpos;\r
+       nextsoundpos = false;\r
+\r
+       if (sound == -1)\r
+               return(false);\r
+\r
+       s = MK_FP(SoundTable[sound],0);\r
+       if ((SoundMode != sdm_Off) && !s)\r
+               Quit("SD_PlaySound() - Uncached sound");\r
+\r
+       if ((DigiMode != sds_Off) && (DigiMap[sound] != -1))\r
+       {\r
+               if ((DigiMode == sds_PC) && (SoundMode == sdm_PC))\r
+               {\r
+                       if (s->priority < SoundPriority)\r
+                               return(false);\r
+\r
+                       SDL_PCStopSound();\r
+\r
+                       SD_PlayDigitized(DigiMap[sound],lp,rp);\r
+                       SoundPositioned = ispos;\r
+                       SoundNumber = sound;\r
+                       SoundPriority = s->priority;\r
+               }\r
+               else\r
+               {\r
+               asm     pushf\r
+               asm     cli\r
+                       if (DigiPriority && !DigiNumber)\r
+                       {\r
+                       asm     popf\r
+                               Quit("SD_PlaySound: Priority without a sound");\r
+                       }\r
+               asm     popf\r
+\r
+                       if (s->priority < DigiPriority)\r
+                               return(false);\r
+\r
+                       SD_PlayDigitized(DigiMap[sound],lp,rp);\r
+                       SoundPositioned = ispos;\r
+                       DigiNumber = sound;\r
+                       DigiPriority = s->priority;\r
+               }\r
+\r
+               return(true);\r
+       }\r
+\r
+       if (SoundMode == sdm_Off)\r
+               return(false);\r
+       if (!s->length)\r
+               Quit("SD_PlaySound() - Zero length sound");\r
+       if (s->priority < SoundPriority)\r
+               return(false);\r
+\r
+       switch (SoundMode)\r
+       {\r
+       case sdm_PC:\r
+               SDL_PCPlaySound((void far *)s);\r
+               break;\r
+       case sdm_AdLib:\r
+               SDL_ALPlaySound((void far *)s);\r
+               break;\r
+       }\r
+\r
+       SoundNumber = sound;\r
+       SoundPriority = s->priority;\r
+\r
+       return(false);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_SoundPlaying() - returns the sound number that's playing, or 0 if\r
+//             no sound is playing\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+word\r
+SD_SoundPlaying(void)\r
+{\r
+       boolean result = false;\r
+\r
+       switch (SoundMode)\r
+       {\r
+       case sdm_PC:\r
+               result = pcSound? true : false;\r
+               break;\r
+       case sdm_AdLib:\r
+               result = alSound? true : false;\r
+               break;\r
+       }\r
+\r
+       if (result)\r
+               return(SoundNumber);\r
+       else\r
+               return(false);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_StopSound() - if a sound is playing, stops it\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_StopSound(void)\r
+{\r
+       if (DigiPlaying)\r
+               SD_StopDigitized();\r
+\r
+       switch (SoundMode)\r
+       {\r
+       case sdm_PC:\r
+               SDL_PCStopSound();\r
+               break;\r
+       case sdm_AdLib:\r
+               SDL_ALStopSound();\r
+               break;\r
+       }\r
+\r
+       SoundPositioned = false;\r
+\r
+       SDL_SoundFinished();\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_WaitSoundDone() - waits until the current sound is done playing\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_WaitSoundDone(void)\r
+{\r
+       while (SD_SoundPlaying())\r
+               ;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_MusicOn() - turns on the sequencer\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_MusicOn(void)\r
+{\r
+       sqActive = true;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_MusicOff() - turns off the sequencer and any playing notes\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_MusicOff(void)\r
+{\r
+       word    i;\r
+\r
+\r
+       switch (MusicMode)\r
+       {\r
+       case smm_AdLib:\r
+               alFXReg = 0;\r
+               alOut(alEffects,0);\r
+               for (i = 0;i < sqMaxTracks;i++)\r
+                       alOut(alFreqH + i + 1,0);\r
+               break;\r
+       }\r
+       sqActive = false;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_StartMusic() - starts playing the music pointed to\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_StartMusic(MusicGroup far *music)\r
+{\r
+       SD_MusicOff();\r
+asm    pushf\r
+asm    cli\r
+\r
+       if (MusicMode == smm_AdLib)\r
+       {\r
+               sqHackPtr = sqHack = music->values;\r
+               sqHackSeqLen = sqHackLen = music->length;\r
+               sqHackTime = 0;\r
+               alTimeCount = 0;\r
+               SD_MusicOn();\r
+       }\r
+\r
+asm    popf\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_FadeOutMusic() - starts fading out the music. Call SD_MusicPlaying()\r
+//             to see if the fadeout is complete\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+SD_FadeOutMusic(void)\r
+{\r
+       switch (MusicMode)\r
+       {\r
+       case smm_AdLib:\r
+               // DEBUG - quick hack to turn the music off\r
+               SD_MusicOff();\r
+               break;\r
+       }\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     SD_MusicPlaying() - returns true if music is currently playing, false if\r
+//             not\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+boolean\r
+SD_MusicPlaying(void)\r
+{\r
+       boolean result;\r
+\r
+       switch (MusicMode)\r
+       {\r
+       case smm_AdLib:\r
+               result = false;\r
+               // DEBUG - not written\r
+               break;\r
+       default:\r
+               result = false;\r
+       }\r
+\r
+       return(result);\r
+}\r
diff --git a/16/wf3d8086/id_sd.equ b/16/wf3d8086/id_sd.equ
new file mode 100755 (executable)
index 0000000..1b1d4e6
--- /dev/null
@@ -0,0 +1,38 @@
+;\r
+;      ID_SD.EQU\r
+;      Id Sound Manager assembly equates\r
+;\r
+\r
+       INCLUDE 'ID_VL.EQU'     ; For screen color debugging stuff\r
+\r
+;      Modes\r
+sdm_Off                                =       0\r
+sdm_PC                         =       1\r
+sdm_AdLib                      =       2\r
+\r
+smm_Off                                =       0\r
+smm_AdLib                      =       1\r
+\r
+sds_Off                                =       0\r
+sds_SoundSource                =       1\r
+sds_SoundBlaster       =       2\r
+\r
+;      Stuff for the PC speaker\r
+pcTimer                                =       42h\r
+pcTAccess                      =       43h\r
+pcSpeaker                      =       61h\r
+pcSpkBits                      =       3\r
+\r
+;      Stuff for the AdLib\r
+;      Operator registers\r
+alChar                         =       20h\r
+alScale                                =       40h\r
+alAttack                       =       60h\r
+alSus                          =       80h\r
+alWave                         =       0e0h\r
+;      Channel registers\r
+alFreqL                                =       0a0h\r
+alFreqH                                =       0b0h\r
+alFeedCon                      =       0c0h\r
+;      Global registers\r
+alEffects                      =       0bdh\r
diff --git a/16/wf3d8086/id_sd.h b/16/wf3d8086/id_sd.h
new file mode 100755 (executable)
index 0000000..1fa4c16
--- /dev/null
@@ -0,0 +1,237 @@
+//\r
+//     ID Engine\r
+//     ID_SD.h - Sound Manager Header\r
+//     Version for Wolfenstein\r
+//     By Jason Blochowiak\r
+//\r
+\r
+#ifndef        __ID_SD__\r
+#define        __ID_SD__\r
+\r
+void   alOut(byte n,byte b);\r
+\r
+#ifdef __DEBUG__\r
+#define        __DEBUG_SoundMgr__\r
+#endif\r
+\r
+#define        TickBase        70              // 70Hz per tick - used as a base for timer 0\r
+\r
+typedef        enum    {\r
+                                       sdm_Off,\r
+                                       sdm_PC,sdm_AdLib,\r
+                               }       SDMode;\r
+typedef        enum    {\r
+                                       smm_Off,smm_AdLib\r
+                               }       SMMode;\r
+typedef        enum    {\r
+                                       sds_Off,sds_PC,sds_SoundSource,sds_SoundBlaster\r
+                               }       SDSMode;\r
+typedef        struct\r
+               {\r
+                       longword        length;\r
+                       word            priority;\r
+               } SoundCommon;\r
+\r
+//     PC Sound stuff\r
+#define        pcTimer         0x42\r
+#define        pcTAccess       0x43\r
+#define        pcSpeaker       0x61\r
+\r
+#define        pcSpkBits       3\r
+\r
+typedef        struct\r
+               {\r
+                       SoundCommon     common;\r
+                       byte            data[1];\r
+               } PCSound;\r
+\r
+//     Registers for the Sound Blaster card - needs to be offset by n0 (0x10,0x20,0x30,0x40,0x50,0x60)\r
+#define        sbReset         0x206   // W\r
+#define        sbFMStatus      0x208   // R\r
+#define        sbFMAddr        0x208   // W\r
+#define        sbFMData        0x209   // W\r
+#define        sbReadData      0x20a   // R\r
+#define        sbWriteCmd      0x20c   // W\r
+#define        sbWriteData     0x20c   // W\r
+#define        sbWriteStat     0x20c   // R\r
+#define        sbDataAvail     0x20e   // R\r
+\r
+//     Registers for the Sound Blaster Pro card - needs to be offset by n0 (0x20 or 0x40)\r
+#define        sbpLFMStatus    0x200   // R\r
+#define        sbpLFMAddr              0x200   // W\r
+#define        sbpLFMData              0x201   // W\r
+#define        sbpRFMStatus    0x202   // R\r
+#define        sbpRFMAddr              0x202   // W\r
+#define        sbpRFMData              0x203   // W\r
+#define        sbpMixerAddr    0x204   // W\r
+#define        sbpMixerData    0x205   // RW\r
+#define        sbpCDData               0x210   // R\r
+#define        sbpCDCommand    0x210   // W\r
+#define        sbpCDStatus             0x211   // R\r
+#define        sbpCDReset              0x212   // W\r
+\r
+//     SBPro Mixer addresses\r
+#define        sbpmReset               0x00\r
+#define        sbpmVoiceVol    0x04\r
+#define        sbpmMicMix              0x0a\r
+#define        sbpmFilterADC   0x0c\r
+#define        sbpmControl             0x0e\r
+#define        sbpmMasterVol   0x22\r
+#define        sbpmFMVol               0x26\r
+#define        sbpmCDVol               0x28\r
+#define        sbpmLineVol             0x2e\r
+\r
+typedef        struct\r
+               {\r
+                       SoundCommon     common;\r
+                       word            hertz;\r
+                       byte            bits,\r
+                                               reference,\r
+                                               data[1];\r
+               } SampledSound;\r
+\r
+//     Registers for the AdLib card\r
+#define        alFMStatus      0x388   // R\r
+#define        alFMAddr        0x388   // W\r
+#define        alFMData        0x389   // W\r
+\r
+//     Register addresses\r
+// Operator stuff\r
+#define        alChar          0x20\r
+#define        alScale         0x40\r
+#define        alAttack        0x60\r
+#define        alSus           0x80\r
+#define        alWave          0xe0\r
+// Channel stuff\r
+#define        alFreqL         0xa0\r
+#define        alFreqH         0xb0\r
+#define        alFeedCon       0xc0\r
+// Global stuff\r
+#define        alEffects       0xbd\r
+\r
+typedef        struct\r
+               {\r
+                       byte    mChar,cChar,\r
+                                       mScale,cScale,\r
+                                       mAttack,cAttack,\r
+                                       mSus,cSus,\r
+                                       mWave,cWave,\r
+                                       nConn,\r
+\r
+                                       // These are only for Muse - these bytes are really unused\r
+                                       voice,\r
+                                       mode,\r
+                                       unused[3];\r
+               } Instrument;\r
+\r
+typedef        struct\r
+               {\r
+                       SoundCommon     common;\r
+                       Instrument      inst;\r
+                       byte            block,\r
+                                               data[1];\r
+               } AdLibSound;\r
+\r
+//\r
+//     Sequencing stuff\r
+//\r
+#define        sqMaxTracks     10\r
+#define        sqMaxMoods      1       // DEBUG\r
+\r
+#define        sev_Null                0       // Does nothing\r
+#define        sev_NoteOff             1       // Turns a note off\r
+#define        sev_NoteOn              2       // Turns a note on\r
+#define        sev_NotePitch   3       // Sets the pitch of a currently playing note\r
+#define        sev_NewInst             4       // Installs a new instrument\r
+#define        sev_NewPerc             5       // Installs a new percussive instrument\r
+#define        sev_PercOn              6       // Turns a percussive note on\r
+#define        sev_PercOff             7       // Turns a percussive note off\r
+#define        sev_SeqEnd              -1      // Terminates a sequence\r
+\r
+//     Flags for MusicGroup.flags\r
+#define        sf_Melodic              0\r
+#define        sf_Percussive   1\r
+\r
+#if 1\r
+typedef        struct\r
+               {\r
+                       word    length,\r
+                                       values[1];\r
+               } MusicGroup;\r
+#else\r
+typedef        struct\r
+               {\r
+                       word    flags,\r
+                                       count,\r
+                                       offsets[1];\r
+               } MusicGroup;\r
+#endif\r
+\r
+typedef        struct\r
+               {\r
+                       /* This part needs to be set up by the user */\r
+                       word        mood,far *moods[sqMaxMoods];\r
+\r
+                       /* The rest is set up by the code */\r
+                       Instrument      inst;\r
+                       boolean         percussive;\r
+                       word            far *seq;\r
+                       longword        nextevent;\r
+               } ActiveTrack;\r
+\r
+#define        sqmode_Normal           0\r
+#define        sqmode_FadeIn           1\r
+#define        sqmode_FadeOut          2\r
+\r
+#define        sqMaxFade               64      // DEBUG\r
+\r
+\r
+// Global variables\r
+extern boolean         AdLibPresent,\r
+                                       SoundSourcePresent,\r
+                                       SoundBlasterPresent,\r
+                                       NeedsMusic,                                     // For Caching Mgr\r
+                                       SoundPositioned;\r
+extern SDMode          SoundMode;\r
+extern SDSMode         DigiMode;\r
+extern SMMode          MusicMode;\r
+extern boolean         DigiPlaying;\r
+extern int                     DigiMap[];\r
+extern longword        TimeCount;                                      // Global time in ticks\r
+\r
+// Function prototypes\r
+extern void    SD_Startup(void),\r
+                               SD_Shutdown(void),\r
+                               SD_Default(boolean gotit,SDMode sd,SMMode sm),\r
+\r
+                               SD_PositionSound(int leftvol,int rightvol);\r
+extern boolean SD_PlaySound(soundnames sound);\r
+extern void    SD_SetPosition(int leftvol,int rightvol),\r
+                               SD_StopSound(void),\r
+                               SD_WaitSoundDone(void),\r
+\r
+                               SD_StartMusic(MusicGroup far *music),\r
+                               SD_MusicOn(void),\r
+                               SD_MusicOff(void),\r
+                               SD_FadeOutMusic(void),\r
+\r
+                               SD_SetUserHook(void (*hook)(void));\r
+extern boolean SD_MusicPlaying(void),\r
+                               SD_SetSoundMode(SDMode mode),\r
+                               SD_SetMusicMode(SMMode mode);\r
+extern word    SD_SoundPlaying(void);\r
+\r
+extern void    SD_SetDigiDevice(SDSMode),\r
+                               SD_PlayDigitized(word which,int leftpos,int rightpos),\r
+                               SD_StopDigitized(void),\r
+                               SD_Poll(void);\r
+\r
+#ifdef _MUSE_  // MUSE Goes directly to the lower level routines\r
+extern void    SDL_PCPlaySound(PCSound far *sound),\r
+                               SDL_PCStopSound(void),\r
+                               SDL_ALPlaySound(AdLibSound far *sound),\r
+                               SDL_ALStopSound(void);\r
+#endif\r
+\r
+#endif\r
+\r
diff --git a/16/wf3d8086/id_sd_a.asm b/16/wf3d8086/id_sd_a.asm
new file mode 100755 (executable)
index 0000000..2de0ea6
--- /dev/null
@@ -0,0 +1,572 @@
+;\r
+;      ID_SD_A.ASM\r
+;      Id Sound Manager assembly stuff\r
+\r
+       .8086\r
+       IDEAL\r
+       MODEL   MEDIUM,C\r
+       JUMPS\r
+\r
+       INCLUDE 'ID_SD.EQU'\r
+\r
+DEBUG  =       0\r
+\r
+       EXTRN   SDL_DigitizedDone:FAR\r
+       EXTRN   alOut:FAR\r
+\r
+;============================================================================\r
+\r
+DATASEG\r
+\r
+       EXTRN   sqActive:WORD\r
+       EXTRN   ssSample:DWORD\r
+       EXTRN   ssLengthLeft:WORD\r
+       EXTRN   ssControl:WORD\r
+       EXTRN   ssStatus:WORD\r
+       EXTRN   ssData:WORD\r
+       EXTRN   ssOn:BYTE\r
+       EXTRN   ssOff:BYTE\r
+\r
+       EXTRN   pcSound:DWORD\r
+       EXTRN   pcLengthLeft:WORD\r
+       EXTRN   pcLastSample:BYTE\r
+       EXTRN   pcSoundLookup:WORD\r
+\r
+       EXTRN   alSound:DWORD\r
+       EXTRN   alBlock:WORD\r
+       EXTRN   alLengthLeft:WORD\r
+       EXTRN   alTimeCount:DWORD\r
+\r
+       EXTRN   sqHack:DWORD\r
+       EXTRN   sqHackPtr:DWORD\r
+       EXTRN   sqHackLen:WORD\r
+       EXTRN   sqHackSeqLen:WORD\r
+       EXTRN   sqHackTime:DWORD\r
+\r
+       EXTRN   HackCount:WORD\r
+       EXTRN   TimeCount:WORD\r
+       EXTRN   LocalTime:WORD\r
+\r
+       EXTRN   TimerCount:WORD\r
+       EXTRN   TimerDivisor:WORD\r
+       EXTRN   t0OldService:DWORD\r
+\r
+       EXTRN   SoundMode:WORD\r
+       EXTRN   DigiMode:WORD\r
+\r
+       EXTRN   SoundNumber:WORD\r
+       EXTRN   SoundPriority:WORD\r
+\r
+count_time     dw      ?\r
+count_fx       dw      ?\r
+\r
+pcdtab db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+\r
+\r
+;============================================================================\r
+\r
+CODESEG\r
+\r
+MyDS   dw      ?\r
+\r
+pcindicate     dw      ?\r
+extreme                dw      ?\r
+\r
+       PROC    SDL_SetDS\r
+       PUBLIC  SDL_SetDS\r
+\r
+       mov     ax,ds\r
+       mov     [cs:MyDS],ds\r
+       ret\r
+\r
+       ENDP\r
+\r
+;\r
+;      COMMONSTART\r
+;      Macro used for common prefix code\r
+;\r
+       MACRO   COMMONSTART\r
+       IF DEBUG\r
+       push dx\r
+       push ax\r
+       mov     dx,STATUS_REGISTER_1\r
+       in      al,dx\r
+       mov     dx,ATR_INDEX\r
+       mov     al,ATR_OVERSCAN\r
+       out     dx,al\r
+       mov     al,4    ; red\r
+       out     dx,al\r
+       ENDIF\r
+\r
+       push ds\r
+       push ax\r
+\r
+       mov     ds,[cs:MyDS]\r
+       inc     [HackCount]\r
+       ENDM\r
+\r
+;\r
+;      DOFX\r
+;      Macro used to do the sound effects code\r
+;\r
+       MACRO   DOFX\r
+       les     di,[pcSound]                            ; PC sound effects\r
+       mov     ax,es\r
+       or      ax,di\r
+       jz      @@nopc                                          ; nil pointer - no PC sound effect going\r
+\r
+       mov     bl,[es:di]                                      ; Get the byte\r
+       inc     [WORD PTR pcSound]                      ; Increment pointer\r
+       cmp     [pcLastSample],bl                       ; Is this sample the same as last?\r
+       jz      @@pcsame                                        ; Yep - don't do anything\r
+       mov     [pcLastSample],bl                       ; No, save it for next time\r
+\r
+       or      bl,bl\r
+       jz      @@pcoff                                         ; If 0, turn sounds off\r
+       xor     bh,bh\r
+       shl     bx,1\r
+       mov     bx,[pcSoundLookup+bx]           ; Use byte as index into frequency table\r
+\r
+       mov     al,0b6h                                         ; Write to channel 2 (speaker) timer\r
+       out     pcTAccess,al\r
+       mov     al,bl\r
+       out     pcTimer,al                                      ; Low byte\r
+       mov     al,bh\r
+       out     pcTimer,al                                      ; High byte\r
+\r
+       in      al,pcSpeaker                            ; Turn the speaker & gate on\r
+       or      al,3\r
+       out     pcSpeaker,al\r
+\r
+       jmp @@pcsame\r
+\r
+@@pcoff:\r
+       in      al,pcSpeaker                            ; Turn the speaker & gate off\r
+       and     al,0fch                                         ; ~3\r
+       out     pcSpeaker,al\r
+\r
+@@pcsame:\r
+       dec     [pcLengthLeft]                          ; Decrement length\r
+       jnz     @@nopc                                          ; If not 0, we're not done with the sound\r
+\r
+       mov     ax,0\r
+       mov     [WORD PTR pcSound],ax           ; Zero the pointer\r
+       mov     [WORD PTR pcSound + 2],ax\r
+       mov     [SoundNumber],ax                ; Indicate no sound\r
+       mov     [SoundPriority],ax                      ;  with no priority\r
+\r
+       in      al,pcSpeaker                            ; Turn the speaker off\r
+       and     al,0fdh                                         ; ~2\r
+       out     pcSpeaker,al\r
+@@nopc:\r
+\r
+       les     di,[alSound]                            ; AdLib sound effects\r
+       mov     ax,es\r
+       or      ax,di\r
+       jz      @@noal                                          ; nil pointer - no AdLib effect going\r
+\r
+       xor     ah,ah\r
+       mov     al,[es:di]\r
+       or      al,al\r
+       jz      @@aldone\r
+\r
+       CALL alOut C,alFreqL,ax\r
+       mov     ax,[alBlock]\r
+\r
+@@aldone:\r
+       CALL alOut C,alFreqH,ax\r
+       inc     [WORD PTR alSound]\r
+       dec     [alLengthLeft]\r
+       jnz     @@noal\r
+\r
+       mov     ax,0\r
+       mov     [WORD PTR alSound],ax           ; Zero the pointer\r
+       mov     [WORD PTR alSound + 2],ax\r
+       mov     [SoundNumber],ax                ; Indicate no sound\r
+       mov     [SoundPriority],ax                      ;  with no priority\r
+       CALL alOut C,alFreqH,ax                 ; Turn off the sound\r
+@@noal:\r
+\r
+       ENDM\r
+\r
+;\r
+;\r
+;\r
+       MACRO   TIME\r
+       cmp     [count_time],2\r
+       jb      @@notime\r
+       add     [LocalTime],1\r
+       adc     [LocalTime+2],0\r
+       add     [TimeCount],1\r
+       adc     [TimeCount+2],0\r
+       mov     [count_time],0\r
+@@notime:\r
+       ENDM\r
+\r
+;\r
+;      COMMONEND\r
+;      Macro used for common suffix code\r
+;\r
+       MACRO   COMMONEND\r
+@@fullexit:\r
+       pop     es\r
+       ;popa\r
+       pop di\r
+       pop si\r
+       pop bp\r
+       pop [oldsp]\r
+       pop bx\r
+       pop dx\r
+       pop cx\r
+       pop ax\r
+\r
+@@nosave:\r
+       mov     ax,[TimerDivisor]\r
+       add     [TimerCount],ax\r
+       jnc     @@myack\r
+\r
+       pushf\r
+       call [t0OldService]\r
+       jmp     @@out\r
+\r
+@@myack:\r
+       mov     al,20h\r
+       out     20h,al\r
+\r
+@@out:\r
+       pop     ax\r
+       pop     ds\r
+\r
+       IF DEBUG\r
+       mov     dx,STATUS_REGISTER_1\r
+       in      al,dx\r
+       mov     dx,ATR_INDEX\r
+       mov     al,ATR_OVERSCAN\r
+       out     dx,al\r
+       mov     al,3    ; blue\r
+       out     dx,al\r
+       mov     al,20h  ; normal\r
+       out     dx,al\r
+       pop     ax\r
+       pop     dx\r
+       ENDIF\r
+\r
+       iret\r
+       ENDM\r
+\r
+;\r
+;      SDL_IndicatePC\r
+;\r
+       PROC    SDL_IndicatePC on:WORD\r
+       PUBLIC  SDL_IndicatePC\r
+\r
+       mov     ax,[on]\r
+       mov     [cs:pcindicate],ax\r
+       ret\r
+\r
+       ENDP\r
+\r
+;\r
+;      SDL_t0ExtremeAsmService\r
+;      Timer 0 ISR 7000Hz interrupts\r
+;\r
+       PROC    SDL_t0ExtremeAsmService\r
+       PUBLIC  SDL_t0ExtremeAsmService\r
+\r
+       push ax\r
+       mov     al,[BYTE PTR cs:pcindicate]\r
+       or      al,al\r
+       jz      @@done\r
+\r
+       push ds\r
+       push es\r
+       ;pusha\r
+       jmp @@skipme\r
+       oldsp dw ?\r
+@@skipme:\r
+       mov [oldsp], sp\r
+       push ax\r
+       push cx\r
+       push dx\r
+       push bx\r
+       push [oldsp]\r
+       push bp\r
+       push si\r
+       push di\r
+\r
+       mov     ds,[cs:MyDS]\r
+\r
+       les     di,[pcSound]\r
+       mov     ax,es\r
+       or      ax,di\r
+       jz      @@donereg                                       ; nil pointer\r
+\r
+       mov     bl,[es:di]                                      ; Get the byte\r
+       inc     [WORD PTR pcSound]                      ; Increment pointer\r
+\r
+       and     bl,11100000b                            ; Nuke some of the precision (DEBUG - do this in the table)\r
+\r
+       xor     bh,bh\r
+       mov     ah,[pcdtab+bx]                          ; Translate the byte\r
+\r
+       in      al,pcSpeaker\r
+       and     al,11111100b\r
+       or      al,ah\r
+       out     pcSpeaker,al\r
+\r
+       dec     [pcLengthLeft]\r
+       jnz     @@donereg\r
+\r
+       mov     [WORD PTR pcSound],0            ; We're done with this sample\r
+       mov     [WORD PTR pcSound+2],0\r
+\r
+       in      al,pcSpeaker\r
+       and     al,11111100b\r
+       out     pcSpeaker,al\r
+\r
+       call SDL_DigitizedDone\r
+\r
+@@donereg:\r
+       ;popa\r
+       pop di\r
+       pop si\r
+       pop bp\r
+       pop [oldsp]\r
+       pop bx\r
+       pop dx\r
+       pop cx\r
+       pop ax\r
+       pop     es\r
+       pop     ds\r
+\r
+@@done:\r
+       inc     [cs:extreme]\r
+       cmp     [cs:extreme],10\r
+       jae     @@tofast\r
+\r
+       mov     al,20h\r
+       out     20h,al\r
+       pop     ax\r
+       iret\r
+\r
+@@tofast:\r
+       mov     [cs:extreme],0\r
+       pop     ax\r
+\r
+;      jmp     SDL_t0FastAsmService                    ; Drops through to SDL_t0FastAsmService\r
+\r
+       ENDP\r
+\r
+;\r
+;      SDL_t0FastAsmService\r
+;      Timer 0 ISR for 700Hz interrupts\r
+;\r
+       PROC    SDL_t0FastAsmService\r
+       PUBLIC  SDL_t0FastAsmService\r
+\r
+       COMMONSTART\r
+\r
+       inc     [count_fx]                                              ; Time to do PC/AdLib effects & time?\r
+       cmp     [count_fx],5\r
+       jae     @@dofull\r
+\r
+       mov     ax,[sqActive]                                   ; Is the sequencer active?\r
+       or      ax,ax\r
+       jnz     @@dofull\r
+\r
+       mov     ax,[WORD PTR ssSample]                  ; Is there a sample for the Sound Src?\r
+       or      ax,[WORD PTR ssSample+2]\r
+       jz      @@nosave\r
+\r
+@@dofull:\r
+       ;pusha\r
+       mov [oldsp], sp\r
+       push ax\r
+       push cx\r
+       push dx\r
+       push bx\r
+       push [oldsp]\r
+       push bp\r
+       push si\r
+       push di\r
+       push es\r
+\r
+       cmp     [count_fx],5\r
+       jb      @@nofx\r
+       mov     [count_fx],0\r
+       DOFX\r
+\r
+       inc     [count_time]\r
+       TIME\r
+@@nofx:\r
+\r
+       mov     ax,[sqActive]\r
+       or      ax,ax\r
+       jz      @@nosq\r
+\r
+       mov     ax,[sqHackLen]\r
+       or      ax,ax\r
+       jz      @@sqdone\r
+\r
+       les     di,[sqHackPtr]\r
+@@sqloop:\r
+       mov     ax,[WORD PTR sqHackTime+2]\r
+       cmp     ax,[WORD PTR alTimeCount+2]\r
+       ja      @@sqdone\r
+       mov     ax,[WORD PTR sqHackTime]\r
+       cmp     ax,[WORD PTR alTimeCount]\r
+       ja      @@sqdone\r
+\r
+       mov     ax,[es:di+2]                                    ; Get time to next event\r
+       add     ax,[WORD PTR alTimeCount]\r
+       mov     [WORD PTR sqHackTime],ax\r
+       mov     ax,[WORD PTR alTimeCount+2]\r
+       adc     ax,0\r
+       mov     [WORD PTR sqHackTime+2],ax\r
+\r
+       mov     ax,[es:di]                                              ; Get register/value pair\r
+       xor     bh,bh\r
+       mov     bl,ah\r
+       xor     ah,ah\r
+       CALL alOut C,ax,bx\r
+\r
+       add     di,4\r
+       mov     [WORD PTR sqHackPtr],di\r
+\r
+       sub     [sqHackLen],4\r
+       jnz     @@sqloop\r
+\r
+@@sqdone:\r
+       add     [WORD PTR alTimeCount],1\r
+       adc     [WORD PTR alTimeCount+2],0\r
+       mov     ax,[sqHackLen]\r
+       or      ax,ax\r
+       jnz     @@nosq\r
+\r
+       mov     ax,[WORD PTR sqHack]            ; Copy pointer\r
+       mov     [WORD PTR sqHackPtr],ax\r
+       mov     ax,[WORD PTR sqHack+2]\r
+       mov     [WORD PTR sqHackPtr+2],ax\r
+\r
+       mov     ax,[sqHackSeqLen]                       ; Copy length\r
+       mov     [sqHackLen],ax\r
+\r
+       mov     ax,0\r
+       mov     [WORD PTR alTimeCount],ax       ; Reset time counts\r
+       mov     [WORD PTR alTimeCount+2],ax\r
+       mov     [WORD PTR sqHackTime],ax\r
+       mov     [WORD PTR sqHackTime+2],ax\r
+@@nosq:\r
+\r
+       les     di,[ssSample]                   ; Get pointer to Sound Source sample\r
+       mov     ax,es\r
+       or      ax,di\r
+       jz      @@ssdone                                ; If nil, skip this\r
+\r
+@@ssloop:\r
+       mov     dx,[ssStatus]                   ; Check to see if FIFO has any empty slots\r
+       in      al,dx\r
+       test al,40h\r
+       jnz     @@ssdone                                ; Nope - don't push any more data out\r
+\r
+       mov     dx,[ssData]\r
+       mov     al,[es:di]                              ; al = *ssSample\r
+       out     dx,al                                   ; Pump the value out\r
+\r
+       mov     dx,[ssControl]                  ; Pulse printer select\r
+       mov     al,[ssOff]\r
+       out     dx,al\r
+       push ax\r
+       pop     ax\r
+       mov     al,[ssOn]\r
+       out     dx,al\r
+\r
+       push ax                                         ; Delay a short while\r
+       pop     ax\r
+\r
+       inc     di\r
+       mov     [WORD PTR ssSample],di  ; ssSample++\r
+\r
+       dec     [ssLengthLeft]\r
+       jnz @@ssloop\r
+\r
+       mov     [WORD PTR ssSample],0   ; We're done with this sample\r
+       mov     [WORD PTR ssSample+2],0\r
+\r
+       call SDL_DigitizedDone\r
+@@ssdone:\r
+\r
+       COMMONEND\r
+\r
+       ENDP\r
+\r
+;\r
+;      SDL_t0SlowAsmService\r
+;      Timer 0 ISR for 140Hz interrupts\r
+;\r
+       PROC    SDL_t0SlowAsmService\r
+       PUBLIC  SDL_t0SlowAsmService\r
+\r
+       IF DEBUG\r
+       push dx\r
+       push ax\r
+       mov     dx,STATUS_REGISTER_1\r
+       in      al,dx\r
+       mov     dx,ATR_INDEX\r
+       mov     al,ATR_OVERSCAN\r
+       out     dx,al\r
+       mov     al,4    ; red\r
+       out     dx,al\r
+       ENDIF\r
+\r
+       push ds\r
+       push ax\r
+\r
+       mov     ds,[cs:MyDS]\r
+\r
+       inc     [count_time]\r
+       TIME\r
+\r
+       mov     ax,[WORD PTR pcSound]           ; Is there a PC sound effect going?\r
+       or      ax,[WORD PTR pcSound+2]\r
+       jnz     @@dofull\r
+\r
+       mov     ax,[WORD PTR alSound]           ; Is there an AdLib sound effect going?\r
+       or      ax,[WORD PTR alSound+2]\r
+       jz      @@nosave\r
+\r
+@@dofull:\r
+       ;pusha\r
+       mov [oldsp], sp\r
+       push ax\r
+       push cx\r
+       push dx\r
+       push bx\r
+       push [oldsp]\r
+       push bp\r
+       push si\r
+       push di\r
+       push es\r
+\r
+       DOFX\r
+\r
+       COMMONEND\r
+\r
+       ENDP\r
+\r
+       END\r
diff --git a/16/wf3d8086/id_sd_a.bak b/16/wf3d8086/id_sd_a.bak
new file mode 100755 (executable)
index 0000000..34e1ac6
--- /dev/null
@@ -0,0 +1,572 @@
+;\r
+;      ID_SD_A.ASM\r
+;      Id Sound Manager assembly stuff\r
+\r
+       .8086\r
+       IDEAL\r
+       MODEL   MEDIUM,C\r
+       JUMPS\r
+\r
+       INCLUDE 'ID_SD.EQU'\r
+\r
+DEBUG  =       0\r
+\r
+       EXTRN   SDL_DigitizedDone:FAR\r
+       EXTRN   alOut:FAR\r
+\r
+;============================================================================\r
+\r
+DATASEG\r
+\r
+       EXTRN   sqActive:WORD\r
+       EXTRN   ssSample:DWORD\r
+       EXTRN   ssLengthLeft:WORD\r
+       EXTRN   ssControl:WORD\r
+       EXTRN   ssStatus:WORD\r
+       EXTRN   ssData:WORD\r
+       EXTRN   ssOn:BYTE\r
+       EXTRN   ssOff:BYTE\r
+\r
+       EXTRN   pcSound:DWORD\r
+       EXTRN   pcLengthLeft:WORD\r
+       EXTRN   pcLastSample:BYTE\r
+       EXTRN   pcSoundLookup:WORD\r
+\r
+       EXTRN   alSound:DWORD\r
+       EXTRN   alBlock:WORD\r
+       EXTRN   alLengthLeft:WORD\r
+       EXTRN   alTimeCount:DWORD\r
+\r
+       EXTRN   sqHack:DWORD\r
+       EXTRN   sqHackPtr:DWORD\r
+       EXTRN   sqHackLen:WORD\r
+       EXTRN   sqHackSeqLen:WORD\r
+       EXTRN   sqHackTime:DWORD\r
+\r
+       EXTRN   HackCount:WORD\r
+       EXTRN   TimeCount:WORD\r
+       EXTRN   LocalTime:WORD\r
+\r
+       EXTRN   TimerCount:WORD\r
+       EXTRN   TimerDivisor:WORD\r
+       EXTRN   t0OldService:DWORD\r
+\r
+       EXTRN   SoundMode:WORD\r
+       EXTRN   DigiMode:WORD\r
+\r
+       EXTRN   SoundNumber:WORD\r
+       EXTRN   SoundPriority:WORD\r
+\r
+count_time     dw      ?\r
+count_fx       dw      ?\r
+\r
+pcdtab db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+               db      10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b\r
+\r
+\r
+;============================================================================\r
+\r
+CODESEG\r
+\r
+MyDS   dw      ?\r
+\r
+pcindicate     dw      ?\r
+extreme                dw      ?\r
+\r
+       PROC    SDL_SetDS\r
+       PUBLIC  SDL_SetDS\r
+\r
+       mov     ax,ds\r
+       mov     [cs:MyDS],ds\r
+       ret\r
+\r
+       ENDP\r
+\r
+;\r
+;      COMMONSTART\r
+;      Macro used for common prefix code\r
+;\r
+       MACRO   COMMONSTART\r
+       IF DEBUG\r
+       push dx\r
+       push ax\r
+       mov     dx,STATUS_REGISTER_1\r
+       in      al,dx\r
+       mov     dx,ATR_INDEX\r
+       mov     al,ATR_OVERSCAN\r
+       out     dx,al\r
+       mov     al,4    ; red\r
+       out     dx,al\r
+       ENDIF\r
+\r
+       push ds\r
+       push ax\r
+\r
+       mov     ds,[cs:MyDS]\r
+       inc     [HackCount]\r
+       ENDM\r
+\r
+;\r
+;      DOFX\r
+;      Macro used to do the sound effects code\r
+;\r
+       MACRO   DOFX\r
+       les     di,[pcSound]                            ; PC sound effects\r
+       mov     ax,es\r
+       or      ax,di\r
+       jz      @@nopc                                          ; nil pointer - no PC sound effect going\r
+\r
+       mov     bl,[es:di]                                      ; Get the byte\r
+       inc     [WORD PTR pcSound]                      ; Increment pointer\r
+       cmp     [pcLastSample],bl                       ; Is this sample the same as last?\r
+       jz      @@pcsame                                        ; Yep - don't do anything\r
+       mov     [pcLastSample],bl                       ; No, save it for next time\r
+\r
+       or      bl,bl\r
+       jz      @@pcoff                                         ; If 0, turn sounds off\r
+       xor     bh,bh\r
+       shl     bx,1\r
+       mov     bx,[pcSoundLookup+bx]           ; Use byte as index into frequency table\r
+\r
+       mov     al,0b6h                                         ; Write to channel 2 (speaker) timer\r
+       out     pcTAccess,al\r
+       mov     al,bl\r
+       out     pcTimer,al                                      ; Low byte\r
+       mov     al,bh\r
+       out     pcTimer,al                                      ; High byte\r
+\r
+       in      al,pcSpeaker                            ; Turn the speaker & gate on\r
+       or      al,3\r
+       out     pcSpeaker,al\r
+\r
+       jmp @@pcsame\r
+\r
+@@pcoff:\r
+       in      al,pcSpeaker                            ; Turn the speaker & gate off\r
+       and     al,0fch                                         ; ~3\r
+       out     pcSpeaker,al\r
+\r
+@@pcsame:\r
+       dec     [pcLengthLeft]                          ; Decrement length\r
+       jnz     @@nopc                                          ; If not 0, we're not done with the sound\r
+\r
+       mov     ax,0\r
+       mov     [WORD PTR pcSound],ax           ; Zero the pointer\r
+       mov     [WORD PTR pcSound + 2],ax\r
+       mov     [SoundNumber],ax                ; Indicate no sound\r
+       mov     [SoundPriority],ax                      ;  with no priority\r
+\r
+       in      al,pcSpeaker                            ; Turn the speaker off\r
+       and     al,0fdh                                         ; ~2\r
+       out     pcSpeaker,al\r
+@@nopc:\r
+\r
+       les     di,[alSound]                            ; AdLib sound effects\r
+       mov     ax,es\r
+       or      ax,di\r
+       jz      @@noal                                          ; nil pointer - no AdLib effect going\r
+\r
+       xor     ah,ah\r
+       mov     al,[es:di]\r
+       or      al,al\r
+       jz      @@aldone\r
+\r
+       CALL alOut C,alFreqL,ax\r
+       mov     ax,[alBlock]\r
+\r
+@@aldone:\r
+       CALL alOut C,alFreqH,ax\r
+       inc     [WORD PTR alSound]\r
+       dec     [alLengthLeft]\r
+       jnz     @@noal\r
+\r
+       mov     ax,0\r
+       mov     [WORD PTR alSound],ax           ; Zero the pointer\r
+       mov     [WORD PTR alSound + 2],ax\r
+       mov     [SoundNumber],ax                ; Indicate no sound\r
+       mov     [SoundPriority],ax                      ;  with no priority\r
+       CALL alOut C,alFreqH,ax                 ; Turn off the sound\r
+@@noal:\r
+\r
+       ENDM\r
+\r
+;\r
+;\r
+;\r
+       MACRO   TIME\r
+       cmp     [count_time],2\r
+       jb      @@notime\r
+       add     [LocalTime],1\r
+       adc     [LocalTime+2],0\r
+       add     [TimeCount],1\r
+       adc     [TimeCount+2],0\r
+       mov     [count_time],0\r
+@@notime:\r
+       ENDM\r
+\r
+;\r
+;      COMMONEND\r
+;      Macro used for common suffix code\r
+;\r
+       MACRO   COMMONEND\r
+@@fullexit:\r
+       pop     es\r
+       ;popa\r
+       pop di\r
+       pop si\r
+       pop bp\r
+       pop [regsp]\r
+       pop bx\r
+       pop dx\r
+       pop cx\r
+       pop ax\r
+\r
+@@nosave:\r
+       mov     ax,[TimerDivisor]\r
+       add     [TimerCount],ax\r
+       jnc     @@myack\r
+\r
+       pushf\r
+       call [t0OldService]\r
+       jmp     @@out\r
+\r
+@@myack:\r
+       mov     al,20h\r
+       out     20h,al\r
+\r
+@@out:\r
+       pop     ax\r
+       pop     ds\r
+\r
+       IF DEBUG\r
+       mov     dx,STATUS_REGISTER_1\r
+       in      al,dx\r
+       mov     dx,ATR_INDEX\r
+       mov     al,ATR_OVERSCAN\r
+       out     dx,al\r
+       mov     al,3    ; blue\r
+       out     dx,al\r
+       mov     al,20h  ; normal\r
+       out     dx,al\r
+       pop     ax\r
+       pop     dx\r
+       ENDIF\r
+\r
+       iret\r
+       ENDM\r
+\r
+;\r
+;      SDL_IndicatePC\r
+;\r
+       PROC    SDL_IndicatePC on:WORD\r
+       PUBLIC  SDL_IndicatePC\r
+\r
+       mov     ax,[on]\r
+       mov     [cs:pcindicate],ax\r
+       ret\r
+\r
+       ENDP\r
+\r
+;\r
+;      SDL_t0ExtremeAsmService\r
+;      Timer 0 ISR 7000Hz interrupts\r
+;\r
+       PROC    SDL_t0ExtremeAsmService\r
+       PUBLIC  SDL_t0ExtremeAsmService\r
+\r
+       push ax\r
+       mov     al,[BYTE PTR cs:pcindicate]\r
+       or      al,al\r
+       jz      @@done\r
+\r
+       push ds\r
+       push es\r
+       ;pusha\r
+       jmp @@skipme\r
+       oldsp dw ?\r
+@@skipme:\r
+       mov [oldsp], sp\r
+       push ax\r
+       push cx\r
+       push dx\r
+       push bx\r
+       push [oldsp]\r
+       push bp\r
+       push si\r
+       push di\r
+\r
+       mov     ds,[cs:MyDS]\r
+\r
+       les     di,[pcSound]\r
+       mov     ax,es\r
+       or      ax,di\r
+       jz      @@donereg                                       ; nil pointer\r
+\r
+       mov     bl,[es:di]                                      ; Get the byte\r
+       inc     [WORD PTR pcSound]                      ; Increment pointer\r
+\r
+       and     bl,11100000b                            ; Nuke some of the precision (DEBUG - do this in the table)\r
+\r
+       xor     bh,bh\r
+       mov     ah,[pcdtab+bx]                          ; Translate the byte\r
+\r
+       in      al,pcSpeaker\r
+       and     al,11111100b\r
+       or      al,ah\r
+       out     pcSpeaker,al\r
+\r
+       dec     [pcLengthLeft]\r
+       jnz     @@donereg\r
+\r
+       mov     [WORD PTR pcSound],0            ; We're done with this sample\r
+       mov     [WORD PTR pcSound+2],0\r
+\r
+       in      al,pcSpeaker\r
+       and     al,11111100b\r
+       out     pcSpeaker,al\r
+\r
+       call SDL_DigitizedDone\r
+\r
+@@donereg:\r
+       ;popa\r
+       pop di\r
+       pop si\r
+       pop bp\r
+       pop [oldsp]\r
+       pop bx\r
+       pop dx\r
+       pop cx\r
+       pop ax\r
+       pop     es\r
+       pop     ds\r
+\r
+@@done:\r
+       inc     [cs:extreme]\r
+       cmp     [cs:extreme],10\r
+       jae     @@tofast\r
+\r
+       mov     al,20h\r
+       out     20h,al\r
+       pop     ax\r
+       iret\r
+\r
+@@tofast:\r
+       mov     [cs:extreme],0\r
+       pop     ax\r
+\r
+;      jmp     SDL_t0FastAsmService                    ; Drops through to SDL_t0FastAsmService\r
+\r
+       ENDP\r
+\r
+;\r
+;      SDL_t0FastAsmService\r
+;      Timer 0 ISR for 700Hz interrupts\r
+;\r
+       PROC    SDL_t0FastAsmService\r
+       PUBLIC  SDL_t0FastAsmService\r
+\r
+       COMMONSTART\r
+\r
+       inc     [count_fx]                                              ; Time to do PC/AdLib effects & time?\r
+       cmp     [count_fx],5\r
+       jae     @@dofull\r
+\r
+       mov     ax,[sqActive]                                   ; Is the sequencer active?\r
+       or      ax,ax\r
+       jnz     @@dofull\r
+\r
+       mov     ax,[WORD PTR ssSample]                  ; Is there a sample for the Sound Src?\r
+       or      ax,[WORD PTR ssSample+2]\r
+       jz      @@nosave\r
+\r
+@@dofull:\r
+       ;pusha\r
+       mov [oldsp], sp\r
+       push ax\r
+       push cx\r
+       push dx\r
+       push bx\r
+       push [oldsp]\r
+       push bp\r
+       push si\r
+       push di\r
+       push es\r
+\r
+       cmp     [count_fx],5\r
+       jb      @@nofx\r
+       mov     [count_fx],0\r
+       DOFX\r
+\r
+       inc     [count_time]\r
+       TIME\r
+@@nofx:\r
+\r
+       mov     ax,[sqActive]\r
+       or      ax,ax\r
+       jz      @@nosq\r
+\r
+       mov     ax,[sqHackLen]\r
+       or      ax,ax\r
+       jz      @@sqdone\r
+\r
+       les     di,[sqHackPtr]\r
+@@sqloop:\r
+       mov     ax,[WORD PTR sqHackTime+2]\r
+       cmp     ax,[WORD PTR alTimeCount+2]\r
+       ja      @@sqdone\r
+       mov     ax,[WORD PTR sqHackTime]\r
+       cmp     ax,[WORD PTR alTimeCount]\r
+       ja      @@sqdone\r
+\r
+       mov     ax,[es:di+2]                                    ; Get time to next event\r
+       add     ax,[WORD PTR alTimeCount]\r
+       mov     [WORD PTR sqHackTime],ax\r
+       mov     ax,[WORD PTR alTimeCount+2]\r
+       adc     ax,0\r
+       mov     [WORD PTR sqHackTime+2],ax\r
+\r
+       mov     ax,[es:di]                                              ; Get register/value pair\r
+       xor     bh,bh\r
+       mov     bl,ah\r
+       xor     ah,ah\r
+       CALL alOut C,ax,bx\r
+\r
+       add     di,4\r
+       mov     [WORD PTR sqHackPtr],di\r
+\r
+       sub     [sqHackLen],4\r
+       jnz     @@sqloop\r
+\r
+@@sqdone:\r
+       add     [WORD PTR alTimeCount],1\r
+       adc     [WORD PTR alTimeCount+2],0\r
+       mov     ax,[sqHackLen]\r
+       or      ax,ax\r
+       jnz     @@nosq\r
+\r
+       mov     ax,[WORD PTR sqHack]            ; Copy pointer\r
+       mov     [WORD PTR sqHackPtr],ax\r
+       mov     ax,[WORD PTR sqHack+2]\r
+       mov     [WORD PTR sqHackPtr+2],ax\r
+\r
+       mov     ax,[sqHackSeqLen]                       ; Copy length\r
+       mov     [sqHackLen],ax\r
+\r
+       mov     ax,0\r
+       mov     [WORD PTR alTimeCount],ax       ; Reset time counts\r
+       mov     [WORD PTR alTimeCount+2],ax\r
+       mov     [WORD PTR sqHackTime],ax\r
+       mov     [WORD PTR sqHackTime+2],ax\r
+@@nosq:\r
+\r
+       les     di,[ssSample]                   ; Get pointer to Sound Source sample\r
+       mov     ax,es\r
+       or      ax,di\r
+       jz      @@ssdone                                ; If nil, skip this\r
+\r
+@@ssloop:\r
+       mov     dx,[ssStatus]                   ; Check to see if FIFO has any empty slots\r
+       in      al,dx\r
+       test al,40h\r
+       jnz     @@ssdone                                ; Nope - don't push any more data out\r
+\r
+       mov     dx,[ssData]\r
+       mov     al,[es:di]                              ; al = *ssSample\r
+       out     dx,al                                   ; Pump the value out\r
+\r
+       mov     dx,[ssControl]                  ; Pulse printer select\r
+       mov     al,[ssOff]\r
+       out     dx,al\r
+       push ax\r
+       pop     ax\r
+       mov     al,[ssOn]\r
+       out     dx,al\r
+\r
+       push ax                                         ; Delay a short while\r
+       pop     ax\r
+\r
+       inc     di\r
+       mov     [WORD PTR ssSample],di  ; ssSample++\r
+\r
+       dec     [ssLengthLeft]\r
+       jnz @@ssloop\r
+\r
+       mov     [WORD PTR ssSample],0   ; We're done with this sample\r
+       mov     [WORD PTR ssSample+2],0\r
+\r
+       call SDL_DigitizedDone\r
+@@ssdone:\r
+\r
+       COMMONEND\r
+\r
+       ENDP\r
+\r
+;\r
+;      SDL_t0SlowAsmService\r
+;      Timer 0 ISR for 140Hz interrupts\r
+;\r
+       PROC    SDL_t0SlowAsmService\r
+       PUBLIC  SDL_t0SlowAsmService\r
+\r
+       IF DEBUG\r
+       push dx\r
+       push ax\r
+       mov     dx,STATUS_REGISTER_1\r
+       in      al,dx\r
+       mov     dx,ATR_INDEX\r
+       mov     al,ATR_OVERSCAN\r
+       out     dx,al\r
+       mov     al,4    ; red\r
+       out     dx,al\r
+       ENDIF\r
+\r
+       push ds\r
+       push ax\r
+\r
+       mov     ds,[cs:MyDS]\r
+\r
+       inc     [count_time]\r
+       TIME\r
+\r
+       mov     ax,[WORD PTR pcSound]           ; Is there a PC sound effect going?\r
+       or      ax,[WORD PTR pcSound+2]\r
+       jnz     @@dofull\r
+\r
+       mov     ax,[WORD PTR alSound]           ; Is there an AdLib sound effect going?\r
+       or      ax,[WORD PTR alSound+2]\r
+       jz      @@nosave\r
+\r
+@@dofull:\r
+       ;pusha\r
+       mov [oldsp], sp\r
+       push ax\r
+       push cx\r
+       push dx\r
+       push bx\r
+       push [oldsp]\r
+       push bp\r
+       push si\r
+       push di\r
+       push es\r
+\r
+       DOFX\r
+\r
+       COMMONEND\r
+\r
+       ENDP\r
+\r
+       END\r
diff --git a/16/wf3d8086/id_us.h b/16/wf3d8086/id_us.h
new file mode 100755 (executable)
index 0000000..439a024
--- /dev/null
@@ -0,0 +1,123 @@
+//\r
+//     ID Engine\r
+//     ID_US.h - Header file for the User Manager\r
+//     v1.0d1\r
+//     By Jason Blochowiak\r
+//\r
+\r
+#ifndef        __ID_US__\r
+#define        __ID_US__\r
+\r
+#ifdef __DEBUG__\r
+#define        __DEBUG_UserMgr__\r
+#endif\r
+\r
+//#define      HELPTEXTLINKED\r
+\r
+#define        MaxX    320\r
+#define        MaxY    200\r
+\r
+#define        MaxHelpLines    500\r
+\r
+#define        MaxHighName     57\r
+#define        MaxScores       7\r
+typedef        struct\r
+               {\r
+                       char    name[MaxHighName + 1];\r
+                       long    score;\r
+                       word    completed,episode;\r
+               } HighScore;\r
+\r
+#define        MaxGameName             32\r
+#define        MaxSaveGames    6\r
+typedef        struct\r
+               {\r
+                       char    signature[4];\r
+                       word    *oldtest;\r
+                       boolean present;\r
+                       char    name[MaxGameName + 1];\r
+               } SaveGame;\r
+\r
+#define        MaxString       128     // Maximum input string size\r
+\r
+typedef        struct\r
+               {\r
+                       int     x,y,\r
+                               w,h,\r
+                               px,py;\r
+               } WindowRec;    // Record used to save & restore screen windows\r
+\r
+typedef        enum\r
+               {\r
+                       gd_Continue,\r
+                       gd_Easy,\r
+                       gd_Normal,\r
+                       gd_Hard\r
+               } GameDiff;\r
+\r
+//     Hack import for TED launch support\r
+extern boolean         tedlevel;\r
+extern int                     tedlevelnum;\r
+extern void            TEDDeath(void);\r
+\r
+extern boolean         ingame,         // Set by game code if a game is in progress\r
+                                       abortgame,      // Set if a game load failed\r
+                                       loadedgame,     // Set if the current game was loaded\r
+                                       NoWait,\r
+                                       HighScoresDirty;\r
+extern char            *abortprogram;  // Set to error msg if program is dying\r
+extern GameDiff        restartgame;    // Normally gd_Continue, else starts game\r
+extern word            PrintX,PrintY;  // Current printing location in the window\r
+extern word            WindowX,WindowY,// Current location of window\r
+                                       WindowW,WindowH;// Current size of window\r
+\r
+extern boolean         Button0,Button1,\r
+                                       CursorBad;\r
+extern int                     CursorX,CursorY;\r
+\r
+extern void            (*USL_MeasureString)(char far *,word *,word *),\r
+                                       (*USL_DrawString)(char far *);\r
+\r
+extern boolean         (*USL_SaveGame)(int),(*USL_LoadGame)(int);\r
+extern void            (*USL_ResetGame)(void);\r
+extern SaveGame        Games[MaxSaveGames];\r
+extern HighScore       Scores[];\r
+\r
+#define        US_HomeWindow() {PrintX = WindowX; PrintY = WindowY;}\r
+\r
+extern void    US_Startup(void),\r
+                               US_Setup(void),\r
+                               US_Shutdown(void),\r
+                               US_InitRndT(boolean randomize),\r
+                               US_SetLoadSaveHooks(boolean (*load)(int),\r
+                                                                       boolean (*save)(int),\r
+                                                                       void (*reset)(void)),\r
+                               US_TextScreen(void),\r
+                               US_UpdateTextScreen(void),\r
+                               US_FinishTextScreen(void),\r
+                               US_DrawWindow(word x,word y,word w,word h),\r
+                               US_CenterWindow(word,word),\r
+                               US_SaveWindow(WindowRec *win),\r
+                               US_RestoreWindow(WindowRec *win),\r
+                               US_ClearWindow(void),\r
+                               US_SetPrintRoutines(void (*measure)(char far *,word *,word *),\r
+                                                                       void (*print)(char far *)),\r
+                               US_PrintCentered(char far *s),\r
+                               US_CPrint(char far *s),\r
+                               US_CPrintLine(char far *s),\r
+                               US_Print(char far *s),\r
+                               US_PrintUnsigned(longword n),\r
+                               US_PrintSigned(long n),\r
+                               US_StartCursor(void),\r
+                               US_ShutCursor(void),\r
+                               US_CheckHighScore(long score,word other),\r
+                               US_DisplayHighScores(int which);\r
+extern boolean US_UpdateCursor(void),\r
+                               US_LineInput(int x,int y,char *buf,char *def,boolean escok,\r
+                                                               int maxchars,int maxwidth);\r
+extern int             US_CheckParm(char *parm,char **strings),\r
+                               US_RndT(void);\r
+\r
+               void    USL_PrintInCenter(char far *s,Rect r);\r
+               char    *USL_GiveSaveName(word game);\r
+#endif\r
diff --git a/16/wf3d8086/id_us_1.c b/16/wf3d8086/id_us_1.c
new file mode 100755 (executable)
index 0000000..c06e4ed
--- /dev/null
@@ -0,0 +1,755 @@
+//\r
+//     ID Engine\r
+//     ID_US_1.c - User Manager - General routines\r
+//     v1.1d1\r
+//     By Jason Blochowiak\r
+//     Hacked up for Catacomb 3D\r
+//\r
+\r
+//\r
+//     This module handles dealing with user input & feedback\r
+//\r
+//     Depends on: Input Mgr, View Mgr, some variables from the Sound, Caching,\r
+//             and Refresh Mgrs, Memory Mgr for background save/restore\r
+//\r
+//     Globals:\r
+//             ingame - Flag set by game indicating if a game is in progress\r
+//      abortgame - Flag set if the current game should be aborted (if a load\r
+//                     game fails)\r
+//             loadedgame - Flag set if a game was loaded\r
+//             abortprogram - Normally nil, this points to a terminal error message\r
+//                     if the program needs to abort\r
+//             restartgame - Normally set to gd_Continue, this is set to one of the\r
+//                     difficulty levels if a new game should be started\r
+//             PrintX, PrintY - Where the User Mgr will print (global coords)\r
+//             WindowX,WindowY,WindowW,WindowH - The dimensions of the current\r
+//                     window\r
+//\r
+\r
+#include "ID_HEADS.H"\r
+\r
+#pragma        hdrstop\r
+\r
+#pragma        warn    -pia\r
+\r
+\r
+//     Global variables\r
+               char            *abortprogram;\r
+               boolean         NoWait;\r
+               word            PrintX,PrintY;\r
+               word            WindowX,WindowY,WindowW,WindowH;\r
+\r
+//     Internal variables\r
+#define        ConfigVersion   1\r
+\r
+static char            *ParmStrings[] = {"TEDLEVEL","NOWAIT"},\r
+                                       *ParmStrings2[] = {"COMP","NOCOMP"};\r
+static boolean         US_Started;\r
+\r
+               boolean         Button0,Button1,\r
+                                       CursorBad;\r
+               int                     CursorX,CursorY;\r
+\r
+               void            (*USL_MeasureString)(char far *,word *,word *) = VW_MeasurePropString,\r
+                                       (*USL_DrawString)(char far *) = VWB_DrawPropString;\r
+\r
+               SaveGame        Games[MaxSaveGames];\r
+               HighScore       Scores[MaxScores] =\r
+                                       {\r
+                                               {"id software-'92",10000,1},\r
+                                               {"Adrian Carmack",10000,1},\r
+                                               {"John Carmack",10000,1},\r
+                                               {"Kevin Cloud",10000,1},\r
+                                               {"Tom Hall",10000,1},\r
+                                               {"John Romero",10000,1},\r
+                                               {"Jay Wilbur",10000,1},\r
+                                       };\r
+\r
+//     Internal routines\r
+\r
+//     Public routines\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     USL_HardError() - Handles the Abort/Retry/Fail sort of errors passed\r
+//                     from DOS.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+#pragma        warn    -par\r
+#pragma        warn    -rch\r
+int\r
+USL_HardError(word errval,int ax,int bp,int si)\r
+{\r
+#define IGNORE  0\r
+#define RETRY   1\r
+#define        ABORT   2\r
+extern void    ShutdownId(void);\r
+\r
+static char            buf[32];\r
+static WindowRec       wr;\r
+               int                     di;\r
+               char            c,*s,*t;\r
+\r
+\r
+       di = _DI;\r
+\r
+       if (ax < 0)\r
+               s = "Device Error";\r
+       else\r
+       {\r
+               if ((di & 0x00ff) == 0)\r
+                       s = "Drive ~ is Write Protected";\r
+               else\r
+                       s = "Error on Drive ~";\r
+               for (t = buf;*s;s++,t++)        // Can't use sprintf()\r
+                       if ((*t = *s) == '~')\r
+                               *t = (ax & 0x00ff) + 'A';\r
+               *t = '\0';\r
+               s = buf;\r
+       }\r
+\r
+       c = peekb(0x40,0x49);   // Get the current screen mode\r
+       if ((c < 4) || (c == 7))\r
+               goto oh_kill_me;\r
+\r
+       // DEBUG - handle screen cleanup\r
+\r
+       US_SaveWindow(&wr);\r
+       US_CenterWindow(30,3);\r
+       US_CPrint(s);\r
+       US_CPrint("(R)etry or (A)bort?");\r
+       VW_UpdateScreen();\r
+       IN_ClearKeysDown();\r
+\r
+asm    sti     // Let the keyboard interrupts come through\r
+\r
+       while (true)\r
+       {\r
+               switch (IN_WaitForASCII())\r
+               {\r
+               case key_Escape:\r
+               case 'a':\r
+               case 'A':\r
+                       goto oh_kill_me;\r
+                       break;\r
+               case key_Return:\r
+               case key_Space:\r
+               case 'r':\r
+               case 'R':\r
+                       US_ClearWindow();\r
+                       VW_UpdateScreen();\r
+                       US_RestoreWindow(&wr);\r
+                       return(RETRY);\r
+                       break;\r
+               }\r
+       }\r
+\r
+oh_kill_me:\r
+       abortprogram = s;\r
+       ShutdownId();\r
+       fprintf(stderr,"Terminal Error: %s\n",s);\r
+       if (tedlevel)\r
+               fprintf(stderr,"You launched from TED. I suggest that you reboot...\n");\r
+\r
+       return(ABORT);\r
+#undef IGNORE\r
+#undef RETRY\r
+#undef ABORT\r
+}\r
+#pragma        warn    +par\r
+#pragma        warn    +rch\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_Startup() - Starts the User Mgr\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_Startup(void)\r
+{\r
+       int     i,n;\r
+\r
+       if (US_Started)\r
+               return;\r
+\r
+       harderr(USL_HardError); // Install the fatal error handler\r
+\r
+       US_InitRndT(true);              // Initialize the random number generator\r
+\r
+       for (i = 1;i < _argc;i++)\r
+       {\r
+               switch (US_CheckParm(_argv[i],ParmStrings2))\r
+               {\r
+               case 0:\r
+                       compatability = true;\r
+                       break;\r
+               case 1:\r
+                       compatability = false;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       // Check for TED launching here\r
+       for (i = 1;i < _argc;i++)\r
+       {\r
+               n = US_CheckParm(_argv[i],ParmStrings);\r
+               switch(n)\r
+               {\r
+                case 0:\r
+                  tedlevelnum = atoi(_argv[i + 1]);\r
+                  if (tedlevelnum >= 0)\r
+                    tedlevel = true;\r
+                  break;\r
+\r
+                case 1:\r
+                  NoWait = true;\r
+                  break;\r
+               }\r
+       }\r
+\r
+       US_Started = true;\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_Shutdown() - Shuts down the User Mgr\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_Shutdown(void)\r
+{\r
+       if (!US_Started)\r
+               return;\r
+\r
+       US_Started = false;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_CheckParm() - checks to see if a string matches one of a set of\r
+//             strings. The check is case insensitive. The routine returns the\r
+//             index of the string that matched, or -1 if no matches were found\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+int\r
+US_CheckParm(char *parm,char **strings)\r
+{\r
+       char    cp,cs,\r
+                       *p,*s;\r
+       int             i;\r
+\r
+       while (!isalpha(*parm)) // Skip non-alphas\r
+               parm++;\r
+\r
+       for (i = 0;*strings && **strings;i++)\r
+       {\r
+               for (s = *strings++,p = parm,cs = cp = 0;cs == cp;)\r
+               {\r
+                       cs = *s++;\r
+                       if (!cs)\r
+                               return(i);\r
+                       cp = *p++;\r
+\r
+                       if (isupper(cs))\r
+                               cs = tolower(cs);\r
+                       if (isupper(cp))\r
+                               cp = tolower(cp);\r
+               }\r
+       }\r
+       return(-1);\r
+}\r
+\r
+\r
+//     Window/Printing routines\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_SetPrintRoutines() - Sets the routines used to measure and print\r
+//             from within the User Mgr. Primarily provided to allow switching\r
+//             between masked and non-masked fonts\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_SetPrintRoutines(void (*measure)(char far *,word *,word *),void (*print)(char far *))\r
+{\r
+       USL_MeasureString = measure;\r
+       USL_DrawString = print;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_Print() - Prints a string in the current window. Newlines are\r
+//             supported.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_Print(char far *s)\r
+{\r
+       char    c,far *se;\r
+       word    w,h;\r
+\r
+       while (*s)\r
+       {\r
+               se = s;\r
+               while ((c = *se) && (c != '\n'))\r
+                       se++;\r
+               *se = '\0';\r
+\r
+               USL_MeasureString(s,&w,&h);\r
+               px = PrintX;\r
+               py = PrintY;\r
+               USL_DrawString(s);\r
+\r
+               s = se;\r
+               if (c)\r
+               {\r
+                       *se = c;\r
+                       s++;\r
+\r
+                       PrintX = WindowX;\r
+                       PrintY += h;\r
+               }\r
+               else\r
+                       PrintX += w;\r
+       }\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_PrintUnsigned() - Prints an unsigned long\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_PrintUnsigned(longword n)\r
+{\r
+       char    buffer[32];\r
+\r
+       US_Print(ultoa(n,buffer,10));\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_PrintSigned() - Prints a signed long\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_PrintSigned(long n)\r
+{\r
+       char    buffer[32];\r
+\r
+       US_Print(ltoa(n,buffer,10));\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     USL_PrintInCenter() - Prints a string in the center of the given rect\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+USL_PrintInCenter(char far *s,Rect r)\r
+{\r
+       word    w,h,\r
+                       rw,rh;\r
+\r
+       USL_MeasureString(s,&w,&h);\r
+       rw = r.lr.x - r.ul.x;\r
+       rh = r.lr.y - r.ul.y;\r
+\r
+       px = r.ul.x + ((rw - w) / 2);\r
+       py = r.ul.y + ((rh - h) / 2);\r
+       USL_DrawString(s);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_PrintCentered() - Prints a string centered in the current window.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_PrintCentered(char far *s)\r
+{\r
+       Rect    r;\r
+\r
+       r.ul.x = WindowX;\r
+       r.ul.y = WindowY;\r
+       r.lr.x = r.ul.x + WindowW;\r
+       r.lr.y = r.ul.y + WindowH;\r
+\r
+       USL_PrintInCenter(s,r);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_CPrintLine() - Prints a string centered on the current line and\r
+//             advances to the next line. Newlines are not supported.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_CPrintLine(char far *s)\r
+{\r
+       word    w,h;\r
+\r
+       USL_MeasureString(s,&w,&h);\r
+\r
+       if (w > WindowW)\r
+               Quit("US_CPrintLine() - String exceeds width");\r
+       px = WindowX + ((WindowW - w) / 2);\r
+       py = PrintY;\r
+       USL_DrawString(s);\r
+       PrintY += h;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_CPrint() - Prints a string in the current window. Newlines are\r
+//             supported.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_CPrint(char far *s)\r
+{\r
+       char    c,far *se;\r
+\r
+       while (*s)\r
+       {\r
+               se = s;\r
+               while ((c = *se) && (c != '\n'))\r
+                       se++;\r
+               *se = '\0';\r
+\r
+               US_CPrintLine(s);\r
+\r
+               s = se;\r
+               if (c)\r
+               {\r
+                       *se = c;\r
+                       s++;\r
+               }\r
+       }\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_ClearWindow() - Clears the current window to white and homes the\r
+//             cursor\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_ClearWindow(void)\r
+{\r
+       VWB_Bar(WindowX,WindowY,WindowW,WindowH,WHITE);\r
+       PrintX = WindowX;\r
+       PrintY = WindowY;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_DrawWindow() - Draws a frame and sets the current window parms\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_DrawWindow(word x,word y,word w,word h)\r
+{\r
+       word    i,\r
+                       sx,sy,sw,sh;\r
+\r
+       WindowX = x * 8;\r
+       WindowY = y * 8;\r
+       WindowW = w * 8;\r
+       WindowH = h * 8;\r
+\r
+       PrintX = WindowX;\r
+       PrintY = WindowY;\r
+\r
+       sx = (x - 1) * 8;\r
+       sy = (y - 1) * 8;\r
+       sw = (w + 1) * 8;\r
+       sh = (h + 1) * 8;\r
+\r
+       US_ClearWindow();\r
+\r
+       VWB_DrawTile8(sx,sy,0),VWB_DrawTile8(sx,sy + sh,5);\r
+       for (i = sx + 8;i <= sx + sw - 8;i += 8)\r
+               VWB_DrawTile8(i,sy,1),VWB_DrawTile8(i,sy + sh,6);\r
+       VWB_DrawTile8(i,sy,2),VWB_DrawTile8(i,sy + sh,7);\r
+\r
+       for (i = sy + 8;i <= sy + sh - 8;i += 8)\r
+               VWB_DrawTile8(sx,i,3),VWB_DrawTile8(sx + sw,i,4);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_CenterWindow() - Generates a window of a given width & height in the\r
+//             middle of the screen\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_CenterWindow(word w,word h)\r
+{\r
+       US_DrawWindow(((MaxX / 8) - w) / 2,((MaxY / 8) - h) / 2,w,h);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_SaveWindow() - Saves the current window parms into a record for\r
+//             later restoration\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_SaveWindow(WindowRec *win)\r
+{\r
+       win->x = WindowX;\r
+       win->y = WindowY;\r
+       win->w = WindowW;\r
+       win->h = WindowH;\r
+\r
+       win->px = PrintX;\r
+       win->py = PrintY;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_RestoreWindow() - Sets the current window parms to those held in the\r
+//             record\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+US_RestoreWindow(WindowRec *win)\r
+{\r
+       WindowX = win->x;\r
+       WindowY = win->y;\r
+       WindowW = win->w;\r
+       WindowH = win->h;\r
+\r
+       PrintX = win->px;\r
+       PrintY = win->py;\r
+}\r
+\r
+//     Input routines\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     USL_XORICursor() - XORs the I-bar text cursor. Used by US_LineInput()\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+USL_XORICursor(int x,int y,char *s,word cursor)\r
+{\r
+       static  boolean status;         // VGA doesn't XOR...\r
+       char    buf[MaxString];\r
+       int             temp;\r
+       word    w,h;\r
+\r
+       strcpy(buf,s);\r
+       buf[cursor] = '\0';\r
+       USL_MeasureString(buf,&w,&h);\r
+\r
+       px = x + w - 1;\r
+       py = y;\r
+       if (status^=1)\r
+               USL_DrawString("\x80");\r
+       else\r
+       {\r
+               temp = fontcolor;\r
+               fontcolor = backcolor;\r
+               USL_DrawString("\x80");\r
+               fontcolor = temp;\r
+       }\r
+\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     US_LineInput() - Gets a line of user input at (x,y), the string defaults\r
+//             to whatever is pointed at by def. Input is restricted to maxchars\r
+//             chars or maxwidth pixels wide. If the user hits escape (and escok is\r
+//             true), nothing is copied into buf, and false is returned. If the\r
+//             user hits return, the current string is copied into buf, and true is\r
+//             returned\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+boolean\r
+US_LineInput(int x,int y,char *buf,char *def,boolean escok,\r
+                               int maxchars,int maxwidth)\r
+{\r
+       boolean         redraw,\r
+                               cursorvis,cursormoved,\r
+                               done,result;\r
+       ScanCode        sc;\r
+       char            c,\r
+                               s[MaxString],olds[MaxString];\r
+       word            i,\r
+                               cursor,\r
+                               w,h,\r
+                               len,temp;\r
+       longword        lasttime;\r
+\r
+       if (def)\r
+               strcpy(s,def);\r
+       else\r
+               *s = '\0';\r
+       *olds = '\0';\r
+       cursor = strlen(s);\r
+       cursormoved = redraw = true;\r
+\r
+       cursorvis = done = false;\r
+       lasttime = TimeCount;\r
+       LastASCII = key_None;\r
+       LastScan = sc_None;\r
+\r
+       while (!done)\r
+       {\r
+               if (cursorvis)\r
+                       USL_XORICursor(x,y,s,cursor);\r
+\r
+       asm     pushf\r
+       asm     cli\r
+\r
+               sc = LastScan;\r
+               LastScan = sc_None;\r
+               c = LastASCII;\r
+               LastASCII = key_None;\r
+\r
+       asm     popf\r
+\r
+               switch (sc)\r
+               {\r
+               case sc_LeftArrow:\r
+                       if (cursor)\r
+                               cursor--;\r
+                       c = key_None;\r
+                       cursormoved = true;\r
+                       break;\r
+               case sc_RightArrow:\r
+                       if (s[cursor])\r
+                               cursor++;\r
+                       c = key_None;\r
+                       cursormoved = true;\r
+                       break;\r
+               case sc_Home:\r
+                       cursor = 0;\r
+                       c = key_None;\r
+                       cursormoved = true;\r
+                       break;\r
+               case sc_End:\r
+                       cursor = strlen(s);\r
+                       c = key_None;\r
+                       cursormoved = true;\r
+                       break;\r
+\r
+               case sc_Return:\r
+                       strcpy(buf,s);\r
+                       done = true;\r
+                       result = true;\r
+                       c = key_None;\r
+                       break;\r
+               case sc_Escape:\r
+                       if (escok)\r
+                       {\r
+                               done = true;\r
+                               result = false;\r
+                       }\r
+                       c = key_None;\r
+                       break;\r
+\r
+               case sc_BackSpace:\r
+                       if (cursor)\r
+                       {\r
+                               strcpy(s + cursor - 1,s + cursor);\r
+                               cursor--;\r
+                               redraw = true;\r
+                       }\r
+                       c = key_None;\r
+                       cursormoved = true;\r
+                       break;\r
+               case sc_Delete:\r
+                       if (s[cursor])\r
+                       {\r
+                               strcpy(s + cursor,s + cursor + 1);\r
+                               redraw = true;\r
+                       }\r
+                       c = key_None;\r
+                       cursormoved = true;\r
+                       break;\r
+\r
+               case 0x4c:      // Keypad 5\r
+               case sc_UpArrow:\r
+               case sc_DownArrow:\r
+               case sc_PgUp:\r
+               case sc_PgDn:\r
+               case sc_Insert:\r
+                       c = key_None;\r
+                       break;\r
+               }\r
+\r
+               if (c)\r
+               {\r
+                       len = strlen(s);\r
+                       USL_MeasureString(s,&w,&h);\r
+\r
+                       if\r
+                       (\r
+                               isprint(c)\r
+                       &&      (len < MaxString - 1)\r
+                       &&      ((!maxchars) || (len < maxchars))\r
+                       &&      ((!maxwidth) || (w < maxwidth))\r
+                       )\r
+                       {\r
+                               for (i = len + 1;i > cursor;i--)\r
+                                       s[i] = s[i - 1];\r
+                               s[cursor++] = c;\r
+                               redraw = true;\r
+                       }\r
+               }\r
+\r
+               if (redraw)\r
+               {\r
+                       px = x;\r
+                       py = y;\r
+                       temp = fontcolor;\r
+                       fontcolor = backcolor;\r
+                       USL_DrawString(olds);\r
+                       fontcolor = temp;\r
+                       strcpy(olds,s);\r
+\r
+                       px = x;\r
+                       py = y;\r
+                       USL_DrawString(s);\r
+\r
+                       redraw = false;\r
+               }\r
+\r
+               if (cursormoved)\r
+               {\r
+                       cursorvis = false;\r
+                       lasttime = TimeCount - TickBase;\r
+\r
+                       cursormoved = false;\r
+               }\r
+               if (TimeCount - lasttime > TickBase / 2)\r
+               {\r
+                       lasttime = TimeCount;\r
+\r
+                       cursorvis ^= true;\r
+               }\r
+               if (cursorvis)\r
+                       USL_XORICursor(x,y,s,cursor);\r
+\r
+               VW_UpdateScreen();\r
+       }\r
+\r
+       if (cursorvis)\r
+               USL_XORICursor(x,y,s,cursor);\r
+       if (!result)\r
+       {\r
+               px = x;\r
+               py = y;\r
+               USL_DrawString(olds);\r
+       }\r
+       VW_UpdateScreen();\r
+\r
+       IN_ClearKeysDown();\r
+       return(result);\r
+}\r
diff --git a/16/wf3d8086/id_us_a.asm b/16/wf3d8086/id_us_a.asm
new file mode 100755 (executable)
index 0000000..22a02f5
--- /dev/null
@@ -0,0 +1,101 @@
+IDEAL\r
+MODEL  MEDIUM,C\r
+\r
+;      Assembly portion of the User Mgr. This is just John Carmack's table\r
+;              driven pseudo-random number generator, and we put it in the User Mgr\r
+;              because we couldn't figure out where it should go\r
+\r
+\r
+;============================================================================\r
+;\r
+;                           RANDOM ROUTINES\r
+;\r
+;============================================================================\r
+\r
+       FARDATA\r
+\r
+rndindex       dw      ?\r
+\r
+rndtable db    0,   8, 109, 220, 222, 241, 149, 107,  75, 248, 254, 140,  16,  66\r
+       db   74,  21, 211,  47,  80, 242, 154,  27, 205, 128, 161,  89,  77,  36\r
+       db   95, 110,  85,  48, 212, 140, 211, 249,  22,  79, 200,  50,  28, 188\r
+       db   52, 140, 202, 120,  68, 145,  62,  70, 184, 190,  91, 197, 152, 224\r
+       db  149, 104,  25, 178, 252, 182, 202, 182, 141, 197,   4,  81, 181, 242\r
+       db  145,  42,  39, 227, 156, 198, 225, 193, 219,  93, 122, 175, 249,   0\r
+       db  175, 143,  70, 239,  46, 246, 163,  53, 163, 109, 168, 135,   2, 235\r
+       db   25,  92,  20, 145, 138,  77,  69, 166,  78, 176, 173, 212, 166, 113\r
+       db   94, 161,  41,  50, 239,  49, 111, 164,  70,  60,   2,  37, 171,  75\r
+       db  136, 156,  11,  56,  42, 146, 138, 229,  73, 146,  77,  61,  98, 196\r
+       db  135, 106,  63, 197, 195,  86,  96, 203, 113, 101, 170, 247, 181, 113\r
+       db   80, 250, 108,   7, 255, 237, 129, 226,  79, 107, 112, 166, 103, 241\r
+       db   24, 223, 239, 120, 198,  58,  60,  82, 128,   3, 184,  66, 143, 224\r
+       db  145, 224,  81, 206, 163,  45,  63,  90, 168, 114,  59,  33, 159,  95\r
+       db   28, 139, 123,  98, 125, 196,  15,  70, 194, 253,  54,  14, 109, 226\r
+       db   71,  17, 161,  93, 186,  87, 244, 138,  20,  52, 123, 251,  26,  36\r
+       db   17,  46,  52, 231, 232,  76,  31, 221,  84,  37, 216, 165, 212, 106\r
+       db  197, 242,  98,  43,  39, 175, 254, 145, 190,  84, 118, 222, 187, 136\r
+       db  120, 163, 236, 249\r
+\r
+PUBLIC rndtable\r
+\r
+       CODESEG\r
+\r
+LastRnd                dw      ?\r
+\r
+;=================================================\r
+;\r
+; void US_InitRndT (boolean randomize)\r
+; Init table based RND generator\r
+; if randomize is false, the counter is set to 0\r
+;\r
+;=================================================\r
+\r
+PROC   US_InitRndT randomize:word\r
+       uses    si,di\r
+       public  US_InitRndT\r
+\r
+       mov     ax,SEG rndtable\r
+       mov     es,ax\r
+\r
+       mov     ax,[randomize]\r
+       or      ax,ax\r
+       jne     @@timeit                ;if randomize is true, really random\r
+\r
+       mov     dx,0                    ;set to a definite value\r
+       jmp     @@setit\r
+\r
+@@timeit:\r
+       mov     ah,2ch\r
+       int     21h                     ;GetSystemTime\r
+       and     dx,0ffh\r
+\r
+@@setit:\r
+       mov     [es:rndindex],dx\r
+       ret\r
+\r
+ENDP\r
+\r
+;=================================================\r
+;\r
+; int US_RndT (void)\r
+; Return a random # between 0-255\r
+; Exit : AX = value\r
+;\r
+;=================================================\r
+PROC   US_RndT\r
+       public  US_RndT\r
+\r
+       mov     ax,SEG rndtable\r
+       mov     es,ax\r
+       mov     bx,[es:rndindex]\r
+       inc     bx\r
+       and     bx,0ffh\r
+       mov     [es:rndindex],bx\r
+       mov     al,[es:rndtable+BX]\r
+       xor     ah,ah\r
+       ret\r
+\r
+ENDP\r
+\r
+END\r
+\r
diff --git a/16/wf3d8086/id_vh.c b/16/wf3d8086/id_vh.c
new file mode 100755 (executable)
index 0000000..696a3e1
--- /dev/null
@@ -0,0 +1,547 @@
+// ID_VH.C\r
+\r
+#include "ID_HEADS.H"\r
+\r
+#define        SCREENWIDTH             80\r
+#define CHARWIDTH              2\r
+#define TILEWIDTH              4\r
+#define GRPLANES               4\r
+#define BYTEPIXELS             4\r
+\r
+#define SCREENXMASK            (~3)\r
+#define SCREENXPLUS            (3)\r
+#define SCREENXDIV             (4)\r
+\r
+#define VIEWWIDTH              80\r
+\r
+#define PIXTOBLOCK             4               // 16 pixels to an update block\r
+\r
+#define UNCACHEGRCHUNK(chunk)  {MM_FreePtr(&grsegs[chunk]);grneeded[chunk]&=~ca_levelbit;}\r
+\r
+byte   update[UPDATEHIGH][UPDATEWIDE];\r
+\r
+//==========================================================================\r
+\r
+pictabletype   _seg *pictable;\r
+\r
+\r
+int    px,py;\r
+byte   fontcolor,backcolor;\r
+int    fontnumber;\r
+int bufferwidth,bufferheight;\r
+\r
+\r
+//==========================================================================\r
+\r
+void   VWL_UpdateScreenBlocks (void);\r
+\r
+//==========================================================================\r
+\r
+void VW_DrawPropString (char far *string)\r
+{\r
+       fontstruct      far     *font;\r
+       int             width,step,height,i;\r
+       byte    far *source, far *dest, far *origdest;\r
+       byte    ch,mask;\r
+\r
+       font = (fontstruct far *)grsegs[STARTFONT+fontnumber];\r
+       height = bufferheight = font->height;\r
+       dest = origdest = MK_FP(SCREENSEG,bufferofs+ylookup[py]+(px>>2));\r
+       mask = 1<<(px&3);\r
+\r
+\r
+       while ((ch = *string++)!=0)\r
+       {\r
+               width = step = font->width[ch];\r
+               source = ((byte far *)font)+font->location[ch];\r
+               while (width--)\r
+               {\r
+                       VGAMAPMASK(mask);\r
+\r
+asm    mov     ah,[BYTE PTR fontcolor]\r
+asm    mov     bx,[step]\r
+asm    mov     cx,[height]\r
+asm    mov     dx,[linewidth]\r
+asm    lds     si,[source]\r
+asm    les     di,[dest]\r
+\r
+vertloop:\r
+asm    mov     al,[si]\r
+asm    or      al,al\r
+asm    je      next\r
+asm    mov     [es:di],ah                      // draw color\r
+\r
+next:\r
+asm    add     si,bx\r
+asm    add     di,dx\r
+asm    loop    vertloop\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+                       source++;\r
+                       px++;\r
+                       mask <<= 1;\r
+                       if (mask == 16)\r
+                       {\r
+                               mask = 1;\r
+                               dest++;\r
+                       }\r
+               }\r
+       }\r
+bufferheight = height;\r
+bufferwidth = ((dest+1)-origdest)*4;\r
+}\r
+\r
+\r
+void VW_DrawColorPropString (char far *string)\r
+{\r
+       fontstruct      far     *font;\r
+       int             width,step,height,i;\r
+       byte    far *source, far *dest, far *origdest;\r
+       byte    ch,mask;\r
+\r
+       font = (fontstruct far *)grsegs[STARTFONT+fontnumber];\r
+       height = bufferheight = font->height;\r
+       dest = origdest = MK_FP(SCREENSEG,bufferofs+ylookup[py]+(px>>2));\r
+       mask = 1<<(px&3);\r
+\r
+\r
+       while ((ch = *string++)!=0)\r
+       {\r
+               width = step = font->width[ch];\r
+               source = ((byte far *)font)+font->location[ch];\r
+               while (width--)\r
+               {\r
+                       VGAMAPMASK(mask);\r
+\r
+asm    mov     ah,[BYTE PTR fontcolor]\r
+asm    mov     bx,[step]\r
+asm    mov     cx,[height]\r
+asm    mov     dx,[linewidth]\r
+asm    lds     si,[source]\r
+asm    les     di,[dest]\r
+\r
+vertloop:\r
+asm    mov     al,[si]\r
+asm    or      al,al\r
+asm    je      next\r
+asm    mov     [es:di],ah                      // draw color\r
+\r
+next:\r
+asm    add     si,bx\r
+asm    add     di,dx\r
+\r
+asm rcr cx,1                           // inc font color\r
+asm jc  cont\r
+asm    inc ah\r
+\r
+cont:\r
+asm rcl cx,1\r
+asm    loop    vertloop\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+                       source++;\r
+                       px++;\r
+                       mask <<= 1;\r
+                       if (mask == 16)\r
+                       {\r
+                               mask = 1;\r
+                               dest++;\r
+                       }\r
+               }\r
+       }\r
+bufferheight = height;\r
+bufferwidth = ((dest+1)-origdest)*4;\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_MungePic\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MungePic (byte far *source, unsigned width, unsigned height)\r
+{\r
+       unsigned        x,y,plane,size,pwidth;\r
+       byte            _seg *temp, far *dest, far *srcline;\r
+\r
+       size = width*height;\r
+\r
+       if (width&3)\r
+               MS_Quit ("VL_MungePic: Not divisable by 4!");\r
+\r
+//\r
+// copy the pic to a temp buffer\r
+//\r
+       MM_GetPtr (&(memptr)temp,size);\r
+       _fmemcpy (temp,source,size);\r
+\r
+//\r
+// munge it back into the original buffer\r
+//\r
+       dest = source;\r
+       pwidth = width/4;\r
+\r
+       for (plane=0;plane<4;plane++)\r
+       {\r
+               srcline = temp;\r
+               for (y=0;y<height;y++)\r
+               {\r
+                       for (x=0;x<pwidth;x++)\r
+                               *dest++ = *(srcline+x*4+plane);\r
+                       srcline+=width;\r
+               }\r
+       }\r
+\r
+       MM_FreePtr (&(memptr)temp);\r
+}\r
+\r
+void VWL_MeasureString (char far *string, word *width, word *height\r
+       , fontstruct _seg *font)\r
+{\r
+       *height = font->height;\r
+       for (*width = 0;*string;string++)\r
+               *width += font->width[*((byte far *)string)];   // proportional width\r
+}\r
+\r
+void   VW_MeasurePropString (char far *string, word *width, word *height)\r
+{\r
+       VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONT+fontnumber]);\r
+}\r
+\r
+void   VW_MeasureMPropString  (char far *string, word *width, word *height)\r
+{\r
+       VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONTM+fontnumber]);\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                               Double buffer management routines\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VW_MarkUpdateBlock\r
+=\r
+= Takes a pixel bounded block and marks the tiles in bufferblocks\r
+= Returns 0 if the entire block is off the buffer screen\r
+=\r
+=======================\r
+*/\r
+\r
+int VW_MarkUpdateBlock (int x1, int y1, int x2, int y2)\r
+{\r
+       int     x,y,xt1,yt1,xt2,yt2,nextline;\r
+       byte *mark;\r
+\r
+       xt1 = x1>>PIXTOBLOCK;\r
+       yt1 = y1>>PIXTOBLOCK;\r
+\r
+       xt2 = x2>>PIXTOBLOCK;\r
+       yt2 = y2>>PIXTOBLOCK;\r
+\r
+       if (xt1<0)\r
+               xt1=0;\r
+       else if (xt1>=UPDATEWIDE)\r
+               return 0;\r
+\r
+       if (yt1<0)\r
+               yt1=0;\r
+       else if (yt1>UPDATEHIGH)\r
+               return 0;\r
+\r
+       if (xt2<0)\r
+               return 0;\r
+       else if (xt2>=UPDATEWIDE)\r
+               xt2 = UPDATEWIDE-1;\r
+\r
+       if (yt2<0)\r
+               return 0;\r
+       else if (yt2>=UPDATEHIGH)\r
+               yt2 = UPDATEHIGH-1;\r
+\r
+       mark = updateptr + uwidthtable[yt1] + xt1;\r
+       nextline = UPDATEWIDE - (xt2-xt1) - 1;\r
+\r
+       for (y=yt1;y<=yt2;y++)\r
+       {\r
+               for (x=xt1;x<=xt2;x++)\r
+                       *mark++ = 1;                    // this tile will need to be updated\r
+\r
+               mark += nextline;\r
+       }\r
+\r
+       return 1;\r
+}\r
+\r
+void VWB_DrawTile8 (int x, int y, int tile)\r
+{\r
+       if (VW_MarkUpdateBlock (x,y,x+7,y+7))\r
+               LatchDrawChar(x,y,tile);\r
+}\r
+\r
+void VWB_DrawTile8M (int x, int y, int tile)\r
+{\r
+       if (VW_MarkUpdateBlock (x,y,x+7,y+7))\r
+               VL_MemToScreen (((byte far *)grsegs[STARTTILE8M])+tile*64,8,8,x,y);\r
+}\r
+\r
+\r
+void VWB_DrawPic (int x, int y, int chunknum)\r
+{\r
+       int     picnum = chunknum - STARTPICS;\r
+       unsigned width,height;\r
+\r
+       x &= ~7;\r
+\r
+       width = pictable[picnum].width;\r
+       height = pictable[picnum].height;\r
+\r
+       if (VW_MarkUpdateBlock (x,y,x+width-1,y+height-1))\r
+               VL_MemToScreen (grsegs[chunknum],width,height,x,y);\r
+}\r
+\r
+\r
+\r
+void VWB_DrawPropString         (char far *string)\r
+{\r
+       int x;\r
+       x=px;\r
+       VW_DrawPropString (string);\r
+       VW_MarkUpdateBlock(x,py,px-1,py+bufferheight-1);\r
+}\r
+\r
+\r
+void VWB_Bar (int x, int y, int width, int height, int color)\r
+{\r
+       if (VW_MarkUpdateBlock (x,y,x+width,y+height-1) )\r
+               VW_Bar (x,y,width,height,color);\r
+}\r
+\r
+void VWB_Plot (int x, int y, int color)\r
+{\r
+       if (VW_MarkUpdateBlock (x,y,x,y))\r
+               VW_Plot(x,y,color);\r
+}\r
+\r
+void VWB_Hlin (int x1, int x2, int y, int color)\r
+{\r
+       if (VW_MarkUpdateBlock (x1,y,x2,y))\r
+               VW_Hlin(x1,x2,y,color);\r
+}\r
+\r
+void VWB_Vlin (int y1, int y2, int x, int color)\r
+{\r
+       if (VW_MarkUpdateBlock (x,y1,x,y2))\r
+               VW_Vlin(y1,y2,x,color);\r
+}\r
+\r
+void VW_UpdateScreen (void)\r
+{\r
+       VH_UpdateScreen ();\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               WOLFENSTEIN STUFF\r
+\r
+=============================================================================\r
+*/\r
+\r
+/*\r
+=====================\r
+=\r
+= LatchDrawPic\r
+=\r
+=====================\r
+*/\r
+\r
+void LatchDrawPic (unsigned x, unsigned y, unsigned picnum)\r
+{\r
+       unsigned wide, height, source;\r
+\r
+       wide = pictable[picnum-STARTPICS].width;\r
+       height = pictable[picnum-STARTPICS].height;\r
+       source = latchpics[2+picnum-LATCHPICS_LUMP_START];\r
+\r
+       VL_LatchToScreen (source,wide/4,height,x*8,y);\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= LoadLatchMem\r
+=\r
+===================\r
+*/\r
+\r
+void LoadLatchMem (void)\r
+{\r
+       int     i,j,p,m,width,height,start,end;\r
+       byte    far *src;\r
+       unsigned        destoff;\r
+\r
+//\r
+// tile 8s\r
+//\r
+       latchpics[0] = freelatch;\r
+       CA_CacheGrChunk (STARTTILE8);\r
+       src = (byte _seg *)grsegs[STARTTILE8];\r
+       destoff = freelatch;\r
+\r
+       for (i=0;i<NUMTILE8;i++)\r
+       {\r
+               VL_MemToLatch (src,8,8,destoff);\r
+               src += 64;\r
+               destoff +=16;\r
+       }\r
+       UNCACHEGRCHUNK (STARTTILE8);\r
+\r
+#if 0  // ran out of latch space!\r
+//\r
+// tile 16s\r
+//\r
+       src = (byte _seg *)grsegs[STARTTILE16];\r
+       latchpics[1] = destoff;\r
+\r
+       for (i=0;i<NUMTILE16;i++)\r
+       {\r
+               CA_CacheGrChunk (STARTTILE16+i);\r
+               src = (byte _seg *)grsegs[STARTTILE16+i];\r
+               VL_MemToLatch (src,16,16,destoff);\r
+               destoff+=64;\r
+               if (src)\r
+                       UNCACHEGRCHUNK (STARTTILE16+i);\r
+       }\r
+#endif\r
+\r
+//\r
+// pics\r
+//\r
+       start = LATCHPICS_LUMP_START;\r
+       end = LATCHPICS_LUMP_END;\r
+\r
+       for (i=start;i<=end;i++)\r
+       {\r
+               latchpics[2+i-start] = destoff;\r
+               CA_CacheGrChunk (i);\r
+               width = pictable[i-STARTPICS].width;\r
+               height = pictable[i-STARTPICS].height;\r
+               VL_MemToLatch (grsegs[i],width,height,destoff);\r
+               destoff += width/4 *height;\r
+               UNCACHEGRCHUNK(i);\r
+       }\r
+\r
+       EGAMAPMASK(15);\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= FizzleFade\r
+=\r
+= returns true if aborted\r
+=\r
+===================\r
+*/\r
+\r
+extern ControlInfo     c;\r
+\r
+boolean FizzleFade (unsigned source, unsigned dest,\r
+       unsigned width,unsigned height, unsigned frames, boolean abortable)\r
+{\r
+       int                     pixperframe;\r
+       unsigned        drawofs,pagedelta;\r
+       byte            mask,maskb[8] = {1,2,4,8};\r
+       unsigned        x,y,p,frame;\r
+       long            rndval;\r
+\r
+       pagedelta = dest-source;\r
+       rndval = 1;\r
+       y = 0;\r
+       pixperframe = 64000/frames;\r
+\r
+       IN_StartAck ();\r
+\r
+       TimeCount=frame=0;\r
+       do      // while (1)\r
+       {\r
+               if (abortable && IN_CheckAck () )\r
+                       return true;\r
+\r
+               asm     mov     es,[screenseg]\r
+\r
+               for (p=0;p<pixperframe;p++)\r
+               {\r
+                       //\r
+                       // seperate random value into x/y pair\r
+                       //\r
+                       asm     mov     ax,[WORD PTR rndval]\r
+                       asm     mov     dx,[WORD PTR rndval+2]\r
+                       asm     mov     bx,ax\r
+                       asm     dec     bl\r
+                       asm     mov     [BYTE PTR y],bl                 // low 8 bits - 1 = y xoordinate\r
+                       asm     mov     bx,ax\r
+                       asm     mov     cx,dx\r
+                       asm     mov     [BYTE PTR x],ah                 // next 9 bits = x xoordinate\r
+                       asm     mov     [BYTE PTR x+1],dl\r
+                       //\r
+                       // advance to next random element\r
+                       //\r
+                       asm     shr     dx,1\r
+                       asm     rcr     ax,1\r
+                       asm     jnc     noxor\r
+                       asm     xor     dx,0x0001\r
+                       asm     xor     ax,0x2000\r
+noxor:\r
+                       asm     mov     [WORD PTR rndval],ax\r
+                       asm     mov     [WORD PTR rndval+2],dx\r
+\r
+                       if (x>width || y>height)\r
+                               continue;\r
+                       drawofs = source+ylookup[y] + (x>>2);\r
+\r
+                       //\r
+                       // copy one pixel\r
+                       //\r
+                       mask = x&3;\r
+                       VGAREADMAP(mask);\r
+                       mask = maskb[mask];\r
+                       VGAMAPMASK(mask);\r
+\r
+                       asm     mov     di,[drawofs]\r
+                       asm     mov     al,[es:di]\r
+                       asm add di,[pagedelta]\r
+                       asm     mov     [es:di],al\r
+\r
+                       if (rndval == 1)                // entire sequence has been completed\r
+                               return false;\r
+               }\r
+               frame++;\r
+               while (TimeCount<frame)         // don't go too fast\r
+               ;\r
+       } while (1);\r
+\r
+\r
+}\r
diff --git a/16/wf3d8086/id_vh.h b/16/wf3d8086/id_vh.h
new file mode 100755 (executable)
index 0000000..3afd1ab
--- /dev/null
@@ -0,0 +1,134 @@
+// ID_VH.H\r
+\r
+\r
+#define WHITE                  15                      // graphics mode independant colors\r
+#define BLACK                  0\r
+#define FIRSTCOLOR             1\r
+#define SECONDCOLOR            12\r
+#define F_WHITE                        15\r
+#define F_BLACK                        0\r
+#define F_FIRSTCOLOR   1\r
+#define F_SECONDCOLOR  12\r
+\r
+//===========================================================================\r
+\r
+#define MAXSHIFTS      1\r
+\r
+typedef struct\r
+{\r
+  int  width,\r
+       height,\r
+       orgx,orgy,\r
+       xl,yl,xh,yh,\r
+       shifts;\r
+} spritetabletype;\r
+\r
+typedef        struct\r
+{\r
+       unsigned        sourceoffset[MAXSHIFTS];\r
+       unsigned        planesize[MAXSHIFTS];\r
+       unsigned        width[MAXSHIFTS];\r
+       byte            data[];\r
+} spritetype;          // the memptr for each sprite points to this\r
+\r
+typedef struct\r
+{\r
+       int width,height;\r
+} pictabletype;\r
+\r
+\r
+typedef struct\r
+{\r
+       int height;\r
+       int location[256];\r
+       char width[256];\r
+} fontstruct;\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+extern pictabletype    _seg *pictable;\r
+extern pictabletype    _seg *picmtable;\r
+extern spritetabletype _seg *spritetable;\r
+\r
+extern byte    fontcolor;\r
+extern int     fontnumber;\r
+extern int     px,py;\r
+\r
+//\r
+// Double buffer management routines\r
+//\r
+\r
+void VW_InitDoubleBuffer (void);\r
+int     VW_MarkUpdateBlock (int x1, int y1, int x2, int y2);\r
+void VW_UpdateScreen (void);\r
+\r
+//\r
+// mode independant routines\r
+// coordinates in pixels, rounded to best screen res\r
+// regions marked in double buffer\r
+//\r
+\r
+void VWB_DrawTile8 (int x, int y, int tile);\r
+void VWB_DrawTile8M (int x, int y, int tile);\r
+void VWB_DrawTile16 (int x, int y, int tile);\r
+void VWB_DrawTile16M (int x, int y, int tile);\r
+void VWB_DrawPic (int x, int y, int chunknum);\r
+void VWB_DrawMPic(int x, int y, int chunknum);\r
+void VWB_Bar (int x, int y, int width, int height, int color);\r
+\r
+void VWB_DrawPropString         (char far *string);\r
+void VWB_DrawMPropString (char far *string);\r
+void VWB_DrawSprite (int x, int y, int chunknum);\r
+void VWB_Plot (int x, int y, int color);\r
+void VWB_Hlin (int x1, int x2, int y, int color);\r
+void VWB_Vlin (int y1, int y2, int x, int color);\r
+\r
+\r
+//\r
+// wolfenstein EGA compatability stuff\r
+//\r
+extern byte far gamepal;\r
+\r
+void VH_SetDefaultColors (void);\r
+\r
+#define VW_Startup             VL_Startup\r
+#define VW_Shutdown            VL_Shutdown\r
+#define VW_SetCRTC             VL_SetCRTC\r
+#define VW_SetScreen   VL_SetScreen\r
+#define VW_Bar                 VL_Bar\r
+#define VW_Plot                        VL_Plot\r
+#define VW_Hlin(x,z,y,c)       VL_Hlin(x,y,(z)-(x)+1,c)\r
+#define VW_Vlin(y,z,x,c)       VL_Vlin(x,y,(z)-(y)+1,c)\r
+#define VW_DrawPic             VH_DrawPic\r
+#define VW_SetSplitScreen      VL_SetSplitScreen\r
+#define VW_SetLineWidth                VL_SetLineWidth\r
+#define VW_ColorBorder VL_ColorBorder\r
+#define VW_WaitVBL             VL_WaitVBL\r
+#define VW_FadeIn()            VL_FadeIn(0,255,&gamepal,30);\r
+#define VW_FadeOut()   VL_FadeOut(0,255,0,0,0,30);\r
+#define VW_ScreenToScreen      VL_ScreenToScreen\r
+#define VW_SetDefaultColors    VH_SetDefaultColors\r
+void   VW_MeasurePropString (char far *string, word *width, word *height);\r
+#define EGAMAPMASK(x)  VGAMAPMASK(x)\r
+#define EGAWRITEMODE(x)        VGAWRITEMODE(x)\r
+\r
+//#define VW_MemToScreen       VL_MemToLatch\r
+\r
+#define MS_Quit                        Quit\r
+\r
+\r
+#define LatchDrawChar(x,y,p) VL_LatchToScreen(latchpics[0]+(p)*16,2,8,x,y)\r
+#define LatchDrawTile(x,y,p) VL_LatchToScreen(latchpics[1]+(p)*64,4,16,x,y)\r
+\r
+void LatchDrawPic (unsigned x, unsigned y, unsigned picnum);\r
+void   LoadLatchMem (void);\r
+boolean        FizzleFade (unsigned source, unsigned dest,\r
+       unsigned width,unsigned height, unsigned frames,boolean abortable);\r
+\r
+\r
+#define NUMLATCHPICS   100\r
+extern unsigned        latchpics[NUMLATCHPICS];\r
+extern unsigned freelatch;\r
+\r
diff --git a/16/wf3d8086/id_vh_a.asm b/16/wf3d8086/id_vh_a.asm
new file mode 100755 (executable)
index 0000000..7e59995
--- /dev/null
@@ -0,0 +1,110 @@
+; ID_VL.ASM\r
+\r
+       IDEAL\r
+       MODEL   MEDIUM,C\r
+\r
+       INCLUDE 'ID_VL.EQU'\r
+\r
+SCREENSEG      =       0a000h\r
+\r
+UPDATEWIDE     =       20\r
+UPDATEHIGH     =       13\r
+\r
+       DATASEG\r
+\r
+\r
+EXTRN  bufferofs                       :WORD\r
+EXTRN  displayofs                      :WORD\r
+EXTRN  ylookup                         :WORD\r
+EXTRN  linewidth                       :WORD\r
+EXTRN  blockstarts                     :WORD   ;offsets from drawofs for each update block\r
+\r
+EXTRN  update                          :BYTE\r
+\r
+       CODESEG\r
+\r
+\r
+;=================\r
+;\r
+; VH_UpdateScreen\r
+;\r
+;=================\r
+\r
+PROC   VH_UpdateScreen\r
+PUBLIC VH_UpdateScreen\r
+USES   si,di\r
+\r
+       mov     dx,SC_INDEX\r
+       mov     ax,SC_MAPMASK+15*256\r
+       out     dx,ax\r
+\r
+       mov dx,GC_INDEX\r
+       mov al,GC_MODE\r
+       out dx,al\r
+\r
+       inc dx\r
+       in      al,dx\r
+       and al,252\r
+       or      al,1\r
+       out dx,al\r
+\r
+       mov     bx,UPDATEWIDE*UPDATEHIGH-1              ; bx is the tile number\r
+       mov     dx,[linewidth]\r
+\r
+;\r
+; see if the tile needs to be copied\r
+;\r
+@@checktile:\r
+       test    [update+bx],1\r
+       jnz     @@copytile\r
+@@next:\r
+       dec     bx\r
+       jns     @@checktile\r
+\r
+;\r
+; done\r
+;\r
+       mov dx,GC_INDEX+1\r
+       in      al,dx\r
+       and al,NOT 3\r
+       or      al,0\r
+       out dx,al\r
+       ret\r
+\r
+;\r
+; copy a tile\r
+;\r
+@@copytile:\r
+       mov     [update+bx],0\r
+       shl     bx,1\r
+       mov     si,[blockstarts+bx]\r
+       shr     bx,1\r
+       mov     di,si\r
+       add     si,[bufferofs]\r
+       add     di,[displayofs]\r
+\r
+       mov     ax,SCREENSEG\r
+       mov     ds,ax\r
+\r
+REPT   16\r
+       mov     al,[si]\r
+       mov     [di],al\r
+       mov     al,[si+1]\r
+       mov     [di+1],al\r
+       mov     al,[si+2]\r
+       mov     [di+2],al\r
+       mov     al,[si+3]\r
+       mov     [di+3],al\r
+       add     si,dx\r
+       add     di,dx\r
+ENDM\r
+\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       jmp     @@next\r
+\r
+ENDP\r
+\r
+\r
+       END\r
+\r
diff --git a/16/wf3d8086/id_vl.bak b/16/wf3d8086/id_vl.bak
new file mode 100755 (executable)
index 0000000..cdd06bb
--- /dev/null
@@ -0,0 +1,1085 @@
+// ID_VL.C\r
+\r
+#include <dos.h>\r
+#include <alloc.h>\r
+#include <mem.h>\r
+#include <string.h>\r
+#include "ID_HEAD.H"\r
+#include "ID_VL.H"\r
+#pragma hdrstop\r
+\r
+//\r
+// SC_INDEX is expected to stay at SC_MAPMASK for proper operation\r
+//\r
+\r
+unsigned       bufferofs;\r
+unsigned       displayofs,pelpan;\r
+\r
+unsigned       screenseg=SCREENSEG;            // set to 0xa000 for asm convenience\r
+\r
+unsigned       linewidth;\r
+unsigned       ylookup[MAXSCANLINES];\r
+\r
+boolean                screenfaded;\r
+unsigned       bordercolor;\r
+\r
+boolean                fastpalette;                            // if true, use outsb to set\r
+\r
+byte           far     palette1[256][3],far palette2[256][3];\r
+\r
+//===========================================================================\r
+\r
+// asm\r
+\r
+int     VL_VideoID (void);\r
+void VL_SetCRTC (int crtc);\r
+void VL_SetScreen (int crtc, int pelpan);\r
+void VL_WaitVBL (int vbls);\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_Startup\r
+=\r
+=======================\r
+*/\r
+\r
+#if 0\r
+void   VL_Startup (void)\r
+{\r
+       if ( !MS_CheckParm ("HIDDENCARD") && VL_VideoID () != 5)\r
+               MS_Quit ("You need a VGA graphics card to run this!");\r
+\r
+       asm     cld;                            // all string instructions assume forward\r
+}\r
+\r
+#endif\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_Startup   // WOLFENSTEIN HACK\r
+=\r
+=======================\r
+*/\r
+\r
+static char *ParmStrings[] = {"HIDDENCARD",""};\r
+\r
+void   VL_Startup (void)\r
+{\r
+       int i,videocard;\r
+\r
+       asm     cld;\r
+\r
+       videocard = VL_VideoID ();\r
+       for (i = 1;i < _argc;i++)\r
+               if (US_CheckParm(_argv[i],ParmStrings) == 0)\r
+               {\r
+                       videocard = 5;\r
+                       break;\r
+               }\r
+\r
+       if (videocard != 5)\r
+Quit ("Improper video card!  If you really have a VGA card that I am not \n"\r
+         "detecting, use the -HIDDENCARD command line parameter!");\r
+\r
+}\r
+\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_Shutdown\r
+=\r
+=======================\r
+*/\r
+\r
+void   VL_Shutdown (void)\r
+{\r
+       VL_SetTextMode ();\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_SetVGAPlaneMode\r
+=\r
+=======================\r
+*/\r
+\r
+void   VL_SetVGAPlaneMode (void)\r
+{\r
+asm    mov     ax,0x13\r
+asm    int     0x10\r
+       VL_DePlaneVGA ();\r
+       VGAMAPMASK(15);\r
+       VL_SetLineWidth (40);\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_SetTextMode\r
+=\r
+=======================\r
+*/\r
+\r
+void   VL_SetTextMode (void)\r
+{\r
+asm    mov     ax,3\r
+asm    int     0x10\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_ClearVideo\r
+=\r
+= Fill the entire video buffer with a given color\r
+=\r
+=================\r
+*/\r
+\r
+void VL_ClearVideo (byte color)\r
+{\r
+asm    mov     dx,GC_INDEX\r
+asm    mov     al,GC_MODE\r
+asm    out     dx,al\r
+asm    inc     dx\r
+asm    in      al,dx\r
+asm    and     al,0xfc                         // write mode 0 to store directly to video\r
+asm    out     dx,al\r
+\r
+asm    mov     dx,SC_INDEX\r
+asm    mov     ax,SC_MAPMASK+15*256\r
+asm    out     dx,ax                           // write through all four planes\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    mov     al,[color]\r
+asm    mov     ah,al\r
+asm    mov     cx,0x8000                       // 0x8000 words, clearing 8 video bytes/word\r
+asm    xor     di,di\r
+asm    rep     stosw\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                       VGA REGISTER MANAGEMENT ROUTINES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_DePlaneVGA\r
+=\r
+=================\r
+*/\r
+\r
+void VL_DePlaneVGA (void)\r
+{\r
+\r
+//\r
+// change CPU addressing to non linear mode\r
+//\r
+\r
+//\r
+// turn off chain 4 and odd/even\r
+//\r
+       outportb (SC_INDEX,SC_MEMMODE);\r
+       outportb (SC_INDEX+1,(inportb(SC_INDEX+1)&~8)|4);\r
+\r
+       outportb (SC_INDEX,SC_MAPMASK);         // leave this set throughought\r
+\r
+//\r
+// turn off odd/even and set write mode 0\r
+//\r
+       outportb (GC_INDEX,GC_MODE);\r
+       outportb (GC_INDEX+1,inportb(GC_INDEX+1)&~0x13);\r
+\r
+//\r
+// turn off chain\r
+//\r
+       outportb (GC_INDEX,GC_MISCELLANEOUS);\r
+       outportb (GC_INDEX+1,inportb(GC_INDEX+1)&~2);\r
+\r
+//\r
+// clear the entire buffer space, because int 10h only did 16 k / plane\r
+//\r
+       VL_ClearVideo (0);\r
+\r
+//\r
+// change CRTC scanning from doubleword to byte mode, allowing >64k scans\r
+//\r
+       outportb (CRTC_INDEX,CRTC_UNDERLINE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1)&~0x40);\r
+\r
+       outportb (CRTC_INDEX,CRTC_MODE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1)|0x40);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= VL_SetLineWidth\r
+=\r
+= Line witdh is in WORDS, 40 words is normal width for vgaplanegr\r
+=\r
+====================\r
+*/\r
+\r
+void VL_SetLineWidth (unsigned width)\r
+{\r
+       int i,offset;\r
+\r
+//\r
+// set wide virtual screen\r
+//\r
+       outport (CRTC_INDEX,CRTC_OFFSET+width*256);\r
+\r
+//\r
+// set up lookup tables\r
+//\r
+       linewidth = width*2;\r
+\r
+       offset = 0;\r
+\r
+       for (i=0;i<MAXSCANLINES;i++)\r
+       {\r
+               ylookup[i]=offset;\r
+               offset += linewidth;\r
+       }\r
+}\r
+\r
+/*\r
+====================\r
+=\r
+= VL_SetSplitScreen\r
+=\r
+====================\r
+*/\r
+\r
+void VL_SetSplitScreen (int linenum)\r
+{\r
+       VL_WaitVBL (1);\r
+       linenum=linenum*2-1;\r
+       outportb (CRTC_INDEX,CRTC_LINECOMPARE);\r
+       outportb (CRTC_INDEX+1,linenum % 256);\r
+       outportb (CRTC_INDEX,CRTC_OVERFLOW);\r
+       outportb (CRTC_INDEX+1, 1+16*(linenum/256));\r
+       outportb (CRTC_INDEX,CRTC_MAXSCANLINE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1) & (255-64));\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               PALETTE OPS\r
+\r
+               To avoid snow, do a WaitVBL BEFORE calling these\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_FillPalette\r
+=\r
+=================\r
+*/\r
+\r
+void VL_FillPalette (int red, int green, int blue)\r
+{\r
+       int     i;\r
+\r
+       outportb (PEL_WRITE_ADR,0);\r
+       for (i=0;i<256;i++)\r
+       {\r
+               outportb (PEL_DATA,red);\r
+               outportb (PEL_DATA,green);\r
+               outportb (PEL_DATA,blue);\r
+       }\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_SetColor\r
+=\r
+=================\r
+*/\r
+\r
+void VL_SetColor       (int color, int red, int green, int blue)\r
+{\r
+       outportb (PEL_WRITE_ADR,color);\r
+       outportb (PEL_DATA,red);\r
+       outportb (PEL_DATA,green);\r
+       outportb (PEL_DATA,blue);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_GetColor\r
+=\r
+=================\r
+*/\r
+\r
+void VL_GetColor       (int color, int *red, int *green, int *blue)\r
+{\r
+       outportb (PEL_READ_ADR,color);\r
+       *red = inportb (PEL_DATA);\r
+       *green = inportb (PEL_DATA);\r
+       *blue = inportb (PEL_DATA);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_SetPalette\r
+=\r
+= If fast palette setting has been tested for, it is used\r
+= (some cards don't like outsb palette setting)\r
+=\r
+=================\r
+*/\r
+\r
+void VL_SetPalette (byte far *palette)\r
+{\r
+       int     i;\r
+\r
+//     outportb (PEL_WRITE_ADR,0);\r
+//     for (i=0;i<768;i++)\r
+//             outportb(PEL_DATA,*palette++);\r
+\r
+       asm     mov     dx,PEL_WRITE_ADR\r
+       asm     mov     al,0\r
+       asm     out     dx,al\r
+       asm     mov     dx,PEL_DATA\r
+       asm     lds     si,[palette]\r
+\r
+       asm     test    [ss:fastpalette],1\r
+       asm     jz      slowset\r
+//\r
+// set palette fast for cards that can take it\r
+//\r
+       asm     mov     cx,768\r
+       asm     rep outsb\r
+       asm     jmp     done\r
+\r
+//\r
+// set palette slowly for some video cards\r
+//\r
+slowset:\r
+       asm     mov     cx,256\r
+setloop:\r
+       asm     lodsb\r
+       asm     out     dx,al\r
+       asm     lodsb\r
+       asm     out     dx,al\r
+       asm     lodsb\r
+       asm     out     dx,al\r
+       asm     loop    setloop\r
+\r
+done:\r
+       asm     mov     ax,ss\r
+       asm     mov     ds,ax\r
+\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_GetPalette\r
+=\r
+= This does not use the port string instructions,\r
+= due to some incompatabilities\r
+=\r
+=================\r
+*/\r
+\r
+void VL_GetPalette (byte far *palette)\r
+{\r
+       int     i;\r
+\r
+       outportb (PEL_READ_ADR,0);\r
+       for (i=0;i<768;i++)\r
+               *palette++ = inportb(PEL_DATA);\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_FadeOut\r
+=\r
+= Fades the current palette to the given color in the given number of steps\r
+=\r
+=================\r
+*/\r
+\r
+void VL_FadeOut (int start, int end, int red, int green, int blue, int steps)\r
+{\r
+       int             i,j,orig,delta;\r
+       byte    far *origptr, far *newptr;\r
+\r
+       VL_WaitVBL(1);\r
+       VL_GetPalette (&palette1[0][0]);\r
+       _fmemcpy (palette2,palette1,768);\r
+\r
+//\r
+// fade through intermediate frames\r
+//\r
+       for (i=0;i<steps;i++)\r
+       {\r
+               origptr = &palette1[start][0];\r
+               newptr = &palette2[start][0];\r
+               for (j=start;j<=end;j++)\r
+               {\r
+                       orig = *origptr++;\r
+                       delta = red-orig;\r
+                       *newptr++ = orig + delta * i / steps;\r
+                       orig = *origptr++;\r
+                       delta = green-orig;\r
+                       *newptr++ = orig + delta * i / steps;\r
+                       orig = *origptr++;\r
+                       delta = blue-orig;\r
+                       *newptr++ = orig + delta * i / steps;\r
+               }\r
+\r
+               VL_WaitVBL(1);\r
+               VL_SetPalette (&palette2[0][0]);\r
+       }\r
+\r
+//\r
+// final color\r
+//\r
+       VL_FillPalette (red,green,blue);\r
+\r
+       screenfaded = true;\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_FadeIn\r
+=\r
+=================\r
+*/\r
+\r
+void VL_FadeIn (int start, int end, byte far *palette, int steps)\r
+{\r
+       int             i,j,delta;\r
+\r
+       VL_WaitVBL(1);\r
+       VL_GetPalette (&palette1[0][0]);\r
+       _fmemcpy (&palette2[0][0],&palette1[0][0],sizeof(palette1));\r
+\r
+       start *= 3;\r
+       end = end*3+2;\r
+\r
+//\r
+// fade through intermediate frames\r
+//\r
+       for (i=0;i<steps;i++)\r
+       {\r
+               for (j=start;j<=end;j++)\r
+               {\r
+                       delta = palette[j]-palette1[0][j];\r
+                       palette2[0][j] = palette1[0][j] + delta * i / steps;\r
+               }\r
+\r
+               VL_WaitVBL(1);\r
+               VL_SetPalette (&palette2[0][0]);\r
+       }\r
+\r
+//\r
+// final color\r
+//\r
+       VL_SetPalette (palette);\r
+       screenfaded = false;\r
+}\r
+\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_TestPaletteSet\r
+=\r
+= Sets the palette with outsb, then reads it in and compares\r
+= If it compares ok, fastpalette is set to true.\r
+=\r
+=================\r
+*/\r
+\r
+void VL_TestPaletteSet (void)\r
+{\r
+       int     i;\r
+\r
+       for (i=0;i<768;i++)\r
+               palette1[0][i] = i;\r
+\r
+       fastpalette = true;\r
+       VL_SetPalette (&palette1[0][0]);\r
+       VL_GetPalette (&palette2[0][0]);\r
+       if (_fmemcmp (&palette1[0][0],&palette2[0][0],768))\r
+               fastpalette = false;\r
+}\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= VL_ColorBorder\r
+=\r
+==================\r
+*/\r
+\r
+void VL_ColorBorder (int color)\r
+{\r
+       _AH=0x10;\r
+       _AL=1;\r
+       _BH=color;\r
+       geninterrupt (0x10);\r
+       bordercolor = color;\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       PIXEL OPS\r
+\r
+=============================================================================\r
+*/\r
+\r
+byte   pixmasks[4] = {1,2,4,8};\r
+byte   leftmasks[4] = {15,14,12,8};\r
+byte   rightmasks[4] = {1,3,7,15};\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_Plot\r
+=\r
+=================\r
+*/\r
+\r
+void VL_Plot (int x, int y, int color)\r
+{\r
+       byte mask;\r
+\r
+       mask = pixmasks[x&3];\r
+       VGAMAPMASK(mask);\r
+       *(byte far *)MK_FP(SCREENSEG,bufferofs+(ylookup[y]+(x>>2))) = color;\r
+       VGAMAPMASK(15);\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_Hlin\r
+=\r
+=================\r
+*/\r
+\r
+void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color)\r
+{\r
+       unsigned                xbyte;\r
+       byte                    far *dest;\r
+       byte                    leftmask,rightmask;\r
+       int                             midbytes;\r
+\r
+       xbyte = x>>2;\r
+       leftmask = leftmasks[x&3];\r
+       rightmask = rightmasks[(x+width-1)&3];\r
+       midbytes = ((x+width+3)>>2) - xbyte - 2;\r
+\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+xbyte);\r
+\r
+       if (midbytes<0)\r
+       {\r
+       // all in one byte\r
+               VGAMAPMASK(leftmask&rightmask);\r
+               *dest = color;\r
+               VGAMAPMASK(15);\r
+               return;\r
+       }\r
+\r
+       VGAMAPMASK(leftmask);\r
+       *dest++ = color;\r
+\r
+       VGAMAPMASK(15);\r
+       _fmemset (dest,color,midbytes);\r
+       dest+=midbytes;\r
+\r
+       VGAMAPMASK(rightmask);\r
+       *dest = color;\r
+\r
+       VGAMAPMASK(15);\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_Vlin\r
+=\r
+=================\r
+*/\r
+\r
+void VL_Vlin (int x, int y, int height, int color)\r
+{\r
+       byte    far *dest,mask;\r
+\r
+       mask = pixmasks[x&3];\r
+       VGAMAPMASK(mask);\r
+\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+(x>>2));\r
+\r
+       while (height--)\r
+       {\r
+               *dest = color;\r
+               dest += linewidth;\r
+       }\r
+\r
+       VGAMAPMASK(15);\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_Bar\r
+=\r
+=================\r
+*/\r
+\r
+void VL_Bar (int x, int y, int width, int height, int color)\r
+{\r
+       byte    far *dest;\r
+       byte    leftmask,rightmask;\r
+       int             midbytes,linedelta;\r
+\r
+       leftmask = leftmasks[x&3];\r
+       rightmask = rightmasks[(x+width-1)&3];\r
+       midbytes = ((x+width+3)>>2) - (x>>2) - 2;\r
+       linedelta = linewidth-(midbytes+1);\r
+\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+(x>>2));\r
+\r
+       if (midbytes<0)\r
+       {\r
+       // all in one byte\r
+               VGAMAPMASK(leftmask&rightmask);\r
+               while (height--)\r
+               {\r
+                       *dest = color;\r
+                       dest += linewidth;\r
+               }\r
+               VGAMAPMASK(15);\r
+               return;\r
+       }\r
+\r
+       while (height--)\r
+       {\r
+               VGAMAPMASK(leftmask);\r
+               *dest++ = color;\r
+\r
+               VGAMAPMASK(15);\r
+               _fmemset (dest,color,midbytes);\r
+               dest+=midbytes;\r
+\r
+               VGAMAPMASK(rightmask);\r
+               *dest = color;\r
+\r
+               dest+=linedelta;\r
+       }\r
+\r
+       VGAMAPMASK(15);\r
+}\r
+\r
+/*\r
+============================================================================\r
+\r
+                                                       MEMORY OPS\r
+\r
+============================================================================\r
+*/\r
+\r
+/*\r
+=================\r
+=\r
+= VL_MemToLatch\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MemToLatch (byte far *source, int width, int height, unsigned dest)\r
+{\r
+       unsigned        count;\r
+       byte    plane,mask;\r
+\r
+       count = ((width+3)/4)*height;\r
+       mask = 1;\r
+       for (plane = 0; plane<4 ; plane++)\r
+       {\r
+               VGAMAPMASK(mask);\r
+               mask <<= 1;\r
+\r
+asm    mov     cx,count\r
+asm mov ax,SCREENSEG\r
+asm mov es,ax\r
+asm    mov     di,[dest]\r
+asm    lds     si,[source]\r
+asm    rep movsb\r
+asm mov        ax,ss\r
+asm    mov     ds,ax\r
+\r
+               source+= count;\r
+       }\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_MemToScreen\r
+=\r
+= Draws a block of data to the screen.\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MemToScreen (byte far *source, int width, int height, int x, int y)\r
+{\r
+       byte    far *screen,far *dest,mask;\r
+       int             plane;\r
+\r
+       width>>=2;\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+(x>>2) );\r
+       mask = 1 << (x&3);\r
+\r
+       for (plane = 0; plane<4; plane++)\r
+       {\r
+               VGAMAPMASK(mask);\r
+               mask <<= 1;\r
+               if (mask == 16)\r
+                       mask = 1;\r
+\r
+               screen = dest;\r
+               for (y=0;y<height;y++,screen+=linewidth,source+=width)\r
+                       _fmemcpy (screen,source,width);\r
+       }\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_MaskedToScreen\r
+=\r
+= Masks a block of main memory to the screen.\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MaskedToScreen (byte far *source, int width, int height, int x, int y)\r
+{\r
+       byte    far *screen,far *dest,mask;\r
+       byte    far *maskptr;\r
+       int             plane;\r
+\r
+       width>>=2;\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+(x>>2) );\r
+//     mask = 1 << (x&3);\r
+\r
+//     maskptr = source;\r
+\r
+       for (plane = 0; plane<4; plane++)\r
+       {\r
+               VGAMAPMASK(mask);\r
+               mask <<= 1;\r
+               if (mask == 16)\r
+                       mask = 1;\r
+\r
+               screen = dest;\r
+               for (y=0;y<height;y++,screen+=linewidth,source+=width)\r
+                       _fmemcpy (screen,source,width);\r
+       }\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_LatchToScreen\r
+=\r
+=================\r
+*/\r
+\r
+void VL_LatchToScreen (unsigned source, int width, int height, int x, int y)\r
+{\r
+       VGAWRITEMODE(1);\r
+       VGAMAPMASK(15);\r
+\r
+asm    mov     di,[y]                          // dest = bufferofs+ylookup[y]+(x>>2)\r
+asm    shl     di,1\r
+asm    mov     di,[WORD PTR ylookup+di]\r
+asm    add     di,[bufferofs]\r
+asm    mov     ax,[x]\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    add     di,ax\r
+\r
+asm    mov     si,[source]\r
+asm    mov     ax,[width]\r
+asm    mov     bx,[linewidth]\r
+asm    sub     bx,ax\r
+asm    mov     dx,[height]\r
+asm    mov     cx,SCREENSEG\r
+asm    mov     ds,cx\r
+asm    mov     es,cx\r
+\r
+drawline:\r
+asm    mov     cx,ax\r
+asm    rep movsb\r
+asm    add     di,bx\r
+asm    dec     dx\r
+asm    jnz     drawline\r
+\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+       VGAWRITEMODE(0);\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+#if 0\r
+\r
+/*\r
+=================\r
+=\r
+= VL_ScreenToScreen\r
+=\r
+=================\r
+*/\r
+\r
+void VL_ScreenToScreen (unsigned source, unsigned dest,int width, int height)\r
+{\r
+       VGAWRITEMODE(1);\r
+       VGAMAPMASK(15);\r
+\r
+asm    mov     si,[source]\r
+asm    mov     di,[dest]\r
+asm    mov     ax,[width]\r
+asm    mov     bx,[linewidth]\r
+asm    sub     bx,ax\r
+asm    mov     dx,[height]\r
+asm    mov     cx,SCREENSEG\r
+asm    mov     ds,cx\r
+asm    mov     es,cx\r
+\r
+drawline:\r
+asm    mov     cx,ax\r
+asm    rep movsb\r
+asm    add     si,bx\r
+asm    add     di,bx\r
+asm    dec     dx\r
+asm    jnz     drawline\r
+\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+       VGAWRITEMODE(0);\r
+}\r
+\r
+\r
+#endif\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               STRING OUTPUT ROUTINES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= VL_DrawTile8String\r
+=\r
+===================\r
+*/\r
+\r
+void VL_DrawTile8String (char *str, char far *tile8ptr, int printx, int printy)\r
+{\r
+       int             i;\r
+       unsigned        far *dest,far *screen,far *src;\r
+\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[printy]+(printx>>2));\r
+\r
+       while (*str)\r
+       {\r
+               src = (unsigned far *)(tile8ptr + (*str<<6));\r
+               // each character is 64 bytes\r
+\r
+               VGAMAPMASK(1);\r
+               screen = dest;\r
+               for (i=0;i<8;i++,screen+=linewidth)\r
+                       *screen = *src++;\r
+               VGAMAPMASK(2);\r
+               screen = dest;\r
+               for (i=0;i<8;i++,screen+=linewidth)\r
+                       *screen = *src++;\r
+               VGAMAPMASK(4);\r
+               screen = dest;\r
+               for (i=0;i<8;i++,screen+=linewidth)\r
+                       *screen = *src++;\r
+               VGAMAPMASK(8);\r
+               screen = dest;\r
+               for (i=0;i<8;i++,screen+=linewidth)\r
+                       *screen = *src++;\r
+\r
+               str++;\r
+               printx += 8;\r
+               dest+=2;\r
+       }\r
+}\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= VL_DrawLatch8String\r
+=\r
+===================\r
+*/\r
+\r
+void VL_DrawLatch8String (char *str, unsigned tile8ptr, int printx, int printy)\r
+{\r
+       int             i;\r
+       unsigned        src,dest;\r
+\r
+       dest = bufferofs+ylookup[printy]+(printx>>2);\r
+\r
+       VGAWRITEMODE(1);\r
+       VGAMAPMASK(15);\r
+\r
+       while (*str)\r
+       {\r
+               src = tile8ptr + (*str<<4);             // each character is 16 latch bytes\r
+\r
+asm    mov     si,[src]\r
+asm    mov     di,[dest]\r
+asm    mov     dx,[linewidth]\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     ds,ax\r
+\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+               str++;\r
+               printx += 8;\r
+               dest+=2;\r
+       }\r
+\r
+       VGAWRITEMODE(0);\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= VL_SizeTile8String\r
+=\r
+===================\r
+*/\r
+\r
+void VL_SizeTile8String (char *str, int *width, int *height)\r
+{\r
+       *height = 8;\r
+       *width = 8*strlen(str);\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/16/wf3d8086/id_vl.c b/16/wf3d8086/id_vl.c
new file mode 100755 (executable)
index 0000000..8e29b6d
--- /dev/null
@@ -0,0 +1,1085 @@
+// ID_VL.C\r
+\r
+#include <dos.h>\r
+#include <alloc.h>\r
+#include <mem.h>\r
+#include <string.h>\r
+#include "ID_HEAD.H"\r
+#include "ID_VL.H"\r
+#pragma hdrstop\r
+\r
+//\r
+// SC_INDEX is expected to stay at SC_MAPMASK for proper operation\r
+//\r
+\r
+unsigned       bufferofs;\r
+unsigned       displayofs,pelpan;\r
+\r
+unsigned       screenseg=SCREENSEG;            // set to 0xa000 for asm convenience\r
+\r
+unsigned       linewidth;\r
+unsigned       ylookup[MAXSCANLINES];\r
+\r
+boolean                screenfaded;\r
+unsigned       bordercolor;\r
+\r
+boolean                fastpalette;                            // if true, use outsb to set\r
+\r
+byte           far     palette1[256][3],far palette2[256][3];\r
+\r
+//===========================================================================\r
+\r
+// asm\r
+\r
+int     VL_VideoID (void);\r
+void VL_SetCRTC (int crtc);\r
+void VL_SetScreen (int crtc, int pelpan);\r
+void VL_WaitVBL (int vbls);\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_Startup\r
+=\r
+=======================\r
+*/\r
+\r
+#if 0\r
+void   VL_Startup (void)\r
+{\r
+       if ( !MS_CheckParm ("HIDDENCARD") && VL_VideoID () != 5)\r
+               MS_Quit ("You need a VGA graphics card to run this!");\r
+\r
+       asm     cld;                            // all string instructions assume forward\r
+}\r
+\r
+#endif\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_Startup   // WOLFENSTEIN HACK\r
+=\r
+=======================\r
+*/\r
+\r
+static char *ParmStrings[] = {"HIDDENCARD",""};\r
+\r
+void   VL_Startup (void)\r
+{\r
+       int i,videocard;\r
+\r
+       asm     cld;\r
+\r
+       videocard = VL_VideoID ();\r
+       for (i = 1;i < _argc;i++)\r
+               if (US_CheckParm(_argv[i],ParmStrings) == 0)\r
+               {\r
+                       videocard = 5;\r
+                       break;\r
+               }\r
+\r
+       if (videocard != 5)\r
+Quit ("Improper video card!  If you really have a VGA card that I am not \n"\r
+         "detecting, use the -HIDDENCARD command line parameter!");\r
+\r
+}\r
+\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_Shutdown\r
+=\r
+=======================\r
+*/\r
+\r
+void   VL_Shutdown (void)\r
+{\r
+       VL_SetTextMode ();\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_SetVGAPlaneMode\r
+=\r
+=======================\r
+*/\r
+\r
+void   VL_SetVGAPlaneMode (void)\r
+{\r
+asm    mov     ax,0x13\r
+asm    int     0x10\r
+       VL_DePlaneVGA ();\r
+       VGAMAPMASK(15);\r
+       VL_SetLineWidth (40);\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_SetTextMode\r
+=\r
+=======================\r
+*/\r
+\r
+void   VL_SetTextMode (void)\r
+{\r
+asm    mov     ax,3\r
+asm    int     0x10\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_ClearVideo\r
+=\r
+= Fill the entire video buffer with a given color\r
+=\r
+=================\r
+*/\r
+\r
+void VL_ClearVideo (byte color)\r
+{\r
+asm    mov     dx,GC_INDEX\r
+asm    mov     al,GC_MODE\r
+asm    out     dx,al\r
+asm    inc     dx\r
+asm    in      al,dx\r
+asm    and     al,0xfc                         // write mode 0 to store directly to video\r
+asm    out     dx,al\r
+\r
+asm    mov     dx,SC_INDEX\r
+asm    mov     ax,SC_MAPMASK+15*256\r
+asm    out     dx,ax                           // write through all four planes\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    mov     al,[color]\r
+asm    mov     ah,al\r
+asm    mov     cx,0x8000                       // 0x8000 words, clearing 8 video bytes/word\r
+asm    xor     di,di\r
+asm    rep     stosw\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                       VGA REGISTER MANAGEMENT ROUTINES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_DePlaneVGA\r
+=\r
+=================\r
+*/\r
+\r
+void VL_DePlaneVGA (void)\r
+{\r
+\r
+//\r
+// change CPU addressing to non linear mode\r
+//\r
+\r
+//\r
+// turn off chain 4 and odd/even\r
+//\r
+       outportb (SC_INDEX,SC_MEMMODE);\r
+       outportb (SC_INDEX+1,(inportb(SC_INDEX+1)&~8)|4);\r
+\r
+       outportb (SC_INDEX,SC_MAPMASK);         // leave this set throughought\r
+\r
+//\r
+// turn off odd/even and set write mode 0\r
+//\r
+       outportb (GC_INDEX,GC_MODE);\r
+       outportb (GC_INDEX+1,inportb(GC_INDEX+1)&~0x13);\r
+\r
+//\r
+// turn off chain\r
+//\r
+       outportb (GC_INDEX,GC_MISCELLANEOUS);\r
+       outportb (GC_INDEX+1,inportb(GC_INDEX+1)&~2);\r
+\r
+//\r
+// clear the entire buffer space, because int 10h only did 16 k / plane\r
+//\r
+       VL_ClearVideo (0);\r
+\r
+//\r
+// change CRTC scanning from doubleword to byte mode, allowing >64k scans\r
+//\r
+       outportb (CRTC_INDEX,CRTC_UNDERLINE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1)&~0x40);\r
+\r
+       outportb (CRTC_INDEX,CRTC_MODE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1)|0x40);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= VL_SetLineWidth\r
+=\r
+= Line witdh is in WORDS, 40 words is normal width for vgaplanegr\r
+=\r
+====================\r
+*/\r
+\r
+void VL_SetLineWidth (unsigned width)\r
+{\r
+       int i,offset;\r
+\r
+//\r
+// set wide virtual screen\r
+//\r
+       outport (CRTC_INDEX,CRTC_OFFSET+width*256);\r
+\r
+//\r
+// set up lookup tables\r
+//\r
+       linewidth = width*2;\r
+\r
+       offset = 0;\r
+\r
+       for (i=0;i<MAXSCANLINES;i++)\r
+       {\r
+               ylookup[i]=offset;\r
+               offset += linewidth;\r
+       }\r
+}\r
+\r
+/*\r
+====================\r
+=\r
+= VL_SetSplitScreen\r
+=\r
+====================\r
+*/\r
+\r
+void VL_SetSplitScreen (int linenum)\r
+{\r
+       VL_WaitVBL (1);\r
+       linenum=linenum*2-1;\r
+       outportb (CRTC_INDEX,CRTC_LINECOMPARE);\r
+       outportb (CRTC_INDEX+1,linenum % 256);\r
+       outportb (CRTC_INDEX,CRTC_OVERFLOW);\r
+       outportb (CRTC_INDEX+1, 1+16*(linenum/256));\r
+       outportb (CRTC_INDEX,CRTC_MAXSCANLINE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1) & (255-64));\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               PALETTE OPS\r
+\r
+               To avoid snow, do a WaitVBL BEFORE calling these\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_FillPalette\r
+=\r
+=================\r
+*/\r
+\r
+void VL_FillPalette (int red, int green, int blue)\r
+{\r
+       int     i;\r
+\r
+       outportb (PEL_WRITE_ADR,0);\r
+       for (i=0;i<256;i++)\r
+       {\r
+               outportb (PEL_DATA,red);\r
+               outportb (PEL_DATA,green);\r
+               outportb (PEL_DATA,blue);\r
+       }\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_SetColor\r
+=\r
+=================\r
+*/\r
+\r
+void VL_SetColor       (int color, int red, int green, int blue)\r
+{\r
+       outportb (PEL_WRITE_ADR,color);\r
+       outportb (PEL_DATA,red);\r
+       outportb (PEL_DATA,green);\r
+       outportb (PEL_DATA,blue);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_GetColor\r
+=\r
+=================\r
+*/\r
+\r
+void VL_GetColor       (int color, int *red, int *green, int *blue)\r
+{\r
+       outportb (PEL_READ_ADR,color);\r
+       *red = inportb (PEL_DATA);\r
+       *green = inportb (PEL_DATA);\r
+       *blue = inportb (PEL_DATA);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_SetPalette\r
+=\r
+= If fast palette setting has been tested for, it is used\r
+= (some cards don't like outsb palette setting)\r
+=\r
+=================\r
+*/\r
+\r
+void VL_SetPalette (byte far *palette)\r
+{\r
+       int     i;\r
+\r
+//     outportb (PEL_WRITE_ADR,0);\r
+//     for (i=0;i<768;i++)\r
+//             outportb(PEL_DATA,*palette++);\r
+\r
+       asm     mov     dx,PEL_WRITE_ADR\r
+       asm     mov     al,0\r
+       asm     out     dx,al\r
+       asm     mov     dx,PEL_DATA\r
+       asm     lds     si,[palette]\r
+\r
+       asm     test    [ss:fastpalette],1\r
+       //asm   jz      slowset\r
+//\r
+// set palette fast for cards that can take it\r
+//\r
+       //asm   mov     cx,768\r
+       //asm   rep outsb\r
+       //asm   jmp     done\r
+\r
+//\r
+// set palette slowly for some video cards\r
+//\r
+slowset:\r
+       asm     mov     cx,256\r
+setloop:\r
+       asm     lodsb\r
+       asm     out     dx,al\r
+       asm     lodsb\r
+       asm     out     dx,al\r
+       asm     lodsb\r
+       asm     out     dx,al\r
+       asm     loop    setloop\r
+\r
+done:\r
+       asm     mov     ax,ss\r
+       asm     mov     ds,ax\r
+\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_GetPalette\r
+=\r
+= This does not use the port string instructions,\r
+= due to some incompatabilities\r
+=\r
+=================\r
+*/\r
+\r
+void VL_GetPalette (byte far *palette)\r
+{\r
+       int     i;\r
+\r
+       outportb (PEL_READ_ADR,0);\r
+       for (i=0;i<768;i++)\r
+               *palette++ = inportb(PEL_DATA);\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_FadeOut\r
+=\r
+= Fades the current palette to the given color in the given number of steps\r
+=\r
+=================\r
+*/\r
+\r
+void VL_FadeOut (int start, int end, int red, int green, int blue, int steps)\r
+{\r
+       int             i,j,orig,delta;\r
+       byte    far *origptr, far *newptr;\r
+\r
+       VL_WaitVBL(1);\r
+       VL_GetPalette (&palette1[0][0]);\r
+       _fmemcpy (palette2,palette1,768);\r
+\r
+//\r
+// fade through intermediate frames\r
+//\r
+       for (i=0;i<steps;i++)\r
+       {\r
+               origptr = &palette1[start][0];\r
+               newptr = &palette2[start][0];\r
+               for (j=start;j<=end;j++)\r
+               {\r
+                       orig = *origptr++;\r
+                       delta = red-orig;\r
+                       *newptr++ = orig + delta * i / steps;\r
+                       orig = *origptr++;\r
+                       delta = green-orig;\r
+                       *newptr++ = orig + delta * i / steps;\r
+                       orig = *origptr++;\r
+                       delta = blue-orig;\r
+                       *newptr++ = orig + delta * i / steps;\r
+               }\r
+\r
+               VL_WaitVBL(1);\r
+               VL_SetPalette (&palette2[0][0]);\r
+       }\r
+\r
+//\r
+// final color\r
+//\r
+       VL_FillPalette (red,green,blue);\r
+\r
+       screenfaded = true;\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_FadeIn\r
+=\r
+=================\r
+*/\r
+\r
+void VL_FadeIn (int start, int end, byte far *palette, int steps)\r
+{\r
+       int             i,j,delta;\r
+\r
+       VL_WaitVBL(1);\r
+       VL_GetPalette (&palette1[0][0]);\r
+       _fmemcpy (&palette2[0][0],&palette1[0][0],sizeof(palette1));\r
+\r
+       start *= 3;\r
+       end = end*3+2;\r
+\r
+//\r
+// fade through intermediate frames\r
+//\r
+       for (i=0;i<steps;i++)\r
+       {\r
+               for (j=start;j<=end;j++)\r
+               {\r
+                       delta = palette[j]-palette1[0][j];\r
+                       palette2[0][j] = palette1[0][j] + delta * i / steps;\r
+               }\r
+\r
+               VL_WaitVBL(1);\r
+               VL_SetPalette (&palette2[0][0]);\r
+       }\r
+\r
+//\r
+// final color\r
+//\r
+       VL_SetPalette (palette);\r
+       screenfaded = false;\r
+}\r
+\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_TestPaletteSet\r
+=\r
+= Sets the palette with outsb, then reads it in and compares\r
+= If it compares ok, fastpalette is set to true.\r
+=\r
+=================\r
+*/\r
+\r
+void VL_TestPaletteSet (void)\r
+{\r
+       int     i;\r
+\r
+       for (i=0;i<768;i++)\r
+               palette1[0][i] = i;\r
+\r
+       fastpalette = true;\r
+       VL_SetPalette (&palette1[0][0]);\r
+       VL_GetPalette (&palette2[0][0]);\r
+       if (_fmemcmp (&palette1[0][0],&palette2[0][0],768))\r
+               fastpalette = false;\r
+}\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= VL_ColorBorder\r
+=\r
+==================\r
+*/\r
+\r
+void VL_ColorBorder (int color)\r
+{\r
+       _AH=0x10;\r
+       _AL=1;\r
+       _BH=color;\r
+       geninterrupt (0x10);\r
+       bordercolor = color;\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       PIXEL OPS\r
+\r
+=============================================================================\r
+*/\r
+\r
+byte   pixmasks[4] = {1,2,4,8};\r
+byte   leftmasks[4] = {15,14,12,8};\r
+byte   rightmasks[4] = {1,3,7,15};\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_Plot\r
+=\r
+=================\r
+*/\r
+\r
+void VL_Plot (int x, int y, int color)\r
+{\r
+       byte mask;\r
+\r
+       mask = pixmasks[x&3];\r
+       VGAMAPMASK(mask);\r
+       *(byte far *)MK_FP(SCREENSEG,bufferofs+(ylookup[y]+(x>>2))) = color;\r
+       VGAMAPMASK(15);\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_Hlin\r
+=\r
+=================\r
+*/\r
+\r
+void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color)\r
+{\r
+       unsigned                xbyte;\r
+       byte                    far *dest;\r
+       byte                    leftmask,rightmask;\r
+       int                             midbytes;\r
+\r
+       xbyte = x>>2;\r
+       leftmask = leftmasks[x&3];\r
+       rightmask = rightmasks[(x+width-1)&3];\r
+       midbytes = ((x+width+3)>>2) - xbyte - 2;\r
+\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+xbyte);\r
+\r
+       if (midbytes<0)\r
+       {\r
+       // all in one byte\r
+               VGAMAPMASK(leftmask&rightmask);\r
+               *dest = color;\r
+               VGAMAPMASK(15);\r
+               return;\r
+       }\r
+\r
+       VGAMAPMASK(leftmask);\r
+       *dest++ = color;\r
+\r
+       VGAMAPMASK(15);\r
+       _fmemset (dest,color,midbytes);\r
+       dest+=midbytes;\r
+\r
+       VGAMAPMASK(rightmask);\r
+       *dest = color;\r
+\r
+       VGAMAPMASK(15);\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_Vlin\r
+=\r
+=================\r
+*/\r
+\r
+void VL_Vlin (int x, int y, int height, int color)\r
+{\r
+       byte    far *dest,mask;\r
+\r
+       mask = pixmasks[x&3];\r
+       VGAMAPMASK(mask);\r
+\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+(x>>2));\r
+\r
+       while (height--)\r
+       {\r
+               *dest = color;\r
+               dest += linewidth;\r
+       }\r
+\r
+       VGAMAPMASK(15);\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_Bar\r
+=\r
+=================\r
+*/\r
+\r
+void VL_Bar (int x, int y, int width, int height, int color)\r
+{\r
+       byte    far *dest;\r
+       byte    leftmask,rightmask;\r
+       int             midbytes,linedelta;\r
+\r
+       leftmask = leftmasks[x&3];\r
+       rightmask = rightmasks[(x+width-1)&3];\r
+       midbytes = ((x+width+3)>>2) - (x>>2) - 2;\r
+       linedelta = linewidth-(midbytes+1);\r
+\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+(x>>2));\r
+\r
+       if (midbytes<0)\r
+       {\r
+       // all in one byte\r
+               VGAMAPMASK(leftmask&rightmask);\r
+               while (height--)\r
+               {\r
+                       *dest = color;\r
+                       dest += linewidth;\r
+               }\r
+               VGAMAPMASK(15);\r
+               return;\r
+       }\r
+\r
+       while (height--)\r
+       {\r
+               VGAMAPMASK(leftmask);\r
+               *dest++ = color;\r
+\r
+               VGAMAPMASK(15);\r
+               _fmemset (dest,color,midbytes);\r
+               dest+=midbytes;\r
+\r
+               VGAMAPMASK(rightmask);\r
+               *dest = color;\r
+\r
+               dest+=linedelta;\r
+       }\r
+\r
+       VGAMAPMASK(15);\r
+}\r
+\r
+/*\r
+============================================================================\r
+\r
+                                                       MEMORY OPS\r
+\r
+============================================================================\r
+*/\r
+\r
+/*\r
+=================\r
+=\r
+= VL_MemToLatch\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MemToLatch (byte far *source, int width, int height, unsigned dest)\r
+{\r
+       unsigned        count;\r
+       byte    plane,mask;\r
+\r
+       count = ((width+3)/4)*height;\r
+       mask = 1;\r
+       for (plane = 0; plane<4 ; plane++)\r
+       {\r
+               VGAMAPMASK(mask);\r
+               mask <<= 1;\r
+\r
+asm    mov     cx,count\r
+asm mov ax,SCREENSEG\r
+asm mov es,ax\r
+asm    mov     di,[dest]\r
+asm    lds     si,[source]\r
+asm    rep movsb\r
+asm mov        ax,ss\r
+asm    mov     ds,ax\r
+\r
+               source+= count;\r
+       }\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_MemToScreen\r
+=\r
+= Draws a block of data to the screen.\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MemToScreen (byte far *source, int width, int height, int x, int y)\r
+{\r
+       byte    far *screen,far *dest,mask;\r
+       int             plane;\r
+\r
+       width>>=2;\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+(x>>2) );\r
+       mask = 1 << (x&3);\r
+\r
+       for (plane = 0; plane<4; plane++)\r
+       {\r
+               VGAMAPMASK(mask);\r
+               mask <<= 1;\r
+               if (mask == 16)\r
+                       mask = 1;\r
+\r
+               screen = dest;\r
+               for (y=0;y<height;y++,screen+=linewidth,source+=width)\r
+                       _fmemcpy (screen,source,width);\r
+       }\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_MaskedToScreen\r
+=\r
+= Masks a block of main memory to the screen.\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MaskedToScreen (byte far *source, int width, int height, int x, int y)\r
+{\r
+       byte    far *screen,far *dest,mask;\r
+       byte    far *maskptr;\r
+       int             plane;\r
+\r
+       width>>=2;\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[y]+(x>>2) );\r
+//     mask = 1 << (x&3);\r
+\r
+//     maskptr = source;\r
+\r
+       for (plane = 0; plane<4; plane++)\r
+       {\r
+               VGAMAPMASK(mask);\r
+               mask <<= 1;\r
+               if (mask == 16)\r
+                       mask = 1;\r
+\r
+               screen = dest;\r
+               for (y=0;y<height;y++,screen+=linewidth,source+=width)\r
+                       _fmemcpy (screen,source,width);\r
+       }\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_LatchToScreen\r
+=\r
+=================\r
+*/\r
+\r
+void VL_LatchToScreen (unsigned source, int width, int height, int x, int y)\r
+{\r
+       VGAWRITEMODE(1);\r
+       VGAMAPMASK(15);\r
+\r
+asm    mov     di,[y]                          // dest = bufferofs+ylookup[y]+(x>>2)\r
+asm    shl     di,1\r
+asm    mov     di,[WORD PTR ylookup+di]\r
+asm    add     di,[bufferofs]\r
+asm    mov     ax,[x]\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    add     di,ax\r
+\r
+asm    mov     si,[source]\r
+asm    mov     ax,[width]\r
+asm    mov     bx,[linewidth]\r
+asm    sub     bx,ax\r
+asm    mov     dx,[height]\r
+asm    mov     cx,SCREENSEG\r
+asm    mov     ds,cx\r
+asm    mov     es,cx\r
+\r
+drawline:\r
+asm    mov     cx,ax\r
+asm    rep movsb\r
+asm    add     di,bx\r
+asm    dec     dx\r
+asm    jnz     drawline\r
+\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+       VGAWRITEMODE(0);\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+#if 0\r
+\r
+/*\r
+=================\r
+=\r
+= VL_ScreenToScreen\r
+=\r
+=================\r
+*/\r
+\r
+void VL_ScreenToScreen (unsigned source, unsigned dest,int width, int height)\r
+{\r
+       VGAWRITEMODE(1);\r
+       VGAMAPMASK(15);\r
+\r
+asm    mov     si,[source]\r
+asm    mov     di,[dest]\r
+asm    mov     ax,[width]\r
+asm    mov     bx,[linewidth]\r
+asm    sub     bx,ax\r
+asm    mov     dx,[height]\r
+asm    mov     cx,SCREENSEG\r
+asm    mov     ds,cx\r
+asm    mov     es,cx\r
+\r
+drawline:\r
+asm    mov     cx,ax\r
+asm    rep movsb\r
+asm    add     si,bx\r
+asm    add     di,bx\r
+asm    dec     dx\r
+asm    jnz     drawline\r
+\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+       VGAWRITEMODE(0);\r
+}\r
+\r
+\r
+#endif\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               STRING OUTPUT ROUTINES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= VL_DrawTile8String\r
+=\r
+===================\r
+*/\r
+\r
+void VL_DrawTile8String (char *str, char far *tile8ptr, int printx, int printy)\r
+{\r
+       int             i;\r
+       unsigned        far *dest,far *screen,far *src;\r
+\r
+       dest = MK_FP(SCREENSEG,bufferofs+ylookup[printy]+(printx>>2));\r
+\r
+       while (*str)\r
+       {\r
+               src = (unsigned far *)(tile8ptr + (*str<<6));\r
+               // each character is 64 bytes\r
+\r
+               VGAMAPMASK(1);\r
+               screen = dest;\r
+               for (i=0;i<8;i++,screen+=linewidth)\r
+                       *screen = *src++;\r
+               VGAMAPMASK(2);\r
+               screen = dest;\r
+               for (i=0;i<8;i++,screen+=linewidth)\r
+                       *screen = *src++;\r
+               VGAMAPMASK(4);\r
+               screen = dest;\r
+               for (i=0;i<8;i++,screen+=linewidth)\r
+                       *screen = *src++;\r
+               VGAMAPMASK(8);\r
+               screen = dest;\r
+               for (i=0;i<8;i++,screen+=linewidth)\r
+                       *screen = *src++;\r
+\r
+               str++;\r
+               printx += 8;\r
+               dest+=2;\r
+       }\r
+}\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= VL_DrawLatch8String\r
+=\r
+===================\r
+*/\r
+\r
+void VL_DrawLatch8String (char *str, unsigned tile8ptr, int printx, int printy)\r
+{\r
+       int             i;\r
+       unsigned        src,dest;\r
+\r
+       dest = bufferofs+ylookup[printy]+(printx>>2);\r
+\r
+       VGAWRITEMODE(1);\r
+       VGAMAPMASK(15);\r
+\r
+       while (*str)\r
+       {\r
+               src = tile8ptr + (*str<<4);             // each character is 16 latch bytes\r
+\r
+asm    mov     si,[src]\r
+asm    mov     di,[dest]\r
+asm    mov     dx,[linewidth]\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     ds,ax\r
+\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+asm    lodsw\r
+asm    mov     [di],ax\r
+asm    add     di,dx\r
+\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+\r
+               str++;\r
+               printx += 8;\r
+               dest+=2;\r
+       }\r
+\r
+       VGAWRITEMODE(0);\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= VL_SizeTile8String\r
+=\r
+===================\r
+*/\r
+\r
+void VL_SizeTile8String (char *str, int *width, int *height)\r
+{\r
+       *height = 8;\r
+       *width = 8*strlen(str);\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/16/wf3d8086/id_vl.equ b/16/wf3d8086/id_vl.equ
new file mode 100755 (executable)
index 0000000..50e3be7
--- /dev/null
@@ -0,0 +1,58 @@
+; ID_VL.EQU\r
+\r
+SC_INDEX       =       03C4h\r
+SC_RESET       =       0\r
+SC_CLOCK       =       1\r
+SC_MAPMASK     =       2\r
+SC_CHARMAP     =       3\r
+SC_MEMMODE     =       4\r
+\r
+CRTC_INDEX     =       03D4h\r
+CRTC_H_TOTAL   =       0\r
+CRTC_H_DISPEND =       1\r
+CRTC_H_BLANK   =       2\r
+CRTC_H_ENDBLANK        =       3\r
+CRTC_H_RETRACE =       4\r
+CRTC_H_ENDRETRACE =    5\r
+CRTC_V_TOTAL   =       6\r
+CRTC_OVERFLOW  =       7\r
+CRTC_ROWSCAN   =       8\r
+CRTC_MAXSCANLINE =     9\r
+CRTC_CURSORSTART =     10\r
+CRTC_CURSOREND =       11\r
+CRTC_STARTHIGH =       12\r
+CRTC_STARTLOW  =       13\r
+CRTC_CURSORHIGH        =       14\r
+CRTC_CURSORLOW =       15\r
+CRTC_V_RETRACE =       16\r
+CRTC_V_ENDRETRACE =    17\r
+CRTC_V_DISPEND =       18\r
+CRTC_OFFSET    =       19\r
+CRTC_UNDERLINE =       20\r
+CRTC_V_BLANK   =       21\r
+CRTC_V_ENDBLANK        =       22\r
+CRTC_MODE      =       23\r
+CRTC_LINECOMPARE =     24\r
+\r
+\r
+GC_INDEX       =       03CEh\r
+GC_SETRESET    =       0\r
+GC_ENABLESETRESET =    1\r
+GC_COLORCOMPARE        =       2\r
+GC_DATAROTATE  =       3\r
+GC_READMAP     =       4\r
+GC_MODE                =       5\r
+GC_MISCELLANEOUS =     6\r
+GC_COLORDONTCARE =     7\r
+GC_BITMASK     =       8\r
+\r
+ATR_INDEX      =       03c0h\r
+ATR_MODE       =       16\r
+ATR_OVERSCAN   =       17\r
+ATR_COLORPLANEENABLE = 18\r
+ATR_PELPAN     =       19\r
+ATR_COLORSELECT        =       20\r
+\r
+STATUS_REGISTER_1     =        03dah\r
+\r
+\r
diff --git a/16/wf3d8086/id_vl.h b/16/wf3d8086/id_vl.h
new file mode 100755 (executable)
index 0000000..9c1510c
--- /dev/null
@@ -0,0 +1,161 @@
+// ID_VL.H\r
+\r
+// wolf compatability\r
+\r
+#define MS_Quit        Quit\r
+\r
+void Quit (char *error);\r
+\r
+//===========================================================================\r
+\r
+\r
+#define SC_INDEX                       0x3C4\r
+#define SC_RESET                       0\r
+#define SC_CLOCK                       1\r
+#define SC_MAPMASK                     2\r
+#define SC_CHARMAP                     3\r
+#define SC_MEMMODE                     4\r
+\r
+#define CRTC_INDEX                     0x3D4\r
+#define CRTC_H_TOTAL           0\r
+#define CRTC_H_DISPEND         1\r
+#define CRTC_H_BLANK           2\r
+#define CRTC_H_ENDBLANK                3\r
+#define CRTC_H_RETRACE         4\r
+#define CRTC_H_ENDRETRACE      5\r
+#define CRTC_V_TOTAL           6\r
+#define CRTC_OVERFLOW          7\r
+#define CRTC_ROWSCAN           8\r
+#define CRTC_MAXSCANLINE       9\r
+#define CRTC_CURSORSTART       10\r
+#define CRTC_CURSOREND         11\r
+#define CRTC_STARTHIGH         12\r
+#define CRTC_STARTLOW          13\r
+#define CRTC_CURSORHIGH                14\r
+#define CRTC_CURSORLOW         15\r
+#define CRTC_V_RETRACE         16\r
+#define CRTC_V_ENDRETRACE      17\r
+#define CRTC_V_DISPEND         18\r
+#define CRTC_OFFSET                    19\r
+#define CRTC_UNDERLINE         20\r
+#define CRTC_V_BLANK           21\r
+#define CRTC_V_ENDBLANK                22\r
+#define CRTC_MODE                      23\r
+#define CRTC_LINECOMPARE       24\r
+\r
+\r
+#define GC_INDEX                       0x3CE\r
+#define GC_SETRESET                    0\r
+#define GC_ENABLESETRESET      1\r
+#define GC_COLORCOMPARE                2\r
+#define GC_DATAROTATE          3\r
+#define GC_READMAP                     4\r
+#define GC_MODE                                5\r
+#define GC_MISCELLANEOUS       6\r
+#define GC_COLORDONTCARE       7\r
+#define GC_BITMASK                     8\r
+\r
+#define ATR_INDEX                      0x3c0\r
+#define ATR_MODE                       16\r
+#define ATR_OVERSCAN           17\r
+#define ATR_COLORPLANEENABLE 18\r
+#define ATR_PELPAN                     19\r
+#define ATR_COLORSELECT                20\r
+\r
+#define        STATUS_REGISTER_1    0x3da\r
+\r
+#define PEL_WRITE_ADR          0x3c8\r
+#define PEL_READ_ADR           0x3c7\r
+#define PEL_DATA                       0x3c9\r
+\r
+\r
+//===========================================================================\r
+\r
+#define SCREENSEG              0xa000\r
+\r
+#define SCREENWIDTH            80                      // default screen width in bytes\r
+#define MAXSCANLINES   200                     // size of ylookup table\r
+\r
+#define CHARWIDTH              2\r
+#define TILEWIDTH              4\r
+\r
+//===========================================================================\r
+\r
+extern unsigned        bufferofs;                      // all drawing is reletive to this\r
+extern unsigned        displayofs,pelpan;      // last setscreen coordinates\r
+\r
+extern unsigned        screenseg;                      // set to 0xa000 for asm convenience\r
+\r
+extern unsigned        linewidth;\r
+extern unsigned        ylookup[MAXSCANLINES];\r
+\r
+extern boolean         screenfaded;\r
+extern unsigned        bordercolor;\r
+\r
+//===========================================================================\r
+\r
+//\r
+// VGA hardware routines\r
+//\r
+\r
+#define VGAWRITEMODE(x) asm{\\r
+cli;\\r
+mov dx,GC_INDEX;\\r
+mov al,GC_MODE;\\r
+out dx,al;\\r
+inc dx;\\r
+in al,dx;\\r
+and al,252;\\r
+or al,x;\\r
+out dx,al;\\r
+sti;}\r
+\r
+#define VGAMAPMASK(x) asm{cli;mov dx,SC_INDEX;mov al,SC_MAPMASK;mov ah,x;out dx,ax;sti;}\r
+#define VGAREADMAP(x) asm{cli;mov dx,GC_INDEX;mov al,GC_READMAP;mov ah,x;out dx,ax;sti;}\r
+\r
+\r
+void VL_Startup (void);\r
+void VL_Shutdown (void);\r
+\r
+void VL_SetVGAPlane (void);\r
+void VL_SetTextMode (void);\r
+void VL_DePlaneVGA (void);\r
+void VL_SetVGAPlaneMode (void);\r
+void VL_ClearVideo (byte color);\r
+\r
+void VL_SetLineWidth (unsigned width);\r
+void VL_SetSplitScreen (int linenum);\r
+\r
+void VL_WaitVBL (int vbls);\r
+void VL_CrtcStart (int crtc);\r
+void VL_SetScreen (int crtc, int pelpan);\r
+\r
+void VL_FillPalette (int red, int green, int blue);\r
+void VL_SetColor       (int color, int red, int green, int blue);\r
+void VL_GetColor       (int color, int *red, int *green, int *blue);\r
+void VL_SetPalette (byte far *palette);\r
+void VL_GetPalette (byte far *palette);\r
+void VL_FadeOut (int start, int end, int red, int green, int blue, int steps);\r
+void VL_FadeIn (int start, int end, byte far *palette, int steps);\r
+void VL_ColorBorder (int color);\r
+\r
+void VL_Plot (int x, int y, int color);\r
+void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color);\r
+void VL_Vlin (int x, int y, int height, int color);\r
+void VL_Bar (int x, int y, int width, int height, int color);\r
+\r
+void VL_MungePic (byte far *source, unsigned width, unsigned height);\r
+void VL_DrawPicBare (int x, int y, byte far *pic, int width, int height);\r
+void VL_MemToLatch (byte far *source, int width, int height, unsigned dest);\r
+void VL_ScreenToScreen (unsigned source, unsigned dest,int width, int height);\r
+void VL_MemToScreen (byte far *source, int width, int height, int x, int y);\r
+void VL_MaskedToScreen (byte far *source, int width, int height, int x, int y);\r
+\r
+void VL_DrawTile8String (char *str, char far *tile8ptr, int printx, int printy);\r
+void VL_DrawLatch8String (char *str, unsigned tile8ptr, int printx, int printy);\r
+void VL_SizeTile8String (char *str, int *width, int *height);\r
+void VL_DrawPropString (char *str, unsigned tile8ptr, int printx, int printy);\r
+void VL_SizePropString (char *str, int *width, int *height, char far *font);\r
+\r
+void VL_TestPaletteSet (void);\r
+\r
diff --git a/16/wf3d8086/id_vl_a.asm b/16/wf3d8086/id_vl_a.asm
new file mode 100755 (executable)
index 0000000..f27ef0c
--- /dev/null
@@ -0,0 +1,742 @@
+; ID_VL.ASM\r
+\r
+       IDEAL\r
+       MODEL   MEDIUM,C\r
+\r
+       INCLUDE 'ID_VL.EQU'\r
+\r
+SCREENSEG      =       0a000h\r
+\r
+       DATASEG\r
+\r
+       EXTRN   TimeCount:WORD          ; incremented every 70th of a second\r
+       EXTRN   linewidth:WORD\r
+\r
+starttime      dw      ?\r
+\r
+       CODESEG\r
+\r
+;===========================================================================\r
+\r
+\r
+;==============\r
+;\r
+; VL_WaitVBL                   ******** NEW *********\r
+;\r
+; Wait for the vertical retrace (returns before the actual vertical sync)\r
+;\r
+;==============\r
+\r
+PROC   VL_WaitVBL  num:WORD\r
+PUBLIC VL_WaitVBL\r
+@@wait:\r
+\r
+       mov     dx,STATUS_REGISTER_1\r
+\r
+       mov     cx,[num]\r
+;\r
+; wait for a display signal to make sure the raster isn't in the middle\r
+; of a sync\r
+;\r
+@@waitnosync:\r
+       in      al,dx\r
+       test    al,8\r
+       jnz     @@waitnosync\r
+\r
+\r
+@@waitsync:\r
+       in      al,dx\r
+       test    al,8\r
+       jz      @@waitsync\r
+\r
+       loop    @@waitnosync\r
+\r
+       ret\r
+\r
+ENDP\r
+\r
+\r
+;===========================================================================\r
+\r
+;==============\r
+;\r
+; VL_SetCRTC\r
+;\r
+;==============\r
+\r
+PROC   VL_SetCRTC  crtc:WORD\r
+PUBLIC VL_SetCRTC\r
+\r
+;\r
+; wait for a display signal to make sure the raster isn't in the middle\r
+; of a sync\r
+;\r
+       cli\r
+\r
+       mov     dx,STATUS_REGISTER_1\r
+\r
+@@waitdisplay:\r
+       in      al,dx\r
+       test    al,1    ;1 = display is disabled (HBL / VBL)\r
+       jnz     @@waitdisplay\r
+\r
+\r
+;\r
+; set CRTC start\r
+;\r
+; for some reason, my XT's EGA card doesn't like word outs to the CRTC\r
+; index...\r
+;\r
+       mov     cx,[crtc]\r
+       mov     dx,CRTC_INDEX\r
+       mov     al,0ch          ;start address high register\r
+       out     dx,al\r
+       inc     dx\r
+       mov     al,ch\r
+       out     dx,al\r
+       dec     dx\r
+       mov     al,0dh          ;start address low register\r
+       out     dx,al\r
+       mov     al,cl\r
+       inc     dx\r
+       out     dx,al\r
+\r
+\r
+       sti\r
+\r
+       ret\r
+\r
+ENDP\r
+\r
+\r
+\r
+;===========================================================================\r
+\r
+;==============\r
+;\r
+; VL_SetScreen\r
+;\r
+;==============\r
+\r
+PROC   VL_SetScreen  crtc:WORD, pel:WORD\r
+PUBLIC VL_SetScreen\r
+\r
+\r
+       mov     cx,[timecount]          ; if timecount goes up by two, the retrace\r
+       add     cx,2                            ; period was missed (an interrupt covered it)\r
+\r
+       mov     dx,STATUS_REGISTER_1\r
+\r
+;\r
+; wait for a display signal to make sure the raster isn't in the middle\r
+; of a sync\r
+;\r
+@@waitdisplay:\r
+       in      al,dx\r
+       test    al,1    ;1 = display is disabled (HBL / VBL)\r
+       jnz     @@waitdisplay\r
+\r
+\r
+@@loop:\r
+       sti\r
+       jmp     $+2\r
+       cli\r
+\r
+       cmp     [timecount],cx          ; will only happen if an interrupt is\r
+       jae     @@setcrtc                       ; straddling the entire retrace period\r
+\r
+;\r
+; when several succesive display not enableds occur,\r
+; the bottom of the screen has been hit\r
+;\r
+\r
+       in      al,dx\r
+       test    al,8\r
+       jnz     @@waitdisplay\r
+       test    al,1\r
+       jz      @@loop\r
+\r
+       in      al,dx\r
+       test    al,8\r
+       jnz     @@waitdisplay\r
+       test    al,1\r
+       jz      @@loop\r
+\r
+       in      al,dx\r
+       test    al,8\r
+       jnz     @@waitdisplay\r
+       test    al,1\r
+       jz      @@loop\r
+\r
+       in      al,dx\r
+       test    al,8\r
+       jnz     @@waitdisplay\r
+       test    al,1\r
+       jz      @@loop\r
+\r
+       in      al,dx\r
+       test    al,8\r
+       jnz     @@waitdisplay\r
+       test    al,1\r
+       jz      @@loop\r
+\r
+\r
+@@setcrtc:\r
+\r
+\r
+;\r
+; set CRTC start\r
+;\r
+; for some reason, my XT's EGA card doesn't like word outs to the CRTC\r
+; index...\r
+;\r
+       mov     cx,[crtc]\r
+       mov     dx,CRTC_INDEX\r
+       mov     al,0ch          ;start address high register\r
+       out     dx,al\r
+       inc     dx\r
+       mov     al,ch\r
+       out     dx,al\r
+       dec     dx\r
+       mov     al,0dh          ;start address low register\r
+       out     dx,al\r
+       mov     al,cl\r
+       inc     dx\r
+       out     dx,al\r
+\r
+;\r
+; set horizontal panning\r
+;\r
+       mov     dx,ATR_INDEX\r
+       mov     al,ATR_PELPAN or 20h\r
+       out     dx,al\r
+       jmp     $+2\r
+       mov     al,[BYTE pel]           ;pel pan value\r
+       out     dx,al\r
+\r
+       sti\r
+\r
+       ret\r
+\r
+ENDP\r
+\r
+\r
+;===========================================================================\r
+\r
+\r
+;============================================================================\r
+;\r
+; VL_ScreenToScreen\r
+;\r
+; Basic block copy routine.  Copies one block of screen memory to another,\r
+; using write mode 1 (sets it and returns with write mode 0).  bufferofs is\r
+; NOT accounted for.\r
+;\r
+;============================================================================\r
+\r
+PROC   VL_ScreenToScreen       source:WORD, dest:WORD, wide:WORD, height:WORD\r
+PUBLIC VL_ScreenToScreen\r
+USES   SI,DI\r
+\r
+       pushf\r
+       cli\r
+\r
+       mov     dx,SC_INDEX\r
+       mov     ax,SC_MAPMASK+15*256\r
+       out     dx,ax\r
+       mov     dx,GC_INDEX\r
+       mov     al,GC_MODE\r
+       out     dx,al\r
+       inc     dx\r
+       in      al,dx\r
+       and     al,NOT 3\r
+       or      al,1\r
+       out     dx,al\r
+\r
+       popf\r
+\r
+       mov     bx,[linewidth]\r
+       sub     bx,[wide]\r
+\r
+       mov     ax,SCREENSEG\r
+       mov     es,ax\r
+       mov     ds,ax\r
+\r
+       mov     si,[source]\r
+       mov     di,[dest]                               ;start at same place in all planes\r
+       mov     dx,[height]                             ;scan lines to draw\r
+       mov     ax,[wide]\r
+\r
+@@lineloop:\r
+       mov     cx,ax\r
+       rep     movsb\r
+       add     si,bx\r
+       add     di,bx\r
+\r
+       dec     dx\r
+       jnz     @@lineloop\r
+\r
+       mov     dx,GC_INDEX+1\r
+       in      al,dx\r
+       and     al,NOT 3\r
+       out     dx,al\r
+\r
+       mov     ax,ss\r
+       mov     ds,ax                                   ;restore turbo's data segment\r
+\r
+       ret\r
+\r
+ENDP\r
+\r
+\r
+;===========================================================================\r
+\r
+\r
+       MASM\r
+;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ\r
+;\r
+; Name:        VL_VideoID\r
+;\r
+; Function:    Detects the presence of various video subsystems\r
+;\r
+; int VideoID;\r
+;\r
+; Subsystem ID values:\r
+;       0  = (none)\r
+;       1  = MDA\r
+;       2  = CGA\r
+;       3  = EGA\r
+;       4  = MCGA\r
+;       5  = VGA\r
+;      80h = HGC\r
+;      81h = HGC+\r
+;      82h = Hercules InColor\r
+;\r
+;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ\r
+\r
+;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ\r
+;\r
+; Equates\r
+;\r
+;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ\r
+VIDstruct      STRUC           ; corresponds to C data structure\r
+\r
+Video0Type     DB      ?       ; first subsystem type\r
+Display0Type   DB      ?       ; display attached to first subsystem\r
+\r
+Video1Type     DB      ?       ; second subsystem type\r
+Display1Type   DB      ?       ; display attached to second subsystem\r
+\r
+VIDstruct      ENDS\r
+\r
+\r
+Device0        EQU     word ptr Video0Type[di]\r
+Device1        EQU     word ptr Video1Type[di]\r
+\r
+\r
+MDA    EQU     1       ; subsystem types\r
+CGA    EQU     2\r
+EGA    EQU     3\r
+MCGA   EQU     4\r
+VGA    EQU     5\r
+HGC    EQU     80h\r
+HGCPlus        EQU     81h\r
+InColor        EQU     82h\r
+\r
+MDADisplay     EQU     1       ; display types\r
+CGADisplay     EQU     2\r
+EGAColorDisplay        EQU     3\r
+PS2MonoDisplay EQU     4\r
+PS2ColorDisplay        EQU     5\r
+\r
+TRUE   EQU     1\r
+FALSE  EQU     0\r
+\r
+;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ\r
+;\r
+; Program\r
+;\r
+;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ\r
+\r
+Results        VIDstruct <>    ;results go here!\r
+\r
+EGADisplays    DB      CGADisplay      ; 0000b, 0001b  (EGA switch values)\r
+       DB      EGAColorDisplay ; 0010b, 0011b\r
+       DB      MDADisplay      ; 0100b, 0101b\r
+       DB      CGADisplay      ; 0110b, 0111b\r
+       DB      EGAColorDisplay ; 1000b, 1001b\r
+       DB      MDADisplay      ; 1010b, 1011b\r
+\r
+DCCtable       DB      0,0     ; translate table for INT 10h func 1Ah\r
+       DB      MDA,MDADisplay\r
+       DB      CGA,CGADisplay\r
+       DB      0,0\r
+       DB      EGA,EGAColorDisplay\r
+       DB      EGA,MDADisplay\r
+       DB      0,0\r
+       DB      VGA,PS2MonoDisplay\r
+       DB      VGA,PS2ColorDisplay\r
+       DB      0,0\r
+       DB      MCGA,EGAColorDisplay\r
+       DB      MCGA,PS2MonoDisplay\r
+       DB      MCGA,PS2ColorDisplay\r
+\r
+TestSequence   DB      TRUE    ; this list of flags and addresses\r
+       DW      FindPS2 ;  determines the order in which this\r
+                       ;  program looks for the various\r
+EGAflag        DB      ?       ;  subsystems\r
+       DW      FindEGA\r
+\r
+CGAflag        DB      ?\r
+       DW      FindCGA\r
+\r
+Monoflag       DB      ?\r
+       DW      FindMono\r
+\r
+NumberOfTests  EQU     ($-TestSequence)/3\r
+\r
+\r
+PUBLIC VL_VideoID\r
+VL_VideoID     PROC\r
+\r
+       push    bp      ; preserve caller registers\r
+       mov     bp,sp\r
+       push    ds\r
+       push    si\r
+       push    di\r
+\r
+       push    cs\r
+       pop     ds\r
+       ASSUME  DS:@Code\r
+\r
+; initialize the data structure that will contain the results\r
+\r
+       lea     di,Results      ; DS:DI -> start of data structure\r
+\r
+       mov     Device0,0       ; zero these variables\r
+       mov     Device1,0\r
+\r
+; look for the various subsystems using the subroutines whose addresses are\r
+; tabulated in TestSequence; each subroutine sets flags in TestSequence\r
+; to indicate whether subsequent subroutines need to be called\r
+\r
+       mov     byte ptr CGAflag,TRUE\r
+       mov     byte ptr EGAflag,TRUE\r
+       mov     byte ptr Monoflag,TRUE\r
+\r
+       mov     cx,NumberOfTests\r
+       mov     si,offset TestSequence\r
+\r
+@@L01: lodsb           ; AL := flag\r
+       test    al,al\r
+       lodsw           ; AX := subroutine address\r
+       jz      @@L02   ; skip subroutine if flag is false\r
+\r
+       push    si\r
+       push    cx\r
+       call    ax      ; call subroutine to detect subsystem\r
+       pop     cx\r
+       pop     si\r
+\r
+@@L02: loop    @@L01\r
+\r
+; determine which subsystem is active\r
+\r
+       call    FindActive\r
+\r
+       mov     al,Results.Video0Type\r
+       mov     ah,0    ; was:  Results.Display0Type\r
+\r
+       pop     di      ; restore caller registers and return\r
+       pop     si\r
+       pop     ds\r
+       mov     sp,bp\r
+       pop     bp\r
+       ret\r
+\r
+VL_VideoID     ENDP\r
+\r
+\r
+;\r
+; FindPS2\r
+;\r
+; This subroutine uses INT 10H function 1Ah to determine the video BIOS\r
+; Display Combination Code (DCC) for each video subsystem present.\r
+;\r
+\r
+FindPS2        PROC    near\r
+\r
+       mov     ax,1A00h\r
+       int     10h     ; call video BIOS for info\r
+\r
+       cmp     al,1Ah\r
+       jne     @@L13   ; exit if function not supported (i.e.,\r
+                       ;  no MCGA or VGA in system)\r
+\r
+; convert BIOS DCCs into specific subsystems & displays\r
+\r
+       mov     cx,bx\r
+       xor     bh,bh   ; BX := DCC for active subsystem\r
+\r
+       or      ch,ch\r
+       jz      @@L11   ; jump if only one subsystem present\r
+\r
+       mov     bl,ch   ; BX := inactive DCC\r
+       add     bx,bx\r
+       mov     ax,[bx+offset DCCtable]\r
+\r
+       mov     Device1,ax\r
+\r
+       mov     bl,cl\r
+       xor     bh,bh   ; BX := active DCC\r
+\r
+@@L11: add     bx,bx\r
+       mov     ax,[bx+offset DCCtable]\r
+\r
+       mov     Device0,ax\r
+\r
+; reset flags for subsystems that have been ruled out\r
+\r
+       mov     byte ptr CGAflag,FALSE\r
+       mov     byte ptr EGAflag,FALSE\r
+       mov     byte ptr Monoflag,FALSE\r
+\r
+       lea     bx,Video0Type[di]  ; if the BIOS reported an MDA ...\r
+       cmp     byte ptr [bx],MDA\r
+       je      @@L12\r
+\r
+       lea     bx,Video1Type[di]\r
+       cmp     byte ptr [bx],MDA\r
+       jne     @@L13\r
+\r
+@@L12: mov     word ptr [bx],0    ; ... Hercules can't be ruled out\r
+       mov     byte ptr Monoflag,TRUE\r
+\r
+@@L13: ret\r
+\r
+FindPS2        ENDP\r
+\r
+\r
+;\r
+; FindEGA\r
+;\r
+; Look for an EGA.  This is done by making a call to an EGA BIOS function\r
+;  which doesn't exist in the default (MDA, CGA) BIOS.\r
+\r
+FindEGA        PROC    near    ; Caller:       AH = flags\r
+                       ; Returns:      AH = flags\r
+                       ;               Video0Type and\r
+                       ;                Display0Type updated\r
+\r
+       mov     bl,10h  ; BL := 10h (return EGA info)\r
+       mov     ah,12h  ; AH := INT 10H function number\r
+       int     10h     ; call EGA BIOS for info\r
+                       ; if EGA BIOS is present,\r
+                       ;  BL <> 10H\r
+                       ;  CL = switch setting\r
+       cmp     bl,10h\r
+       je      @@L22   ; jump if EGA BIOS not present\r
+\r
+       mov     al,cl\r
+       shr     al,1    ; AL := switches/2\r
+       mov     bx,offset EGADisplays\r
+       xlat            ; determine display type from switches\r
+       mov     ah,al   ; AH := display type\r
+       mov     al,EGA  ; AL := subystem type\r
+       call    FoundDevice\r
+\r
+       cmp     ah,MDADisplay\r
+       je      @@L21   ; jump if EGA has a monochrome display\r
+\r
+       mov     CGAflag,FALSE   ; no CGA if EGA has color display\r
+       jmp     short @@L22\r
+\r
+@@L21: mov     Monoflag,FALSE  ; EGA has a mono display, so MDA and\r
+                       ;  Hercules are ruled out\r
+@@L22: ret\r
+\r
+FindEGA        ENDP\r
+\r
+;\r
+; FindCGA\r
+;\r
+; This is done by looking for the CGA's 6845 CRTC at I/O port 3D4H.\r
+;\r
+FindCGA        PROC    near    ; Returns:      VIDstruct updated\r
+\r
+       mov     dx,3D4h ; DX := CRTC address port\r
+       call    Find6845\r
+       jc      @@L31   ; jump if not present\r
+\r
+       mov     al,CGA\r
+       mov     ah,CGADisplay\r
+       call    FoundDevice\r
+\r
+@@L31: ret\r
+\r
+FindCGA        ENDP\r
+\r
+;\r
+; FindMono\r
+;\r
+; This is done by looking for the MDA's 6845 CRTC at I/O port 3B4H.  If\r
+; a 6845 is found, the subroutine distinguishes between an MDA\r
+; and a Hercules adapter by monitoring bit 7 of the CRT Status byte.\r
+; This bit changes on Hercules adapters but does not change on an MDA.\r
+;\r
+; The various Hercules adapters are identified by bits 4 through 6 of\r
+; the CRT Status value:\r
+;\r
+; 000b = HGC\r
+; 001b = HGC+\r
+; 101b = InColor card\r
+;\r
+\r
+FindMono       PROC    near    ; Returns:      VIDstruct updated\r
+\r
+       mov     dx,3B4h ; DX := CRTC address port\r
+       call    Find6845\r
+       jc      @@L44   ; jump if not present\r
+\r
+       mov     dl,0BAh ; DX := 3BAh (status port)\r
+       in      al,dx\r
+       and     al,80h\r
+       mov     ah,al   ; AH := bit 7 (vertical sync on HGC)\r
+\r
+       mov     cx,8000h        ; do this 32768 times\r
+@@L41: in      al,dx\r
+       and     al,80h  ; isolate bit 7\r
+       cmp     ah,al\r
+       loope   @@L41   ; wait for bit 7 to change\r
+       jne     @@L42   ; if bit 7 changed, it's a Hercules\r
+\r
+       mov     al,MDA  ; if bit 7 didn't change, it's an MDA\r
+       mov     ah,MDADisplay\r
+       call    FoundDevice\r
+       jmp     short @@L44\r
+\r
+@@L42: in      al,dx\r
+       mov     dl,al   ; DL := value from status port\r
+       and     dl,01110000b    ; mask bits 4 thru 6\r
+\r
+       mov     ah,MDADisplay   ; assume it's a monochrome display\r
+\r
+       mov     al,HGCPlus      ; look for an HGC+\r
+       cmp     dl,00010000b\r
+       je      @@L43   ; jump if it's an HGC+\r
+\r
+       mov     al,HGC  ; look for an InColor card or HGC\r
+       cmp     dl,01010000b\r
+       jne     @@L43   ; jump if it's not an InColor card\r
+\r
+       mov     al,InColor      ; it's an InColor card\r
+       mov     ah,EGAColorDisplay\r
+\r
+@@L43: call    FoundDevice\r
+\r
+@@L44: ret\r
+\r
+FindMono       ENDP\r
+\r
+;\r
+; Find6845\r
+;\r
+; This routine detects the presence of the CRTC on a MDA, CGA or HGC.\r
+; The technique is to write and read register 0Fh of the chip (cursor\r
+; low).  If the same value is read as written, assume the chip is\r
+; present at the specified port addr.\r
+;\r
+\r
+Find6845       PROC    near    ; Caller:  DX = port addr\r
+                       ; Returns: cf set if not present\r
+       mov     al,0Fh\r
+       out     dx,al   ; select 6845 reg 0Fh (Cursor Low)\r
+       inc     dx\r
+       in      al,dx   ; AL := current Cursor Low value\r
+       mov     ah,al   ; preserve in AH\r
+       mov     al,66h  ; AL := arbitrary value\r
+       out     dx,al   ; try to write to 6845\r
+\r
+       mov     cx,100h\r
+@@L51: loop    @@L51   ; wait for 6845 to respond\r
+\r
+       in      al,dx\r
+       xchg    ah,al   ; AH := returned value\r
+                       ; AL := original value\r
+       out     dx,al   ; restore original value\r
+\r
+       cmp     ah,66h  ; test whether 6845 responded\r
+       je      @@L52   ; jump if it did (cf is reset)\r
+\r
+       stc             ; set carry flag if no 6845 present\r
+\r
+@@L52: ret\r
+\r
+Find6845       ENDP\r
+\r
+\r
+;\r
+; FindActive\r
+;\r
+; This subroutine stores the currently active device as Device0.  The\r
+; current video mode determines which subsystem is active.\r
+;\r
+\r
+FindActive     PROC    near\r
+\r
+       cmp     word ptr Device1,0\r
+       je      @@L63   ; exit if only one subsystem\r
+\r
+       cmp     Video0Type[di],4        ; exit if MCGA or VGA present\r
+       jge     @@L63   ;  (INT 10H function 1AH\r
+       cmp     Video1Type[di],4        ;  already did the work)\r
+       jge     @@L63\r
+\r
+       mov     ah,0Fh\r
+       int     10h     ; AL := current BIOS video mode\r
+\r
+       and     al,7\r
+       cmp     al,7    ; jump if monochrome\r
+       je      @@L61   ;  (mode 7 or 0Fh)\r
+\r
+       cmp     Display0Type[di],MDADisplay\r
+       jne     @@L63   ; exit if Display0 is color\r
+       jmp     short @@L62\r
+\r
+@@L61: cmp     Display0Type[di],MDADisplay\r
+       je      @@L63   ; exit if Display0 is monochrome\r
+\r
+@@L62: mov     ax,Device0      ; make Device0 currently active\r
+       xchg    ax,Device1\r
+       mov     Device0,ax\r
+\r
+@@L63: ret\r
+\r
+FindActive     ENDP\r
+\r
+\r
+;\r
+; FoundDevice\r
+;\r
+; This routine updates the list of subsystems.\r
+;\r
+\r
+FoundDevice    PROC    near    ; Caller:    AH = display #\r
+                       ;            AL = subsystem #\r
+                       ; Destroys:  BX\r
+       lea     bx,Video0Type[di]\r
+       cmp     byte ptr [bx],0\r
+       je      @@L71   ; jump if 1st subsystem\r
+\r
+       lea     bx,Video1Type[di]       ; must be 2nd subsystem\r
+\r
+@@L71: mov     [bx],ax ; update list entry\r
+       ret\r
+\r
+FoundDevice    ENDP\r
+\r
+IDEAL\r
+\r
+\r
+\r
+END\r
diff --git a/16/wf3d8086/jabhack.asm b/16/wf3d8086/jabhack.asm
new file mode 100755 (executable)
index 0000000..243aa9f
--- /dev/null
@@ -0,0 +1,103 @@
+; JABHACK.ASM\r
+\r
+.386C\r
+IDEAL\r
+MODEL  MEDIUM\r
+\r
+EXTRN  LDIV@:far\r
+\r
+;============================================================================\r
+\r
+DATASEG\r
+\r
+EXTRN  _intaddr:word\r
+\r
+;============================================================================\r
+\r
+CODESEG\r
+\r
+;      Hacked up Juan Jimenez's code a bit to just return 386/not 386\r
+PROC   _CheckIs386\r
+PUBLIC _CheckIs386\r
+\r
+       pushf                   ; Save flag registers, we use them here\r
+       xor     ax,ax           ; Clear AX and...\r
+       push ax                 ; ...push it onto the stack\r
+       popf                    ; Pop 0 into flag registers (all bits to 0),\r
+       pushf                   ; attempting to set bits 12-15 of flags to 0's\r
+       pop     ax                      ; Recover the save flags\r
+       and     ax,08000h       ; If bits 12-15 of flags are set to\r
+       cmp     ax,08000h       ; zero then it's 8088/86 or 80188/186\r
+       jz      not386\r
+\r
+       mov     ax,07000h       ; Try to set flag bits 12-14 to 1's\r
+       push ax                 ; Push the test value onto the stack\r
+       popf                    ; Pop it into the flag register\r
+       pushf                   ; Push it back onto the stack\r
+       pop     ax                      ; Pop it into AX for check\r
+       and     ax,07000h       ; if bits 12-14 are cleared then\r
+       jz      not386          ; the chip is an 80286\r
+\r
+       mov     ax,1            ; We now assume it's a 80386 or better\r
+       popf\r
+       retf\r
+\r
+not386:\r
+       xor     ax,ax\r
+       popf\r
+       retf\r
+\r
+       ENDP\r
+\r
+\r
+PROC   _jabhack2\r
+PUBLIC _jabhack2\r
+\r
+       jmp     @@skip\r
+\r
+@@where:\r
+       int     060h\r
+       retf\r
+\r
+@@skip:\r
+       push    es\r
+\r
+       mov     ax,seg LDIV@\r
+       mov     es,ax\r
+       mov     ax,[WORD PTR @@where]\r
+       mov     [WORD FAR es:LDIV@],ax\r
+       mov     ax,[WORD PTR @@where+2]\r
+       mov     [WORD FAR es:LDIV@+2],ax\r
+\r
+       mov     ax,offset @@jabdiv\r
+       mov     [_intaddr],ax\r
+       mov     ax,seg @@jabdiv\r
+       mov     [_intaddr+2],ax\r
+\r
+       pop     es\r
+       retf\r
+\r
+@@jabdiv:\r
+       add     sp,4    ;Nuke IRET address, but leave flags\r
+       push bp\r
+       mov     bp,sp   ;Save BP, and set it equal to stack\r
+       cli\r
+\r
+       mov     eax,[bp+8]\r
+       cdq\r
+       idiv [DWORD PTR bp+12]\r
+       mov     edx,eax\r
+       ;begin 8086 hack\r
+       ;shr    edx,16\r
+       push cx\r
+       mov cl,16\r
+       shr     edx,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       pop     bp              ;Restore BP\r
+       popf            ;Restore flags (from INT)\r
+       retf    8       ;Return to original caller\r
+\r
+       ENDP\r
+\r
+       END\r
diff --git a/16/wf3d8086/makefile.wl6 b/16/wf3d8086/makefile.wl6
new file mode 100755 (executable)
index 0000000..d611be2
--- /dev/null
@@ -0,0 +1,203 @@
+.AUTODEPEND\r
+\r
+.PATH.obj = OBJ\r
+\r
+#              *Translator Definitions*\r
+CC = bcc +WOLF3D.CFG\r
+TASM = TASM\r
+TLIB = tlib\r
+TLINK = tlink\r
+LIBPATH = C:\BORLANDC\LIB\r
+INCLUDEPATH = C:\BORLANDC\INCLUDE\r
+\r
+\r
+#              *Implicit Rules*\r
+.c.obj:\r
+  $(CC) -c {$< }\r
+\r
+.cpp.obj:\r
+  $(CC) -c {$< }\r
+\r
+#              *List Macros*\r
+\r
+\r
+EXE_dependencies =  \\r
+ obj\c0.obj \\r
+ h_ldiv.obj \\r
+ wolfhack.obj \\r
+ whack_a.obj \\r
+ wl_asm.obj \\r
+ wl_main.obj \\r
+ wl_text.obj \\r
+ wl_menu.obj \\r
+ wl_inter.obj \\r
+ wl_game.obj \\r
+ wl_play.obj \\r
+ wl_debug.obj \\r
+ wl_draw.obj \\r
+ wl_dr_a.obj \\r
+ wl_scale.obj \\r
+ wl_state.obj \\r
+ wl_agent.obj \\r
+ wl_act1.obj \\r
+ wl_act2.obj \\r
+ obj\signon.obj \\r
+ obj\gamepal.obj \\r
+ id_ca.obj \\r
+ id_in.obj \\r
+ id_mm.obj \\r
+ id_pm.obj \\r
+ id_sd.obj \\r
+ id_sd_a.obj \\r
+ id_us_1.obj \\r
+ id_us_a.obj \\r
+ id_vl.obj \\r
+ id_vh.obj \\r
+ id_vl_a.obj \\r
+ id_vh_a.obj\r
+\r
+#              *Explicit Rules*\r
+obj\wolf3d.exe: wolf3d.cfg $(EXE_dependencies)\r
+  $(TLINK) /s/c/P-/L$(LIBPATH) @&&|\r
+obj\c0.obj+\r
+obj\h_ldiv.obj+\r
+obj\wolfhack.obj+\r
+obj\whack_a.obj+\r
+obj\wl_asm.obj+\r
+obj\wl_main.obj+\r
+obj\wl_text.obj+\r
+obj\wl_menu.obj+\r
+obj\wl_inter.obj+\r
+obj\wl_game.obj+\r
+obj\wl_play.obj+\r
+obj\wl_debug.obj+\r
+obj\wl_draw.obj+\r
+obj\wl_dr_a.obj+\r
+obj\wl_scale.obj+\r
+obj\wl_state.obj+\r
+obj\wl_agent.obj+\r
+obj\wl_act1.obj+\r
+obj\wl_act2.obj+\r
+obj\signon.obj+\r
+obj\gamepal.obj+\r
+obj\id_ca.obj+\r
+obj\id_in.obj+\r
+obj\id_mm.obj+\r
+obj\id_pm.obj+\r
+obj\id_sd.obj+\r
+obj\id_sd_a.obj+\r
+obj\id_us_1.obj+\r
+obj\id_us_a.obj+\r
+obj\id_vl.obj+\r
+obj\id_vh.obj+\r
+obj\id_vl_a.obj+\r
+obj\id_vh_a.obj\r
+obj\wolf3d,obj\wolf3d\r
+emu.lib+\r
+mathm.lib+\r
+cm.lib\r
+|\r
+\r
+\r
+#              *Individual File Dependencies*\r
+obj\c0.obj: wolf3d.cfg c0.asm \r
+       $(TASM) /MX /ZI /O /D__MEDIUM__ C0.ASM,OBJ\C0.OBJ\r
+\r
+h_ldiv.obj: wolf3d.cfg h_ldiv.asm \r
+       $(TASM) /MX /ZI /O H_LDIV.ASM,OBJ\H_LDIV.OBJ /d__MEDIUM__\r
+\r
+wolfhack.obj: wolf3d.cfg wolfhack.c \r
+\r
+whack_a.obj: wolf3d.cfg whack_a.asm \r
+       $(TASM) /MX /ZI /O WHACK_A.ASM,OBJ\WHACK_A.OBJ\r
+\r
+wl_asm.obj: wolf3d.cfg wl_asm.asm \r
+       $(TASM) /MX /ZI /O WL_ASM.ASM,OBJ\WL_ASM.OBJ\r
+\r
+wl_main.obj: wolf3d.cfg wl_main.c \r
+\r
+wl_text.obj: wolf3d.cfg wl_text.c \r
+\r
+wl_menu.obj: wolf3d.cfg wl_menu.c \r
+\r
+wl_inter.obj: wolf3d.cfg wl_inter.c \r
+\r
+wl_game.obj: wolf3d.cfg wl_game.c \r
+\r
+wl_play.obj: wolf3d.cfg wl_play.c \r
+\r
+wl_debug.obj: wolf3d.cfg wl_debug.c \r
+\r
+wl_draw.obj: wolf3d.cfg wl_draw.c \r
+\r
+wl_dr_a.obj: wolf3d.cfg wl_dr_a.asm \r
+       $(TASM) /MX /ZI /O WL_DR_A.ASM,OBJ\WL_DR_A.OBJ\r
+\r
+wl_scale.obj: wolf3d.cfg wl_scale.c \r
+\r
+wl_state.obj: wolf3d.cfg wl_state.c \r
+\r
+wl_agent.obj: wolf3d.cfg wl_agent.c \r
+\r
+wl_act1.obj: wolf3d.cfg wl_act1.c \r
+\r
+wl_act2.obj: wolf3d.cfg wl_act2.c \r
+\r
+id_ca.obj: wolf3d.cfg id_ca.c \r
+\r
+id_in.obj: wolf3d.cfg id_in.c \r
+\r
+id_mm.obj: wolf3d.cfg id_mm.c \r
+\r
+id_pm.obj: wolf3d.cfg id_pm.c \r
+\r
+id_sd.obj: wolf3d.cfg id_sd.c \r
+\r
+id_sd_a.obj: wolf3d.cfg id_sd_a.asm \r
+       $(TASM) /MX /ZI /O ID_SD_A.ASM,OBJ\ID_SD_A.OBJ\r
+\r
+id_us_1.obj: wolf3d.cfg id_us_1.c \r
+\r
+id_us_a.obj: wolf3d.cfg id_us_a.asm \r
+       $(TASM) /MX /ZI /O ID_US_A.ASM,OBJ\ID_US_A.OBJ\r
+\r
+id_vl.obj: wolf3d.cfg id_vl.c \r
+\r
+id_vh.obj: wolf3d.cfg id_vh.c \r
+\r
+id_vl_a.obj: wolf3d.cfg id_vl_a.asm \r
+       $(TASM) /MX /ZI /O ID_VL_A.ASM,OBJ\ID_VL_A.OBJ\r
+\r
+id_vh_a.obj: wolf3d.cfg id_vh_a.asm \r
+       $(TASM) /MX /ZI /O ID_VH_A.ASM,OBJ\ID_VH_A.OBJ\r
+\r
+#              *Compiler Configuration File*\r
+wolf3d.cfg: makefile.wl6\r
+  copy &&|\r
+-mm\r
+-3\r
+-a\r
+-ff-\r
+-G\r
+-O\r
+-Og\r
+-Oe\r
+-Om\r
+-Ov\r
+-Ol\r
+-Ob\r
+-Op\r
+-Oi\r
+-Z\r
+-d\r
+-H=WOLF3D.SYM\r
+-Fc\r
+-weas\r
+-wpre\r
+-nOBJ\r
+-I$(INCLUDEPATH)\r
+-L$(LIBPATH)\r
+-P-.C\r
+| wolf3d.cfg\r
+\r
+\r
diff --git a/16/wf3d8086/mapssdm.h b/16/wf3d8086/mapssdm.h
new file mode 100755 (executable)
index 0000000..bcf6cb6
--- /dev/null
@@ -0,0 +1,14 @@
+///////////////////////////////////////\r
+//\r
+// TED5 Map Header for SDM\r
+//\r
+///////////////////////////////////////\r
+\r
+//\r
+// Map Names\r
+//\r
+typedef enum {\r
+               TUNNELS_1_MAP,           // 0\r
+               TUNNELS_2_MAP,           // 1\r
+               LASTMAP\r
+            } mapnames;\r
diff --git a/16/wf3d8086/mapssod.h b/16/wf3d8086/mapssod.h
new file mode 100755 (executable)
index 0000000..c3b24a4
--- /dev/null
@@ -0,0 +1,33 @@
+///////////////////////////////////////\r
+//\r
+// TED5 Map Header for SOD\r
+//\r
+///////////////////////////////////////\r
+\r
+//\r
+// Map Names\r
+//\r
+typedef enum {\r
+               TUNNELS_1_MAP,           // 0\r
+               TUNNELS_2_MAP,           // 1\r
+               TUNNELS_3_MAP,           // 2\r
+               TUNNELS_4_MAP,           // 3\r
+               TUNNEL_BOSS_MAP,         // 4\r
+               DUNGEONS_1_MAP,          // 5\r
+               DUNGEONS_2_MAP,          // 6\r
+               DUNGEONS_3_MAP,          // 7\r
+               DUNGEONS_4_MAP,          // 8\r
+               DUNGEON_BOSS_MAP,        // 9\r
+               CASTLE_1_MAP,            // 10\r
+               CASTLE_2_MAP,            // 11\r
+               CASTLE_3_MAP,            // 12\r
+               CASTLE_4_MAP,            // 13\r
+               CASTLE_5_MAP,            // 14\r
+               CASTLE_BOSS_MAP,         // 15\r
+               RAMPARTS_MAP,            // 16\r
+               DEATH_KNIGHT_MAP,        // 17\r
+               SECRET_1_MAP,            // 18\r
+               SECRET_2_MAP,            // 19\r
+               ANGEL_OF_DEATH_MAP,      // 20\r
+               LASTMAP\r
+            } mapnames;\r
diff --git a/16/wf3d8086/mapswl1.h b/16/wf3d8086/mapswl1.h
new file mode 100755 (executable)
index 0000000..9ecf673
--- /dev/null
@@ -0,0 +1,42 @@
+///////////////////////////////////////\r
+//\r
+// TED5 Map Header for WL1\r
+//\r
+///////////////////////////////////////\r
+\r
+//\r
+// Map Names\r
+//\r
+typedef enum {\r
+               WOLF1_MAP1_MAP,          // 0\r
+               WOLF1_MAP2_MAP,          // 1\r
+               WOLF1_MAP3_MAP,          // 2\r
+               WOLF1_MAP4_MAP,          // 3\r
+               WOLF1_MAP5_MAP,          // 4\r
+               WOLF1_MAP6_MAP,          // 5\r
+               WOLF1_MAP7_MAP,          // 6\r
+               WOLF1_MAP8_MAP,          // 7\r
+               WOLF1_BOSS_MAP,          // 8\r
+               WOLF1_SECRET_MAP,        // 9\r
+               WOLF2_MAP1_MAP,          // 10\r
+               WOLF2_MAP2_MAP,          // 11\r
+               WOLF2_MAP3_MAP,          // 12\r
+               WOLF2_MAP4_MAP,          // 13\r
+               WOLF2_MAP5_MAP,          // 14\r
+               WOLF2_MAP6_MAP,          // 15\r
+               WOLF2_MAP7_MAP,          // 16\r
+               WOLF2_MAP8_MAP,          // 17\r
+               WOLF2_BOSS_MAP,          // 18\r
+               WOLF2_SECRET_MAP,        // 19\r
+               WOLF3_MAP1_MAP,          // 20\r
+               WOLF3_MAP2_MAP,          // 21\r
+               WOLF3_MAP3_MAP,          // 22\r
+               WOLF3_MAP4_MAP,          // 23\r
+               WOLF3_MAP5_MAP,          // 24\r
+               WOLF3_MAP6_MAP,          // 25\r
+               WOLF3_MAP7_MAP,          // 26\r
+               WOLF3_MAP8_MAP,          // 27\r
+               WOLF3_BOSS_MAP,          // 28\r
+               WOLF3_SECRET_MAP,        // 29\r
+               LASTMAP\r
+            } mapnames;\r
diff --git a/16/wf3d8086/mapswl6.h b/16/wf3d8086/mapswl6.h
new file mode 100755 (executable)
index 0000000..649ed78
--- /dev/null
@@ -0,0 +1,73 @@
+///////////////////////////////////////\r
+//\r
+// TED5 Map Header for WL6\r
+//\r
+///////////////////////////////////////\r
+\r
+//\r
+// Map Names\r
+//\r
+typedef enum {\r
+               WOLF1_MAP1_MAP,          // 0\r
+               WOLF1_MAP2_MAP,          // 1\r
+               WOLF1_MAP3_MAP,          // 2\r
+               WOLF1_MAP4_MAP,          // 3\r
+               WOLF1_MAP5_MAP,          // 4\r
+               WOLF1_MAP6_MAP,          // 5\r
+               WOLF1_MAP7_MAP,          // 6\r
+               WOLF1_MAP8_MAP,          // 7\r
+               WOLF1_BOSS_MAP,          // 8\r
+               WOLF1_SECRET_MAP,        // 9\r
+               WOLF2_MAP1_MAP,          // 10\r
+               WOLF2_MAP2_MAP,          // 11\r
+               WOLF2_MAP3_MAP,          // 12\r
+               WOLF2_MAP4_MAP,          // 13\r
+               WOLF2_MAP5_MAP,          // 14\r
+               WOLF2_MAP6_MAP,          // 15\r
+               WOLF2_MAP7_MAP,          // 16\r
+               WOLF2_MAP8_MAP,          // 17\r
+               WOLF2_BOSS_MAP,          // 18\r
+               WOLF2_SECRET_MAP,        // 19\r
+               WOLF3_MAP1_MAP,          // 20\r
+               WOLF3_MAP2_MAP,          // 21\r
+               WOLF3_MAP3_MAP,          // 22\r
+               WOLF3_MAP4_MAP,          // 23\r
+               WOLF3_MAP5_MAP,          // 24\r
+               WOLF3_MAP6_MAP,          // 25\r
+               WOLF3_MAP7_MAP,          // 26\r
+               WOLF3_MAP8_MAP,          // 27\r
+               WOLF3_BOSS_MAP,          // 28\r
+               WOLF3_SECRET_MAP,        // 29\r
+               WOLF4_MAP_1_MAP,         // 30\r
+               WOLF4_MAP_2_MAP,         // 31\r
+               WOLF4_MAP_3_MAP,         // 32\r
+               WOLF4_MAP_4_MAP,         // 33\r
+               WOLF4_MAP_5_MAP,         // 34\r
+               WOLF4_MAP_6_MAP,         // 35\r
+               WOLF4_MAP_7_MAP,         // 36\r
+               WOLF4_MAP_8_MAP,         // 37\r
+               WOLF4_BOSS_MAP,          // 38\r
+               WOLF4_SECRET_MAP,        // 39\r
+               WOLF5_MAP_1_MAP,         // 40\r
+               WOLF5_MAP_2_MAP,         // 41\r
+               WOLF5_MAP_3_MAP,         // 42\r
+               WOLF5_MAP_4_MAP,         // 43\r
+               WOLF5_MAP_5_MAP,         // 44\r
+               WOLF5_MAP_6_MAP,         // 45\r
+               WOLF5_MAP_7_MAP,         // 46\r
+               WOLF5_MAP_8_MAP,         // 47\r
+               WOLF5_BOSS_MAP,          // 48\r
+               WOLF5_SECRET_MAP,        // 49\r
+               WOLF6_MAP_1_MAP,         // 50\r
+               WOLF6_MAP_2_MAP,         // 51\r
+               WOLF6_MAP_3_MAP,         // 52\r
+               WOLF6_MAP_4_MAP,         // 53\r
+               WOLF6_MAP_5_MAP,         // 54\r
+               WOLF6_MAP_6_MAP,         // 55\r
+               WOLF6_MAP_7_MAP,         // 56\r
+               WOLF6_MAP_8_MAP,         // 57\r
+               WOLF6_BOSS_MAP,          // 58\r
+               WOLF6_SECRET_MAP,        // 59\r
+               MAP4L10PATH_MAP,         // 60\r
+               LASTMAP\r
+            } mapnames;\r
diff --git a/16/wf3d8086/mapswlf.h b/16/wf3d8086/mapswlf.h
new file mode 100755 (executable)
index 0000000..1003658
--- /dev/null
@@ -0,0 +1,16 @@
+///////////////////////////////////////\r
+//\r
+// TED5 Map Header for WLF\r
+//\r
+///////////////////////////////////////\r
+\r
+//\r
+// Map Names\r
+//\r
+typedef enum {\r
+               LEVEL_ONE_MAP,           // 0\r
+               LEVEL_TWO_MAP,           // 1\r
+               LEVEL_THREE_MAP,         // 2\r
+               LEVEL_FOUR_MAP,          // 3\r
+               LASTMAP\r
+            } mapnames;\r
diff --git a/16/wf3d8086/munge.c b/16/wf3d8086/munge.c
new file mode 100755 (executable)
index 0000000..87f9eb7
--- /dev/null
@@ -0,0 +1,48 @@
+\r
+/*\r
+=================\r
+=\r
+= VL_MungePic\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MungePic (unsigned char far *source, unsigned width, unsigned height)\r
+{\r
+       unsigned        x,y,plane,size,pwidth;\r
+       unsigned char   far *temp, far *dest, far *srcline;\r
+\r
+       size = width*height;\r
+\r
+       if (width&3)\r
+               errout ("VL_MungePic: Not divisable by 4!\n");\r
+\r
+//\r
+// copy the pic to a temp buffer\r
+//\r
+       temp = (unsigned char far *)farmalloc (size);\r
+       if (!temp)\r
+               errout ("Non enough memory for munge buffer!\n");\r
+\r
+       _fmemcpy (temp,source,size);\r
+\r
+//\r
+// munge it back into the original buffer\r
+//\r
+       dest = source;\r
+       pwidth = width/4;\r
+\r
+       for (plane=0;plane<4;plane++)\r
+       {\r
+               srcline = temp;\r
+               for (y=0;y<height;y++)\r
+               {\r
+                       for (x=0;x<pwidth;x++)\r
+                               *dest++ = *(srcline+x*4+plane);\r
+                       srcline+=width;\r
+               }\r
+       }\r
+\r
+       free (temp);\r
+}\r
+\r
diff --git a/16/wf3d8086/obj/wolf3d.exe b/16/wf3d8086/obj/wolf3d.exe
new file mode 100755 (executable)
index 0000000..928f67b
Binary files /dev/null and b/16/wf3d8086/obj/wolf3d.exe differ
diff --git a/16/wf3d8086/obj/wolf3d.map b/16/wf3d8086/obj/wolf3d.map
new file mode 100755 (executable)
index 0000000..972cba9
--- /dev/null
@@ -0,0 +1,3638 @@
+\r
+ Start  Stop   Length Name               Class\r
+\r
+ 00000H 044F8H 044F9H _TEXT              CODE\r
+ 044FAH 044FAH 00000H H_LDIV_TEXT        CODE\r
+ 044FAH 04899H 003A0H WOLFHACK_TEXT      CODE\r
+ 0489AH 04904H 0006BH WHACK_A_TEXT       CODE\r
+ 04906H 0491CH 00017H WL_ASM_TEXT        CODE\r
+ 0491DH 062DDH 019C1H WL_MAIN_TEXT       CODE\r
+ 062DEH 06CD5H 009F8H WL_TEXT_TEXT       CODE\r
+ 06CD6H 0B05DH 04388H WL_MENU_TEXT       CODE\r
+ 0B05EH 0C637H 015DAH WL_INTER_TEXT      CODE\r
+ 0C638H 0DA6CH 01435H WL_GAME_TEXT       CODE\r
+ 0DA6DH 0EC13H 011A7H WL_PLAY_TEXT       CODE\r
+ 0EC14H 0F7ABH 00B98H WL_DEBUG_TEXT      CODE\r
+ 0F7ACH 10792H 00FE7H WL_DRAW_TEXT       CODE\r
+ 10794H 10BFDH 0046AH WL_DR_A_TEXT       CODE\r
+ 10BFEH 114B0H 008B3H WL_SCALE_TEXT      CODE\r
+ 114B1H 12D5FH 018AFH WL_STATE_TEXT      CODE\r
+ 12D60H 1402BH 012CCH WL_AGENT_TEXT      CODE\r
+ 1402CH 14D6CH 00D41H WL_ACT1_TEXT       CODE\r
+ 14D6DH 1710AH 0239EH WL_ACT2_TEXT       CODE\r
+ 1710BH 1885CH 01752H ID_CA_TEXT         CODE\r
+ 1885DH 193E0H 00B84H ID_IN_TEXT         CODE\r
+ 193E1H 1A267H 00E87H ID_MM_TEXT         CODE\r
+ 1A268H 1B44AH 011E3H ID_PM_TEXT         CODE\r
+ 1B44BH 1CD63H 01919H ID_SD_TEXT         CODE\r
+ 1CD64H 1D1D4H 00471H ID_SD_A_TEXT       CODE\r
+ 1D1D5H 1DDD7H 00C03H ID_US_1_TEXT       CODE\r
+ 1DDD8H 1DE1CH 00045H ID_US_A_TEXT       CODE\r
+ 1DE1DH 1E98FH 00B73H ID_VL_TEXT         CODE\r
+ 1E990H 1F2B9H 0092AH ID_VH_TEXT         CODE\r
+ 1F2BAH 1F54DH 00294H ID_VL_A_TEXT       CODE\r
+ 1F54EH 1F743H 001F6H ID_VH_A_TEXT       CODE\r
+ 1F750H 21EC6H 02777H EMU_PROG           CODE\r
+ 21ED0H 22497H 005C8H E87_PROG           CODE\r
+ 224A0H 224A0H 00000H _FARDATA           FAR_DATA\r
+ 224A0H 2449FH 02000H FAR_DATA           FAR_DATA\r
+ 244A0H 245A1H 00102H FAR_DATA           FAR_DATA\r
+ 245B0H 248A3H 002F4H WL_MAIN5_DATA      FAR_DATA\r
+ 248B0H 24B7FH 002D0H WL_MENU5_DATA      FAR_DATA\r
+ 24B80H 24CF9H 0017AH WL_MENU6_DATA      FAR_DATA\r
+ 24D00H 24EF7H 001F8H WL_MENU7_DATA      FAR_DATA\r
+ 24F00H 24FFBH 000FCH WL_MENU8_DATA      FAR_DATA\r
+ 25000H 251CDH 001CEH WL_MENU9_DATA      FAR_DATA\r
+ 251D0H 25277H 000A8H WL_MENU10_DATA     FAR_DATA\r
+ 25280H 25423H 001A4H WL_MENU11_DATA     FAR_DATA\r
+ 25430H 255A9H 0017AH WL_MENU12_DATA     FAR_DATA\r
+ 255B0H 255D3H 00024H WL_MENU13_DATA     FAR_DATA\r
+ 255E0H 34FDFH 0FA00H SignonSeg          FAR_DATA\r
+ 34FE0H 3505FH 00080H ID_IN5_DATA        FAR_DATA\r
+ 35060H 350DFH 00080H ID_IN6_DATA        FAR_DATA\r
+ 350E0H 3515FH 00080H ID_IN7_DATA        FAR_DATA\r
+ 35160H 35160H 00000H _FARBSS            FAR_BSS\r
+ 35160H 356B8H 00559H _COMDEF_AA_        FAR_BSS\r
+ 356C0H 35DC7H 00708H _COMDEF_AB_        FAR_BSS\r
+ 35DD0H 36BDFH 00E10H _COMDEF_AC_        FAR_BSS\r
+ 36BE0H 36C74H 00095H _COMDEF_AD_        FAR_BSS\r
+ 36C80H 37E7FH 01200H _COMDEF_AE_        FAR_BSS\r
+ 37E80H 3907FH 01200H _COMDEF_AF_        FAR_BSS\r
+ 39080H 3B14FH 020D0H _COMDEF_AG_        FAR_BSS\r
+ 3B150H 3B44FH 00300H _COMDEF_AH_        FAR_BSS\r
+ 3B450H 3B74FH 00300H _COMDEF_AI_        FAR_BSS\r
+ 3B750H 3B750H 00000H _OVERLAY_          OVRINFO\r
+ 3B750H 3B750H 00000H _1STUB_            STUBSEG\r
+ 3B750H 3FE89H 0473AH _DATA              DATA\r
+ 3FE8AH 3FE8DH 00004H _CVTSEG            DATA\r
+ 3FE8EH 3FE99H 0000CH _SCNSEG            DATA\r
+ 3FE9AH 3FE9AH 00000H _CONST             CONST\r
+ 3FE9AH 3FEB7H 0001EH _INIT_             INITDATA\r
+ 3FEB8H 3FEB8H 00000H _INITEND_          INITDATA\r
+ 3FEB8H 3FEBDH 00006H _EXIT_             EXITDATA\r
+ 3FEBEH 3FEBEH 00000H _EXITEND_          EXITDATA\r
+ 3FEBEH 40133H 00276H _BSS               BSS\r
+ 40134H 4A6FCH 0A5C9H _COMDEF_           BSS\r
+ 4A6FDH 4A6FDH 00000H _BSSEND            BSSEND\r
+ 4A700H 4A77FH 00080H _STACK             STACK\r
+\r
+\r
+Detailed map of segments\r
+\r
+ 0000:0000 02B3 C=CODE   S=_TEXT          G=(none)  M=C0.ASM     ACBP=28\r
+ 0000:02B3 00DE C=CODE   S=_TEXT          G=(none)  M=H_LDIV.ASM ACBP=28\r
+ 0000:0391 0258 C=CODE   S=_TEXT          G=(none)  M=FPINIT     ACBP=28\r
+ 0000:05E9 0000 C=CODE   S=_TEXT          G=(none)  M=E87TRAP    ACBP=28\r
+ 0000:05E9 0000 C=CODE   S=_TEXT          G=(none)  M=PROTFLAG   ACBP=28\r
+ 0000:05E9 0000 C=CODE   S=_TEXT          G=(none)  M=DEFLT87    ACBP=28\r
+ 0000:05E9 000D C=CODE   S=_TEXT          G=(none)  M=ATAN       ACBP=28\r
+ 0000:05F6 0000 C=CODE   S=_TEXT          G=(none)  M=HUGEVAL    ACBP=28\r
+ 0000:05F6 009A C=CODE   S=_TEXT          G=(none)  M=LDTRUNC    ACBP=28\r
+ 0000:0690 0000 C=CODE   S=_TEXT          G=(none)  M=MATHWHY    ACBP=28\r
+ 0000:0690 01B5 C=CODE   S=_TEXT          G=(none)  M=REALCVT    ACBP=28\r
+ 0000:0845 0361 C=CODE   S=_TEXT          G=(none)  M=SCANTOD    ACBP=28\r
+ 0000:0BA6 0209 C=CODE   S=_TEXT          G=(none)  M=XCVT       ACBP=28\r
+ 0000:0DAF 00A6 C=CODE   S=_TEXT          G=(none)  M=FPERR      ACBP=28\r
+ 0000:0E55 00C9 C=CODE   S=_TEXT          G=(none)  M=_POW10     ACBP=28\r
+ 0000:0F1E 000B C=CODE   S=_TEXT          G=(none)  M=POW10D     ACBP=28\r
+ 0000:0F29 0026 C=CODE   S=_TEXT          G=(none)  M=MATHERR    ACBP=28\r
+ 0000:0F4F 004D C=CODE   S=_TEXT          G=(none)  M=SIN        ACBP=28\r
+ 0000:0F9C 0050 C=CODE   S=_TEXT          G=(none)  M=TAN        ACBP=28\r
+ 0000:0FEC 0090 C=CODE   S=_TEXT          G=(none)  M=_MATHERR   ACBP=28\r
+ 0000:107C 00BB C=CODE   S=_TEXT          G=(none)  M=ATAN2      ACBP=28\r
+ 0000:1137 002C C=CODE   S=_TEXT          G=(none)  M=FFTOL      ACBP=28\r
+ 0000:1163 002D C=CODE   S=_TEXT          G=(none)  M=ATEXIT     ACBP=28\r
+ 0000:1190 0000 C=CODE   S=_TEXT          G=(none)  M=CTYPE      ACBP=28\r
+ 0000:1190 0036 C=CODE   S=_TEXT          G=(none)  M=DOSDFREE   ACBP=28\r
+ 0000:11C6 0038 C=CODE   S=_TEXT          G=(none)  M=DOSFATTR   ACBP=28\r
+ 0000:11FE 0032 C=CODE   S=_TEXT          G=(none)  M=DOSGDATE   ACBP=28\r
+ 0000:1230 0023 C=CODE   S=_TEXT          G=(none)  M=DOSWRITE   ACBP=28\r
+ 0000:1253 0093 C=CODE   S=_TEXT          G=(none)  M=EXIT       ACBP=28\r
+ 0000:12E6 0000 C=CODE   S=_TEXT          G=(none)  M=FILES      ACBP=28\r
+ 0000:12E6 0000 C=CODE   S=_TEXT          G=(none)  M=FILES2     ACBP=28\r
+ 0000:12E6 0000 C=CODE   S=_TEXT          G=(none)  M=FMODE      ACBP=28\r
+ 0000:12E6 0000 C=CODE   S=_TEXT          G=(none)  M=FPSTKLEN   ACBP=28\r
+ 0000:12E6 0017 C=CODE   S=_TEXT          G=(none)  M=F_LXMUL    ACBP=28\r
+ 0000:12FD 0021 C=CODE   S=_TEXT          G=(none)  M=F_PCMP     ACBP=28\r
+ 0000:131E 001C C=CODE   S=_TEXT          G=(none)  M=F_SCOPY    ACBP=28\r
+ 0000:133A 0020 C=CODE   S=_TEXT          G=(none)  M=GETVECT    ACBP=28\r
+ 0000:135A 0000 C=CODE   S=_TEXT          G=(none)  M=HEAPLEN    ACBP=28\r
+ 0000:135A 0021 C=CODE   S=_TEXT          G=(none)  M=H_LLSH     ACBP=28\r
+ 0000:137B 0020 C=CODE   S=_TEXT          G=(none)  M=H_LRSH     ACBP=28\r
+ 0000:139B 0021 C=CODE   S=_TEXT          G=(none)  M=H_LURSH    ACBP=28\r
+ 0000:13BC 0088 C=CODE   S=_TEXT          G=(none)  M=H_PADA     ACBP=28\r
+ 0000:1444 0060 C=CODE   S=_TEXT          G=(none)  M=H_PADD     ACBP=28\r
+ 0000:14A4 0028 C=CODE   S=_TEXT          G=(none)  M=H_PSBP     ACBP=28\r
+ 0000:14CC 0027 C=CODE   S=_TEXT          G=(none)  M=H_SPUSH    ACBP=28\r
+ 0000:14F3 004B C=CODE   S=_TEXT          G=(none)  M=IOERROR    ACBP=28\r
+ 0000:153E 0011 C=CODE   S=_TEXT          G=(none)  M=ISATTY     ACBP=28\r
+ 0000:154F 009A C=CODE   S=_TEXT          G=(none)  M=LONGTOA    ACBP=28\r
+ 0000:15E9 0029 C=CODE   S=_TEXT          G=(none)  M=LSEEK      ACBP=28\r
+ 0000:1612 0082 C=CODE   S=_TEXT          G=(none)  M=MKNAME     ACBP=28\r
+ 0000:1694 0021 C=CODE   S=_TEXT          G=(none)  M=N_PCMP     ACBP=28\r
+ 0000:16B5 002D C=CODE   S=_TEXT          G=(none)  M=READA      ACBP=28\r
+ 0000:16E2 01AA C=CODE   S=_TEXT          G=(none)  M=SCANTOL    ACBP=28\r
+ 0000:188C 00A5 C=CODE   S=_TEXT          G=(none)  M=SETUPIO    ACBP=28\r
+ 0000:1931 0000 C=CODE   S=_TEXT          G=(none)  M=SIGDATA    ACBP=28\r
+ 0000:1931 0000 C=CODE   S=_TEXT          G=(none)  M=STKLEN     ACBP=28\r
+ 0000:1931 002C C=CODE   S=_TEXT          G=(none)  M=TOLOWER    ACBP=28\r
+ 0000:195D 002C C=CODE   S=_TEXT          G=(none)  M=TOUPPER    ACBP=28\r
+ 0000:1989 0016 C=CODE   S=_TEXT          G=(none)  M=UNLINK     ACBP=28\r
+ 0000:199F 04CB C=CODE   S=_TEXT          G=(none)  M=VPRINTER   ACBP=28\r
+ 0000:1E6A 009F C=CODE   S=_TEXT          G=(none)  M=VRAM       ACBP=28\r
+ 0000:1F09 001A C=CODE   S=_TEXT          G=(none)  M=XCLOSE     ACBP=28\r
+ 0000:1F23 0029 C=CODE   S=_TEXT          G=(none)  M=_STPCPY    ACBP=28\r
+ 0000:1F4C 0025 C=CODE   S=_TEXT          G=(none)  M=BIOSKEY    ACBP=28\r
+ 0000:1F71 006F C=CODE   S=_TEXT          G=(none)  M=BRK        ACBP=28\r
+ 0000:1FE0 0029 C=CODE   S=_TEXT          G=(none)  M=CLRSCR     ACBP=28\r
+ 0000:2009 0010 C=CODE   S=_TEXT          G=(none)  M=CORELEFT   ACBP=28\r
+ 0000:2019 01A1 C=CODE   S=_TEXT          G=(none)  M=CRTINIT    ACBP=28\r
+ 0000:21BA 001F C=CODE   S=_TEXT          G=(none)  M=CVTFAK     ACBP=28\r
+ 0000:21D9 0421 C=CODE   S=_TEXT          G=(none)  M=FARHEAP    ACBP=28\r
+ 0000:25FA 0140 C=CODE   S=_TEXT          G=(none)  M=FBRK       ACBP=28\r
+ 0000:273A 0050 C=CODE   S=_TEXT          G=(none)  M=FCORELFT   ACBP=28\r
+ 0000:278A 0049 C=CODE   S=_TEXT          G=(none)  M=GOTOXY     ACBP=28\r
+ 0000:27D3 00A8 C=CODE   S=_TEXT          G=(none)  M=GPTEXT     ACBP=28\r
+ 0000:287B 002E C=CODE   S=_TEXT          G=(none)  M=HARD       ACBP=28\r
+ 0000:28A9 0126 C=CODE   S=_TEXT          G=(none)  M=HARDERR    ACBP=28\r
+ 0000:29CF 0027 C=CODE   S=_TEXT          G=(none)  M=IOCTL      ACBP=28\r
+ 0000:29F6 009D C=CODE   S=_TEXT          G=(none)  M=MOVETEXT   ACBP=28\r
+ 0000:2A93 027B C=CODE   S=_TEXT          G=(none)  M=NEARHEAP   ACBP=28\r
+ 0000:2D0E 0004 C=CODE   S=_TEXT          G=(none)  M=REALCVT    ACBP=28\r
+ 0000:2D12 01BD C=CODE   S=_TEXT          G=(none)  M=SCREEN     ACBP=28\r
+ 0000:2ECF 0188 C=CODE   S=_TEXT          G=(none)  M=SCROLL     ACBP=28\r
+ 0000:3057 0119 C=CODE   S=_TEXT          G=(none)  M=SETARGV    ACBP=28\r
+ 0000:3170 001C C=CODE   S=_TEXT          G=(none)  M=SETBLOCK   ACBP=28\r
+ 0000:318C 005D C=CODE   S=_TEXT          G=(none)  M=SETENVP    ACBP=28\r
+ 0000:31E9 002C C=CODE   S=_TEXT          G=(none)  M=WHEREXY    ACBP=28\r
+ 0000:3215 007D C=CODE   S=_TEXT          G=(none)  M=ATOL       ACBP=28\r
+ 0000:3292 0010 C=CODE   S=_TEXT          G=(none)  M=BDOS       ACBP=28\r
+ 0000:32A2 001B C=CODE   S=_TEXT          G=(none)  M=CHMODA     ACBP=28\r
+ 0000:32BD 0028 C=CODE   S=_TEXT          G=(none)  M=CLOSE      ACBP=28\r
+ 0000:32E5 001E C=CODE   S=_TEXT          G=(none)  M=CLOSEA     ACBP=28\r
+ 0000:3303 008B C=CODE   S=_TEXT          G=(none)  M=CREAT      ACBP=28\r
+ 0000:338E 0081 C=CODE   S=_TEXT          G=(none)  M=FCLOSE     ACBP=28\r
+ 0000:340F 0081 C=CODE   S=_TEXT          G=(none)  M=FFLUSH     ACBP=28\r
+ 0000:3490 0060 C=CODE   S=_TEXT          G=(none)  M=FINDFIRS   ACBP=28\r
+ 0000:34F0 0041 C=CODE   S=_TEXT          G=(none)  M=FLENGTH    ACBP=28\r
+ 0000:3531 003A C=CODE   S=_TEXT          G=(none)  M=FLUSHALL   ACBP=28\r
+ 0000:356B 01A0 C=CODE   S=_TEXT          G=(none)  M=FOPEN      ACBP=28\r
+ 0000:370B 0016 C=CODE   S=_TEXT          G=(none)  M=FPRINTF    ACBP=28\r
+ 0000:3721 018C C=CODE   S=_TEXT          G=(none)  M=FSEEK      ACBP=28\r
+ 0000:38AD 005F C=CODE   S=_TEXT          G=(none)  M=GETENV     ACBP=28\r
+ 0000:390C 0067 C=CODE   S=_TEXT          G=(none)  M=LTOA1      ACBP=28\r
+ 0000:3973 001F C=CODE   S=_TEXT          G=(none)  M=MEMCPY     ACBP=28\r
+ 0000:3992 0022 C=CODE   S=_TEXT          G=(none)  M=MOVEDATA   ACBP=28\r
+ 0000:39B4 0183 C=CODE   S=_TEXT          G=(none)  M=OPEN       ACBP=28\r
+ 0000:3B37 004D C=CODE   S=_TEXT          G=(none)  M=OPENA      ACBP=28\r
+ 0000:3B84 0017 C=CODE   S=_TEXT          G=(none)  M=PRINTF     ACBP=28\r
+ 0000:3B9B 0309 C=CODE   S=_TEXT          G=(none)  M=PUTC       ACBP=28\r
+ 0000:3EA4 004B C=CODE   S=_TEXT          G=(none)  M=PUTS       ACBP=28\r
+ 0000:3EEF 00CE C=CODE   S=_TEXT          G=(none)  M=READ       ACBP=28\r
+ 0000:3FBD 0003 C=CODE   S=_TEXT          G=(none)  M=READU      ACBP=28\r
+ 0000:3FC0 00D8 C=CODE   S=_TEXT          G=(none)  M=SETVBUF    ACBP=28\r
+ 0000:4098 0061 C=CODE   S=_TEXT          G=(none)  M=SPRINTF    ACBP=28\r
+ 0000:40F9 0039 C=CODE   S=_TEXT          G=(none)  M=STRCAT     ACBP=28\r
+ 0000:4132 001A C=CODE   S=_TEXT          G=(none)  M=STRLEN     ACBP=28\r
+ 0000:414C 00FF C=CODE   S=_TEXT          G=(none)  M=STRTOL     ACBP=28\r
+ 0000:424B 010E C=CODE   S=_TEXT          G=(none)  M=WRITE      ACBP=28\r
+ 0000:4359 003A C=CODE   S=_TEXT          G=(none)  M=WRITEA     ACBP=28\r
+ 0000:4393 0003 C=CODE   S=_TEXT          G=(none)  M=WRITEU     ACBP=28\r
+ 0000:4396 0028 C=CODE   S=_TEXT          G=(none)  M=XFCLOSE    ACBP=28\r
+ 0000:43BE 0023 C=CODE   S=_TEXT          G=(none)  M=XFFLUSH    ACBP=28\r
+ 0000:43E1 0028 C=CODE   S=_TEXT          G=(none)  M=FMEMCMP    ACBP=28\r
+ 0000:4409 0024 C=CODE   S=_TEXT          G=(none)  M=FMEMCPY    ACBP=28\r
+ 0000:442D 0043 C=CODE   S=_TEXT          G=(none)  M=FMEMSET    ACBP=28\r
+ 0000:4470 0029 C=CODE   S=_TEXT          G=(none)  M=FSTRCPY    ACBP=28\r
+ 0000:4499 0041 C=CODE   S=_TEXT          G=(none)  M=FSTRICMP   ACBP=28\r
+ 0000:44DA 001F C=CODE   S=_TEXT          G=(none)  M=FSTRLEN    ACBP=28\r
+ 044F:000A 0000 C=CODE   S=H_LDIV_TEXT    G=(none)  M=H_LDIV.ASM ACBP=48\r
+ 044F:000A 03A0 C=CODE   S=WOLFHACK_TEXT  G=(none)  M=WOLFHACK.C ACBP=28\r
+ 0489:000A 006B C=CODE   S=WHACK_A_TEXT   G=(none)  M=WHACK_A.ASM ACBP=48\r
+ 0490:0006 0017 C=CODE   S=WL_ASM_TEXT    G=(none)  M=WL_ASM.ASM ACBP=48\r
+ 0491:000D 19C1 C=CODE   S=WL_MAIN_TEXT   G=(none)  M=WL_MAIN.C  ACBP=28\r
+ 062D:000E 09F8 C=CODE   S=WL_TEXT_TEXT   G=(none)  M=WL_TEXT.C  ACBP=28\r
+ 06CD:0006 4388 C=CODE   S=WL_MENU_TEXT   G=(none)  M=WL_MENU.C  ACBP=28\r
+ 0B05:000E 15DA C=CODE   S=WL_INTER_TEXT  G=(none)  M=WL_INTER.C ACBP=28\r
+ 0C63:0008 1435 C=CODE   S=WL_GAME_TEXT   G=(none)  M=WL_GAME.C  ACBP=28\r
+ 0DA6:000D 11A7 C=CODE   S=WL_PLAY_TEXT   G=(none)  M=WL_PLAY.C  ACBP=28\r
+ 0EC1:0004 0B98 C=CODE   S=WL_DEBUG_TEXT  G=(none)  M=WL_DEBUG.C ACBP=28\r
+ 0F7A:000C 0FE7 C=CODE   S=WL_DRAW_TEXT   G=(none)  M=WL_DRAW.C  ACBP=28\r
+ 1079:0004 046A C=CODE   S=WL_DR_A_TEXT   G=(none)  M=WL_DR_A.ASM ACBP=48\r
+ 10BF:000E 08B3 C=CODE   S=WL_SCALE_TEXT  G=(none)  M=WL_SCALE.C ACBP=28\r
+ 114B:0001 18AF C=CODE   S=WL_STATE_TEXT  G=(none)  M=WL_STATE.C ACBP=28\r
+ 12D6:0000 12CC C=CODE   S=WL_AGENT_TEXT  G=(none)  M=WL_AGENT.C ACBP=28\r
+ 1402:000C 0D41 C=CODE   S=WL_ACT1_TEXT   G=(none)  M=WL_ACT1.C  ACBP=28\r
+ 14D6:000D 239E C=CODE   S=WL_ACT2_TEXT   G=(none)  M=WL_ACT2.C  ACBP=28\r
+ 1710:000B 1752 C=CODE   S=ID_CA_TEXT     G=(none)  M=ID_CA.C    ACBP=28\r
+ 1885:000D 0B84 C=CODE   S=ID_IN_TEXT     G=(none)  M=ID_IN.C    ACBP=28\r
+ 193E:0001 0E87 C=CODE   S=ID_MM_TEXT     G=(none)  M=ID_MM.C    ACBP=28\r
+ 1A26:0008 11E3 C=CODE   S=ID_PM_TEXT     G=(none)  M=ID_PM.C    ACBP=28\r
+ 1B44:000B 1919 C=CODE   S=ID_SD_TEXT     G=(none)  M=ID_SD.C    ACBP=28\r
+ 1CD6:0004 0471 C=CODE   S=ID_SD_A_TEXT   G=(none)  M=ID_SD_A.ASM ACBP=48\r
+ 1D1D:0005 0C03 C=CODE   S=ID_US_1_TEXT   G=(none)  M=ID_US_1.C  ACBP=28\r
+ 1DDD:0008 0045 C=CODE   S=ID_US_A_TEXT   G=(none)  M=ID_US_A.ASM ACBP=48\r
+ 1DE1:000D 0B73 C=CODE   S=ID_VL_TEXT     G=(none)  M=ID_VL.C    ACBP=28\r
+ 1E99:0000 092A C=CODE   S=ID_VH_TEXT     G=(none)  M=ID_VH.C    ACBP=28\r
+ 1F2B:000A 0294 C=CODE   S=ID_VL_A_TEXT   G=(none)  M=ID_VL_A.ASM ACBP=48\r
+ 1F54:000E 01F6 C=CODE   S=ID_VH_A_TEXT   G=(none)  M=ID_VH_A.ASM ACBP=48\r
+ 1F75:0000 0000 C=CODE   S=EMU_PROG       G=(none)  M=FPINIT     ACBP=68\r
+ 1F75:0000 2777 C=CODE   S=EMU_PROG       G=(none)  M=EMU086     ACBP=68\r
+ 21ED:0000 0000 C=CODE   S=E87_PROG       G=(none)  M=FPINIT     ACBP=68\r
+ 21ED:0000 03E3 C=CODE   S=E87_PROG       G=(none)  M=EMU087     ACBP=68\r
+ 21ED:03F0 01D8 C=CODE   S=E87_PROG       G=(none)  M=E87TRAP    ACBP=68\r
+ 224A:0000 0000 C=FAR_DATA S=_FARDATA       G=(none)  M=C0.ASM     ACBP=68\r
+ 224A:0000 2000 C=FAR_DATA S=FAR_DATA       G=(none)  M=WHACK_A.ASM ACBP=60\r
+ 244A:0000 0102 C=FAR_DATA S=FAR_DATA       G=(none)  M=ID_US_A.ASM ACBP=60\r
+ 245B:0000 02F4 C=FAR_DATA S=WL_MAIN5_DATA  G=(none)  M=WL_MAIN.C  ACBP=68\r
+ 248B:0000 02D0 C=FAR_DATA S=WL_MENU5_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 24B8:0000 017A C=FAR_DATA S=WL_MENU6_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 24D0:0000 01F8 C=FAR_DATA S=WL_MENU7_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 24F0:0000 00FC C=FAR_DATA S=WL_MENU8_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 2500:0000 01CE C=FAR_DATA S=WL_MENU9_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 251D:0000 00A8 C=FAR_DATA S=WL_MENU10_DATA G=(none)  M=WL_MENU.C  ACBP=68\r
+ 2528:0000 01A4 C=FAR_DATA S=WL_MENU11_DATA G=(none)  M=WL_MENU.C  ACBP=68\r
+ 2543:0000 017A C=FAR_DATA S=WL_MENU12_DATA G=(none)  M=WL_MENU.C  ACBP=68\r
+ 255B:0000 0024 C=FAR_DATA S=WL_MENU13_DATA G=(none)  M=WL_MENU.C  ACBP=68\r
+ 255E:0000 FA00 C=FAR_DATA S=SignonSeg      G=(none)  M=SIGNON.BIN   ACBP=60\r
+ 34FE:0000 0080 C=FAR_DATA S=ID_IN5_DATA    G=(none)  M=ID_IN.C    ACBP=68\r
+ 3506:0000 0080 C=FAR_DATA S=ID_IN6_DATA    G=(none)  M=ID_IN.C    ACBP=68\r
+ 350E:0000 0080 C=FAR_DATA S=ID_IN7_DATA    G=(none)  M=ID_IN.C    ACBP=68\r
+ 3516:0000 0000 C=FAR_BSS S=_FARBSS        G=(none)  M=C0.ASM     ACBP=68\r
+ 3516:0000 0559 C=FAR_BSS S=_COMDEF_AA_    G=(none)  M=WL_ACT1.C  ACBP=60\r
+ 356C:0000 0708 C=FAR_BSS S=_COMDEF_AB_    G=(none)  M=WL_DRAW.C  ACBP=60\r
+ 35DD:0000 0E10 C=FAR_BSS S=_COMDEF_AC_    G=(none)  M=WL_DRAW.C  ACBP=60\r
+ 36BE:0000 0095 C=FAR_BSS S=_COMDEF_AD_    G=(none)  M=ID_CA.C    ACBP=60\r
+ 36C8:0000 1200 C=FAR_BSS S=_COMDEF_AE_    G=(none)  M=WL_PLAY.C  ACBP=60\r
+ 37E8:0000 1200 C=FAR_BSS S=_COMDEF_AF_    G=(none)  M=WL_PLAY.C  ACBP=60\r
+ 3908:0000 20D0 C=FAR_BSS S=_COMDEF_AG_    G=(none)  M=ID_MM.C    ACBP=60\r
+ 3B15:0000 0300 C=FAR_BSS S=_COMDEF_AH_    G=(none)  M=ID_VL.C    ACBP=60\r
+ 3B45:0000 0300 C=FAR_BSS S=_COMDEF_AI_    G=(none)  M=ID_VL.C    ACBP=60\r
+ 3B75:0000 0000 C=OVRINFO S=_OVERLAY_      G=(none)  M=C0.ASM     ACBP=68\r
+ 3B75:0000 0000 C=STUBSEG S=_1STUB_        G=(none)  M=C0.ASM     ACBP=68\r
+ 3B75:0000 00D9 C=DATA   S=_DATA          G=DGROUP  M=C0.ASM     ACBP=68\r
+ 3B75:00DA 0000 C=DATA   S=_DATA          G=DGROUP  M=H_LDIV.ASM ACBP=48\r
+ 3B75:00DA 0002 C=DATA   S=_DATA          G=DGROUP  M=WOLFHACK.C ACBP=48\r
+ 3B75:00DC 0000 C=DATA   S=_DATA          G=DGROUP  M=WHACK_A.ASM ACBP=48\r
+ 3B75:00DC 0000 C=DATA   S=_DATA          G=DGROUP  M=WL_ASM.ASM ACBP=48\r
+ 3B75:00DC 0254 C=DATA   S=_DATA          G=DGROUP  M=WL_MAIN.C  ACBP=48\r
+ 3B75:0330 00A1 C=DATA   S=_DATA          G=DGROUP  M=WL_TEXT.C  ACBP=48\r
+ 3B75:03D2 06B4 C=DATA   S=_DATA          G=DGROUP  M=WL_MENU.C  ACBP=48\r
+ 3B75:0A86 03ED C=DATA   S=_DATA          G=DGROUP  M=WL_INTER.C ACBP=48\r
+ 3B75:0E74 03FC C=DATA   S=_DATA          G=DGROUP  M=WL_GAME.C  ACBP=48\r
+ 3B75:1270 0216 C=DATA   S=_DATA          G=DGROUP  M=WL_PLAY.C  ACBP=48\r
+ 3B75:1486 01FE C=DATA   S=_DATA          G=DGROUP  M=WL_DEBUG.C ACBP=48\r
+ 3B75:1684 0096 C=DATA   S=_DATA          G=DGROUP  M=WL_DRAW.C  ACBP=48\r
+ 3B75:171A 0000 C=DATA   S=_DATA          G=DGROUP  M=WL_DR_A.ASM ACBP=48\r
+ 3B75:171A 00F1 C=DATA   S=_DATA          G=DGROUP  M=WL_SCALE.C ACBP=48\r
+ 3B75:180C 00FF C=DATA   S=_DATA          G=DGROUP  M=WL_STATE.C ACBP=48\r
+ 3B75:190C 0112 C=DATA   S=_DATA          G=DGROUP  M=WL_AGENT.C ACBP=48\r
+ 3B75:1A1E 0119 C=DATA   S=_DATA          G=DGROUP  M=WL_ACT1.C  ACBP=48\r
+ 3B75:1B38 1412 C=DATA   S=_DATA          G=DGROUP  M=WL_ACT2.C  ACBP=48\r
+ 3B75:2F4A 0300 C=DATA   S=_DATA          G=DGROUP  M=GAMEPAL.BIN  ACBP=48\r
+ 3B75:324A 0109 C=DATA   S=_DATA          G=DGROUP  M=ID_CA.C    ACBP=48\r
+ 3B75:3354 005F C=DATA   S=_DATA          G=DGROUP  M=ID_IN.C    ACBP=48\r
+ 3B75:33B4 015B C=DATA   S=_DATA          G=DGROUP  M=ID_MM.C    ACBP=48\r
+ 3B75:3510 0490 C=DATA   S=_DATA          G=DGROUP  M=ID_PM.C    ACBP=48\r
+ 3B75:39A0 0265 C=DATA   S=_DATA          G=DGROUP  M=ID_SD.C    ACBP=48\r
+ 3B75:3C06 0104 C=DATA   S=_DATA          G=DGROUP  M=ID_SD_A.ASM ACBP=48\r
+ 3B75:3D0A 02B9 C=DATA   S=_DATA          G=DGROUP  M=ID_US_1.C  ACBP=48\r
+ 3B75:3FC4 0000 C=DATA   S=_DATA          G=DGROUP  M=ID_US_A.ASM ACBP=48\r
+ 3B75:3FC4 0097 C=DATA   S=_DATA          G=DGROUP  M=ID_VL.C    ACBP=48\r
+ 3B75:405C 0029 C=DATA   S=_DATA          G=DGROUP  M=ID_VH.C    ACBP=48\r
+ 3B75:4086 0002 C=DATA   S=_DATA          G=DGROUP  M=ID_VL_A.ASM ACBP=48\r
+ 3B75:4088 0000 C=DATA   S=_DATA          G=DGROUP  M=ID_VH_A.ASM ACBP=48\r
+ 3B75:4090 0002 C=DATA   S=_DATA          G=DGROUP  M=FPINIT     ACBP=68\r
+ 3B75:40A0 0000 C=DATA   S=_DATA          G=DGROUP  M=E87TRAP    ACBP=68\r
+ 3B75:40A0 0003 C=DATA   S=_DATA          G=DGROUP  M=PROTFLAG   ACBP=48\r
+ 3B75:40A4 0002 C=DATA   S=_DATA          G=DGROUP  M=DEFLT87    ACBP=48\r
+ 3B75:40A6 0000 C=DATA   S=_DATA          G=DGROUP  M=ATAN       ACBP=48\r
+ 3B75:40A6 0024 C=DATA   S=_DATA          G=DGROUP  M=HUGEVAL    ACBP=48\r
+ 3B75:40CA 0000 C=DATA   S=_DATA          G=DGROUP  M=LDTRUNC    ACBP=48\r
+ 3B75:40CA 0037 C=DATA   S=_DATA          G=DGROUP  M=MATHWHY    ACBP=48\r
+ 3B75:4102 0000 C=DATA   S=_DATA          G=DGROUP  M=REALCVT    ACBP=48\r
+ 3B75:4102 0018 C=DATA   S=_DATA          G=DGROUP  M=SCANTOD    ACBP=48\r
+ 3B75:411A 0000 C=DATA   S=_DATA          G=DGROUP  M=XCVT       ACBP=48\r
+ 3B75:411A 008C C=DATA   S=_DATA          G=DGROUP  M=FPERR      ACBP=48\r
+ 3B75:41A6 0080 C=DATA   S=_DATA          G=DGROUP  M=_POW10     ACBP=48\r
+ 3B75:4226 0000 C=DATA   S=_DATA          G=DGROUP  M=POW10D     ACBP=48\r
+ 3B75:4226 0000 C=DATA   S=_DATA          G=DGROUP  M=MATHERR    ACBP=48\r
+ 3B75:4226 000C C=DATA   S=_DATA          G=DGROUP  M=SIN        ACBP=48\r
+ 3B75:4232 000C C=DATA   S=_DATA          G=DGROUP  M=TAN        ACBP=48\r
+ 3B75:423E 000E C=DATA   S=_DATA          G=DGROUP  M=_MATHERR   ACBP=48\r
+ 3B75:424C 0018 C=DATA   S=_DATA          G=DGROUP  M=ATAN2      ACBP=48\r
+ 3B75:4270 0110 C=DATA   S=_DATA          G=DGROUP  M=EMUVARS    ACBP=68\r
+ 3B75:4380 0000 C=DATA   S=_DATA          G=DGROUP  M=FFTOL      ACBP=48\r
+ 3B75:4380 0002 C=DATA   S=_DATA          G=DGROUP  M=ATEXIT     ACBP=48\r
+ 3B75:4382 0101 C=DATA   S=_DATA          G=DGROUP  M=CTYPE      ACBP=48\r
+ 3B75:4484 0000 C=DATA   S=_DATA          G=DGROUP  M=DOSDFREE   ACBP=48\r
+ 3B75:4484 0000 C=DATA   S=_DATA          G=DGROUP  M=DOSFATTR   ACBP=48\r
+ 3B75:4484 0000 C=DATA   S=_DATA          G=DGROUP  M=DOSGDATE   ACBP=48\r
+ 3B75:4484 0000 C=DATA   S=_DATA          G=DGROUP  M=DOSWRITE   ACBP=48\r
+ 3B75:4484 000C C=DATA   S=_DATA          G=DGROUP  M=EXIT       ACBP=48\r
+ 3B75:4490 0140 C=DATA   S=_DATA          G=DGROUP  M=FILES      ACBP=48\r
+ 3B75:45D0 002A C=DATA   S=_DATA          G=DGROUP  M=FILES2     ACBP=48\r
+ 3B75:45FA 0004 C=DATA   S=_DATA          G=DGROUP  M=FMODE      ACBP=48\r
+ 3B75:45FE 0002 C=DATA   S=_DATA          G=DGROUP  M=FPSTKLEN   ACBP=48\r
+ 3B75:4600 0000 C=DATA   S=_DATA          G=DGROUP  M=F_LXMUL    ACBP=48\r
+ 3B75:4600 0000 C=DATA   S=_DATA          G=DGROUP  M=F_PCMP     ACBP=48\r
+ 3B75:4600 0000 C=DATA   S=_DATA          G=DGROUP  M=F_SCOPY    ACBP=48\r
+ 3B75:4600 0000 C=DATA   S=_DATA          G=DGROUP  M=GETVECT    ACBP=48\r
+ 3B75:4600 0002 C=DATA   S=_DATA          G=DGROUP  M=HEAPLEN    ACBP=48\r
+ 3B75:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_LLSH     ACBP=48\r
+ 3B75:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_LRSH     ACBP=48\r
+ 3B75:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_LURSH    ACBP=48\r
+ 3B75:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_PADA     ACBP=48\r
+ 3B75:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_PADD     ACBP=48\r
+ 3B75:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_PSBP     ACBP=48\r
+ 3B75:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_SPUSH    ACBP=48\r
+ 3B75:4602 005B C=DATA   S=_DATA          G=DGROUP  M=IOERROR    ACBP=48\r
+ 3B75:465E 0000 C=DATA   S=_DATA          G=DGROUP  M=ISATTY     ACBP=48\r
+ 3B75:465E 0000 C=DATA   S=_DATA          G=DGROUP  M=LONGTOA    ACBP=48\r
+ 3B75:465E 0000 C=DATA   S=_DATA          G=DGROUP  M=LSEEK      ACBP=48\r
+ 3B75:465E 0009 C=DATA   S=_DATA          G=DGROUP  M=MKNAME     ACBP=48\r
+ 3B75:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=N_PCMP     ACBP=48\r
+ 3B75:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=READA      ACBP=48\r
+ 3B75:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=SCANTOL    ACBP=48\r
+ 3B75:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=SETUPIO    ACBP=48\r
+ 3B75:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=SIGDATA    ACBP=48\r
+ 3B75:4668 0002 C=DATA   S=_DATA          G=DGROUP  M=STKLEN     ACBP=48\r
+ 3B75:466A 0000 C=DATA   S=_DATA          G=DGROUP  M=TOLOWER    ACBP=48\r
+ 3B75:466A 0000 C=DATA   S=_DATA          G=DGROUP  M=TOUPPER    ACBP=48\r
+ 3B75:466A 0000 C=DATA   S=_DATA          G=DGROUP  M=UNLINK     ACBP=48\r
+ 3B75:466A 0067 C=DATA   S=_DATA          G=DGROUP  M=VPRINTER   ACBP=48\r
+ 3B75:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=VRAM       ACBP=48\r
+ 3B75:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=XCLOSE     ACBP=48\r
+ 3B75:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=_STPCPY    ACBP=48\r
+ 3B75:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=BIOSKEY    ACBP=48\r
+ 3B75:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=BRK        ACBP=48\r
+ 3B75:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=CLRSCR     ACBP=48\r
+ 3B75:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=CORELEFT   ACBP=48\r
+ 3B75:46D2 0018 C=DATA   S=_DATA          G=DGROUP  M=CRTINIT    ACBP=48\r
+ 3B75:46EA 0031 C=DATA   S=_DATA          G=DGROUP  M=CVTFAK     ACBP=48\r
+ 3B75:471C 0000 C=DATA   S=_DATA          G=DGROUP  M=FARHEAP    ACBP=48\r
+ 3B75:471C 0002 C=DATA   S=_DATA          G=DGROUP  M=FBRK       ACBP=48\r
+ 3B75:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=FCORELFT   ACBP=48\r
+ 3B75:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=GOTOXY     ACBP=48\r
+ 3B75:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=GPTEXT     ACBP=48\r
+ 3B75:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=HARD       ACBP=48\r
+ 3B75:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=HARDERR    ACBP=48\r
+ 3B75:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=IOCTL      ACBP=48\r
+ 3B75:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=MOVETEXT   ACBP=48\r
+ 3B75:471E 0006 C=DATA   S=_DATA          G=DGROUP  M=NEARHEAP   ACBP=48\r
+ 3B75:4724 0000 C=DATA   S=_DATA          G=DGROUP  M=REALCVT    ACBP=48\r
+ 3B75:4724 0000 C=DATA   S=_DATA          G=DGROUP  M=SCREEN     ACBP=48\r
+ 3B75:4724 0000 C=DATA   S=_DATA          G=DGROUP  M=SCROLL     ACBP=48\r
+ 3B75:4724 000E C=DATA   S=_DATA          G=DGROUP  M=SETARGV    ACBP=48\r
+ 3B75:4732 0000 C=DATA   S=_DATA          G=DGROUP  M=SETBLOCK   ACBP=48\r
+ 3B75:4732 0002 C=DATA   S=_DATA          G=DGROUP  M=SETENVP    ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=WHEREXY    ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=ATOL       ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=BDOS       ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=CHMODA     ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=CLOSE      ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=CLOSEA     ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=CREAT      ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FCLOSE     ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FFLUSH     ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FINDFIRS   ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FLENGTH    ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FLUSHALL   ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FOPEN      ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FPRINTF    ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FSEEK      ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=GETENV     ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=LTOA1      ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=MEMCPY     ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=MOVEDATA   ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=OPEN       ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=OPENA      ACBP=48\r
+ 3B75:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=PRINTF     ACBP=48\r
+ 3B75:4734 0001 C=DATA   S=_DATA          G=DGROUP  M=PUTC       ACBP=48\r
+ 3B75:4736 0000 C=DATA   S=_DATA          G=DGROUP  M=PUTS       ACBP=48\r
+ 3B75:4736 0000 C=DATA   S=_DATA          G=DGROUP  M=READ       ACBP=48\r
+ 3B75:4736 0000 C=DATA   S=_DATA          G=DGROUP  M=READU      ACBP=48\r
+ 3B75:4736 0004 C=DATA   S=_DATA          G=DGROUP  M=SETVBUF    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=SPRINTF    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=STRCAT     ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=STRLEN     ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=STRTOL     ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=WRITE      ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=WRITEA     ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=WRITEU     ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=XFCLOSE    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=XFFLUSH    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FMEMCMP    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FMEMCPY    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FMEMSET    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FSTRCPY    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FSTRICMP   ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FSTRLEN    ACBP=48\r
+ 3B75:473A 0000 C=DATA   S=_CVTSEG        G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3B75:473A 0002 C=DATA   S=_CVTSEG        G=DGROUP  M=REALCVT    ACBP=48\r
+ 3B75:473C 0002 C=DATA   S=_CVTSEG        G=DGROUP  M=CVTFAK     ACBP=48\r
+ 3B75:473E 0000 C=DATA   S=_CVTSEG        G=DGROUP  M=REALCVT    ACBP=48\r
+ 3B75:473E 0000 C=DATA   S=_SCNSEG        G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3B75:473E 0006 C=DATA   S=_SCNSEG        G=DGROUP  M=SCANTOD    ACBP=48\r
+ 3B75:4744 0006 C=DATA   S=_SCNSEG        G=DGROUP  M=CVTFAK     ACBP=48\r
+ 3B75:474A 0000 C=CONST  S=_CONST         G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3B75:474A 0000 C=INITDATA S=_INIT_         G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3B75:474A 0006 C=INITDATA S=_INIT_         G=DGROUP  M=FPINIT     ACBP=48\r
+ 3B75:4750 0006 C=INITDATA S=_INIT_         G=DGROUP  M=SETUPIO    ACBP=48\r
+ 3B75:4756 0006 C=INITDATA S=_INIT_         G=DGROUP  M=CRTINIT    ACBP=48\r
+ 3B75:475C 0006 C=INITDATA S=_INIT_         G=DGROUP  M=SETARGV    ACBP=48\r
+ 3B75:4762 0006 C=INITDATA S=_INIT_         G=DGROUP  M=SETENVP    ACBP=48\r
+ 3B75:4768 0000 C=INITDATA S=_INITEND_      G=DGROUP  M=C0.ASM     ACBP=28\r
+ 3B75:4768 0000 C=EXITDATA S=_EXIT_         G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3B75:4768 0006 C=EXITDATA S=_EXIT_         G=DGROUP  M=FPINIT     ACBP=48\r
+ 3B75:476E 0000 C=EXITDATA S=_EXITEND_      G=DGROUP  M=C0.ASM     ACBP=28\r
+ 3B75:476E 0000 C=BSS    S=_BSS           G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3B75:476E 0000 C=BSS    S=_BSS           G=DGROUP  M=WOLFHACK.C ACBP=48\r
+ 3B75:476E 0002 C=BSS    S=_BSS           G=DGROUP  M=WL_MAIN.C  ACBP=48\r
+ 3B75:4770 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_TEXT.C  ACBP=48\r
+ 3B75:4770 0002 C=BSS    S=_BSS           G=DGROUP  M=WL_MENU.C  ACBP=48\r
+ 3B75:4772 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_INTER.C ACBP=48\r
+ 3B75:4772 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_GAME.C  ACBP=48\r
+ 3B75:4772 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_PLAY.C  ACBP=48\r
+ 3B75:4772 000A C=BSS    S=_BSS           G=DGROUP  M=WL_DEBUG.C ACBP=48\r
+ 3B75:477C 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_DRAW.C  ACBP=48\r
+ 3B75:477C 0004 C=BSS    S=_BSS           G=DGROUP  M=WL_SCALE.C ACBP=48\r
+ 3B75:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_STATE.C ACBP=48\r
+ 3B75:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_AGENT.C ACBP=48\r
+ 3B75:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_ACT1.C  ACBP=48\r
+ 3B75:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_ACT2.C  ACBP=48\r
+ 3B75:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_CA.C    ACBP=48\r
+ 3B75:4780 0014 C=BSS    S=_BSS           G=DGROUP  M=ID_IN.C    ACBP=48\r
+ 3B75:4794 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_MM.C    ACBP=48\r
+ 3B75:4794 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_PM.C    ACBP=48\r
+ 3B75:4794 0180 C=BSS    S=_BSS           G=DGROUP  M=ID_SD.C    ACBP=48\r
+ 3B75:4914 0030 C=BSS    S=_BSS           G=DGROUP  M=ID_US_1.C  ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_VL.C    ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_VH.C    ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=ATAN       ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=LDTRUNC    ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=REALCVT    ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=SCANTOD    ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=XCVT       ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=_POW10     ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=SIN        ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=TAN        ACBP=48\r
+ 3B75:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=ATAN2      ACBP=48\r
+ 3B75:4944 0080 C=BSS    S=_BSS           G=DGROUP  M=ATEXIT     ACBP=48\r
+ 3B75:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=DOSFATTR   ACBP=48\r
+ 3B75:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=DOSWRITE   ACBP=48\r
+ 3B75:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=GETVECT    ACBP=48\r
+ 3B75:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=IOERROR    ACBP=48\r
+ 3B75:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=ISATTY     ACBP=48\r
+ 3B75:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=LONGTOA    ACBP=48\r
+ 3B75:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=LSEEK      ACBP=48\r
+ 3B75:49C4 000D C=BSS    S=_BSS           G=DGROUP  M=MKNAME     ACBP=48\r
+ 3B75:49D2 0000 C=BSS    S=_BSS           G=DGROUP  M=READA      ACBP=48\r
+ 3B75:49D2 0000 C=BSS    S=_BSS           G=DGROUP  M=SCANTOL    ACBP=48\r
+ 3B75:49D2 0000 C=BSS    S=_BSS           G=DGROUP  M=SETUPIO    ACBP=48\r
+ 3B75:49D2 0004 C=BSS    S=_BSS           G=DGROUP  M=SIGDATA    ACBP=48\r
+ 3B75:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=UNLINK     ACBP=48\r
+ 3B75:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=VPRINTER   ACBP=48\r
+ 3B75:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=VRAM       ACBP=48\r
+ 3B75:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=BIOSKEY    ACBP=48\r
+ 3B75:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=BRK        ACBP=48\r
+ 3B75:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=CORELEFT   ACBP=48\r
+ 3B75:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=CRTINIT    ACBP=48\r
+ 3B75:49D6 000C C=BSS    S=_BSS           G=DGROUP  M=HARDERR    ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=IOCTL      ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=SETBLOCK   ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=ATOL       ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=BDOS       ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=CHMODA     ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=CLOSEA     ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=CREAT      ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=FINDFIRS   ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=FLENGTH    ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=GETENV     ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=MEMCPY     ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=MOVEDATA   ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=OPEN       ACBP=48\r
+ 3B75:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=OPENA      ACBP=48\r
+ 3B75:49E2 0001 C=BSS    S=_BSS           G=DGROUP  M=PUTC       ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=READ       ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=STRCAT     ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=STRLEN     ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=WRITEA     ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FMEMCMP    ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FMEMCPY    ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FMEMSET    ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FSTRCPY    ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FSTRICMP   ACBP=48\r
+ 3B75:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FSTRLEN    ACBP=48\r
+ 3B75:49E4 A5C9 C=BSS    S=_COMDEF_       G=DGROUP  M=WOLFHACK.C ACBP=48\r
+ 3B75:EFAD 0000 C=BSSEND S=_BSSEND        G=DGROUP  M=C0.ASM     ACBP=28\r
+ 4A70:0000 0080 C=STACK  S=_STACK         G=(none)  M=C0.ASM     ACBP=74\r
+\r
+  Address         Publics by Name\r
+\r
+ 3B75:0000 idle  DATASEG@\r
+ 0000:02AF idle  DGROUP@\r
+ 1F75:2152       e086_Entry\r
+ 1F75:26E0       e086_Shortcut\r
+ 21ED:0306       e087_Entry\r
+ 21ED:03C6       e087_Shortcut\r
+ 21ED:0430       e087_Trap\r
+ 0000:FE32 idle  FIARQQ\r
+ 0000:0E32 idle  FICRQQ\r
+ 0000:5C32  Abs  FIDRQQ\r
+ 0000:1632  Abs  FIERQQ\r
+ 0000:0632 idle  FISRQQ\r
+ 0000:A23D  Abs  FIWRQQ\r
+ 0000:4000 idle  FJARQQ\r
+ 0000:C000 idle  FJCRQQ\r
+ 0000:8000 idle  FJSRQQ\r
+ 0000:1137 idle  FTOL@\r
+ 0000:1137       F_FTOL@\r
+ 0000:02B6       F_LDIV@\r
+ 0000:02DD       F_LMOD@\r
+ 0000:02D5 idle  F_LUDIV@\r
+ 0000:02E5 idle  F_LUMOD@\r
+ 0000:135D       F_LXLSH@\r
+ 0000:12E6       F_LXMUL@\r
+ 0000:137E       F_LXRSH@\r
+ 0000:139E       F_LXURSH@\r
+ 0000:13BF       F_PADA@\r
+ 0000:1447       F_PADD@\r
+ 0000:12FD       F_PCMP@\r
+ 0000:1403       F_PSBA@\r
+ 0000:14A7       F_PSBP@\r
+ 0000:1476 idle  F_PSUB@\r
+ 0000:131E       F_SCOPY@\r
+ 0000:14D2       F_SPUSH@\r
+ 0000:02B6       LDIV@\r
+ 0000:02DD idle  LMOD@\r
+ 0000:02D5 idle  LUDIV@\r
+ 0000:02E5 idle  LUMOD@\r
+ 0000:135D idle  LXLSH@\r
+ 0000:12E6 idle  LXMUL@\r
+ 0000:137E idle  LXRSH@\r
+ 0000:139E idle  LXURSH@\r
+ 0000:02B3 idle  N_LDIV@\r
+ 0000:02DA idle  N_LMOD@\r
+ 0000:02D2 idle  N_LUDIV@\r
+ 0000:02E2 idle  N_LUMOD@\r
+ 0000:135A       N_LXLSH@\r
+ 0000:137B idle  N_LXRSH@\r
+ 0000:139B idle  N_LXURSH@\r
+ 0000:13BC idle  N_PADA@\r
+ 0000:1444       N_PADD@\r
+ 0000:1694       N_PCMP@\r
+ 0000:1400 idle  N_PSBA@\r
+ 0000:14A4       N_PSBP@\r
+ 0000:1473 idle  N_PSUB@\r
+ 0000:14CC idle  N_SPUSH@\r
+ 0000:13BF idle  PADA@\r
+ 0000:1447 idle  PADD@\r
+ 0000:12FD idle  PCMP@\r
+ 0000:1403 idle  PSBA@\r
+ 0000:14A7 idle  PSBP@\r
+ 0000:1476 idle  PSUB@\r
+ 0000:131E idle  SCOPY@\r
+ 0000:14D2 idle  SPUSH@\r
+ 0000:0297       _abort\r
+ 3B75:EE0F       _abortprogram\r
+ 3B75:55B8       _actorat\r
+ 3B75:9C41       _AdLibPresent\r
+ 3B75:3293 idle  _afilename\r
+ 3B75:E8AE       _aftersort\r
+ 3B75:3289 idle  _aheadname\r
+ 3B75:EAB0       _alBlock\r
+ 3B75:EAAC       _alLengthLeft\r
+ 3B75:EAB6       _alNoCheck\r
+ 1B44:0D39       _alOut\r
+ 3B75:EAB2       _alSound\r
+ 3B75:EAA8       _alTimeCount\r
+ 3B75:EA98       _alZeroInst\r
+ 3B75:D9C4       _angle\r
+ 3B75:A4E0       _anglefrac\r
+ 3B75:52DA       _areabyplayer\r
+ 3516:0000       _areaconnect\r
+ 1079:0070       _AsmRefresh\r
+ 0000:05E9       _atan\r
+ 0000:107C       _atan2\r
+ 0000:1163 idle  _atexit\r
+ 0000:3285 idle  _atoi\r
+ 0000:3215       _atol\r
+ 3B75:192C idle  _attackinfo\r
+ 3B75:E01B       _audiohandle\r
+ 3B75:E021       _audiohuffman\r
+ 3B75:324A       _audioname\r
+ 3B75:A052       _audiosegs\r
+ 3B75:E819       _audiostarts\r
+ 14D6:0761       _A_DeathScream\r
+ 14D6:12D4 idle  _A_HitlerMorph\r
+ 14D6:1366 idle  _A_MechaSound\r
+ 14D6:1398 idle  _A_Slurpie\r
+ 14D6:000D idle  _A_Smoke\r
+ 14D6:2092 idle  _A_StartDeathCam\r
+ 3B75:9954       _backcolor\r
+ 062D:0690 idle  _BackPage\r
+ 10BF:000E idle  _BadScale\r
+ 3B75:4C52       _basedist\r
+ 0000:3292       _bdos\r
+ 3B75:E8B2       _beforesort\r
+ 0000:1F4C       _bioskey\r
+ 0B05:060A idle  _BJ_Breathe\r
+ 3B75:9955       _blockstarts\r
+ 3B75:E894       _bombonerror\r
+ 3B75:A41A       _bonuscount\r
+ 3B75:EE13       _bordercolor\r
+ 06CD:02A6 idle  _BossKey\r
+ 0000:1FC4 idle  _brk\r
+ 3B75:E826       _btnstate\r
+ 3B75:EFA9       _bufferheight\r
+ 3B75:52D2       _bufferofs\r
+ 3B75:E824       _bufferseg\r
+ 3B75:EFAB       _bufferwidth\r
+ 10BF:01E4 idle  _BuildCompScale\r
+ 0491:0D31 idle  _BuildTables\r
+ 3B75:EE0D       _Button0\r
+ 3B75:EE0B       _Button1\r
+ 3B75:A4FC       _buttonheld\r
+ 3B75:1290       _buttonjoy\r
+ 3B75:1288       _buttonmouse\r
+ 3B75:1278       _buttonscan\r
+ 3B75:A4E8       _buttonstate\r
+ 062D:06BA idle  _CacheLayoutGraphics\r
+ 06CD:3212       _CacheLump\r
+ 0F7A:02FE idle  _CalcHeight\r
+ 0491:0E89 idle  _CalcProjection\r
+ 0F7A:0A9A idle  _CalcRotate\r
+ 0F7A:0DCB       _CalcTics\r
+ 06CD:171A idle  _CalibrateJoystick\r
+ 1710:0498 idle  _CAL_CarmackExpand\r
+ 1710:0E6E idle  _CAL_ExpandGrChunk\r
+ 1710:0090 idle  _CAL_GetGrChunkLength\r
+ 1710:032B idle  _CAL_HuffExpand\r
+ 1710:02D3 idle  _CAL_OptimizeNodes\r
+ 1710:0BBC idle  _CAL_SetupAudioFile\r
+ 1710:07BF idle  _CAL_SetupGrFile\r
+ 1710:09F4 idle  _CAL_SetupMapFile\r
+ 1710:0D3A       _CA_CacheAudioChunk\r
+ 1710:0F45       _CA_CacheGrChunk\r
+ 1710:1181       _CA_CacheMap\r
+ 1710:13F0       _CA_CacheMarks\r
+ 1710:108C       _CA_CacheScreen\r
+ 1710:16FC idle  _CA_CannotOpen\r
+ 1710:136E idle  _CA_ClearAllMarks\r
+ 1710:134D idle  _CA_ClearMarks\r
+ 1710:007F idle  _CA_CloseDebug\r
+ 1710:1326       _CA_DownLevel\r
+ 1710:00F0       _CA_FarRead\r
+ 1710:013C       _CA_FarWrite\r
+ 3B75:9EE7       _ca_levelbit\r
+ 3B75:E821       _ca_levelnum\r
+ 1710:0DE9       _CA_LoadAllSounds\r
+ 1710:0252 idle  _CA_LoadFile\r
+ 1710:005B idle  _CA_OpenDebug\r
+ 1710:0188 idle  _CA_ReadFile\r
+ 1710:05B6 idle  _CA_RLEWCompress\r
+ 1710:0703 idle  _CA_RLEWexpand\r
+ 1710:13C2       _CA_SetAllPurge\r
+ 1710:1394 idle  _CA_SetGrPurge\r
+ 1710:0D11       _CA_Shutdown\r
+ 1710:0CF0       _CA_Startup\r
+ 1710:12E1       _CA_UpLevel\r
+ 1710:01FA       _CA_WriteFile\r
+ 0DA6:060B       _CenterWindow\r
+ 3B75:9894       _centerx\r
+ 06CD:41C8       _CheckForEpisodes\r
+ 0B05:13BD       _CheckHighScore\r
+ 0490:0006       _CheckIs386\r
+ 0DA6:0639 idle  _CheckKeys\r
+ 114B:10B4       _CheckLine\r
+ 06CD:4104 idle  _CheckPause\r
+ 14D6:1FF3 idle  _CheckPosition\r
+ 114B:1365 idle  _CheckSight\r
+ 12D6:0000 idle  _CheckWeaponChange\r
+ 3B75:E017       _chunkcomplen\r
+ 3B75:E013       _chunkexplen\r
+ 3B75:D864       _ChunksInFile\r
+ 06CD:3431 idle  _CleanupControlPanel\r
+ 0C63:017F       _ClearMemory\r
+ 06CD:31F5       _ClearMScreen\r
+ 0DA6:0D2C idle  _ClearPaletteShifts\r
+ 0B05:000E       _ClearSplitVWB\r
+ 12D6:09BD idle  _ClipMove\r
+ 0000:32BD       _close\r
+ 1402:037E idle  _CloseDoor\r
+ 0000:1FE0       _clrscr\r
+ 12D6:0BDC idle  _Cmd_Fire\r
+ 12D6:0C2E idle  _Cmd_Use\r
+ 3B75:0418 idle  _color_hlite\r
+ 3B75:0420 idle  _color_norml\r
+ 3B75:D844       _compatability\r
+ 3B75:00EE       _configname\r
+ 06CD:3DA8 idle  _Confirm\r
+ 1402:01C4 idle  _ConnectAreas\r
+ 12D6:0034 idle  _ControlMovement\r
+ 3B75:E842       _Controls\r
+ 3B75:A4FA       _controlx\r
+ 3B75:A4F8       _controly\r
+ 0000:2009       _coreleft\r
+ 3B75:1694       _costable\r
+ 0EC1:00C9 idle  _CountObjects\r
+ 06CD:2D24 idle  _CP_ChangeView\r
+ 06CD:02F3 idle  _CP_CheckQuick\r
+ 06CD:1977 idle  _CP_Control\r
+ 06CD:0865 idle  _CP_EndGame\r
+ 06CD:1091 idle  _CP_LoadGame\r
+ 06CD:092F idle  _CP_NewGame\r
+ 06CD:2F41 idle  _CP_Quit\r
+ 06CD:13B7 idle  _CP_SaveGame\r
+ 06CD:0C24 idle  _CP_Sound\r
+ 06CD:08C1       _CP_ViewScores\r
+ 0000:331C       _creat\r
+ 3B75:03F0 idle  _CtlItems\r
+ 24F0:0000 idle  _CtlMenu\r
+ 3B75:EE09       _CursorBad\r
+ 3B75:EE07       _CursorX\r
+ 3B75:EE05       _CursorY\r
+ 3B75:03FA idle  _CusItems\r
+ 2543:0000 idle  _CusMenu\r
+ 06CD:2002 idle  _CustomControls\r
+ 114B:0FB1       _DamageActor\r
+ 3B75:A41C       _damagecount\r
+ 3B75:E81D       _debughandle\r
+ 0EC1:07BB       _DebugKeys\r
+ 0EC1:0004 idle  _DebugMemory\r
+ 3B75:A4DC       _DebugOk\r
+ 06CD:20F8 idle  _DefineJoyBtns\r
+ 06CD:213E idle  _DefineKeyBtns\r
+ 06CD:2184 idle  _DefineKeyMove\r
+ 06CD:20B3 idle  _DefineMouseBtns\r
+ 3B75:E840       _DemoBuffer\r
+ 3B75:A2AA       _demobuffer\r
+ 0491:1770 idle  _DemoLoop\r
+ 3B75:335E idle  _DemoMode\r
+ 3B75:1204       _demoname\r
+ 3B75:E83E       _DemoOffset\r
+ 3B75:A2B4       _demoplayback\r
+ 3B75:A2B0       _demoptr\r
+ 3B75:A2B6       _demorecord\r
+ 3B75:E83C       _DemoSize\r
+ 3B75:181E idle  _diagonal\r
+ 0C63:0FEF idle  _Died\r
+ 3B75:ECD3       _DigiLastEnd\r
+ 3B75:ECD5       _DigiLastStart\r
+ 3B75:ECD9       _DigiLeft\r
+ 3B75:D848       _DigiList\r
+ 3B75:9B89       _DigiMap\r
+ 3B75:9C39       _DigiMode\r
+ 3B75:ECED       _DigiNumber\r
+ 3B75:ECD7       _DigiPage\r
+ 3B75:ED05       _DigiPlaying\r
+ 3B75:ECE9       _DigiPriority\r
+ 3B75:00DC       _dirangle\r
+ 3B75:46E1       _directvideo\r
+ 3B75:1270       _dirscan\r
+ 3B75:1B38 idle  _dirtable\r
+ 0491:041B idle  _DiskFlopAnim\r
+ 3B75:9D4C       _displayofs\r
+ 0DA6:0E7E idle  _DoActor\r
+ 0491:044A idle  _DoChecksum\r
+ 0491:11A6 idle  _DoJukebox\r
+ 1402:07E6 idle  _DoorClosing\r
+ 3B75:D85A       _doornum\r
+ 3B75:86B8       _doorobjlist\r
+ 1402:0656 idle  _DoorOpen\r
+ 1402:0684 idle  _DoorOpening\r
+ 3B75:5326       _doorposition\r
+ 0C63:0A23       _DrawAllPlayBorder\r
+ 0C63:09F1       _DrawAllPlayBorderSides\r
+ 12D6:0542       _DrawAmmo\r
+ 06CD:2EB3 idle  _DrawChangeView\r
+ 06CD:1E13 idle  _DrawCtlScreen\r
+ 06CD:2BF6 idle  _DrawCustJoy\r
+ 06CD:2C8A idle  _DrawCustKeybd\r
+ 06CD:2CF2 idle  _DrawCustKeys\r
+ 06CD:2B4F idle  _DrawCustMouse\r
+ 06CD:27F7 idle  _DrawCustomScreen\r
+ 12D6:01FE       _DrawFace\r
+ 06CD:3A15 idle  _DrawGun\r
+ 06CD:39D1 idle  _DrawHalfStep\r
+ 12D6:033E       _DrawHealth\r
+ 0B05:11C2       _DrawHighScores\r
+ 12D6:04B2       _DrawKeys\r
+ 12D6:03DD       _DrawLevel\r
+ 12D6:03FC       _DrawLives\r
+ 06CD:125D idle  _DrawLoadSaveScreen\r
+ 06CD:0FFA idle  _DrawLSAction\r
+ 06CD:01E9 idle  _DrawMainMenu\r
+ 06CD:3B11       _DrawMenu\r
+ 06CD:4146 idle  _DrawMenuGun\r
+ 06CD:1A92 idle  _DrawMouseSens\r
+ 06CD:0AA0 idle  _DrawNewEpisode\r
+ 06CD:0B66 idle  _DrawNewGame\r
+ 06CD:0C08 idle  _DrawNewGameDiff\r
+ 06CD:32AA idle  _DrawOutline\r
+ 044F:027F idle  _DrawPlanes\r
+ 0C63:0A56       _DrawPlayBorder\r
+ 0C63:095C idle  _DrawPlayBorderSides\r
+ 0F7A:0D2B idle  _DrawPlayerWeapon\r
+ 0C63:0B2E       _DrawPlayScreen\r
+ 0F7A:0B17 idle  _DrawScaleds\r
+ 12D6:043A       _DrawScore\r
+ 06CD:0DD5 idle  _DrawSoundMenu\r
+ 044F:0032 idle  _DrawSpans\r
+ 06CD:417D       _DrawStripes\r
+ 12D6:0497       _DrawWeapon\r
+ 06CD:3270       _DrawWindow\r
+ 114B:0C16 idle  _DropItem\r
+ 3B75:A420       _dummyobj\r
+ 3B75:0E74 idle  _ElevatorBackTo\r
+ 3B75:352A idle  _EMMDriverName\r
+ 3B75:E8F0       _EMSAvail\r
+ 3B75:E8EE       _EMSHandle\r
+ 3B75:E8D2       _EMSList\r
+ 3B75:E8EC       _EMSPageFrame\r
+ 3B75:A292       _EMSPagesAvail\r
+ 3B75:E8C0       _EMSPagesUsed\r
+ 3B75:E8EA       _EMSPhysicalPage\r
+ 3B75:A296       _EMSPresent\r
+ 3B75:0330 idle  _endextern\r
+ 3B75:0341       _endfilename\r
+ 248B:0000 idle  _endStrings\r
+ 062D:0957       _EndText\r
+ 06CD:21CA idle  _EnterCtrlData\r
+ 3B75:4732       _environ\r
+ 3B75:0428 idle  _EpisodeSelect\r
+ 06CD:3953 idle  _EraseGun\r
+ 3B75:00C3       _errno\r
+ 0000:12AB       _exit\r
+ 3B75:A04D       _extension\r
+ 3B75:A50C       _extravbls\r
+ 3B75:A4DE       _facecount\r
+ 0000:273A       _farcoreleft\r
+ 0000:2319       _farfree\r
+ 3B75:E8A8       _farheap\r
+ 0000:2423       _farmalloc\r
+ 3B75:8638       _farmapylookup\r
+ 0000:2580 idle  _farrealloc\r
+ 0F7A:040E       _FarScalePost\r
+ 3B75:D866       _farthest\r
+ 3B75:EE11       _fastpalette\r
+ 0000:338E       _fclose\r
+ 0000:340F       _fflush\r
+ 0000:34F0       _filelength\r
+ 0000:3490       _findfirst\r
+ 0000:34C3       _findnext\r
+ 35DD:0000       _finetangent\r
+ 0C63:0C31 idle  _FinishDemoRecord\r
+ 0DA6:0E50       _FinishPaletteShifts\r
+ 0491:1076 idle  _FinishSignon\r
+ 114B:1471 idle  _FirstSighting\r
+ 0F7A:000C       _FixedByFrac\r
+ 044F:000A idle  _FixedMul\r
+ 0F7A:0E2E       _FixOfs\r
+ 06CD:2647 idle  _FixupCustom\r
+ 1E99:07DA       _FizzleFade\r
+ 3B75:A2C6       _fizzlein\r
+ 0000:3531       _flushall\r
+ 3B75:9898       _focallength\r
+ 3B75:D9CE       _focaltx\r
+ 3B75:D9CC       _focalty\r
+ 3B75:9D4B       _fontcolor\r
+ 3B75:9D49       _fontnumber\r
+ 0000:36EC       _fopen\r
+ 0000:370B       _fprintf\r
+ 0000:3BB4       _fputc\r
+ 0000:3CEA idle  _fputchar\r
+ 3B75:A4E4       _frameon\r
+ 0000:2A93       _free\r
+ 3B75:168A       _freelatch\r
+ 06CD:4099       _FreeMusic\r
+ 0000:377E       _fseek\r
+ 0000:37E6 idle  _ftell\r
+ 3B75:D9DA       _fullscalefarcall\r
+ 3B75:A414       _funnyticount\r
+ 0C63:1229       _GameLoop\r
+ 3B75:2F4A       _gamepal\r
+ 3B75:ED09       _Games\r
+ 3B75:95C0       _gamestate\r
+ 3B75:326B idle  _gdictname\r
+ 12D6:05AA       _GetBonus\r
+ 0000:38AD       _getenv\r
+ 0DA6:0A52       _GetNewActor\r
+ 0000:27D3       _gettext\r
+ 0000:133A       _getvect\r
+ 3B75:3261 idle  _gfilename\r
+ 3B75:3257 idle  _gheadname\r
+ 12D6:0560 idle  _GiveAmmo\r
+ 12D6:041A idle  _GiveExtraMan\r
+ 12D6:0595 idle  _GiveKey\r
+ 12D6:045A       _GivePoints\r
+ 12D6:0517       _GiveWeapon\r
+ 3B75:A2A6       _globalsoundx\r
+ 3B75:A2A2       _globalsoundy\r
+ 3B75:A510       _godmode\r
+ 3B75:E009       _gotgatgun\r
+ 0000:278A       _gotoxy\r
+ 1710:000B idle  _GRFILEPOS\r
+ 3B75:E01F       _grhandle\r
+ 3B75:E41D       _grhuffman\r
+ 36BE:0000       _grneeded\r
+ 3B75:9D4E       _grsegs\r
+ 3B75:E81B       _grstarts\r
+ 12D6:0EC0 idle  _GunAttack\r
+ 3B75:ECFF       _HackCount\r
+ 3B75:00DA idle  _halfheight\r
+ 062D:00FB idle  _HandleCommand\r
+ 062D:03BD idle  _HandleCtrls\r
+ 06CD:344B       _HandleMenu\r
+ 062D:03DF idle  _HandleWord\r
+ 0000:287B       _harderr\r
+ 0000:288D idle  _hardresume\r
+ 0000:289B idle  _hardretn\r
+ 12D6:03B6       _HealSelf\r
+ 3B75:9604       _heightnumerator\r
+ 3B75:0332 idle  _helpextern\r
+ 3B75:0334 idle  _helpfilename\r
+ 062D:08C9 idle  _HelpScreens\r
+ 0F7A:0659       _HitHorizDoor\r
+ 0F7A:086A       _HitHorizPWall\r
+ 0F7A:0536       _HitHorizWall\r
+ 0F7A:0760       _HitVertDoor\r
+ 0F7A:094B       _HitVertPWall\r
+ 0F7A:0416       _HitVertWall\r
+ 3B75:5428       _horizwall\r
+ 3B75:A048       _ingame\r
+ 0DA6:0A0B       _InitActorList\r
+ 1402:01FD       _InitAreas\r
+ 0491:1185 idle  _InitDigiMap\r
+ 1402:0225       _InitDoorList\r
+ 0491:13C2 idle  _InitGame\r
+ 0DA6:0BBA       _InitRedShifts\r
+ 1402:000C       _InitStaticList\r
+ 1885:01EC       _INL_GetJoyDelta\r
+ 3B75:DDF5       _insetupscaling\r
+ 06CD:2FD3       _IntroScreen\r
+ 1885:0B0E       _IN_Ack\r
+ 1885:0AB4       _IN_CheckAck\r
+ 1885:06D7       _IN_ClearKeysDown\r
+ 1885:0659 idle  _IN_Default\r
+ 1885:0151       _IN_GetJoyAbs\r
+ 1885:035A idle  _IN_GetJoyButtonsDB\r
+ 06CD:40BC idle  _IN_GetScanName\r
+ 1885:0B7B       _IN_JoyButtons\r
+ 1885:0B64       _IN_MouseButtons\r
+ 1885:06F6       _IN_ReadControl\r
+ 1885:0A18 idle  _IN_SetControlType\r
+ 1885:06C5 idle  _IN_SetKeyHook\r
+ 1885:04CB       _IN_SetupJoy\r
+ 1885:0699       _IN_Shutdown\r
+ 1885:0A64       _IN_StartAck\r
+ 1885:05B8       _IN_Startup\r
+ 1885:0B1F       _IN_UserInput\r
+ 1885:0A47       _IN_WaitForASCII\r
+ 1885:0A29 idle  _IN_WaitForKey\r
+ 0000:29CF       _ioctl\r
+ 3B75:989C       _IsA386\r
+ 0000:153E       _isatty\r
+ 0000:390C       _itoa\r
+ 0490:000A       _jabhack2\r
+ 3B75:00FC idle  _JHParmStrings\r
+ 3B75:E84A       _JoyDefs\r
+ 3B75:54AE       _joypadenabled\r
+ 3B75:E83A       _JoyPadPresent\r
+ 3B75:9C43       _JoysPresent\r
+ 3B75:54B0       _joystickenabled\r
+ 3B75:54AA       _joystickport\r
+ 3B75:54AC       _joystickprogressive\r
+ 3B75:3354 idle  _KbdDefs\r
+ 3B75:9C49       _Keyboard\r
+ 114B:0CB1 idle  _KillActor\r
+ 3B75:A2B8       _killerobj\r
+ 12D6:0E27 idle  _KnifeAttack\r
+ 3B75:A04A       _LastASCII\r
+ 3B75:E007       _LastAttacker\r
+ 3B75:A2AC       _lastdemoptr\r
+ 3B75:E00F       _lastdoorobj\r
+ 3B75:D9D2       _lastintercept\r
+ 3B75:B516       _lastobj\r
+ 3B75:9EE0       _LastScan\r
+ 3B75:D9D6       _lastside\r
+ 3B75:8938       _laststatobj\r
+ 3B75:D9D0       _lasttilehit\r
+ 3B75:9EEA       _lasttimecount\r
+ 1E99:065C       _LatchDrawPic\r
+ 12D6:02AF idle  _LatchNumber\r
+ 3B75:A2D0       _latchpics\r
+ 3B75:9E8C       _layoutdone\r
+ 3B75:A2A0       _leftchannel\r
+ 3B75:9EBA       _leftmargin\r
+ 3B75:3FCE idle  _leftmasks\r
+ 3B75:ECE7       _LeftPosition\r
+ 3B75:1042 idle  _lefttable\r
+ 0B05:066B       _LevelCompleted\r
+ 3B75:9904       _LevelRatios\r
+ 3B75:DDE9       _linecmds\r
+ 3B75:DDE5       _linescale\r
+ 3B75:EFA5       _linewidth\r
+ 3B75:9B83       _loadedgame\r
+ 1E99:06B9       _LoadLatchMem\r
+ 0491:08D5       _LoadTheGame\r
+ 3B75:ECDD       _LocalTime\r
+ 0000:15E9       _lseek\r
+ 3B75:03E6 idle  _LSItems\r
+ 2528:0000 idle  _LSMenu\r
+ 0000:394E       _ltoa\r
+ 3B75:D842       _madenoise\r
+ 0491:19AD       _main\r
+ 3B75:03D2       _MainItems\r
+ 3B75:E9BC       _MainMemPages\r
+ 3B75:E8F4       _MainMemUsed\r
+ 24B8:0000       _MainMenu\r
+ 3B75:E8F2       _MainPagesAvail\r
+ 3B75:E8BE       _MainPagesUsed\r
+ 3B75:EA84       _MainPresent\r
+ 0000:2B62       _malloc\r
+ 3B75:E01D       _maphandle\r
+ 3B75:A398       _mapheaderseg\r
+ 3B75:A2CA       _mapheight\r
+ 3B75:171A       _mapmasks1\r
+ 3B75:173A       _mapmasks2\r
+ 3B75:175A       _mapmasks3\r
+ 3B75:A29C       _mapon\r
+ 3B75:D850       _maporgx\r
+ 3B75:D84E       _maporgy\r
+ 0489:000A       _MapRow\r
+ 3B75:A410       _mapsegs\r
+ 3B75:A2CC       _mapwidth\r
+ 3B75:A45C       _mapwidthtable\r
+ 3B75:DDE2       _mask1\r
+ 3B75:DDE1       _mask2\r
+ 3B75:DDE0       _mask3\r
+ 3B75:DDE3       _maskword\r
+ 0000:0F29       _matherr\r
+ 3B75:DDF7       _maxscale\r
+ 3B75:D9D8       _maxscaleshl2\r
+ 3B75:9608       _maxslope\r
+ 3B75:05F2 idle  _mbarray\r
+ 0000:3973       _memcpy\r
+ 06CD:3ED3       _Message\r
+ 3B75:327F idle  _mfilename\r
+ 3B75:3275 idle  _mheadname\r
+ 3B75:D9C6       _midangle\r
+ 3B75:1690 idle  _mindist\r
+ 3B75:9602       _minheightdiv\r
+ 3B75:49FA       _mirrorofs\r
+ 3908:0000       _mmblocks\r
+ 3B75:A29A       _mmerror\r
+ 3B75:E89E       _mmfree\r
+ 3B75:E8A2       _mmhead\r
+ 3B75:9E78       _mminfo\r
+ 193E:0001 idle  _MML_CheckForXMS\r
+ 193E:0242 idle  _MML_ClearBlock\r
+ 193E:001C idle  _MML_SetupXMS\r
+ 193E:008B idle  _MML_ShutdownXMS\r
+ 193E:00BC       _MML_UseSpace\r
+ 3B75:E896       _mmnew\r
+ 3B75:E89A       _mmrover\r
+ 3B75:E8AC       _mmstarted\r
+ 193E:0E7D       _MM_BombOnError\r
+ 193E:0C67 idle  _MM_DumpData\r
+ 193E:0780       _MM_FreePtr\r
+ 193E:04C3       _MM_GetPtr\r
+ 193E:08C8       _MM_SetLock\r
+ 193E:0847       _MM_SetPurge\r
+ 193E:0B0A idle  _MM_ShowMemory\r
+ 193E:049B       _MM_Shutdown\r
+ 193E:094E       _MM_SortMem\r
+ 193E:02A8       _MM_Startup\r
+ 193E:0DFF       _MM_TotalFree\r
+ 193E:0D98       _MM_UnusedMemory\r
+ 3B75:988C       _mouseadjustment\r
+ 3B75:E836       _MouseDownCount\r
+ 3B75:54B2       _mouseenabled\r
+ 3B75:9C47       _MousePresent\r
+ 06CD:1BD1 idle  _MouseSensitivity\r
+ 0000:3992       _movedata\r
+ 1402:0922       _MoveDoors\r
+ 114B:09CE       _MoveObj\r
+ 3B75:0622 idle  _moveorder\r
+ 1402:0B29       _MovePWalls\r
+ 0000:29F6       _movetext\r
+ 3B75:49EE       _mr_count\r
+ 3B75:49E4       _mr_dest\r
+ 3B75:49F0       _mr_rowofs\r
+ 3B75:49E8       _mr_xfrac\r
+ 3B75:49EC       _mr_xstep\r
+ 3B75:49E6       _mr_yfrac\r
+ 3B75:49EA       _mr_ystep\r
+ 0491:111B       _MS_CheckParm\r
+ 3B75:01C4 idle  _MusicItems\r
+ 245B:0000 idle  _MusicMenu\r
+ 3B75:9C37       _MusicMode\r
+ 3B75:E8A6       _nearheap\r
+ 3B75:85B8       _nearmapylookup\r
+ 3B75:ED01       _NeedsDigitized\r
+ 3B75:ED07       _NeedsMusic\r
+ 3B75:95BC       _new\r
+ 3B75:0404 idle  _NewEitems\r
+ 2500:0000 idle  _NewEmenu\r
+ 0491:03CA       _NewGame\r
+ 3B75:040E idle  _NewItems\r
+ 062D:0362 idle  _NewLine\r
+ 251D:0000 idle  _NewMenu\r
+ 114B:00B0       _NewState\r
+ 0491:1642       _NewViewSize\r
+ 3B75:ECF9       _nextsoundpos\r
+ 3B75:A50E       _noclip\r
+ 0B05:1513 idle  _NonShareware\r
+ 3B75:989E       _nospr\r
+ 3B75:01FC idle  _nosprtxt\r
+ 3B75:9B81       _NoWait\r
+ 3B75:D84A       _NumDigi\r
+ 3B75:9ED8       _numpages\r
+ 3B75:E88E       _numUMBs\r
+ 3B75:B518       _obj\r
+ 3B75:A41E       _objcount\r
+ 3B75:B514       _objfreelist\r
+ 3B75:B51A       _objlist\r
+ 3B75:E011       _oldsoundmode\r
+ 0000:39DF       _open\r
+ 1402:0355       _OpenDoor\r
+ 1402:05E1       _OperateDoor\r
+ 3B75:180C idle  _opposite\r
+ 3B75:05FE idle  _order\r
+ 3B75:3520 idle  _PageFile\r
+ 3B75:3512       _PageFileName\r
+ 062D:0490 idle  _PageLayout\r
+ 3B75:9EDA       _pagenum\r
+ 3B45:0000       _palette1\r
+ 3B15:0000       _palette2\r
+ 3B75:A418       _palshifted\r
+ 062D:0021 idle  _ParseNumber\r
+ 062D:0075 idle  _ParsePicCommand\r
+ 062D:0093 idle  _ParseTimedCommand\r
+ 0491:036B idle  _Patch386\r
+ 3B75:A04B       _Paused\r
+ 3B75:ECBE       _pcLastSample\r
+ 3B75:ECB6       _pcLengthLeft\r
+ 3B75:49F2       _pcos\r
+ 3B75:ECBA       _pcSound\r
+ 3B75:EAB8       _pcSoundLookup\r
+ 3B75:EFA7       _pelpan\r
+ 0B05:0448       _PG13\r
+ 3B75:9E8E       _picdelay\r
+ 3B75:9EE8       _pickquick\r
+ 3B75:9E90       _picnum\r
+ 3B75:9EE5       _pictable\r
+ 0EC1:01C5       _PicturePause\r
+ 3B75:9E94       _picx\r
+ 3B75:9E92       _picy\r
+ 3B75:960C       _pixelangle\r
+ 3B75:3FCA idle  _pixmasks\r
+ 3B75:D9B0       _pixx\r
+ 1402:00E6       _PlaceItemType\r
+ 224A:0000       _planepics\r
+ 3B75:4AC2       _planeylookup\r
+ 0C63:0E72       _PlayDemo\r
+ 3B75:95BA       _player\r
+ 3B75:E003       _playerxmove\r
+ 3B75:DFFF       _playerymove\r
+ 0DA6:101B       _PlayLoop\r
+ 0C63:00FB       _PlaySoundLocGlobal\r
+ 3B75:95BE       _playstate\r
+ 3B75:DFFD       _plux\r
+ 3B75:DFFB       _pluy\r
+ 3B75:E8B8       _PMFrameCount\r
+ 1A26:06F7 idle  _PML_ClosePageFile\r
+ 1A26:0AFB idle  _PML_GetAPageBuffer\r
+ 1A26:0731 idle  _PML_GetEMSAddress\r
+ 1A26:0C08 idle  _PML_GetPageFromXMS\r
+ 1A26:0866 idle  _PML_GiveLRUPage\r
+ 1A26:0907 idle  _PML_GiveLRUXMSPage\r
+ 1A26:0C8C idle  _PML_LoadPage\r
+ 1A26:0008 idle  _PML_MapEMS\r
+ 1A26:0510 idle  _PML_OpenPageFile\r
+ 1A26:0979 idle  _PML_PutPageInXMS\r
+ 1A26:0490 idle  _PML_ReadFromFile\r
+ 1A26:0160 idle  _PML_ShutdownEMS\r
+ 1A26:0469 idle  _PML_ShutdownMainMem\r
+ 1A26:02A4 idle  _PML_ShutdownXMS\r
+ 1A26:002B idle  _PML_StartupEMS\r
+ 1A26:03EC idle  _PML_StartupMainMem\r
+ 1A26:0184 idle  _PML_StartupXMS\r
+ 1A26:0A28 idle  _PML_TransferPageSpace\r
+ 1A26:01F7 idle  _PML_XMSCopy\r
+ 3B75:E8BC       _PMNumBlocks\r
+ 3B75:D85C       _PMPages\r
+ 3B75:E8C6       _PMPanicMode\r
+ 3B75:E8B6       _PMSegPages\r
+ 3B75:D860       _PMSoundStart\r
+ 3B75:D862       _PMSpriteStart\r
+ 3B75:E8C8       _PMStarted\r
+ 3B75:E8C4       _PMThrashing\r
+ 1A26:02F3       _PM_CheckMainMem\r
+ 1A26:0CDE       _PM_GetPage\r
+ 1A26:080D       _PM_GetPageAddress\r
+ 1A26:1036       _PM_NextFrame\r
+ 1A26:0DD0       _PM_Preload\r
+ 1A26:10B0 idle  _PM_Reset\r
+ 1A26:02CA       _PM_SetMainMemPurge\r
+ 1A26:0DA0       _PM_SetPageLock\r
+ 1A26:11CF       _PM_Shutdown\r
+ 1A26:111E       _PM_Startup\r
+ 0DA6:03D3 idle  _PollControls\r
+ 0DA6:0078 idle  _PollJoystickButtons\r
+ 0DA6:0253 idle  _PollJoystickMove\r
+ 0DA6:000D idle  _PollKeyboardButtons\r
+ 0DA6:0109 idle  _PollKeyboardMove\r
+ 0DA6:0034 idle  _PollMouseButtons\r
+ 0DA6:0215 idle  _PollMouseMove\r
+ 3B75:D856       _postsource\r
+ 3B75:D852       _postwidth\r
+ 3B75:D854       _postx\r
+ 0000:0F1E       _pow10\r
+ 0B05:110F       _PreloadGraphics\r
+ 0B05:106E idle  _PreloadUpdate\r
+ 06CD:2BAC idle  _PrintCustJoy\r
+ 06CD:2C53 idle  _PrintCustKeybd\r
+ 06CD:2CBC idle  _PrintCustKeys\r
+ 06CD:2B05 idle  _PrintCustMouse\r
+ 0000:3B84       _printf\r
+ 06CD:1327 idle  _PrintLSEntry\r
+ 3B75:A046       _PrintX\r
+ 3B75:9B7F       _PrintY\r
+ 3B75:E81F       _profilehandle\r
+ 14D6:005B idle  _ProjectileTryMove\r
+ 3B75:49F6       _psin\r
+ 1402:0975       _PushWall\r
+ 0000:3EA4       _puts\r
+ 0000:2827       _puttext\r
+ 3B75:52D4       _pwalldir\r
+ 3B75:53A6       _pwallpos\r
+ 3B75:5324       _pwallstate\r
+ 3B75:52D8       _pwallx\r
+ 3B75:52D6       _pwally\r
+ 3B75:9EE3       _px\r
+ 3B75:9EE1       _py\r
+ 0491:168A       _Quit\r
+ 3B75:0102 idle  _radtoint\r
+ 0000:3FBD       _read\r
+ 06CD:3C46 idle  _ReadAnyControl\r
+ 0491:000D idle  _ReadConfig\r
+ 0000:2CBB idle  _realloc\r
+ 0C63:0D16       _RecordDemo\r
+ 1402:0176 idle  _RecursiveConnect\r
+ 37E8:0000       _redshifts\r
+ 0DA6:0AB4 idle  _RemoveObj\r
+ 3B75:A29E       _rightchannel\r
+ 3B75:9E9C       _rightmargin\r
+ 3B75:3FD2 idle  _rightmasks\r
+ 3B75:ECE5       _RightPosition\r
+ 3B75:0E80 idle  _righttable\r
+ 062D:000E idle  _RipToEOL\r
+ 244A:0002 idle  _rndtable\r
+ 3B75:9E96       _rowon\r
+ 3B75:A4E2       _running\r
+ 3B75:9EEE       _SaveGameNames\r
+ 3B75:A030       _SaveGamesAvail\r
+ 3B75:0436 idle  _SaveName\r
+ 0491:0497       _SaveTheGame\r
+ 3B75:ED03       _SBProPresent\r
+ 0000:1FD0 idle  _sbrk\r
+ 3B75:52CA       _scale\r
+ 3B75:DDF9       _scaledirectory\r
+ 10BF:0339 idle  _ScaleLine\r
+ 0F7A:0397 idle  _ScalePost\r
+ 10BF:0487       _ScaleShape\r
+ 0C63:019A idle  _ScanInfoPlane\r
+ 3B75:3D1A       _Scores\r
+ 3B75:D846       _screenfaded\r
+ 3B75:1684       _screenloc\r
+ 3B75:9896       _screenofs\r
+ 3B75:3FC4       _screenseg\r
+ 1B44:0B88       _SDL_DigitizedDone\r
+ 1CD6:0012       _SDL_IndicatePC\r
+ 1B44:08CF idle  _SDL_LoadDigiSegment\r
+ 1B44:0904 idle  _SDL_PlayDigiSegment\r
+ 1B44:0511 idle  _SDL_SBSetDMA\r
+ 1CD6:000A       _SDL_SetDS\r
+ 1B44:0C56 idle  _SDL_SetupDigi\r
+ 1CD6:001E       _SDL_t0ExtremeAsmService\r
+ 1CD6:00B8       _SDL_t0FastAsmService\r
+ 1CD6:031A       _SDL_t0SlowAsmService\r
+ 1B44:1525 idle  _SD_Default\r
+ 1B44:18FE idle  _SD_FadeOutMusic\r
+ 1B44:185F       _SD_MusicOff\r
+ 1B44:1854       _SD_MusicOn\r
+ 1B44:190F idle  _SD_MusicPlaying\r
+ 1B44:0AC4 idle  _SD_PlayDigitized\r
+ 1B44:1618       _SD_PlaySound\r
+ 1B44:09F0       _SD_Poll\r
+ 1B44:1601       _SD_PositionSound\r
+ 1B44:0BF2       _SD_SetDigiDevice\r
+ 1B44:1184       _SD_SetMusicMode\r
+ 1B44:0A7C       _SD_SetPosition\r
+ 1B44:10F4       _SD_SetSoundMode\r
+ 1B44:15EF idle  _SD_SetUserHook\r
+ 1B44:1594       _SD_Shutdown\r
+ 1B44:17C9       _SD_SoundPlaying\r
+ 1B44:18AC       _SD_StartMusic\r
+ 1B44:11D6       _SD_Startup\r
+ 1B44:094E       _SD_StopDigitized\r
+ 1B44:1810       _SD_StopSound\r
+ 1B44:1847       _SD_WaitSoundDone\r
+ 114B:07AA       _SelectChaseDir\r
+ 114B:067A       _SelectDodgeDir\r
+ 14D6:1A4F idle  _SelectPathDir\r
+ 114B:0904       _SelectRunDir\r
+ 0000:3170       _setblock\r
+ 044F:0176 idle  _SetPlaneViewSize\r
+ 0C63:0008 idle  _SetSoundLoc\r
+ 06CD:3BDF idle  _SetTextColor\r
+ 06CD:330F idle  _SetupControlPanel\r
+ 0C63:06A6       _SetupGameLevel\r
+ 10BF:001F       _SetupScaling\r
+ 0491:0FC1 idle  _SetupWalls\r
+ 0000:3FC0       _setvbuf\r
+ 0000:1349       _setvect\r
+ 0491:156F       _SetViewSize\r
+ 0EC1:02EE idle  _ShapeTest\r
+ 3B75:9892       _shootdelta\r
+ 06CD:41B7 idle  _ShootSnd\r
+ 062D:07A6 idle  _ShowArticle\r
+ 0491:15F7       _ShowViewSize\r
+ 0491:0D09       _ShutdownId\r
+ 114B:1784       _SightPlayer\r
+ 255E:0000       _signon\r
+ 0491:0FE8 idle  _SignonScreen\r
+ 10BF:07A0       _SimpleScaleShape\r
+ 0000:0F4F       _sin\r
+ 3B75:A512       _singlestep\r
+ 356C:0000       _sintable\r
+ 3B75:DDED       _slinewidth\r
+ 3B75:DDEF       _slinex\r
+ 3B75:03DC idle  _SndItems\r
+ 24D0:0000 idle  _SndMenu\r
+ 3B75:1298 idle  _songs\r
+ 3B75:9C3D       _SoundBlasterPresent\r
+ 3B75:9C3B       _SoundMode\r
+ 3B75:ECEF       _SoundNumber\r
+ 3B75:A2CE       _SoundPositioned\r
+ 3B75:ECEB       _SoundPriority\r
+ 3B75:9C3F       _SoundSourcePresent\r
+ 3B75:0434 idle  _SoundStatus\r
+ 3B75:ECFD       _SoundTable\r
+ 3B75:4F72       _spanstart\r
+ 14D6:1EAA       _SpawnBJVictory\r
+ 14D6:0500       _SpawnBoss\r
+ 14D6:04E0       _SpawnDeadGuard\r
+ 1402:025D       _SpawnDoor\r
+ 14D6:1204       _SpawnFakeHitler\r
+ 14D6:0AAA       _SpawnFat\r
+ 14D6:0950       _SpawnGhosts\r
+ 14D6:0A42       _SpawnGift\r
+ 14D6:0553       _SpawnGretel\r
+ 14D6:126C       _SpawnHitler\r
+ 114B:0001       _SpawnNewObj\r
+ 14D6:05A6       _SpawnPatrol\r
+ 12D6:0D87       _SpawnPlayer\r
+ 14D6:09DA       _SpawnSchabbs\r
+ 14D6:032D       _SpawnStand\r
+ 1402:0017       _SpawnStatic\r
+ 3B75:A2BC       _spearangle\r
+ 3B75:A2BA       _spearflag\r
+ 3B75:A2C2       _spearx\r
+ 3B75:A2BE       _speary\r
+ 3B75:A514       _spotvis\r
+ 0000:40C0       _sprintf\r
+ 3B75:EA96       _sqActive\r
+ 3B75:EA92       _sqHack\r
+ 3B75:EA8C       _sqHackLen\r
+ 3B75:EA8E       _sqHackPtr\r
+ 3B75:EA8A       _sqHackSeqLen\r
+ 3B75:EA86       _sqHackTime\r
+ 3B75:ECCF       _ssActive\r
+ 3B75:ECCD       _ssControl\r
+ 3B75:ECC9       _ssData\r
+ 3B75:ECFB       _ssIsTandy\r
+ 3B75:ECBF       _ssLengthLeft\r
+ 3B75:ECD1       _ssNoCheck\r
+ 3B75:ECC7       _ssOff\r
+ 3B75:ECC8       _ssOn\r
+ 3B75:39A0 idle  _ssPort\r
+ 3B75:ECC3       _ssSample\r
+ 3B75:ECCB       _ssStatus\r
+ 0DA6:0D39       _StartBonusFlash\r
+ 06CD:400C       _StartCPMusic\r
+ 0DA6:0D44       _StartDamageFlash\r
+ 0C63:0BDA idle  _StartDemoRecord\r
+ 3B75:A02E       _StartGame\r
+ 3B75:9890       _startgame\r
+ 3B75:1B4A idle  _starthitpoints\r
+ 0DA6:0B3E       _StartMusic\r
+ 3B75:1A1E idle  _statinfo\r
+ 3B75:893A       _statobjlist\r
+ 12D6:01A5 idle  _StatusDrawPic\r
+ 3B75:DDF1       _stepbytwo\r
+ 3B75:4DE2       _stepscale\r
+ 0DA6:0B03       _StopMusic\r
+ 3B75:98B4       _str\r
+ 3B75:98A0       _str2\r
+ 3B75:1A0C idle  _strafeangle\r
+ 0000:40F9       _strcat\r
+ 0000:4132       _strlen\r
+ 0000:4176       _strtol\r
+ 3B75:191C idle  _s_attack\r
+ 3B75:2EB4 idle  _s_bjjump1\r
+ 3B75:2EC4 idle  _s_bjjump2\r
+ 3B75:2ED4 idle  _s_bjjump3\r
+ 3B75:2EE4 idle  _s_bjjump4\r
+ 3B75:2E54 idle  _s_bjrun1\r
+ 3B75:2E64 idle  _s_bjrun1s\r
+ 3B75:2E74 idle  _s_bjrun2\r
+ 3B75:2E84 idle  _s_bjrun3\r
+ 3B75:2E94 idle  _s_bjrun3s\r
+ 3B75:2EA4 idle  _s_bjrun4\r
+ 3B75:1DDA       _s_blinkychase1\r
+ 3B75:1DEA idle  _s_blinkychase2\r
+ 3B75:1C4A idle  _s_boom1\r
+ 3B75:1C5A idle  _s_boom2\r
+ 3B75:1C6A idle  _s_boom3\r
+ 3B75:246A       _s_bosschase1\r
+ 3B75:247A idle  _s_bosschase1s\r
+ 3B75:248A idle  _s_bosschase2\r
+ 3B75:249A idle  _s_bosschase3\r
+ 3B75:24AA idle  _s_bosschase3s\r
+ 3B75:24BA idle  _s_bosschase4\r
+ 3B75:24CA       _s_bossdie1\r
+ 3B75:24DA idle  _s_bossdie2\r
+ 3B75:24EA idle  _s_bossdie3\r
+ 3B75:24FA idle  _s_bossdie4\r
+ 3B75:250A idle  _s_bossshoot1\r
+ 3B75:251A idle  _s_bossshoot2\r
+ 3B75:252A idle  _s_bossshoot3\r
+ 3B75:253A idle  _s_bossshoot4\r
+ 3B75:254A idle  _s_bossshoot5\r
+ 3B75:255A idle  _s_bossshoot6\r
+ 3B75:256A idle  _s_bossshoot7\r
+ 3B75:257A idle  _s_bossshoot8\r
+ 3B75:245A idle  _s_bossstand\r
+ 3B75:1E3A idle  _s_clydechase1\r
+ 3B75:1E4A idle  _s_clydechase2\r
+ 3B75:2EF4       _s_deathcam\r
+ 3B75:1F0A       _s_dogchase1\r
+ 3B75:1F1A idle  _s_dogchase1s\r
+ 3B75:1F2A idle  _s_dogchase2\r
+ 3B75:1F3A idle  _s_dogchase3\r
+ 3B75:1F4A idle  _s_dogchase3s\r
+ 3B75:1F5A idle  _s_dogchase4\r
+ 3B75:1F9A idle  _s_dogdead\r
+ 3B75:1F6A       _s_dogdie1\r
+ 3B75:1F7A idle  _s_dogdie2\r
+ 3B75:1F8A idle  _s_dogdie3\r
+ 3B75:1EBA idle  _s_dogjump1\r
+ 3B75:1ECA idle  _s_dogjump2\r
+ 3B75:1EDA idle  _s_dogjump3\r
+ 3B75:1EEA idle  _s_dogjump4\r
+ 3B75:1EFA idle  _s_dogjump5\r
+ 3B75:1E5A idle  _s_dogpath1\r
+ 3B75:1E6A idle  _s_dogpath1s\r
+ 3B75:1E7A idle  _s_dogpath2\r
+ 3B75:1E8A idle  _s_dogpath3\r
+ 3B75:1E9A idle  _s_dogpath3s\r
+ 3B75:1EAA idle  _s_dogpath4\r
+ 3B75:2A5C       _s_fakechase1\r
+ 3B75:2A6C idle  _s_fakechase1s\r
+ 3B75:2A7C idle  _s_fakechase2\r
+ 3B75:2A8C idle  _s_fakechase3\r
+ 3B75:2A9C idle  _s_fakechase3s\r
+ 3B75:2AAC idle  _s_fakechase4\r
+ 3B75:2ABC       _s_fakedie1\r
+ 3B75:2ACC idle  _s_fakedie2\r
+ 3B75:2ADC idle  _s_fakedie3\r
+ 3B75:2AEC idle  _s_fakedie4\r
+ 3B75:2AFC idle  _s_fakedie5\r
+ 3B75:2B0C idle  _s_fakedie6\r
+ 3B75:2B1C idle  _s_fakeshoot1\r
+ 3B75:2B2C idle  _s_fakeshoot2\r
+ 3B75:2B3C idle  _s_fakeshoot3\r
+ 3B75:2B4C idle  _s_fakeshoot4\r
+ 3B75:2B5C idle  _s_fakeshoot5\r
+ 3B75:2B6C idle  _s_fakeshoot6\r
+ 3B75:2B7C idle  _s_fakeshoot7\r
+ 3B75:2B8C idle  _s_fakeshoot8\r
+ 3B75:2B9C idle  _s_fakeshoot9\r
+ 3B75:2A4C idle  _s_fakestand\r
+ 3B75:291C       _s_fatchase1\r
+ 3B75:292C idle  _s_fatchase1s\r
+ 3B75:293C idle  _s_fatchase2\r
+ 3B75:294C idle  _s_fatchase3\r
+ 3B75:295C idle  _s_fatchase3s\r
+ 3B75:296C idle  _s_fatchase4\r
+ 3B75:297C idle  _s_fatdeathcam\r
+ 3B75:298C       _s_fatdie1\r
+ 3B75:299C idle  _s_fatdie2\r
+ 3B75:29AC idle  _s_fatdie3\r
+ 3B75:29BC idle  _s_fatdie4\r
+ 3B75:29CC idle  _s_fatdie5\r
+ 3B75:29DC idle  _s_fatdie6\r
+ 3B75:29EC idle  _s_fatshoot1\r
+ 3B75:29FC idle  _s_fatshoot2\r
+ 3B75:2A0C idle  _s_fatshoot3\r
+ 3B75:2A1C idle  _s_fatshoot4\r
+ 3B75:2A2C idle  _s_fatshoot5\r
+ 3B75:2A3C idle  _s_fatshoot6\r
+ 3B75:290C idle  _s_fatstand\r
+ 3B75:2BAC idle  _s_fire1\r
+ 3B75:2BBC idle  _s_fire2\r
+ 3B75:281C       _s_giftchase1\r
+ 3B75:282C idle  _s_giftchase1s\r
+ 3B75:283C idle  _s_giftchase2\r
+ 3B75:284C idle  _s_giftchase3\r
+ 3B75:285C idle  _s_giftchase3s\r
+ 3B75:286C idle  _s_giftchase4\r
+ 3B75:287C idle  _s_giftdeathcam\r
+ 3B75:288C       _s_giftdie1\r
+ 3B75:289C idle  _s_giftdie2\r
+ 3B75:28AC idle  _s_giftdie3\r
+ 3B75:28BC idle  _s_giftdie4\r
+ 3B75:28CC idle  _s_giftdie5\r
+ 3B75:28DC idle  _s_giftdie6\r
+ 3B75:28EC idle  _s_giftshoot1\r
+ 3B75:28FC idle  _s_giftshoot2\r
+ 3B75:280C idle  _s_giftstand\r
+ 3B75:1D3A       _s_grdchase1\r
+ 3B75:1D4A idle  _s_grdchase1s\r
+ 3B75:1D5A idle  _s_grdchase2\r
+ 3B75:1D6A idle  _s_grdchase3\r
+ 3B75:1D7A idle  _s_grdchase3s\r
+ 3B75:1D8A idle  _s_grdchase4\r
+ 3B75:1D9A       _s_grddie1\r
+ 3B75:1DAA idle  _s_grddie2\r
+ 3B75:1DBA idle  _s_grddie3\r
+ 3B75:1DCA idle  _s_grddie4\r
+ 3B75:1CEA       _s_grdpain\r
+ 3B75:1CFA       _s_grdpain1\r
+ 3B75:1C8A idle  _s_grdpath1\r
+ 3B75:1C9A idle  _s_grdpath1s\r
+ 3B75:1CAA idle  _s_grdpath2\r
+ 3B75:1CBA idle  _s_grdpath3\r
+ 3B75:1CCA idle  _s_grdpath3s\r
+ 3B75:1CDA idle  _s_grdpath4\r
+ 3B75:1D0A idle  _s_grdshoot1\r
+ 3B75:1D1A idle  _s_grdshoot2\r
+ 3B75:1D2A idle  _s_grdshoot3\r
+ 3B75:1C7A idle  _s_grdstand\r
+ 3B75:259A       _s_gretelchase1\r
+ 3B75:25AA idle  _s_gretelchase1s\r
+ 3B75:25BA idle  _s_gretelchase2\r
+ 3B75:25CA idle  _s_gretelchase3\r
+ 3B75:25DA idle  _s_gretelchase3s\r
+ 3B75:25EA idle  _s_gretelchase4\r
+ 3B75:25FA       _s_greteldie1\r
+ 3B75:260A idle  _s_greteldie2\r
+ 3B75:261A idle  _s_greteldie3\r
+ 3B75:262A idle  _s_greteldie4\r
+ 3B75:263A idle  _s_gretelshoot1\r
+ 3B75:264A idle  _s_gretelshoot2\r
+ 3B75:265A idle  _s_gretelshoot3\r
+ 3B75:266A idle  _s_gretelshoot4\r
+ 3B75:267A idle  _s_gretelshoot5\r
+ 3B75:268A idle  _s_gretelshoot6\r
+ 3B75:269A idle  _s_gretelshoot7\r
+ 3B75:26AA idle  _s_gretelshoot8\r
+ 3B75:258A idle  _s_gretelstand\r
+ 3B75:2CDC       _s_hitlerchase1\r
+ 3B75:2CEC idle  _s_hitlerchase1s\r
+ 3B75:2CFC idle  _s_hitlerchase2\r
+ 3B75:2D0C idle  _s_hitlerchase3\r
+ 3B75:2D1C idle  _s_hitlerchase3s\r
+ 3B75:2D2C idle  _s_hitlerchase4\r
+ 3B75:2D3C idle  _s_hitlerdeathcam\r
+ 3B75:2D4C       _s_hitlerdie1\r
+ 3B75:2DDC idle  _s_hitlerdie10\r
+ 3B75:2D5C idle  _s_hitlerdie2\r
+ 3B75:2D6C idle  _s_hitlerdie3\r
+ 3B75:2D7C idle  _s_hitlerdie4\r
+ 3B75:2D8C idle  _s_hitlerdie5\r
+ 3B75:2D9C idle  _s_hitlerdie6\r
+ 3B75:2DAC idle  _s_hitlerdie7\r
+ 3B75:2DBC idle  _s_hitlerdie8\r
+ 3B75:2DCC idle  _s_hitlerdie9\r
+ 3B75:2DEC idle  _s_hitlershoot1\r
+ 3B75:2DFC idle  _s_hitlershoot2\r
+ 3B75:2E0C idle  _s_hitlershoot3\r
+ 3B75:2E1C idle  _s_hitlershoot4\r
+ 3B75:2E2C idle  _s_hitlershoot5\r
+ 3B75:2E3C idle  _s_hitlershoot6\r
+ 3B75:1DFA idle  _s_inkychase1\r
+ 3B75:1E0A idle  _s_inkychase2\r
+ 3B75:2BDC       _s_mechachase1\r
+ 3B75:2BEC idle  _s_mechachase1s\r
+ 3B75:2BFC idle  _s_mechachase2\r
+ 3B75:2C0C idle  _s_mechachase3\r
+ 3B75:2C1C idle  _s_mechachase3s\r
+ 3B75:2C2C idle  _s_mechachase4\r
+ 3B75:2C3C       _s_mechadie1\r
+ 3B75:2C4C idle  _s_mechadie2\r
+ 3B75:2C5C idle  _s_mechadie3\r
+ 3B75:2C6C idle  _s_mechadie4\r
+ 3B75:2C7C idle  _s_mechashoot1\r
+ 3B75:2C8C idle  _s_mechashoot2\r
+ 3B75:2C9C idle  _s_mechashoot3\r
+ 3B75:2CAC idle  _s_mechashoot4\r
+ 3B75:2CBC idle  _s_mechashoot5\r
+ 3B75:2CCC idle  _s_mechashoot6\r
+ 3B75:2BCC idle  _s_mechastand\r
+ 3B75:21EA       _s_mutchase1\r
+ 3B75:21FA idle  _s_mutchase1s\r
+ 3B75:220A idle  _s_mutchase2\r
+ 3B75:221A idle  _s_mutchase3\r
+ 3B75:222A idle  _s_mutchase3s\r
+ 3B75:223A idle  _s_mutchase4\r
+ 3B75:224A       _s_mutdie1\r
+ 3B75:225A idle  _s_mutdie2\r
+ 3B75:226A idle  _s_mutdie3\r
+ 3B75:227A idle  _s_mutdie4\r
+ 3B75:228A idle  _s_mutdie5\r
+ 3B75:218A       _s_mutpain\r
+ 3B75:219A       _s_mutpain1\r
+ 3B75:212A idle  _s_mutpath1\r
+ 3B75:213A idle  _s_mutpath1s\r
+ 3B75:214A idle  _s_mutpath2\r
+ 3B75:215A idle  _s_mutpath3\r
+ 3B75:216A idle  _s_mutpath3s\r
+ 3B75:217A idle  _s_mutpath4\r
+ 3B75:21AA idle  _s_mutshoot1\r
+ 3B75:21BA idle  _s_mutshoot2\r
+ 3B75:21CA idle  _s_mutshoot3\r
+ 3B75:21DA idle  _s_mutshoot4\r
+ 3B75:211A idle  _s_mutstand\r
+ 3B75:27CC idle  _s_needle1\r
+ 3B75:27DC idle  _s_needle2\r
+ 3B75:27EC idle  _s_needle3\r
+ 3B75:27FC idle  _s_needle4\r
+ 3B75:206A       _s_ofcchase1\r
+ 3B75:207A idle  _s_ofcchase1s\r
+ 3B75:208A idle  _s_ofcchase2\r
+ 3B75:209A idle  _s_ofcchase3\r
+ 3B75:20AA idle  _s_ofcchase3s\r
+ 3B75:20BA idle  _s_ofcchase4\r
+ 3B75:20CA       _s_ofcdie1\r
+ 3B75:20DA idle  _s_ofcdie2\r
+ 3B75:20EA idle  _s_ofcdie3\r
+ 3B75:20FA idle  _s_ofcdie4\r
+ 3B75:210A idle  _s_ofcdie5\r
+ 3B75:201A       _s_ofcpain\r
+ 3B75:202A       _s_ofcpain1\r
+ 3B75:1FBA idle  _s_ofcpath1\r
+ 3B75:1FCA idle  _s_ofcpath1s\r
+ 3B75:1FDA idle  _s_ofcpath2\r
+ 3B75:1FEA idle  _s_ofcpath3\r
+ 3B75:1FFA idle  _s_ofcpath3s\r
+ 3B75:200A idle  _s_ofcpath4\r
+ 3B75:203A idle  _s_ofcshoot1\r
+ 3B75:204A idle  _s_ofcshoot2\r
+ 3B75:205A idle  _s_ofcshoot3\r
+ 3B75:1FAA idle  _s_ofcstand\r
+ 3B75:1E1A idle  _s_pinkychase1\r
+ 3B75:1E2A idle  _s_pinkychase2\r
+ 3B75:190C idle  _s_player\r
+ 3B75:1BFA idle  _s_rocket\r
+ 3B75:26DC       _s_schabbchase1\r
+ 3B75:26EC idle  _s_schabbchase1s\r
+ 3B75:26FC idle  _s_schabbchase2\r
+ 3B75:270C idle  _s_schabbchase3\r
+ 3B75:271C idle  _s_schabbchase3s\r
+ 3B75:272C idle  _s_schabbchase4\r
+ 3B75:273C idle  _s_schabbdeathcam\r
+ 3B75:274C       _s_schabbdie1\r
+ 3B75:275C idle  _s_schabbdie2\r
+ 3B75:276C idle  _s_schabbdie3\r
+ 3B75:277C idle  _s_schabbdie4\r
+ 3B75:278C idle  _s_schabbdie5\r
+ 3B75:279C idle  _s_schabbdie6\r
+ 3B75:27AC idle  _s_schabbshoot1\r
+ 3B75:27BC idle  _s_schabbshoot2\r
+ 3B75:26CC idle  _s_schabbstand\r
+ 3B75:1C0A idle  _s_smoke1\r
+ 3B75:1C1A idle  _s_smoke2\r
+ 3B75:1C2A idle  _s_smoke3\r
+ 3B75:1C3A idle  _s_smoke4\r
+ 3B75:23BA       _s_sschase1\r
+ 3B75:23CA idle  _s_sschase1s\r
+ 3B75:23DA idle  _s_sschase2\r
+ 3B75:23EA idle  _s_sschase3\r
+ 3B75:23FA idle  _s_sschase3s\r
+ 3B75:240A idle  _s_sschase4\r
+ 3B75:241A       _s_ssdie1\r
+ 3B75:242A idle  _s_ssdie2\r
+ 3B75:243A idle  _s_ssdie3\r
+ 3B75:244A idle  _s_ssdie4\r
+ 3B75:230A       _s_sspain\r
+ 3B75:231A       _s_sspain1\r
+ 3B75:22AA idle  _s_sspath1\r
+ 3B75:22BA idle  _s_sspath1s\r
+ 3B75:22CA idle  _s_sspath2\r
+ 3B75:22DA idle  _s_sspath3\r
+ 3B75:22EA idle  _s_sspath3s\r
+ 3B75:22FA idle  _s_sspath4\r
+ 3B75:232A idle  _s_ssshoot1\r
+ 3B75:233A idle  _s_ssshoot2\r
+ 3B75:234A idle  _s_ssshoot3\r
+ 3B75:235A idle  _s_ssshoot4\r
+ 3B75:236A idle  _s_ssshoot5\r
+ 3B75:237A idle  _s_ssshoot6\r
+ 3B75:238A idle  _s_ssshoot7\r
+ 3B75:239A idle  _s_ssshoot8\r
+ 3B75:23AA idle  _s_ssshoot9\r
+ 3B75:229A idle  _s_ssstand\r
+ 3B75:ECE1       _t0OldService\r
+ 12D6:035C       _TakeDamage\r
+ 0000:0F9C       _tan\r
+ 3B75:9B87       _tedlevel\r
+ 3B75:9B85       _tedlevelnum\r
+ 3B75:9E98       _text\r
+ 0F7A:0F3F       _ThreeDRefresh\r
+ 12D6:0AF4 idle  _Thrust\r
+ 3B75:E00B       _thrustspeed\r
+ 06CD:3AD3 idle  _TicDelay\r
+ 3B75:A2C8       _tics\r
+ 3B75:168C       _tileglobal\r
+ 3B75:D9B2       _tilehit\r
+ 3B75:75B8       _tilemap\r
+ 3B75:9EDC       _TimeCount\r
+ 062D:00B8 idle  _TimedPicCommand\r
+ 3B75:ECF1       _TimerCount\r
+ 3B75:ECF5       _TimerDivisor\r
+ 3B75:ECDB       _TimerRate\r
+ 3B75:E822       _tinf\r
+ 0000:1931       _tolower\r
+ 0000:195D       _toupper\r
+ 06CD:1232 idle  _TrackWhichGame\r
+ 0F7A:004A idle  _TransformActor\r
+ 0F7A:018C idle  _TransformTile\r
+ 12D6:0825 idle  _TryMove\r
+ 114B:00C8       _TryWalk\r
+ 12D6:10B7 idle  _T_Attack\r
+ 14D6:1DCC idle  _T_Bite\r
+ 14D6:1FE8 idle  _T_BJDone\r
+ 14D6:1F9B idle  _T_BJJump\r
+ 14D6:1EFE idle  _T_BJRun\r
+ 14D6:1FC6 idle  _T_BJYell\r
+ 14D6:15B9 idle  _T_Chase\r
+ 14D6:18E6 idle  _T_DogChase\r
+ 14D6:14CA idle  _T_Fake\r
+ 14D6:13A9 idle  _T_FakeFire\r
+ 14D6:1074 idle  _T_Fat\r
+ 14D6:1836 idle  _T_Ghosts\r
+ 14D6:0EE4 idle  _T_Gift\r
+ 14D6:0C33 idle  _T_GiftThrow\r
+ 14D6:1A9B idle  _T_Path\r
+ 12D6:124A idle  _T_Player\r
+ 14D6:00FE idle  _T_Projectile\r
+ 14D6:0D54 idle  _T_Schabb\r
+ 14D6:0B12 idle  _T_SchabbThrow\r
+ 14D6:1BD1 idle  _T_Shoot\r
+ 14D6:15A9 idle  _T_Stand\r
+ 0000:3934       _ultoa\r
+ 3B75:E87A       _UMBbase\r
+ 06CD:3231       _UnCacheLump\r
+ 0000:1989       _unlink\r
+ 3B75:54B4       _update\r
+ 12D6:0268 idle  _UpdateFace\r
+ 0DA6:0D50 idle  _UpdatePaletteShifts\r
+ 3B75:9B77       _updateptr\r
+ 0C63:014C       _UpdateSoundLoc\r
+ 3B75:3D16 idle  _USL_DrawString\r
+ 1D1D:0005 idle  _USL_HardError\r
+ 3B75:3D12       _USL_MeasureString\r
+ 1D1D:03E6 idle  _USL_PrintInCenter\r
+ 1D1D:06A2 idle  _US_CenterWindow\r
+ 1D1D:0225       _US_CheckParm\r
+ 1D1D:0555       _US_ClearWindow\r
+ 06CD:0006       _US_ControlPanel\r
+ 1D1D:04EA       _US_CPrint\r
+ 1D1D:048A idle  _US_CPrintLine\r
+ 1D1D:0582       _US_DrawWindow\r
+ 1DDD:000A       _US_InitRndT\r
+ 1D1D:07BB       _US_LineInput\r
+ 1D1D:02EE       _US_Print\r
+ 1D1D:0446       _US_PrintCentered\r
+ 1D1D:03BD idle  _US_PrintSigned\r
+ 1D1D:0394       _US_PrintUnsigned\r
+ 1D1D:06F3 idle  _US_RestoreWindow\r
+ 1DDD:0032       _US_RndT\r
+ 1D1D:06C6 idle  _US_SaveWindow\r
+ 1D1D:02CF idle  _US_SetPrintRoutines\r
+ 1D1D:0213       _US_Shutdown\r
+ 1D1D:013D       _US_Startup\r
+ 3B75:9B5D       _uwidthtable\r
+ 3B75:53A8       _vertwall\r
+ 3B75:1698 idle  _vgaCeiling\r
+ 0F7A:0A2C idle  _VGAClearScreen\r
+ 1F54:000E       _VH_UpdateScreen\r
+ 0B05:003B       _Victory\r
+ 12D6:0FF7 idle  _VictorySpin\r
+ 12D6:0AE4 idle  _VictoryTile\r
+ 3B75:DDDE       _viewangle\r
+ 3B75:503A       _viewcos\r
+ 3B75:52CE       _viewheight\r
+ 3B75:503E       _viewsin\r
+ 3B75:54A8       _viewsize\r
+ 3B75:D9CA       _viewtx\r
+ 3B75:D9C8       _viewty\r
+ 3B75:D84C       _viewtype\r
+ 3B75:52D0       _viewwidth\r
+ 3B75:5046       _viewx\r
+ 3B75:5042       _viewy\r
+ 3B75:988E       _virtualreality\r
+ 3B75:D86C       _vislist\r
+ 3B75:D86A       _visptr\r
+ 3B75:D868       _visstep\r
+ 1DE1:0682       _VL_Bar\r
+ 1DE1:00A4 idle  _VL_ClearVideo\r
+ 1DE1:04D5       _VL_ColorBorder\r
+ 1DE1:00CE idle  _VL_DePlaneVGA\r
+ 1DE1:0AA5 idle  _VL_DrawLatch8String\r
+ 1DE1:0975 idle  _VL_DrawTile8String\r
+ 1DE1:038C       _VL_FadeIn\r
+ 1DE1:025F       _VL_FadeOut\r
+ 1DE1:01AA idle  _VL_FillPalette\r
+ 1DE1:01EA idle  _VL_GetColor\r
+ 1DE1:023E idle  _VL_GetPalette\r
+ 1DE1:0539       _VL_Hlin\r
+ 1DE1:090B       _VL_LatchToScreen\r
+ 1DE1:087B idle  _VL_MaskedToScreen\r
+ 1DE1:0789       _VL_MemToLatch\r
+ 1DE1:07DE       _VL_MemToScreen\r
+ 1E99:0236       _VL_MungePic\r
+ 1DE1:04E9       _VL_Plot\r
+ 1F2B:00B2       _VL_ScreenToScreen\r
+ 1DE1:01CF idle  _VL_SetColor\r
+ 1F2B:0021 idle  _VL_SetCRTC\r
+ 1DE1:0126 idle  _VL_SetLineWidth\r
+ 1DE1:0215       _VL_SetPalette\r
+ 1F2B:0045       _VL_SetScreen\r
+ 1DE1:015B idle  _VL_SetSplitScreen\r
+ 1DE1:009A idle  _VL_SetTextMode\r
+ 1DE1:0075       _VL_SetVGAPlaneMode\r
+ 1DE1:006B       _VL_Shutdown\r
+ 1DE1:0B56 idle  _VL_SizeTile8String\r
+ 1DE1:000D       _VL_Startup\r
+ 1DE1:0471       _VL_TestPaletteSet\r
+ 1F2B:0132       _VL_VideoID\r
+ 1DE1:0618       _VL_Vlin\r
+ 1F2B:000A       _VL_WaitVBL\r
+ 0000:40DD idle  _vsprintf\r
+ 1E99:0583       _VWB_Bar\r
+ 1E99:04DB       _VWB_DrawPic\r
+ 1E99:054A       _VWB_DrawPropString\r
+ 1E99:044C       _VWB_DrawTile8\r
+ 1E99:0494 idle  _VWB_DrawTile8M\r
+ 1E99:05EA       _VWB_Hlin\r
+ 1E99:05BF       _VWB_Plot\r
+ 1E99:061E       _VWB_Vlin\r
+ 1E99:02FA idle  _VWL_MeasureString\r
+ 1E99:0117 idle  _VW_DrawColorPropString\r
+ 1E99:0000 idle  _VW_DrawPropString\r
+ 1E99:037E       _VW_MarkUpdateBlock\r
+ 1E99:035C idle  _VW_MeasureMPropString\r
+ 1E99:033A       _VW_MeasurePropString\r
+ 1E99:0652       _VW_UpdateScreen\r
+ 06CD:3C14 idle  _WaitKeyUp\r
+ 3B75:504A       _wallheight\r
+ 0F7A:0E51 idle  _WallRefresh\r
+ 3B75:1710 idle  _weaponscale\r
+ 0000:31F3 idle  _wherex\r
+ 0000:3202 idle  _wherey\r
+ 36C8:0000       _whiteshifts\r
+ 3B75:A044       _WindowH\r
+ 3B75:9B79       _WindowW\r
+ 3B75:9B7D       _WindowX\r
+ 3B75:9B7B       _WindowY\r
+ 3B75:177A idle  _wordmasks\r
+ 3B75:DDF3       _work\r
+ 0000:4393       _write\r
+ 0B05:04FF       _Write\r
+ 0491:023E idle  _WriteConfig\r
+ 3B75:D9A4       _xintercept\r
+ 3B75:D9B6       _xinttile\r
+ 3B75:E890       _XMSaddr\r
+ 3B75:E8D0       _XMSAvail\r
+ 3B75:E8CA       _XMSDriver\r
+ 3B75:E8CE       _XMSHandle\r
+ 3B75:A294       _XMSPagesAvail\r
+ 3B75:E8C2       _XMSPagesUsed\r
+ 3B75:A298       _XMSPresent\r
+ 3B75:3510 idle  _XMSProtectPage\r
+ 3B75:D9C2       _xpartial\r
+ 3B75:D9BC       _xpartialdown\r
+ 3B75:D9BE       _xpartialup\r
+ 3B75:D99C       _xstep\r
+ 3B75:D9AE       _xtile\r
+ 3B75:D9AA       _xtilestep\r
+ 3B75:D9A0       _yintercept\r
+ 3B75:D9B4       _yinttile\r
+ 3B75:EE15       _ylookup\r
+ 3B75:D9C0       _ypartial\r
+ 3B75:D9B8       _ypartialdown\r
+ 3B75:D9BA       _ypartialup\r
+ 3B75:D998       _ystep\r
+ 3B75:D9AC       _ytile\r
+ 3B75:D9A8       _ytilestep\r
+ 3B75:4090       __8087\r
+ 0000:1000 idle  __AHINCR\r
+ 0000:000C idle  __AHSHIFT\r
+ 3B75:4724       __argc\r
+ 3B75:4726       __argv\r
+ 3B75:4380       __atexitcnt\r
+ 3B75:4944       __atexittbl\r
+ 0000:2670       __brk\r
+ 3B75:00D1       __brklvl\r
+ 3B75:00B3       __C0argc\r
+ 3B75:00B5       __C0argv\r
+ 0000:20DC idle  __c0crtinit\r
+ 3B75:00B7       __C0environ\r
+ 0000:12CC idle  __cexit\r
+ 0000:018A       __checknull\r
+ 0000:32A2       __chmod\r
+ 0000:0177       __cleanup\r
+ 0000:32E5       __close\r
+ 0000:20F9 idle  __crtinit\r
+ 3B75:4382       __ctype\r
+ 0000:0000  Abs  __cvtfak\r
+ 0000:12DA idle  __c_exit\r
+ 3B75:40A4       __default87\r
+ 3B75:4602       __doserrno\r
+ 0000:152C       __DOSERROR\r
+ 3B75:4604 idle  __dosErrorToSV\r
+ 0000:11FE idle  __dos_getdate\r
+ 0000:1190       __dos_getdiskfree\r
+ 0000:11C6       __dos_getfileattr\r
+ 0000:1217       __dos_gettime\r
+ 0000:11E3 idle  __dos_setfileattr\r
+ 0000:1230       __dos_write\r
+ 3B75:4270       __emu\r
+ 3B75:00B9       __envLng\r
+ 3B75:00BB       __envseg\r
+ 3B75:00BD       __envSize\r
+ 0000:12BA       __exit\r
+ 3B75:4484       __exitbuf\r
+ 3B75:4488       __exitfopen\r
+ 3B75:448C       __exitopen\r
+ 3B75:471E idle  __first\r
+ 0000:8087 idle  __floatconvert\r
+ 0000:43E1       __fmemcmp\r
+ 0000:4409       __fmemcpy\r
+ 0000:4451       __fmemset\r
+ 3B75:45FA       __fmode\r
+ 0000:0DAF       __fperror\r
+ 3B75:45FE       __fpstklen\r
+ 0000:05E5       __fpuint\r
+ 0000:3B9B idle  __fputc\r
+ 0000:3CFC       __FPUTN\r
+ 0000:442D idle  __fsetmem\r
+ 0000:4470       __fstrcpy\r
+ 0000:4499       __fstricmp\r
+ 0000:44DA       __fstrlen\r
+ 0000:36C1 idle  __GETFP\r
+ 0000:2929 idle  __harderr\r
+ 0000:2955       __hardresume\r
+ 0000:2970       __hardretn\r
+ 3B75:00CD       __heapbase\r
+ 3B75:4600       __heaplen\r
+ 3B75:00D5       __heaptop\r
+ 3B75:40AA       __huge_dble\r
+ 3B75:40A6 idle  __huge_flt\r
+ 3B75:40B2 idle  __huge_ldble\r
+ 3B75:40BC idle  __indefinite\r
+ 3B75:00A3 idle  __Int0Vector\r
+ 3B75:00A7 idle  __Int4Vector\r
+ 3B75:00AB idle  __Int5Vector\r
+ 3B75:00AF idle  __Int6Vector\r
+ 0000:14F3       __IOERROR\r
+ 3B75:4720 idle  __last\r
+ 3B75:40A1       __LDT\r
+ 0000:05F6       __LDTRUNC\r
+ 0000:154F       __LONGTOA\r
+ 0000:0FEC       __matherr\r
+ 3B75:40CA       __mathwhy\r
+ 0000:1612       __MKNAME\r
+ 0000:02B1 idle  __MMODEL\r
+ 3B75:45D0       __nfile\r
+ 3B75:45FC       __notUmask\r
+ 0000:3B37       __open\r
+ 3B75:45D2       __openfd\r
+ 0000:3625 idle  __OPENFP\r
+ 3B75:00C1       __osmajor\r
+ 3B75:00C2 idle  __osminor\r
+ 3B75:00C1 idle  __osversion\r
+ 0000:0E55       __POW10\r
+ 3B75:40A0       __protected\r
+ 3B75:00BF       __psp\r
+ 0000:16B5       __read\r
+ 0000:2D0E       __REALCVT\r
+ 3B75:473A       __RealCvtVector\r
+ 0000:020B       __restorezero\r
+ 3B75:4722 idle  __rover\r
+ 0000:26AF       __sbrk\r
+ 3B75:473E idle  __ScanTodVector\r
+ 0000:170D       __scantol\r
+ 0000:2E3E       __SCREENIO\r
+ 0000:2EF1       __SCROLL\r
+ 0000:0000 idle  __setargv__\r
+ 0000:0000 idle  __setenvp__\r
+ 0000:188C       __setupio\r
+ 3B75:00C5 idle  __StartTime\r
+ 3B75:4668       __stklen\r
+ 0000:1F23       __stpcpy\r
+ 3B75:4490       __streams\r
+ 0000:01B5       __terminate\r
+ 3B75:40C0 idle  __tiny_ldble\r
+ 0000:1651 idle  __TMPNAM\r
+ 0000:0000 idle  __turboCrt\r
+ 0000:0000  Abs  __turboCvt\r
+ 0000:8087  Abs  __turboFloat\r
+ 0000:15CC       __UTOA\r
+ 0000:2E7A       __VALIDATEXY\r
+ 3B75:00C1       __version\r
+ 3B75:46D2       __video\r
+ 0000:2051       __VideoInt\r
+ 0000:19B7       __VPRINTER\r
+ 0000:1E6A       __VPTR\r
+ 0000:1E8F       __VRAM\r
+ 0000:31E9       __wherexy\r
+ 0000:4359       __write\r
+ 0000:1F09       __xclose\r
+ 0000:0BA6       __XCVT\r
+ 0000:4396       __xfclose\r
+ 0000:43BE       __xfflush\r
+ 0000:1F71       ___brk\r
+ 3B75:00CB       ___brklvl\r
+ 0000:21D9 idle  ___first\r
+ 0000:04FE idle  ___fpreset\r
+ 0000:28FD       ___harderr\r
+ 3B75:00C9 idle  ___heapbase\r
+ 0000:21DB idle  ___last\r
+ 0000:3EEF       ___read\r
+ 0000:21DD idle  ___rover\r
+ 0000:1F93       ___sbrk\r
+ 3B75:49D2       ___SignalPtr\r
+ 0000:424B       ___write\r
+\r
+  Address         Publics by Value\r
+\r
+ 0000:0000  Abs  __turboCvt\r
+ 0000:0000 idle  __turboCrt\r
+ 0000:0000  Abs  __cvtfak\r
+ 0000:0000 idle  __setargv__\r
+ 0000:0000 idle  __setenvp__\r
+ 0000:000C idle  __AHSHIFT\r
+ 0000:0177       __cleanup\r
+ 0000:018A       __checknull\r
+ 0000:01B5       __terminate\r
+ 0000:020B       __restorezero\r
+ 0000:0297       _abort\r
+ 0000:02AF idle  DGROUP@\r
+ 0000:02B1 idle  __MMODEL\r
+ 0000:02B3 idle  N_LDIV@\r
+ 0000:02B6       LDIV@\r
+ 0000:02B6       F_LDIV@\r
+ 0000:02D2 idle  N_LUDIV@\r
+ 0000:02D5 idle  F_LUDIV@\r
+ 0000:02D5 idle  LUDIV@\r
+ 0000:02DA idle  N_LMOD@\r
+ 0000:02DD       F_LMOD@\r
+ 0000:02DD idle  LMOD@\r
+ 0000:02E2 idle  N_LUMOD@\r
+ 0000:02E5 idle  LUMOD@\r
+ 0000:02E5 idle  F_LUMOD@\r
+ 0000:04FE idle  ___fpreset\r
+ 0000:05E5       __fpuint\r
+ 0000:05E9       _atan\r
+ 0000:05F6       __LDTRUNC\r
+ 0000:0632 idle  FISRQQ\r
+ 0000:0BA6       __XCVT\r
+ 0000:0DAF       __fperror\r
+ 0000:0E32 idle  FICRQQ\r
+ 0000:0E55       __POW10\r
+ 0000:0F1E       _pow10\r
+ 0000:0F29       _matherr\r
+ 0000:0F4F       _sin\r
+ 0000:0F9C       _tan\r
+ 0000:0FEC       __matherr\r
+ 0000:1000 idle  __AHINCR\r
+ 0000:107C       _atan2\r
+ 0000:1137       F_FTOL@\r
+ 0000:1137 idle  FTOL@\r
+ 0000:1163 idle  _atexit\r
+ 0000:1190       __dos_getdiskfree\r
+ 0000:11C6       __dos_getfileattr\r
+ 0000:11E3 idle  __dos_setfileattr\r
+ 0000:11FE idle  __dos_getdate\r
+ 0000:1217       __dos_gettime\r
+ 0000:1230       __dos_write\r
+ 0000:12AB       _exit\r
+ 0000:12BA       __exit\r
+ 0000:12CC idle  __cexit\r
+ 0000:12DA idle  __c_exit\r
+ 0000:12E6       F_LXMUL@\r
+ 0000:12E6 idle  LXMUL@\r
+ 0000:12FD       F_PCMP@\r
+ 0000:12FD idle  PCMP@\r
+ 0000:131E       F_SCOPY@\r
+ 0000:131E idle  SCOPY@\r
+ 0000:133A       _getvect\r
+ 0000:1349       _setvect\r
+ 0000:135A       N_LXLSH@\r
+ 0000:135D       F_LXLSH@\r
+ 0000:135D idle  LXLSH@\r
+ 0000:137B idle  N_LXRSH@\r
+ 0000:137E       F_LXRSH@\r
+ 0000:137E idle  LXRSH@\r
+ 0000:139B idle  N_LXURSH@\r
+ 0000:139E       F_LXURSH@\r
+ 0000:139E idle  LXURSH@\r
+ 0000:13BC idle  N_PADA@\r
+ 0000:13BF       F_PADA@\r
+ 0000:13BF idle  PADA@\r
+ 0000:1400 idle  N_PSBA@\r
+ 0000:1403       F_PSBA@\r
+ 0000:1403 idle  PSBA@\r
+ 0000:1444       N_PADD@\r
+ 0000:1447       F_PADD@\r
+ 0000:1447 idle  PADD@\r
+ 0000:1473 idle  N_PSUB@\r
+ 0000:1476 idle  F_PSUB@\r
+ 0000:1476 idle  PSUB@\r
+ 0000:14A4       N_PSBP@\r
+ 0000:14A7       F_PSBP@\r
+ 0000:14A7 idle  PSBP@\r
+ 0000:14CC idle  N_SPUSH@\r
+ 0000:14D2       F_SPUSH@\r
+ 0000:14D2 idle  SPUSH@\r
+ 0000:14F3       __IOERROR\r
+ 0000:152C       __DOSERROR\r
+ 0000:153E       _isatty\r
+ 0000:154F       __LONGTOA\r
+ 0000:15CC       __UTOA\r
+ 0000:15E9       _lseek\r
+ 0000:1612       __MKNAME\r
+ 0000:1632  Abs  FIERQQ\r
+ 0000:1651 idle  __TMPNAM\r
+ 0000:1694       N_PCMP@\r
+ 0000:16B5       __read\r
+ 0000:170D       __scantol\r
+ 0000:188C       __setupio\r
+ 0000:1931       _tolower\r
+ 0000:195D       _toupper\r
+ 0000:1989       _unlink\r
+ 0000:19B7       __VPRINTER\r
+ 0000:1E6A       __VPTR\r
+ 0000:1E8F       __VRAM\r
+ 0000:1F09       __xclose\r
+ 0000:1F23       __stpcpy\r
+ 0000:1F4C       _bioskey\r
+ 0000:1F71       ___brk\r
+ 0000:1F93       ___sbrk\r
+ 0000:1FC4 idle  _brk\r
+ 0000:1FD0 idle  _sbrk\r
+ 0000:1FE0       _clrscr\r
+ 0000:2009       _coreleft\r
+ 0000:2051       __VideoInt\r
+ 0000:20DC idle  __c0crtinit\r
+ 0000:20F9 idle  __crtinit\r
+ 0000:21D9 idle  ___first\r
+ 0000:21DB idle  ___last\r
+ 0000:21DD idle  ___rover\r
+ 0000:2319       _farfree\r
+ 0000:2423       _farmalloc\r
+ 0000:2580 idle  _farrealloc\r
+ 0000:2670       __brk\r
+ 0000:26AF       __sbrk\r
+ 0000:273A       _farcoreleft\r
+ 0000:278A       _gotoxy\r
+ 0000:27D3       _gettext\r
+ 0000:2827       _puttext\r
+ 0000:287B       _harderr\r
+ 0000:288D idle  _hardresume\r
+ 0000:289B idle  _hardretn\r
+ 0000:28FD       ___harderr\r
+ 0000:2929 idle  __harderr\r
+ 0000:2955       __hardresume\r
+ 0000:2970       __hardretn\r
+ 0000:29CF       _ioctl\r
+ 0000:29F6       _movetext\r
+ 0000:2A93       _free\r
+ 0000:2B62       _malloc\r
+ 0000:2CBB idle  _realloc\r
+ 0000:2D0E       __REALCVT\r
+ 0000:2E3E       __SCREENIO\r
+ 0000:2E7A       __VALIDATEXY\r
+ 0000:2EF1       __SCROLL\r
+ 0000:3170       _setblock\r
+ 0000:31E9       __wherexy\r
+ 0000:31F3 idle  _wherex\r
+ 0000:3202 idle  _wherey\r
+ 0000:3215       _atol\r
+ 0000:3285 idle  _atoi\r
+ 0000:3292       _bdos\r
+ 0000:32A2       __chmod\r
+ 0000:32BD       _close\r
+ 0000:32E5       __close\r
+ 0000:331C       _creat\r
+ 0000:338E       _fclose\r
+ 0000:340F       _fflush\r
+ 0000:3490       _findfirst\r
+ 0000:34C3       _findnext\r
+ 0000:34F0       _filelength\r
+ 0000:3531       _flushall\r
+ 0000:3625 idle  __OPENFP\r
+ 0000:36C1 idle  __GETFP\r
+ 0000:36EC       _fopen\r
+ 0000:370B       _fprintf\r
+ 0000:377E       _fseek\r
+ 0000:37E6 idle  _ftell\r
+ 0000:38AD       _getenv\r
+ 0000:390C       _itoa\r
+ 0000:3934       _ultoa\r
+ 0000:394E       _ltoa\r
+ 0000:3973       _memcpy\r
+ 0000:3992       _movedata\r
+ 0000:39DF       _open\r
+ 0000:3B37       __open\r
+ 0000:3B84       _printf\r
+ 0000:3B9B idle  __fputc\r
+ 0000:3BB4       _fputc\r
+ 0000:3CEA idle  _fputchar\r
+ 0000:3CFC       __FPUTN\r
+ 0000:3EA4       _puts\r
+ 0000:3EEF       ___read\r
+ 0000:3FBD       _read\r
+ 0000:3FC0       _setvbuf\r
+ 0000:4000 idle  FJARQQ\r
+ 0000:40C0       _sprintf\r
+ 0000:40DD idle  _vsprintf\r
+ 0000:40F9       _strcat\r
+ 0000:4132       _strlen\r
+ 0000:4176       _strtol\r
+ 0000:424B       ___write\r
+ 0000:4359       __write\r
+ 0000:4393       _write\r
+ 0000:4396       __xfclose\r
+ 0000:43BE       __xfflush\r
+ 0000:43E1       __fmemcmp\r
+ 0000:4409       __fmemcpy\r
+ 0000:442D idle  __fsetmem\r
+ 0000:4451       __fmemset\r
+ 0000:4470       __fstrcpy\r
+ 0000:4499       __fstricmp\r
+ 0000:44DA       __fstrlen\r
+ 0000:5C32  Abs  FIDRQQ\r
+ 0000:8000 idle  FJSRQQ\r
+ 0000:8087  Abs  __turboFloat\r
+ 0000:8087 idle  __floatconvert\r
+ 0000:A23D  Abs  FIWRQQ\r
+ 0000:C000 idle  FJCRQQ\r
+ 0000:FE32 idle  FIARQQ\r
+ 044F:000A idle  _FixedMul\r
+ 044F:0032 idle  _DrawSpans\r
+ 044F:0176 idle  _SetPlaneViewSize\r
+ 044F:027F idle  _DrawPlanes\r
+ 0489:000A       _MapRow\r
+ 0490:0006       _CheckIs386\r
+ 0490:000A       _jabhack2\r
+ 0491:000D idle  _ReadConfig\r
+ 0491:023E idle  _WriteConfig\r
+ 0491:036B idle  _Patch386\r
+ 0491:03CA       _NewGame\r
+ 0491:041B idle  _DiskFlopAnim\r
+ 0491:044A idle  _DoChecksum\r
+ 0491:0497       _SaveTheGame\r
+ 0491:08D5       _LoadTheGame\r
+ 0491:0D09       _ShutdownId\r
+ 0491:0D31 idle  _BuildTables\r
+ 0491:0E89 idle  _CalcProjection\r
+ 0491:0FC1 idle  _SetupWalls\r
+ 0491:0FE8 idle  _SignonScreen\r
+ 0491:1076 idle  _FinishSignon\r
+ 0491:111B       _MS_CheckParm\r
+ 0491:1185 idle  _InitDigiMap\r
+ 0491:11A6 idle  _DoJukebox\r
+ 0491:13C2 idle  _InitGame\r
+ 0491:156F       _SetViewSize\r
+ 0491:15F7       _ShowViewSize\r
+ 0491:1642       _NewViewSize\r
+ 0491:168A       _Quit\r
+ 0491:1770 idle  _DemoLoop\r
+ 0491:19AD       _main\r
+ 062D:000E idle  _RipToEOL\r
+ 062D:0021 idle  _ParseNumber\r
+ 062D:0075 idle  _ParsePicCommand\r
+ 062D:0093 idle  _ParseTimedCommand\r
+ 062D:00B8 idle  _TimedPicCommand\r
+ 062D:00FB idle  _HandleCommand\r
+ 062D:0362 idle  _NewLine\r
+ 062D:03BD idle  _HandleCtrls\r
+ 062D:03DF idle  _HandleWord\r
+ 062D:0490 idle  _PageLayout\r
+ 062D:0690 idle  _BackPage\r
+ 062D:06BA idle  _CacheLayoutGraphics\r
+ 062D:07A6 idle  _ShowArticle\r
+ 062D:08C9 idle  _HelpScreens\r
+ 062D:0957       _EndText\r
+ 06CD:0006       _US_ControlPanel\r
+ 06CD:01E9 idle  _DrawMainMenu\r
+ 06CD:02A6 idle  _BossKey\r
+ 06CD:02F3 idle  _CP_CheckQuick\r
+ 06CD:0865 idle  _CP_EndGame\r
+ 06CD:08C1       _CP_ViewScores\r
+ 06CD:092F idle  _CP_NewGame\r
+ 06CD:0AA0 idle  _DrawNewEpisode\r
+ 06CD:0B66 idle  _DrawNewGame\r
+ 06CD:0C08 idle  _DrawNewGameDiff\r
+ 06CD:0C24 idle  _CP_Sound\r
+ 06CD:0DD5 idle  _DrawSoundMenu\r
+ 06CD:0FFA idle  _DrawLSAction\r
+ 06CD:1091 idle  _CP_LoadGame\r
+ 06CD:1232 idle  _TrackWhichGame\r
+ 06CD:125D idle  _DrawLoadSaveScreen\r
+ 06CD:1327 idle  _PrintLSEntry\r
+ 06CD:13B7 idle  _CP_SaveGame\r
+ 06CD:171A idle  _CalibrateJoystick\r
+ 06CD:1977 idle  _CP_Control\r
+ 06CD:1A92 idle  _DrawMouseSens\r
+ 06CD:1BD1 idle  _MouseSensitivity\r
+ 06CD:1E13 idle  _DrawCtlScreen\r
+ 06CD:2002 idle  _CustomControls\r
+ 06CD:20B3 idle  _DefineMouseBtns\r
+ 06CD:20F8 idle  _DefineJoyBtns\r
+ 06CD:213E idle  _DefineKeyBtns\r
+ 06CD:2184 idle  _DefineKeyMove\r
+ 06CD:21CA idle  _EnterCtrlData\r
+ 06CD:2647 idle  _FixupCustom\r
+ 06CD:27F7 idle  _DrawCustomScreen\r
+ 06CD:2B05 idle  _PrintCustMouse\r
+ 06CD:2B4F idle  _DrawCustMouse\r
+ 06CD:2BAC idle  _PrintCustJoy\r
+ 06CD:2BF6 idle  _DrawCustJoy\r
+ 06CD:2C53 idle  _PrintCustKeybd\r
+ 06CD:2C8A idle  _DrawCustKeybd\r
+ 06CD:2CBC idle  _PrintCustKeys\r
+ 06CD:2CF2 idle  _DrawCustKeys\r
+ 06CD:2D24 idle  _CP_ChangeView\r
+ 06CD:2EB3 idle  _DrawChangeView\r
+ 06CD:2F41 idle  _CP_Quit\r
+ 06CD:2FD3       _IntroScreen\r
+ 06CD:31F5       _ClearMScreen\r
+ 06CD:3212       _CacheLump\r
+ 06CD:3231       _UnCacheLump\r
+ 06CD:3270       _DrawWindow\r
+ 06CD:32AA idle  _DrawOutline\r
+ 06CD:330F idle  _SetupControlPanel\r
+ 06CD:3431 idle  _CleanupControlPanel\r
+ 06CD:344B       _HandleMenu\r
+ 06CD:3953 idle  _EraseGun\r
+ 06CD:39D1 idle  _DrawHalfStep\r
+ 06CD:3A15 idle  _DrawGun\r
+ 06CD:3AD3 idle  _TicDelay\r
+ 06CD:3B11       _DrawMenu\r
+ 06CD:3BDF idle  _SetTextColor\r
+ 06CD:3C14 idle  _WaitKeyUp\r
+ 06CD:3C46 idle  _ReadAnyControl\r
+ 06CD:3DA8 idle  _Confirm\r
+ 06CD:3ED3       _Message\r
+ 06CD:400C       _StartCPMusic\r
+ 06CD:4099       _FreeMusic\r
+ 06CD:40BC idle  _IN_GetScanName\r
+ 06CD:4104 idle  _CheckPause\r
+ 06CD:4146 idle  _DrawMenuGun\r
+ 06CD:417D       _DrawStripes\r
+ 06CD:41B7 idle  _ShootSnd\r
+ 06CD:41C8       _CheckForEpisodes\r
+ 0B05:000E       _ClearSplitVWB\r
+ 0B05:003B       _Victory\r
+ 0B05:0448       _PG13\r
+ 0B05:04FF       _Write\r
+ 0B05:060A idle  _BJ_Breathe\r
+ 0B05:066B       _LevelCompleted\r
+ 0B05:106E idle  _PreloadUpdate\r
+ 0B05:110F       _PreloadGraphics\r
+ 0B05:11C2       _DrawHighScores\r
+ 0B05:13BD       _CheckHighScore\r
+ 0B05:1513 idle  _NonShareware\r
+ 0C63:0008 idle  _SetSoundLoc\r
+ 0C63:00FB       _PlaySoundLocGlobal\r
+ 0C63:014C       _UpdateSoundLoc\r
+ 0C63:017F       _ClearMemory\r
+ 0C63:019A idle  _ScanInfoPlane\r
+ 0C63:06A6       _SetupGameLevel\r
+ 0C63:095C idle  _DrawPlayBorderSides\r
+ 0C63:09F1       _DrawAllPlayBorderSides\r
+ 0C63:0A23       _DrawAllPlayBorder\r
+ 0C63:0A56       _DrawPlayBorder\r
+ 0C63:0B2E       _DrawPlayScreen\r
+ 0C63:0BDA idle  _StartDemoRecord\r
+ 0C63:0C31 idle  _FinishDemoRecord\r
+ 0C63:0D16       _RecordDemo\r
+ 0C63:0E72       _PlayDemo\r
+ 0C63:0FEF idle  _Died\r
+ 0C63:1229       _GameLoop\r
+ 0DA6:000D idle  _PollKeyboardButtons\r
+ 0DA6:0034 idle  _PollMouseButtons\r
+ 0DA6:0078 idle  _PollJoystickButtons\r
+ 0DA6:0109 idle  _PollKeyboardMove\r
+ 0DA6:0215 idle  _PollMouseMove\r
+ 0DA6:0253 idle  _PollJoystickMove\r
+ 0DA6:03D3 idle  _PollControls\r
+ 0DA6:060B       _CenterWindow\r
+ 0DA6:0639 idle  _CheckKeys\r
+ 0DA6:0A0B       _InitActorList\r
+ 0DA6:0A52       _GetNewActor\r
+ 0DA6:0AB4 idle  _RemoveObj\r
+ 0DA6:0B03       _StopMusic\r
+ 0DA6:0B3E       _StartMusic\r
+ 0DA6:0BBA       _InitRedShifts\r
+ 0DA6:0D2C idle  _ClearPaletteShifts\r
+ 0DA6:0D39       _StartBonusFlash\r
+ 0DA6:0D44       _StartDamageFlash\r
+ 0DA6:0D50 idle  _UpdatePaletteShifts\r
+ 0DA6:0E50       _FinishPaletteShifts\r
+ 0DA6:0E7E idle  _DoActor\r
+ 0DA6:101B       _PlayLoop\r
+ 0EC1:0004 idle  _DebugMemory\r
+ 0EC1:00C9 idle  _CountObjects\r
+ 0EC1:01C5       _PicturePause\r
+ 0EC1:02EE idle  _ShapeTest\r
+ 0EC1:07BB       _DebugKeys\r
+ 0F7A:000C       _FixedByFrac\r
+ 0F7A:004A idle  _TransformActor\r
+ 0F7A:018C idle  _TransformTile\r
+ 0F7A:02FE idle  _CalcHeight\r
+ 0F7A:0397 idle  _ScalePost\r
+ 0F7A:040E       _FarScalePost\r
+ 0F7A:0416       _HitVertWall\r
+ 0F7A:0536       _HitHorizWall\r
+ 0F7A:0659       _HitHorizDoor\r
+ 0F7A:0760       _HitVertDoor\r
+ 0F7A:086A       _HitHorizPWall\r
+ 0F7A:094B       _HitVertPWall\r
+ 0F7A:0A2C idle  _VGAClearScreen\r
+ 0F7A:0A9A idle  _CalcRotate\r
+ 0F7A:0B17 idle  _DrawScaleds\r
+ 0F7A:0D2B idle  _DrawPlayerWeapon\r
+ 0F7A:0DCB       _CalcTics\r
+ 0F7A:0E2E       _FixOfs\r
+ 0F7A:0E51 idle  _WallRefresh\r
+ 0F7A:0F3F       _ThreeDRefresh\r
+ 1079:0070       _AsmRefresh\r
+ 10BF:000E idle  _BadScale\r
+ 10BF:001F       _SetupScaling\r
+ 10BF:01E4 idle  _BuildCompScale\r
+ 10BF:0339 idle  _ScaleLine\r
+ 10BF:0487       _ScaleShape\r
+ 10BF:07A0       _SimpleScaleShape\r
+ 114B:0001       _SpawnNewObj\r
+ 114B:00B0       _NewState\r
+ 114B:00C8       _TryWalk\r
+ 114B:067A       _SelectDodgeDir\r
+ 114B:07AA       _SelectChaseDir\r
+ 114B:0904       _SelectRunDir\r
+ 114B:09CE       _MoveObj\r
+ 114B:0C16 idle  _DropItem\r
+ 114B:0CB1 idle  _KillActor\r
+ 114B:0FB1       _DamageActor\r
+ 114B:10B4       _CheckLine\r
+ 114B:1365 idle  _CheckSight\r
+ 114B:1471 idle  _FirstSighting\r
+ 114B:1784       _SightPlayer\r
+ 12D6:0000 idle  _CheckWeaponChange\r
+ 12D6:0034 idle  _ControlMovement\r
+ 12D6:01A5 idle  _StatusDrawPic\r
+ 12D6:01FE       _DrawFace\r
+ 12D6:0268 idle  _UpdateFace\r
+ 12D6:02AF idle  _LatchNumber\r
+ 12D6:033E       _DrawHealth\r
+ 12D6:035C       _TakeDamage\r
+ 12D6:03B6       _HealSelf\r
+ 12D6:03DD       _DrawLevel\r
+ 12D6:03FC       _DrawLives\r
+ 12D6:041A idle  _GiveExtraMan\r
+ 12D6:043A       _DrawScore\r
+ 12D6:045A       _GivePoints\r
+ 12D6:0497       _DrawWeapon\r
+ 12D6:04B2       _DrawKeys\r
+ 12D6:0517       _GiveWeapon\r
+ 12D6:0542       _DrawAmmo\r
+ 12D6:0560 idle  _GiveAmmo\r
+ 12D6:0595 idle  _GiveKey\r
+ 12D6:05AA       _GetBonus\r
+ 12D6:0825 idle  _TryMove\r
+ 12D6:09BD idle  _ClipMove\r
+ 12D6:0AE4 idle  _VictoryTile\r
+ 12D6:0AF4 idle  _Thrust\r
+ 12D6:0BDC idle  _Cmd_Fire\r
+ 12D6:0C2E idle  _Cmd_Use\r
+ 12D6:0D87       _SpawnPlayer\r
+ 12D6:0E27 idle  _KnifeAttack\r
+ 12D6:0EC0 idle  _GunAttack\r
+ 12D6:0FF7 idle  _VictorySpin\r
+ 12D6:10B7 idle  _T_Attack\r
+ 12D6:124A idle  _T_Player\r
+ 1402:000C       _InitStaticList\r
+ 1402:0017       _SpawnStatic\r
+ 1402:00E6       _PlaceItemType\r
+ 1402:0176 idle  _RecursiveConnect\r
+ 1402:01C4 idle  _ConnectAreas\r
+ 1402:01FD       _InitAreas\r
+ 1402:0225       _InitDoorList\r
+ 1402:025D       _SpawnDoor\r
+ 1402:0355       _OpenDoor\r
+ 1402:037E idle  _CloseDoor\r
+ 1402:05E1       _OperateDoor\r
+ 1402:0656 idle  _DoorOpen\r
+ 1402:0684 idle  _DoorOpening\r
+ 1402:07E6 idle  _DoorClosing\r
+ 1402:0922       _MoveDoors\r
+ 1402:0975       _PushWall\r
+ 1402:0B29       _MovePWalls\r
+ 14D6:000D idle  _A_Smoke\r
+ 14D6:005B idle  _ProjectileTryMove\r
+ 14D6:00FE idle  _T_Projectile\r
+ 14D6:032D       _SpawnStand\r
+ 14D6:04E0       _SpawnDeadGuard\r
+ 14D6:0500       _SpawnBoss\r
+ 14D6:0553       _SpawnGretel\r
+ 14D6:05A6       _SpawnPatrol\r
+ 14D6:0761       _A_DeathScream\r
+ 14D6:0950       _SpawnGhosts\r
+ 14D6:09DA       _SpawnSchabbs\r
+ 14D6:0A42       _SpawnGift\r
+ 14D6:0AAA       _SpawnFat\r
+ 14D6:0B12 idle  _T_SchabbThrow\r
+ 14D6:0C33 idle  _T_GiftThrow\r
+ 14D6:0D54 idle  _T_Schabb\r
+ 14D6:0EE4 idle  _T_Gift\r
+ 14D6:1074 idle  _T_Fat\r
+ 14D6:1204       _SpawnFakeHitler\r
+ 14D6:126C       _SpawnHitler\r
+ 14D6:12D4 idle  _A_HitlerMorph\r
+ 14D6:1366 idle  _A_MechaSound\r
+ 14D6:1398 idle  _A_Slurpie\r
+ 14D6:13A9 idle  _T_FakeFire\r
+ 14D6:14CA idle  _T_Fake\r
+ 14D6:15A9 idle  _T_Stand\r
+ 14D6:15B9 idle  _T_Chase\r
+ 14D6:1836 idle  _T_Ghosts\r
+ 14D6:18E6 idle  _T_DogChase\r
+ 14D6:1A4F idle  _SelectPathDir\r
+ 14D6:1A9B idle  _T_Path\r
+ 14D6:1BD1 idle  _T_Shoot\r
+ 14D6:1DCC idle  _T_Bite\r
+ 14D6:1EAA       _SpawnBJVictory\r
+ 14D6:1EFE idle  _T_BJRun\r
+ 14D6:1F9B idle  _T_BJJump\r
+ 14D6:1FC6 idle  _T_BJYell\r
+ 14D6:1FE8 idle  _T_BJDone\r
+ 14D6:1FF3 idle  _CheckPosition\r
+ 14D6:2092 idle  _A_StartDeathCam\r
+ 1710:000B idle  _GRFILEPOS\r
+ 1710:005B idle  _CA_OpenDebug\r
+ 1710:007F idle  _CA_CloseDebug\r
+ 1710:0090 idle  _CAL_GetGrChunkLength\r
+ 1710:00F0       _CA_FarRead\r
+ 1710:013C       _CA_FarWrite\r
+ 1710:0188 idle  _CA_ReadFile\r
+ 1710:01FA       _CA_WriteFile\r
+ 1710:0252 idle  _CA_LoadFile\r
+ 1710:02D3 idle  _CAL_OptimizeNodes\r
+ 1710:032B idle  _CAL_HuffExpand\r
+ 1710:0498 idle  _CAL_CarmackExpand\r
+ 1710:05B6 idle  _CA_RLEWCompress\r
+ 1710:0703 idle  _CA_RLEWexpand\r
+ 1710:07BF idle  _CAL_SetupGrFile\r
+ 1710:09F4 idle  _CAL_SetupMapFile\r
+ 1710:0BBC idle  _CAL_SetupAudioFile\r
+ 1710:0CF0       _CA_Startup\r
+ 1710:0D11       _CA_Shutdown\r
+ 1710:0D3A       _CA_CacheAudioChunk\r
+ 1710:0DE9       _CA_LoadAllSounds\r
+ 1710:0E6E idle  _CAL_ExpandGrChunk\r
+ 1710:0F45       _CA_CacheGrChunk\r
+ 1710:108C       _CA_CacheScreen\r
+ 1710:1181       _CA_CacheMap\r
+ 1710:12E1       _CA_UpLevel\r
+ 1710:1326       _CA_DownLevel\r
+ 1710:134D idle  _CA_ClearMarks\r
+ 1710:136E idle  _CA_ClearAllMarks\r
+ 1710:1394 idle  _CA_SetGrPurge\r
+ 1710:13C2       _CA_SetAllPurge\r
+ 1710:13F0       _CA_CacheMarks\r
+ 1710:16FC idle  _CA_CannotOpen\r
+ 1885:0151       _IN_GetJoyAbs\r
+ 1885:01EC       _INL_GetJoyDelta\r
+ 1885:035A idle  _IN_GetJoyButtonsDB\r
+ 1885:04CB       _IN_SetupJoy\r
+ 1885:05B8       _IN_Startup\r
+ 1885:0659 idle  _IN_Default\r
+ 1885:0699       _IN_Shutdown\r
+ 1885:06C5 idle  _IN_SetKeyHook\r
+ 1885:06D7       _IN_ClearKeysDown\r
+ 1885:06F6       _IN_ReadControl\r
+ 1885:0A18 idle  _IN_SetControlType\r
+ 1885:0A29 idle  _IN_WaitForKey\r
+ 1885:0A47       _IN_WaitForASCII\r
+ 1885:0A64       _IN_StartAck\r
+ 1885:0AB4       _IN_CheckAck\r
+ 1885:0B0E       _IN_Ack\r
+ 1885:0B1F       _IN_UserInput\r
+ 1885:0B64       _IN_MouseButtons\r
+ 1885:0B7B       _IN_JoyButtons\r
+ 193E:0001 idle  _MML_CheckForXMS\r
+ 193E:001C idle  _MML_SetupXMS\r
+ 193E:008B idle  _MML_ShutdownXMS\r
+ 193E:00BC       _MML_UseSpace\r
+ 193E:0242 idle  _MML_ClearBlock\r
+ 193E:02A8       _MM_Startup\r
+ 193E:049B       _MM_Shutdown\r
+ 193E:04C3       _MM_GetPtr\r
+ 193E:0780       _MM_FreePtr\r
+ 193E:0847       _MM_SetPurge\r
+ 193E:08C8       _MM_SetLock\r
+ 193E:094E       _MM_SortMem\r
+ 193E:0B0A idle  _MM_ShowMemory\r
+ 193E:0C67 idle  _MM_DumpData\r
+ 193E:0D98       _MM_UnusedMemory\r
+ 193E:0DFF       _MM_TotalFree\r
+ 193E:0E7D       _MM_BombOnError\r
+ 1A26:0008 idle  _PML_MapEMS\r
+ 1A26:002B idle  _PML_StartupEMS\r
+ 1A26:0160 idle  _PML_ShutdownEMS\r
+ 1A26:0184 idle  _PML_StartupXMS\r
+ 1A26:01F7 idle  _PML_XMSCopy\r
+ 1A26:02A4 idle  _PML_ShutdownXMS\r
+ 1A26:02CA       _PM_SetMainMemPurge\r
+ 1A26:02F3       _PM_CheckMainMem\r
+ 1A26:03EC idle  _PML_StartupMainMem\r
+ 1A26:0469 idle  _PML_ShutdownMainMem\r
+ 1A26:0490 idle  _PML_ReadFromFile\r
+ 1A26:0510 idle  _PML_OpenPageFile\r
+ 1A26:06F7 idle  _PML_ClosePageFile\r
+ 1A26:0731 idle  _PML_GetEMSAddress\r
+ 1A26:080D       _PM_GetPageAddress\r
+ 1A26:0866 idle  _PML_GiveLRUPage\r
+ 1A26:0907 idle  _PML_GiveLRUXMSPage\r
+ 1A26:0979 idle  _PML_PutPageInXMS\r
+ 1A26:0A28 idle  _PML_TransferPageSpace\r
+ 1A26:0AFB idle  _PML_GetAPageBuffer\r
+ 1A26:0C08 idle  _PML_GetPageFromXMS\r
+ 1A26:0C8C idle  _PML_LoadPage\r
+ 1A26:0CDE       _PM_GetPage\r
+ 1A26:0DA0       _PM_SetPageLock\r
+ 1A26:0DD0       _PM_Preload\r
+ 1A26:1036       _PM_NextFrame\r
+ 1A26:10B0 idle  _PM_Reset\r
+ 1A26:111E       _PM_Startup\r
+ 1A26:11CF       _PM_Shutdown\r
+ 1B44:0511 idle  _SDL_SBSetDMA\r
+ 1B44:08CF idle  _SDL_LoadDigiSegment\r
+ 1B44:0904 idle  _SDL_PlayDigiSegment\r
+ 1B44:094E       _SD_StopDigitized\r
+ 1B44:09F0       _SD_Poll\r
+ 1B44:0A7C       _SD_SetPosition\r
+ 1B44:0AC4 idle  _SD_PlayDigitized\r
+ 1B44:0B88       _SDL_DigitizedDone\r
+ 1B44:0BF2       _SD_SetDigiDevice\r
+ 1B44:0C56 idle  _SDL_SetupDigi\r
+ 1B44:0D39       _alOut\r
+ 1B44:10F4       _SD_SetSoundMode\r
+ 1B44:1184       _SD_SetMusicMode\r
+ 1B44:11D6       _SD_Startup\r
+ 1B44:1525 idle  _SD_Default\r
+ 1B44:1594       _SD_Shutdown\r
+ 1B44:15EF idle  _SD_SetUserHook\r
+ 1B44:1601       _SD_PositionSound\r
+ 1B44:1618       _SD_PlaySound\r
+ 1B44:17C9       _SD_SoundPlaying\r
+ 1B44:1810       _SD_StopSound\r
+ 1B44:1847       _SD_WaitSoundDone\r
+ 1B44:1854       _SD_MusicOn\r
+ 1B44:185F       _SD_MusicOff\r
+ 1B44:18AC       _SD_StartMusic\r
+ 1B44:18FE idle  _SD_FadeOutMusic\r
+ 1B44:190F idle  _SD_MusicPlaying\r
+ 1CD6:000A       _SDL_SetDS\r
+ 1CD6:0012       _SDL_IndicatePC\r
+ 1CD6:001E       _SDL_t0ExtremeAsmService\r
+ 1CD6:00B8       _SDL_t0FastAsmService\r
+ 1CD6:031A       _SDL_t0SlowAsmService\r
+ 1D1D:0005 idle  _USL_HardError\r
+ 1D1D:013D       _US_Startup\r
+ 1D1D:0213       _US_Shutdown\r
+ 1D1D:0225       _US_CheckParm\r
+ 1D1D:02CF idle  _US_SetPrintRoutines\r
+ 1D1D:02EE       _US_Print\r
+ 1D1D:0394       _US_PrintUnsigned\r
+ 1D1D:03BD idle  _US_PrintSigned\r
+ 1D1D:03E6 idle  _USL_PrintInCenter\r
+ 1D1D:0446       _US_PrintCentered\r
+ 1D1D:048A idle  _US_CPrintLine\r
+ 1D1D:04EA       _US_CPrint\r
+ 1D1D:0555       _US_ClearWindow\r
+ 1D1D:0582       _US_DrawWindow\r
+ 1D1D:06A2 idle  _US_CenterWindow\r
+ 1D1D:06C6 idle  _US_SaveWindow\r
+ 1D1D:06F3 idle  _US_RestoreWindow\r
+ 1D1D:07BB       _US_LineInput\r
+ 1DDD:000A       _US_InitRndT\r
+ 1DDD:0032       _US_RndT\r
+ 1DE1:000D       _VL_Startup\r
+ 1DE1:006B       _VL_Shutdown\r
+ 1DE1:0075       _VL_SetVGAPlaneMode\r
+ 1DE1:009A idle  _VL_SetTextMode\r
+ 1DE1:00A4 idle  _VL_ClearVideo\r
+ 1DE1:00CE idle  _VL_DePlaneVGA\r
+ 1DE1:0126 idle  _VL_SetLineWidth\r
+ 1DE1:015B idle  _VL_SetSplitScreen\r
+ 1DE1:01AA idle  _VL_FillPalette\r
+ 1DE1:01CF idle  _VL_SetColor\r
+ 1DE1:01EA idle  _VL_GetColor\r
+ 1DE1:0215       _VL_SetPalette\r
+ 1DE1:023E idle  _VL_GetPalette\r
+ 1DE1:025F       _VL_FadeOut\r
+ 1DE1:038C       _VL_FadeIn\r
+ 1DE1:0471       _VL_TestPaletteSet\r
+ 1DE1:04D5       _VL_ColorBorder\r
+ 1DE1:04E9       _VL_Plot\r
+ 1DE1:0539       _VL_Hlin\r
+ 1DE1:0618       _VL_Vlin\r
+ 1DE1:0682       _VL_Bar\r
+ 1DE1:0789       _VL_MemToLatch\r
+ 1DE1:07DE       _VL_MemToScreen\r
+ 1DE1:087B idle  _VL_MaskedToScreen\r
+ 1DE1:090B       _VL_LatchToScreen\r
+ 1DE1:0975 idle  _VL_DrawTile8String\r
+ 1DE1:0AA5 idle  _VL_DrawLatch8String\r
+ 1DE1:0B56 idle  _VL_SizeTile8String\r
+ 1E99:0000 idle  _VW_DrawPropString\r
+ 1E99:0117 idle  _VW_DrawColorPropString\r
+ 1E99:0236       _VL_MungePic\r
+ 1E99:02FA idle  _VWL_MeasureString\r
+ 1E99:033A       _VW_MeasurePropString\r
+ 1E99:035C idle  _VW_MeasureMPropString\r
+ 1E99:037E       _VW_MarkUpdateBlock\r
+ 1E99:044C       _VWB_DrawTile8\r
+ 1E99:0494 idle  _VWB_DrawTile8M\r
+ 1E99:04DB       _VWB_DrawPic\r
+ 1E99:054A       _VWB_DrawPropString\r
+ 1E99:0583       _VWB_Bar\r
+ 1E99:05BF       _VWB_Plot\r
+ 1E99:05EA       _VWB_Hlin\r
+ 1E99:061E       _VWB_Vlin\r
+ 1E99:0652       _VW_UpdateScreen\r
+ 1E99:065C       _LatchDrawPic\r
+ 1E99:06B9       _LoadLatchMem\r
+ 1E99:07DA       _FizzleFade\r
+ 1F2B:000A       _VL_WaitVBL\r
+ 1F2B:0021 idle  _VL_SetCRTC\r
+ 1F2B:0045       _VL_SetScreen\r
+ 1F2B:00B2       _VL_ScreenToScreen\r
+ 1F2B:0132       _VL_VideoID\r
+ 1F54:000E       _VH_UpdateScreen\r
+ 1F75:2152       e086_Entry\r
+ 1F75:26E0       e086_Shortcut\r
+ 21ED:0306       e087_Entry\r
+ 21ED:03C6       e087_Shortcut\r
+ 21ED:0430       e087_Trap\r
+ 224A:0000       _planepics\r
+ 244A:0002 idle  _rndtable\r
+ 245B:0000 idle  _MusicMenu\r
+ 248B:0000 idle  _endStrings\r
+ 24B8:0000       _MainMenu\r
+ 24D0:0000 idle  _SndMenu\r
+ 24F0:0000 idle  _CtlMenu\r
+ 2500:0000 idle  _NewEmenu\r
+ 251D:0000 idle  _NewMenu\r
+ 2528:0000 idle  _LSMenu\r
+ 2543:0000 idle  _CusMenu\r
+ 255E:0000       _signon\r
+ 3516:0000       _areaconnect\r
+ 356C:0000       _sintable\r
+ 35DD:0000       _finetangent\r
+ 36BE:0000       _grneeded\r
+ 36C8:0000       _whiteshifts\r
+ 37E8:0000       _redshifts\r
+ 3908:0000       _mmblocks\r
+ 3B15:0000       _palette2\r
+ 3B45:0000       _palette1\r
+ 3B75:0000 idle  DATASEG@\r
+ 3B75:00A3 idle  __Int0Vector\r
+ 3B75:00A7 idle  __Int4Vector\r
+ 3B75:00AB idle  __Int5Vector\r
+ 3B75:00AF idle  __Int6Vector\r
+ 3B75:00B3       __C0argc\r
+ 3B75:00B5       __C0argv\r
+ 3B75:00B7       __C0environ\r
+ 3B75:00B9       __envLng\r
+ 3B75:00BB       __envseg\r
+ 3B75:00BD       __envSize\r
+ 3B75:00BF       __psp\r
+ 3B75:00C1 idle  __osversion\r
+ 3B75:00C1       __osmajor\r
+ 3B75:00C1       __version\r
+ 3B75:00C2 idle  __osminor\r
+ 3B75:00C3       _errno\r
+ 3B75:00C5 idle  __StartTime\r
+ 3B75:00C9 idle  ___heapbase\r
+ 3B75:00CB       ___brklvl\r
+ 3B75:00CD       __heapbase\r
+ 3B75:00D1       __brklvl\r
+ 3B75:00D5       __heaptop\r
+ 3B75:00DA idle  _halfheight\r
+ 3B75:00DC       _dirangle\r
+ 3B75:00EE       _configname\r
+ 3B75:00FC idle  _JHParmStrings\r
+ 3B75:0102 idle  _radtoint\r
+ 3B75:01C4 idle  _MusicItems\r
+ 3B75:01FC idle  _nosprtxt\r
+ 3B75:0330 idle  _endextern\r
+ 3B75:0332 idle  _helpextern\r
+ 3B75:0334 idle  _helpfilename\r
+ 3B75:0341       _endfilename\r
+ 3B75:03D2       _MainItems\r
+ 3B75:03DC idle  _SndItems\r
+ 3B75:03E6 idle  _LSItems\r
+ 3B75:03F0 idle  _CtlItems\r
+ 3B75:03FA idle  _CusItems\r
+ 3B75:0404 idle  _NewEitems\r
+ 3B75:040E idle  _NewItems\r
+ 3B75:0418 idle  _color_hlite\r
+ 3B75:0420 idle  _color_norml\r
+ 3B75:0428 idle  _EpisodeSelect\r
+ 3B75:0434 idle  _SoundStatus\r
+ 3B75:0436 idle  _SaveName\r
+ 3B75:05F2 idle  _mbarray\r
+ 3B75:05FE idle  _order\r
+ 3B75:0622 idle  _moveorder\r
+ 3B75:0E74 idle  _ElevatorBackTo\r
+ 3B75:0E80 idle  _righttable\r
+ 3B75:1042 idle  _lefttable\r
+ 3B75:1204       _demoname\r
+ 3B75:1270       _dirscan\r
+ 3B75:1278       _buttonscan\r
+ 3B75:1288       _buttonmouse\r
+ 3B75:1290       _buttonjoy\r
+ 3B75:1298 idle  _songs\r
+ 3B75:1684       _screenloc\r
+ 3B75:168A       _freelatch\r
+ 3B75:168C       _tileglobal\r
+ 3B75:1690 idle  _mindist\r
+ 3B75:1694       _costable\r
+ 3B75:1698 idle  _vgaCeiling\r
+ 3B75:1710 idle  _weaponscale\r
+ 3B75:171A       _mapmasks1\r
+ 3B75:173A       _mapmasks2\r
+ 3B75:175A       _mapmasks3\r
+ 3B75:177A idle  _wordmasks\r
+ 3B75:180C idle  _opposite\r
+ 3B75:181E idle  _diagonal\r
+ 3B75:190C idle  _s_player\r
+ 3B75:191C idle  _s_attack\r
+ 3B75:192C idle  _attackinfo\r
+ 3B75:1A0C idle  _strafeangle\r
+ 3B75:1A1E idle  _statinfo\r
+ 3B75:1B38 idle  _dirtable\r
+ 3B75:1B4A idle  _starthitpoints\r
+ 3B75:1BFA idle  _s_rocket\r
+ 3B75:1C0A idle  _s_smoke1\r
+ 3B75:1C1A idle  _s_smoke2\r
+ 3B75:1C2A idle  _s_smoke3\r
+ 3B75:1C3A idle  _s_smoke4\r
+ 3B75:1C4A idle  _s_boom1\r
+ 3B75:1C5A idle  _s_boom2\r
+ 3B75:1C6A idle  _s_boom3\r
+ 3B75:1C7A idle  _s_grdstand\r
+ 3B75:1C8A idle  _s_grdpath1\r
+ 3B75:1C9A idle  _s_grdpath1s\r
+ 3B75:1CAA idle  _s_grdpath2\r
+ 3B75:1CBA idle  _s_grdpath3\r
+ 3B75:1CCA idle  _s_grdpath3s\r
+ 3B75:1CDA idle  _s_grdpath4\r
+ 3B75:1CEA       _s_grdpain\r
+ 3B75:1CFA       _s_grdpain1\r
+ 3B75:1D0A idle  _s_grdshoot1\r
+ 3B75:1D1A idle  _s_grdshoot2\r
+ 3B75:1D2A idle  _s_grdshoot3\r
+ 3B75:1D3A       _s_grdchase1\r
+ 3B75:1D4A idle  _s_grdchase1s\r
+ 3B75:1D5A idle  _s_grdchase2\r
+ 3B75:1D6A idle  _s_grdchase3\r
+ 3B75:1D7A idle  _s_grdchase3s\r
+ 3B75:1D8A idle  _s_grdchase4\r
+ 3B75:1D9A       _s_grddie1\r
+ 3B75:1DAA idle  _s_grddie2\r
+ 3B75:1DBA idle  _s_grddie3\r
+ 3B75:1DCA idle  _s_grddie4\r
+ 3B75:1DDA       _s_blinkychase1\r
+ 3B75:1DEA idle  _s_blinkychase2\r
+ 3B75:1DFA idle  _s_inkychase1\r
+ 3B75:1E0A idle  _s_inkychase2\r
+ 3B75:1E1A idle  _s_pinkychase1\r
+ 3B75:1E2A idle  _s_pinkychase2\r
+ 3B75:1E3A idle  _s_clydechase1\r
+ 3B75:1E4A idle  _s_clydechase2\r
+ 3B75:1E5A idle  _s_dogpath1\r
+ 3B75:1E6A idle  _s_dogpath1s\r
+ 3B75:1E7A idle  _s_dogpath2\r
+ 3B75:1E8A idle  _s_dogpath3\r
+ 3B75:1E9A idle  _s_dogpath3s\r
+ 3B75:1EAA idle  _s_dogpath4\r
+ 3B75:1EBA idle  _s_dogjump1\r
+ 3B75:1ECA idle  _s_dogjump2\r
+ 3B75:1EDA idle  _s_dogjump3\r
+ 3B75:1EEA idle  _s_dogjump4\r
+ 3B75:1EFA idle  _s_dogjump5\r
+ 3B75:1F0A       _s_dogchase1\r
+ 3B75:1F1A idle  _s_dogchase1s\r
+ 3B75:1F2A idle  _s_dogchase2\r
+ 3B75:1F3A idle  _s_dogchase3\r
+ 3B75:1F4A idle  _s_dogchase3s\r
+ 3B75:1F5A idle  _s_dogchase4\r
+ 3B75:1F6A       _s_dogdie1\r
+ 3B75:1F7A idle  _s_dogdie2\r
+ 3B75:1F8A idle  _s_dogdie3\r
+ 3B75:1F9A idle  _s_dogdead\r
+ 3B75:1FAA idle  _s_ofcstand\r
+ 3B75:1FBA idle  _s_ofcpath1\r
+ 3B75:1FCA idle  _s_ofcpath1s\r
+ 3B75:1FDA idle  _s_ofcpath2\r
+ 3B75:1FEA idle  _s_ofcpath3\r
+ 3B75:1FFA idle  _s_ofcpath3s\r
+ 3B75:200A idle  _s_ofcpath4\r
+ 3B75:201A       _s_ofcpain\r
+ 3B75:202A       _s_ofcpain1\r
+ 3B75:203A idle  _s_ofcshoot1\r
+ 3B75:204A idle  _s_ofcshoot2\r
+ 3B75:205A idle  _s_ofcshoot3\r
+ 3B75:206A       _s_ofcchase1\r
+ 3B75:207A idle  _s_ofcchase1s\r
+ 3B75:208A idle  _s_ofcchase2\r
+ 3B75:209A idle  _s_ofcchase3\r
+ 3B75:20AA idle  _s_ofcchase3s\r
+ 3B75:20BA idle  _s_ofcchase4\r
+ 3B75:20CA       _s_ofcdie1\r
+ 3B75:20DA idle  _s_ofcdie2\r
+ 3B75:20EA idle  _s_ofcdie3\r
+ 3B75:20FA idle  _s_ofcdie4\r
+ 3B75:210A idle  _s_ofcdie5\r
+ 3B75:211A idle  _s_mutstand\r
+ 3B75:212A idle  _s_mutpath1\r
+ 3B75:213A idle  _s_mutpath1s\r
+ 3B75:214A idle  _s_mutpath2\r
+ 3B75:215A idle  _s_mutpath3\r
+ 3B75:216A idle  _s_mutpath3s\r
+ 3B75:217A idle  _s_mutpath4\r
+ 3B75:218A       _s_mutpain\r
+ 3B75:219A       _s_mutpain1\r
+ 3B75:21AA idle  _s_mutshoot1\r
+ 3B75:21BA idle  _s_mutshoot2\r
+ 3B75:21CA idle  _s_mutshoot3\r
+ 3B75:21DA idle  _s_mutshoot4\r
+ 3B75:21EA       _s_mutchase1\r
+ 3B75:21FA idle  _s_mutchase1s\r
+ 3B75:220A idle  _s_mutchase2\r
+ 3B75:221A idle  _s_mutchase3\r
+ 3B75:222A idle  _s_mutchase3s\r
+ 3B75:223A idle  _s_mutchase4\r
+ 3B75:224A       _s_mutdie1\r
+ 3B75:225A idle  _s_mutdie2\r
+ 3B75:226A idle  _s_mutdie3\r
+ 3B75:227A idle  _s_mutdie4\r
+ 3B75:228A idle  _s_mutdie5\r
+ 3B75:229A idle  _s_ssstand\r
+ 3B75:22AA idle  _s_sspath1\r
+ 3B75:22BA idle  _s_sspath1s\r
+ 3B75:22CA idle  _s_sspath2\r
+ 3B75:22DA idle  _s_sspath3\r
+ 3B75:22EA idle  _s_sspath3s\r
+ 3B75:22FA idle  _s_sspath4\r
+ 3B75:230A       _s_sspain\r
+ 3B75:231A       _s_sspain1\r
+ 3B75:232A idle  _s_ssshoot1\r
+ 3B75:233A idle  _s_ssshoot2\r
+ 3B75:234A idle  _s_ssshoot3\r
+ 3B75:235A idle  _s_ssshoot4\r
+ 3B75:236A idle  _s_ssshoot5\r
+ 3B75:237A idle  _s_ssshoot6\r
+ 3B75:238A idle  _s_ssshoot7\r
+ 3B75:239A idle  _s_ssshoot8\r
+ 3B75:23AA idle  _s_ssshoot9\r
+ 3B75:23BA       _s_sschase1\r
+ 3B75:23CA idle  _s_sschase1s\r
+ 3B75:23DA idle  _s_sschase2\r
+ 3B75:23EA idle  _s_sschase3\r
+ 3B75:23FA idle  _s_sschase3s\r
+ 3B75:240A idle  _s_sschase4\r
+ 3B75:241A       _s_ssdie1\r
+ 3B75:242A idle  _s_ssdie2\r
+ 3B75:243A idle  _s_ssdie3\r
+ 3B75:244A idle  _s_ssdie4\r
+ 3B75:245A idle  _s_bossstand\r
+ 3B75:246A       _s_bosschase1\r
+ 3B75:247A idle  _s_bosschase1s\r
+ 3B75:248A idle  _s_bosschase2\r
+ 3B75:249A idle  _s_bosschase3\r
+ 3B75:24AA idle  _s_bosschase3s\r
+ 3B75:24BA idle  _s_bosschase4\r
+ 3B75:24CA       _s_bossdie1\r
+ 3B75:24DA idle  _s_bossdie2\r
+ 3B75:24EA idle  _s_bossdie3\r
+ 3B75:24FA idle  _s_bossdie4\r
+ 3B75:250A idle  _s_bossshoot1\r
+ 3B75:251A idle  _s_bossshoot2\r
+ 3B75:252A idle  _s_bossshoot3\r
+ 3B75:253A idle  _s_bossshoot4\r
+ 3B75:254A idle  _s_bossshoot5\r
+ 3B75:255A idle  _s_bossshoot6\r
+ 3B75:256A idle  _s_bossshoot7\r
+ 3B75:257A idle  _s_bossshoot8\r
+ 3B75:258A idle  _s_gretelstand\r
+ 3B75:259A       _s_gretelchase1\r
+ 3B75:25AA idle  _s_gretelchase1s\r
+ 3B75:25BA idle  _s_gretelchase2\r
+ 3B75:25CA idle  _s_gretelchase3\r
+ 3B75:25DA idle  _s_gretelchase3s\r
+ 3B75:25EA idle  _s_gretelchase4\r
+ 3B75:25FA       _s_greteldie1\r
+ 3B75:260A idle  _s_greteldie2\r
+ 3B75:261A idle  _s_greteldie3\r
+ 3B75:262A idle  _s_greteldie4\r
+ 3B75:263A idle  _s_gretelshoot1\r
+ 3B75:264A idle  _s_gretelshoot2\r
+ 3B75:265A idle  _s_gretelshoot3\r
+ 3B75:266A idle  _s_gretelshoot4\r
+ 3B75:267A idle  _s_gretelshoot5\r
+ 3B75:268A idle  _s_gretelshoot6\r
+ 3B75:269A idle  _s_gretelshoot7\r
+ 3B75:26AA idle  _s_gretelshoot8\r
+ 3B75:26CC idle  _s_schabbstand\r
+ 3B75:26DC       _s_schabbchase1\r
+ 3B75:26EC idle  _s_schabbchase1s\r
+ 3B75:26FC idle  _s_schabbchase2\r
+ 3B75:270C idle  _s_schabbchase3\r
+ 3B75:271C idle  _s_schabbchase3s\r
+ 3B75:272C idle  _s_schabbchase4\r
+ 3B75:273C idle  _s_schabbdeathcam\r
+ 3B75:274C       _s_schabbdie1\r
+ 3B75:275C idle  _s_schabbdie2\r
+ 3B75:276C idle  _s_schabbdie3\r
+ 3B75:277C idle  _s_schabbdie4\r
+ 3B75:278C idle  _s_schabbdie5\r
+ 3B75:279C idle  _s_schabbdie6\r
+ 3B75:27AC idle  _s_schabbshoot1\r
+ 3B75:27BC idle  _s_schabbshoot2\r
+ 3B75:27CC idle  _s_needle1\r
+ 3B75:27DC idle  _s_needle2\r
+ 3B75:27EC idle  _s_needle3\r
+ 3B75:27FC idle  _s_needle4\r
+ 3B75:280C idle  _s_giftstand\r
+ 3B75:281C       _s_giftchase1\r
+ 3B75:282C idle  _s_giftchase1s\r
+ 3B75:283C idle  _s_giftchase2\r
+ 3B75:284C idle  _s_giftchase3\r
+ 3B75:285C idle  _s_giftchase3s\r
+ 3B75:286C idle  _s_giftchase4\r
+ 3B75:287C idle  _s_giftdeathcam\r
+ 3B75:288C       _s_giftdie1\r
+ 3B75:289C idle  _s_giftdie2\r
+ 3B75:28AC idle  _s_giftdie3\r
+ 3B75:28BC idle  _s_giftdie4\r
+ 3B75:28CC idle  _s_giftdie5\r
+ 3B75:28DC idle  _s_giftdie6\r
+ 3B75:28EC idle  _s_giftshoot1\r
+ 3B75:28FC idle  _s_giftshoot2\r
+ 3B75:290C idle  _s_fatstand\r
+ 3B75:291C       _s_fatchase1\r
+ 3B75:292C idle  _s_fatchase1s\r
+ 3B75:293C idle  _s_fatchase2\r
+ 3B75:294C idle  _s_fatchase3\r
+ 3B75:295C idle  _s_fatchase3s\r
+ 3B75:296C idle  _s_fatchase4\r
+ 3B75:297C idle  _s_fatdeathcam\r
+ 3B75:298C       _s_fatdie1\r
+ 3B75:299C idle  _s_fatdie2\r
+ 3B75:29AC idle  _s_fatdie3\r
+ 3B75:29BC idle  _s_fatdie4\r
+ 3B75:29CC idle  _s_fatdie5\r
+ 3B75:29DC idle  _s_fatdie6\r
+ 3B75:29EC idle  _s_fatshoot1\r
+ 3B75:29FC idle  _s_fatshoot2\r
+ 3B75:2A0C idle  _s_fatshoot3\r
+ 3B75:2A1C idle  _s_fatshoot4\r
+ 3B75:2A2C idle  _s_fatshoot5\r
+ 3B75:2A3C idle  _s_fatshoot6\r
+ 3B75:2A4C idle  _s_fakestand\r
+ 3B75:2A5C       _s_fakechase1\r
+ 3B75:2A6C idle  _s_fakechase1s\r
+ 3B75:2A7C idle  _s_fakechase2\r
+ 3B75:2A8C idle  _s_fakechase3\r
+ 3B75:2A9C idle  _s_fakechase3s\r
+ 3B75:2AAC idle  _s_fakechase4\r
+ 3B75:2ABC       _s_fakedie1\r
+ 3B75:2ACC idle  _s_fakedie2\r
+ 3B75:2ADC idle  _s_fakedie3\r
+ 3B75:2AEC idle  _s_fakedie4\r
+ 3B75:2AFC idle  _s_fakedie5\r
+ 3B75:2B0C idle  _s_fakedie6\r
+ 3B75:2B1C idle  _s_fakeshoot1\r
+ 3B75:2B2C idle  _s_fakeshoot2\r
+ 3B75:2B3C idle  _s_fakeshoot3\r
+ 3B75:2B4C idle  _s_fakeshoot4\r
+ 3B75:2B5C idle  _s_fakeshoot5\r
+ 3B75:2B6C idle  _s_fakeshoot6\r
+ 3B75:2B7C idle  _s_fakeshoot7\r
+ 3B75:2B8C idle  _s_fakeshoot8\r
+ 3B75:2B9C idle  _s_fakeshoot9\r
+ 3B75:2BAC idle  _s_fire1\r
+ 3B75:2BBC idle  _s_fire2\r
+ 3B75:2BCC idle  _s_mechastand\r
+ 3B75:2BDC       _s_mechachase1\r
+ 3B75:2BEC idle  _s_mechachase1s\r
+ 3B75:2BFC idle  _s_mechachase2\r
+ 3B75:2C0C idle  _s_mechachase3\r
+ 3B75:2C1C idle  _s_mechachase3s\r
+ 3B75:2C2C idle  _s_mechachase4\r
+ 3B75:2C3C       _s_mechadie1\r
+ 3B75:2C4C idle  _s_mechadie2\r
+ 3B75:2C5C idle  _s_mechadie3\r
+ 3B75:2C6C idle  _s_mechadie4\r
+ 3B75:2C7C idle  _s_mechashoot1\r
+ 3B75:2C8C idle  _s_mechashoot2\r
+ 3B75:2C9C idle  _s_mechashoot3\r
+ 3B75:2CAC idle  _s_mechashoot4\r
+ 3B75:2CBC idle  _s_mechashoot5\r
+ 3B75:2CCC idle  _s_mechashoot6\r
+ 3B75:2CDC       _s_hitlerchase1\r
+ 3B75:2CEC idle  _s_hitlerchase1s\r
+ 3B75:2CFC idle  _s_hitlerchase2\r
+ 3B75:2D0C idle  _s_hitlerchase3\r
+ 3B75:2D1C idle  _s_hitlerchase3s\r
+ 3B75:2D2C idle  _s_hitlerchase4\r
+ 3B75:2D3C idle  _s_hitlerdeathcam\r
+ 3B75:2D4C       _s_hitlerdie1\r
+ 3B75:2D5C idle  _s_hitlerdie2\r
+ 3B75:2D6C idle  _s_hitlerdie3\r
+ 3B75:2D7C idle  _s_hitlerdie4\r
+ 3B75:2D8C idle  _s_hitlerdie5\r
+ 3B75:2D9C idle  _s_hitlerdie6\r
+ 3B75:2DAC idle  _s_hitlerdie7\r
+ 3B75:2DBC idle  _s_hitlerdie8\r
+ 3B75:2DCC idle  _s_hitlerdie9\r
+ 3B75:2DDC idle  _s_hitlerdie10\r
+ 3B75:2DEC idle  _s_hitlershoot1\r
+ 3B75:2DFC idle  _s_hitlershoot2\r
+ 3B75:2E0C idle  _s_hitlershoot3\r
+ 3B75:2E1C idle  _s_hitlershoot4\r
+ 3B75:2E2C idle  _s_hitlershoot5\r
+ 3B75:2E3C idle  _s_hitlershoot6\r
+ 3B75:2E54 idle  _s_bjrun1\r
+ 3B75:2E64 idle  _s_bjrun1s\r
+ 3B75:2E74 idle  _s_bjrun2\r
+ 3B75:2E84 idle  _s_bjrun3\r
+ 3B75:2E94 idle  _s_bjrun3s\r
+ 3B75:2EA4 idle  _s_bjrun4\r
+ 3B75:2EB4 idle  _s_bjjump1\r
+ 3B75:2EC4 idle  _s_bjjump2\r
+ 3B75:2ED4 idle  _s_bjjump3\r
+ 3B75:2EE4 idle  _s_bjjump4\r
+ 3B75:2EF4       _s_deathcam\r
+ 3B75:2F4A       _gamepal\r
+ 3B75:324A       _audioname\r
+ 3B75:3257 idle  _gheadname\r
+ 3B75:3261 idle  _gfilename\r
+ 3B75:326B idle  _gdictname\r
+ 3B75:3275 idle  _mheadname\r
+ 3B75:327F idle  _mfilename\r
+ 3B75:3289 idle  _aheadname\r
+ 3B75:3293 idle  _afilename\r
+ 3B75:3354 idle  _KbdDefs\r
+ 3B75:335E idle  _DemoMode\r
+ 3B75:3510 idle  _XMSProtectPage\r
+ 3B75:3512       _PageFileName\r
+ 3B75:3520 idle  _PageFile\r
+ 3B75:352A idle  _EMMDriverName\r
+ 3B75:39A0 idle  _ssPort\r
+ 3B75:3D12       _USL_MeasureString\r
+ 3B75:3D16 idle  _USL_DrawString\r
+ 3B75:3D1A       _Scores\r
+ 3B75:3FC4       _screenseg\r
+ 3B75:3FCA idle  _pixmasks\r
+ 3B75:3FCE idle  _leftmasks\r
+ 3B75:3FD2 idle  _rightmasks\r
+ 3B75:4090       __8087\r
+ 3B75:40A0       __protected\r
+ 3B75:40A1       __LDT\r
+ 3B75:40A4       __default87\r
+ 3B75:40A6 idle  __huge_flt\r
+ 3B75:40AA       __huge_dble\r
+ 3B75:40B2 idle  __huge_ldble\r
+ 3B75:40BC idle  __indefinite\r
+ 3B75:40C0 idle  __tiny_ldble\r
+ 3B75:40CA       __mathwhy\r
+ 3B75:4270       __emu\r
+ 3B75:4380       __atexitcnt\r
+ 3B75:4382       __ctype\r
+ 3B75:4484       __exitbuf\r
+ 3B75:4488       __exitfopen\r
+ 3B75:448C       __exitopen\r
+ 3B75:4490       __streams\r
+ 3B75:45D0       __nfile\r
+ 3B75:45D2       __openfd\r
+ 3B75:45FA       __fmode\r
+ 3B75:45FC       __notUmask\r
+ 3B75:45FE       __fpstklen\r
+ 3B75:4600       __heaplen\r
+ 3B75:4602       __doserrno\r
+ 3B75:4604 idle  __dosErrorToSV\r
+ 3B75:4668       __stklen\r
+ 3B75:46D2       __video\r
+ 3B75:46E1       _directvideo\r
+ 3B75:471E idle  __first\r
+ 3B75:4720 idle  __last\r
+ 3B75:4722 idle  __rover\r
+ 3B75:4724       __argc\r
+ 3B75:4726       __argv\r
+ 3B75:4732       _environ\r
+ 3B75:473A       __RealCvtVector\r
+ 3B75:473E idle  __ScanTodVector\r
+ 3B75:4944       __atexittbl\r
+ 3B75:49D2       ___SignalPtr\r
+ 3B75:49E4       _mr_dest\r
+ 3B75:49E6       _mr_yfrac\r
+ 3B75:49E8       _mr_xfrac\r
+ 3B75:49EA       _mr_ystep\r
+ 3B75:49EC       _mr_xstep\r
+ 3B75:49EE       _mr_count\r
+ 3B75:49F0       _mr_rowofs\r
+ 3B75:49F2       _pcos\r
+ 3B75:49F6       _psin\r
+ 3B75:49FA       _mirrorofs\r
+ 3B75:4AC2       _planeylookup\r
+ 3B75:4C52       _basedist\r
+ 3B75:4DE2       _stepscale\r
+ 3B75:4F72       _spanstart\r
+ 3B75:503A       _viewcos\r
+ 3B75:503E       _viewsin\r
+ 3B75:5042       _viewy\r
+ 3B75:5046       _viewx\r
+ 3B75:504A       _wallheight\r
+ 3B75:52CA       _scale\r
+ 3B75:52CE       _viewheight\r
+ 3B75:52D0       _viewwidth\r
+ 3B75:52D2       _bufferofs\r
+ 3B75:52D4       _pwalldir\r
+ 3B75:52D6       _pwally\r
+ 3B75:52D8       _pwallx\r
+ 3B75:52DA       _areabyplayer\r
+ 3B75:5324       _pwallstate\r
+ 3B75:5326       _doorposition\r
+ 3B75:53A6       _pwallpos\r
+ 3B75:53A8       _vertwall\r
+ 3B75:5428       _horizwall\r
+ 3B75:54A8       _viewsize\r
+ 3B75:54AA       _joystickport\r
+ 3B75:54AC       _joystickprogressive\r
+ 3B75:54AE       _joypadenabled\r
+ 3B75:54B0       _joystickenabled\r
+ 3B75:54B2       _mouseenabled\r
+ 3B75:54B4       _update\r
+ 3B75:55B8       _actorat\r
+ 3B75:75B8       _tilemap\r
+ 3B75:85B8       _nearmapylookup\r
+ 3B75:8638       _farmapylookup\r
+ 3B75:86B8       _doorobjlist\r
+ 3B75:8938       _laststatobj\r
+ 3B75:893A       _statobjlist\r
+ 3B75:95BA       _player\r
+ 3B75:95BC       _new\r
+ 3B75:95BE       _playstate\r
+ 3B75:95C0       _gamestate\r
+ 3B75:9602       _minheightdiv\r
+ 3B75:9604       _heightnumerator\r
+ 3B75:9608       _maxslope\r
+ 3B75:960C       _pixelangle\r
+ 3B75:988C       _mouseadjustment\r
+ 3B75:988E       _virtualreality\r
+ 3B75:9890       _startgame\r
+ 3B75:9892       _shootdelta\r
+ 3B75:9894       _centerx\r
+ 3B75:9896       _screenofs\r
+ 3B75:9898       _focallength\r
+ 3B75:989C       _IsA386\r
+ 3B75:989E       _nospr\r
+ 3B75:98A0       _str2\r
+ 3B75:98B4       _str\r
+ 3B75:9904       _LevelRatios\r
+ 3B75:9954       _backcolor\r
+ 3B75:9955       _blockstarts\r
+ 3B75:9B5D       _uwidthtable\r
+ 3B75:9B77       _updateptr\r
+ 3B75:9B79       _WindowW\r
+ 3B75:9B7B       _WindowY\r
+ 3B75:9B7D       _WindowX\r
+ 3B75:9B7F       _PrintY\r
+ 3B75:9B81       _NoWait\r
+ 3B75:9B83       _loadedgame\r
+ 3B75:9B85       _tedlevelnum\r
+ 3B75:9B87       _tedlevel\r
+ 3B75:9B89       _DigiMap\r
+ 3B75:9C37       _MusicMode\r
+ 3B75:9C39       _DigiMode\r
+ 3B75:9C3B       _SoundMode\r
+ 3B75:9C3D       _SoundBlasterPresent\r
+ 3B75:9C3F       _SoundSourcePresent\r
+ 3B75:9C41       _AdLibPresent\r
+ 3B75:9C43       _JoysPresent\r
+ 3B75:9C47       _MousePresent\r
+ 3B75:9C49       _Keyboard\r
+ 3B75:9D49       _fontnumber\r
+ 3B75:9D4B       _fontcolor\r
+ 3B75:9D4C       _displayofs\r
+ 3B75:9D4E       _grsegs\r
+ 3B75:9E78       _mminfo\r
+ 3B75:9E8C       _layoutdone\r
+ 3B75:9E8E       _picdelay\r
+ 3B75:9E90       _picnum\r
+ 3B75:9E92       _picy\r
+ 3B75:9E94       _picx\r
+ 3B75:9E96       _rowon\r
+ 3B75:9E98       _text\r
+ 3B75:9E9C       _rightmargin\r
+ 3B75:9EBA       _leftmargin\r
+ 3B75:9ED8       _numpages\r
+ 3B75:9EDA       _pagenum\r
+ 3B75:9EDC       _TimeCount\r
+ 3B75:9EE0       _LastScan\r
+ 3B75:9EE1       _py\r
+ 3B75:9EE3       _px\r
+ 3B75:9EE5       _pictable\r
+ 3B75:9EE7       _ca_levelbit\r
+ 3B75:9EE8       _pickquick\r
+ 3B75:9EEA       _lasttimecount\r
+ 3B75:9EEE       _SaveGameNames\r
+ 3B75:A02E       _StartGame\r
+ 3B75:A030       _SaveGamesAvail\r
+ 3B75:A044       _WindowH\r
+ 3B75:A046       _PrintX\r
+ 3B75:A048       _ingame\r
+ 3B75:A04A       _LastASCII\r
+ 3B75:A04B       _Paused\r
+ 3B75:A04D       _extension\r
+ 3B75:A052       _audiosegs\r
+ 3B75:A292       _EMSPagesAvail\r
+ 3B75:A294       _XMSPagesAvail\r
+ 3B75:A296       _EMSPresent\r
+ 3B75:A298       _XMSPresent\r
+ 3B75:A29A       _mmerror\r
+ 3B75:A29C       _mapon\r
+ 3B75:A29E       _rightchannel\r
+ 3B75:A2A0       _leftchannel\r
+ 3B75:A2A2       _globalsoundy\r
+ 3B75:A2A6       _globalsoundx\r
+ 3B75:A2AA       _demobuffer\r
+ 3B75:A2AC       _lastdemoptr\r
+ 3B75:A2B0       _demoptr\r
+ 3B75:A2B4       _demoplayback\r
+ 3B75:A2B6       _demorecord\r
+ 3B75:A2B8       _killerobj\r
+ 3B75:A2BA       _spearflag\r
+ 3B75:A2BC       _spearangle\r
+ 3B75:A2BE       _speary\r
+ 3B75:A2C2       _spearx\r
+ 3B75:A2C6       _fizzlein\r
+ 3B75:A2C8       _tics\r
+ 3B75:A2CA       _mapheight\r
+ 3B75:A2CC       _mapwidth\r
+ 3B75:A2CE       _SoundPositioned\r
+ 3B75:A2D0       _latchpics\r
+ 3B75:A398       _mapheaderseg\r
+ 3B75:A410       _mapsegs\r
+ 3B75:A414       _funnyticount\r
+ 3B75:A418       _palshifted\r
+ 3B75:A41A       _bonuscount\r
+ 3B75:A41C       _damagecount\r
+ 3B75:A41E       _objcount\r
+ 3B75:A420       _dummyobj\r
+ 3B75:A45C       _mapwidthtable\r
+ 3B75:A4DC       _DebugOk\r
+ 3B75:A4DE       _facecount\r
+ 3B75:A4E0       _anglefrac\r
+ 3B75:A4E2       _running\r
+ 3B75:A4E4       _frameon\r
+ 3B75:A4E8       _buttonstate\r
+ 3B75:A4F8       _controly\r
+ 3B75:A4FA       _controlx\r
+ 3B75:A4FC       _buttonheld\r
+ 3B75:A50C       _extravbls\r
+ 3B75:A50E       _noclip\r
+ 3B75:A510       _godmode\r
+ 3B75:A512       _singlestep\r
+ 3B75:A514       _spotvis\r
+ 3B75:B514       _objfreelist\r
+ 3B75:B516       _lastobj\r
+ 3B75:B518       _obj\r
+ 3B75:B51A       _objlist\r
+ 3B75:D842       _madenoise\r
+ 3B75:D844       _compatability\r
+ 3B75:D846       _screenfaded\r
+ 3B75:D848       _DigiList\r
+ 3B75:D84A       _NumDigi\r
+ 3B75:D84C       _viewtype\r
+ 3B75:D84E       _maporgy\r
+ 3B75:D850       _maporgx\r
+ 3B75:D852       _postwidth\r
+ 3B75:D854       _postx\r
+ 3B75:D856       _postsource\r
+ 3B75:D85A       _doornum\r
+ 3B75:D85C       _PMPages\r
+ 3B75:D860       _PMSoundStart\r
+ 3B75:D862       _PMSpriteStart\r
+ 3B75:D864       _ChunksInFile\r
+ 3B75:D866       _farthest\r
+ 3B75:D868       _visstep\r
+ 3B75:D86A       _visptr\r
+ 3B75:D86C       _vislist\r
+ 3B75:D998       _ystep\r
+ 3B75:D99C       _xstep\r
+ 3B75:D9A0       _yintercept\r
+ 3B75:D9A4       _xintercept\r
+ 3B75:D9A8       _ytilestep\r
+ 3B75:D9AA       _xtilestep\r
+ 3B75:D9AC       _ytile\r
+ 3B75:D9AE       _xtile\r
+ 3B75:D9B0       _pixx\r
+ 3B75:D9B2       _tilehit\r
+ 3B75:D9B4       _yinttile\r
+ 3B75:D9B6       _xinttile\r
+ 3B75:D9B8       _ypartialdown\r
+ 3B75:D9BA       _ypartialup\r
+ 3B75:D9BC       _xpartialdown\r
+ 3B75:D9BE       _xpartialup\r
+ 3B75:D9C0       _ypartial\r
+ 3B75:D9C2       _xpartial\r
+ 3B75:D9C4       _angle\r
+ 3B75:D9C6       _midangle\r
+ 3B75:D9C8       _viewty\r
+ 3B75:D9CA       _viewtx\r
+ 3B75:D9CC       _focalty\r
+ 3B75:D9CE       _focaltx\r
+ 3B75:D9D0       _lasttilehit\r
+ 3B75:D9D2       _lastintercept\r
+ 3B75:D9D6       _lastside\r
+ 3B75:D9D8       _maxscaleshl2\r
+ 3B75:D9DA       _fullscalefarcall\r
+ 3B75:DDDE       _viewangle\r
+ 3B75:DDE0       _mask3\r
+ 3B75:DDE1       _mask2\r
+ 3B75:DDE2       _mask1\r
+ 3B75:DDE3       _maskword\r
+ 3B75:DDE5       _linescale\r
+ 3B75:DDE9       _linecmds\r
+ 3B75:DDED       _slinewidth\r
+ 3B75:DDEF       _slinex\r
+ 3B75:DDF1       _stepbytwo\r
+ 3B75:DDF3       _work\r
+ 3B75:DDF5       _insetupscaling\r
+ 3B75:DDF7       _maxscale\r
+ 3B75:DDF9       _scaledirectory\r
+ 3B75:DFFB       _pluy\r
+ 3B75:DFFD       _plux\r
+ 3B75:DFFF       _playerymove\r
+ 3B75:E003       _playerxmove\r
+ 3B75:E007       _LastAttacker\r
+ 3B75:E009       _gotgatgun\r
+ 3B75:E00B       _thrustspeed\r
+ 3B75:E00F       _lastdoorobj\r
+ 3B75:E011       _oldsoundmode\r
+ 3B75:E013       _chunkexplen\r
+ 3B75:E017       _chunkcomplen\r
+ 3B75:E01B       _audiohandle\r
+ 3B75:E01D       _maphandle\r
+ 3B75:E01F       _grhandle\r
+ 3B75:E021       _audiohuffman\r
+ 3B75:E41D       _grhuffman\r
+ 3B75:E819       _audiostarts\r
+ 3B75:E81B       _grstarts\r
+ 3B75:E81D       _debughandle\r
+ 3B75:E81F       _profilehandle\r
+ 3B75:E821       _ca_levelnum\r
+ 3B75:E822       _tinf\r
+ 3B75:E824       _bufferseg\r
+ 3B75:E826       _btnstate\r
+ 3B75:E836       _MouseDownCount\r
+ 3B75:E83A       _JoyPadPresent\r
+ 3B75:E83C       _DemoSize\r
+ 3B75:E83E       _DemoOffset\r
+ 3B75:E840       _DemoBuffer\r
+ 3B75:E842       _Controls\r
+ 3B75:E84A       _JoyDefs\r
+ 3B75:E87A       _UMBbase\r
+ 3B75:E88E       _numUMBs\r
+ 3B75:E890       _XMSaddr\r
+ 3B75:E894       _bombonerror\r
+ 3B75:E896       _mmnew\r
+ 3B75:E89A       _mmrover\r
+ 3B75:E89E       _mmfree\r
+ 3B75:E8A2       _mmhead\r
+ 3B75:E8A6       _nearheap\r
+ 3B75:E8A8       _farheap\r
+ 3B75:E8AC       _mmstarted\r
+ 3B75:E8AE       _aftersort\r
+ 3B75:E8B2       _beforesort\r
+ 3B75:E8B6       _PMSegPages\r
+ 3B75:E8B8       _PMFrameCount\r
+ 3B75:E8BC       _PMNumBlocks\r
+ 3B75:E8BE       _MainPagesUsed\r
+ 3B75:E8C0       _EMSPagesUsed\r
+ 3B75:E8C2       _XMSPagesUsed\r
+ 3B75:E8C4       _PMThrashing\r
+ 3B75:E8C6       _PMPanicMode\r
+ 3B75:E8C8       _PMStarted\r
+ 3B75:E8CA       _XMSDriver\r
+ 3B75:E8CE       _XMSHandle\r
+ 3B75:E8D0       _XMSAvail\r
+ 3B75:E8D2       _EMSList\r
+ 3B75:E8EA       _EMSPhysicalPage\r
+ 3B75:E8EC       _EMSPageFrame\r
+ 3B75:E8EE       _EMSHandle\r
+ 3B75:E8F0       _EMSAvail\r
+ 3B75:E8F2       _MainPagesAvail\r
+ 3B75:E8F4       _MainMemUsed\r
+ 3B75:E9BC       _MainMemPages\r
+ 3B75:EA84       _MainPresent\r
+ 3B75:EA86       _sqHackTime\r
+ 3B75:EA8A       _sqHackSeqLen\r
+ 3B75:EA8C       _sqHackLen\r
+ 3B75:EA8E       _sqHackPtr\r
+ 3B75:EA92       _sqHack\r
+ 3B75:EA96       _sqActive\r
+ 3B75:EA98       _alZeroInst\r
+ 3B75:EAA8       _alTimeCount\r
+ 3B75:EAAC       _alLengthLeft\r
+ 3B75:EAB0       _alBlock\r
+ 3B75:EAB2       _alSound\r
+ 3B75:EAB6       _alNoCheck\r
+ 3B75:EAB8       _pcSoundLookup\r
+ 3B75:ECB6       _pcLengthLeft\r
+ 3B75:ECBA       _pcSound\r
+ 3B75:ECBE       _pcLastSample\r
+ 3B75:ECBF       _ssLengthLeft\r
+ 3B75:ECC3       _ssSample\r
+ 3B75:ECC7       _ssOff\r
+ 3B75:ECC8       _ssOn\r
+ 3B75:ECC9       _ssData\r
+ 3B75:ECCB       _ssStatus\r
+ 3B75:ECCD       _ssControl\r
+ 3B75:ECCF       _ssActive\r
+ 3B75:ECD1       _ssNoCheck\r
+ 3B75:ECD3       _DigiLastEnd\r
+ 3B75:ECD5       _DigiLastStart\r
+ 3B75:ECD7       _DigiPage\r
+ 3B75:ECD9       _DigiLeft\r
+ 3B75:ECDB       _TimerRate\r
+ 3B75:ECDD       _LocalTime\r
+ 3B75:ECE1       _t0OldService\r
+ 3B75:ECE5       _RightPosition\r
+ 3B75:ECE7       _LeftPosition\r
+ 3B75:ECE9       _DigiPriority\r
+ 3B75:ECEB       _SoundPriority\r
+ 3B75:ECED       _DigiNumber\r
+ 3B75:ECEF       _SoundNumber\r
+ 3B75:ECF1       _TimerCount\r
+ 3B75:ECF5       _TimerDivisor\r
+ 3B75:ECF9       _nextsoundpos\r
+ 3B75:ECFB       _ssIsTandy\r
+ 3B75:ECFD       _SoundTable\r
+ 3B75:ECFF       _HackCount\r
+ 3B75:ED01       _NeedsDigitized\r
+ 3B75:ED03       _SBProPresent\r
+ 3B75:ED05       _DigiPlaying\r
+ 3B75:ED07       _NeedsMusic\r
+ 3B75:ED09       _Games\r
+ 3B75:EE05       _CursorY\r
+ 3B75:EE07       _CursorX\r
+ 3B75:EE09       _CursorBad\r
+ 3B75:EE0B       _Button1\r
+ 3B75:EE0D       _Button0\r
+ 3B75:EE0F       _abortprogram\r
+ 3B75:EE11       _fastpalette\r
+ 3B75:EE13       _bordercolor\r
+ 3B75:EE15       _ylookup\r
+ 3B75:EFA5       _linewidth\r
+ 3B75:EFA7       _pelpan\r
+ 3B75:EFA9       _bufferheight\r
+ 3B75:EFAB       _bufferwidth\r
+\r
+Program entry point at 0000:0000\r
+\r
diff --git a/16/wf3d8086/oldscale.c b/16/wf3d8086/oldscale.c
new file mode 100755 (executable)
index 0000000..694b1c0
--- /dev/null
@@ -0,0 +1,738 @@
+// WL_SCALE.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+#define OP_RETF        0xcb\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                 GLOBALS\r
+\r
+=============================================================================\r
+*/\r
+\r
+t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1];\r
+long                   fullscalefarcall[MAXSCALEHEIGHT+1];\r
+\r
+int                    maxscale,maxscaleshl2;\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                 LOCALS\r
+\r
+=============================================================================\r
+*/\r
+\r
+t_compscale    _seg *work;\r
+unsigned BuildCompScale (int height, memptr *finalspot);\r
+\r
+int                    stepbytwo;\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==============\r
+=\r
+= BadScale\r
+=\r
+==============\r
+*/\r
+\r
+void far BadScale (void)\r
+{\r
+       Quit ("BadScale called!");\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= SetupScaling\r
+=\r
+==========================\r
+*/\r
+\r
+void SetupScaling (int maxscaleheight)\r
+{\r
+       int             i,x,y;\r
+       byte    far *dest;\r
+\r
+       maxscaleheight/=2;                      // one scaler every two pixels\r
+\r
+       maxscale = maxscaleheight-1;\r
+       maxscaleshl2 = maxscale<<2;\r
+\r
+//\r
+// free up old scalers\r
+//\r
+       for (i=1;i<MAXSCALEHEIGHT;i++)\r
+       {\r
+               if (scaledirectory[i])\r
+                       MM_FreePtr (&(memptr)scaledirectory[i]);\r
+               if (i>=stepbytwo)\r
+                       i += 2;\r
+       }\r
+       memset (scaledirectory,0,sizeof(scaledirectory));\r
+\r
+       MM_SortMem ();\r
+\r
+//\r
+// build the compiled scalers\r
+//\r
+       stepbytwo = viewheight/2;       // save space by double stepping\r
+       MM_GetPtr (&(memptr)work,20000);\r
+       if (mmerror)\r
+               return;\r
+\r
+       for (i=1;i<=maxscaleheight;i++)\r
+       {\r
+               BuildCompScale (i*2,&(memptr)scaledirectory[i]);\r
+               if (mmerror)\r
+               {\r
+                       MM_FreePtr (&(memptr)work);\r
+                       return;\r
+               }\r
+               if (i>=stepbytwo)\r
+                       i+= 2;\r
+       }\r
+       MM_FreePtr (&(memptr)work);\r
+\r
+//\r
+// compact memory and lock down scalers\r
+//\r
+       MM_SortMem ();\r
+       for (i=1;i<=maxscaleheight;i++)\r
+       {\r
+               MM_SetLock (&(memptr)scaledirectory[i],true);\r
+               fullscalefarcall[i] = (unsigned)scaledirectory[i];\r
+               fullscalefarcall[i] <<=16;\r
+               fullscalefarcall[i] += scaledirectory[i]->codeofs[0];\r
+               if (i>=stepbytwo)\r
+               {\r
+                       scaledirectory[i+1] = scaledirectory[i];\r
+                       fullscalefarcall[i+1] = fullscalefarcall[i];\r
+                       scaledirectory[i+2] = scaledirectory[i];\r
+                       fullscalefarcall[i+2] = fullscalefarcall[i];\r
+                       i+=2;\r
+               }\r
+       }\r
+       scaledirectory[0] = scaledirectory[1];\r
+       fullscalefarcall[0] = fullscalefarcall[1];\r
+\r
+//\r
+// check for oversize wall drawing\r
+//\r
+       for (i=maxscaleheight;i<MAXSCALEHEIGHT;i++)\r
+               fullscalefarcall[i] = (long)BadScale;\r
+\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+========================\r
+=\r
+= BuildCompScale\r
+=\r
+= Builds a compiled scaler object that will scale a 64 tall object to\r
+= the given height (centered vertically on the screen)\r
+=\r
+= height should be even\r
+=\r
+= Call with\r
+= ---------\r
+= DS:SI                Source for scale\r
+= ES:DI                Dest for scale\r
+=\r
+= Calling the compiled scaler only destroys AL\r
+=\r
+========================\r
+*/\r
+\r
+unsigned BuildCompScale (int height, memptr *finalspot)\r
+{\r
+       byte            far *code;\r
+\r
+       int                     i;\r
+       long            fix,step;\r
+       unsigned        src,totalscaled,totalsize;\r
+       int                     startpix,endpix,toppix;\r
+\r
+\r
+       step = ((long)height<<16) / 64;\r
+       code = &work->code[0];\r
+       toppix = (viewheight-height)/2;\r
+       fix = 0;\r
+\r
+       for (src=0;src<=64;src++)\r
+       {\r
+               startpix = fix>>16;\r
+               fix += step;\r
+               endpix = fix>>16;\r
+\r
+               if (endpix>startpix)\r
+                       work->width[src] = endpix-startpix;\r
+               else\r
+                       work->width[src] = 0;\r
+\r
+//\r
+// mark the start of the code\r
+//\r
+               work->codeofs[src] = FP_OFF(code);\r
+\r
+//\r
+// compile some code if the source pixel generates any screen pixels\r
+//\r
+               startpix+=toppix;\r
+               endpix+=toppix;\r
+\r
+               if (startpix == endpix || endpix < 0 || startpix >= viewheight || src == 64)\r
+                       continue;\r
+\r
+       //\r
+       // mov al,[si+src]\r
+       //\r
+               *code++ = 0x8a;\r
+               *code++ = 0x44;\r
+               *code++ = src;\r
+\r
+               for (;startpix<endpix;startpix++)\r
+               {\r
+                       if (startpix >= viewheight)\r
+                               break;                                          // off the bottom of the view area\r
+                       if (startpix < 0)\r
+                               continue;                                       // not into the view area\r
+\r
+               //\r
+               // mov [es:di+heightofs],al\r
+               //\r
+                       *code++ = 0x26;\r
+                       *code++ = 0x88;\r
+                       *code++ = 0x85;\r
+                       *((unsigned far *)code)++ = startpix*SCREENBWIDE;\r
+               }\r
+\r
+       }\r
+\r
+//\r
+// retf\r
+//\r
+       *code++ = 0xcb;\r
+\r
+       totalsize = FP_OFF(code);\r
+       MM_GetPtr (finalspot,totalsize);\r
+       if (mmerror)\r
+               return 0;\r
+       _fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize);\r
+\r
+       return totalsize;\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= ScaleLine\r
+=\r
+= linescale should have the high word set to the segment of the scaler\r
+=\r
+=======================\r
+*/\r
+\r
+extern int                     slinex,slinewidth;\r
+extern unsigned        far *linecmds;\r
+extern long            linescale;\r
+extern unsigned        maskword;\r
+\r
+byte   mask1,mask2,mask3;\r
+\r
+\r
+void near ScaleLine (void)\r
+{\r
+asm    mov     cx,WORD PTR [linescale+2]\r
+asm    mov     es,cx                                           // segment of scaler\r
+\r
+asm    mov bp,WORD PTR [linecmds]\r
+asm    mov     dx,SC_INDEX+1                           // to set SC_MAPMASK\r
+\r
+asm    mov     bx,[slinex]\r
+asm    mov     di,bx\r
+asm    shr     di,1                                            // X in bytes\r
+asm    shr     di,1\r
+asm    add     di,[bufferofs]\r
+asm    and     bx,3\r
+asm    shl     bx,3\r
+asm    add     bx,[slinewidth]                         // bx = (pixel*8+pixwidth)\r
+asm    mov     al,BYTE [mapmasks3-1+bx]        // -1 because pixwidth of 1 is first\r
+asm    mov     ds,WORD PTR [linecmds+2]\r
+asm    or      al,al\r
+asm    jz      notthreebyte                            // scale across three bytes\r
+asm    jmp     threebyte\r
+notthreebyte:\r
+asm    mov     al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first\r
+asm    or      al,al\r
+asm    jnz     twobyte                                         // scale across two bytes\r
+\r
+//\r
+// one byte scaling\r
+//\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    out     dx,al                                           // set map mask register\r
+\r
+scalesingle:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     dl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+\r
+asm    mov     es,cx                                           // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],dl                     // unpatch the RETF\r
+asm    jmp     scalesingle                                     // do the next segment\r
+\r
+\r
+//\r
+// done\r
+//\r
+linedone:\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+return;\r
+\r
+//\r
+// two byte scaling\r
+//\r
+twobyte:\r
+asm    mov     ss:[mask2],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask1],al\r
+\r
+scaledouble:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     cl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    mov     al,ss:[mask1]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask2]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    dec     di\r
+\r
+asm    mov     es,WORD PTR ss:[linescale+2] // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],cl                     // unpatch the RETF\r
+asm    jmp     scaledouble                                     // do the next segment\r
+\r
+\r
+//\r
+// three byte scaling\r
+//\r
+threebyte:\r
+asm    mov     ss:[mask3],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask2],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask1],al\r
+\r
+scaletriple:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     cl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    mov     al,ss:[mask1]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask2]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask3]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    dec     di\r
+asm    dec     di\r
+\r
+asm    mov     es,WORD PTR ss:[linescale+2] // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],cl                     // unpatch the RETF\r
+asm    jmp     scaletriple                                     // do the next segment\r
+\r
+\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= ScaleShape\r
+=\r
+= Draws a compiled shape at [scale] pixels high\r
+=\r
+= each vertical line of the shape has a pointer to segment data:\r
+=      end of segment pixel*2 (0 terminates line) used to patch rtl in scaler\r
+=      top of virtual line with segment in proper place\r
+=      start of segment pixel*2, used to jsl into compiled scaler\r
+=      <repeat>\r
+=\r
+= Setup for call\r
+= --------------\r
+= GC_MODE                      read mode 1, write mode 2\r
+= GC_COLORDONTCARE  set to 0, so all reads from video memory return 0xff\r
+= GC_INDEX                     pointing at GC_BITMASK\r
+=\r
+=======================\r
+*/\r
+\r
+static long            longtemp;\r
+\r
+void ScaleShape (int xcenter, int shapenum, unsigned height)\r
+{\r
+       t_compshape     _seg *shape;\r
+       t_compscale _seg *comptable;\r
+       unsigned        scale,srcx,stopx,tempx;\r
+       int                     t;\r
+       unsigned        far *cmdptr;\r
+       boolean         leftvis,rightvis;\r
+\r
+\r
+       shape = PM_GetSpritePage (shapenum);\r
+\r
+       scale = height>>3;                                              // low three bits are fractional\r
+       if (!scale || scale>maxscale)\r
+               return;                                                         // too close or far away\r
+       comptable = scaledirectory[scale];\r
+\r
+       *(((unsigned *)&linescale)+1)=(unsigned)comptable;      // seg of far call\r
+       *(((unsigned *)&linecmds)+1)=(unsigned)shape;           // seg of shape\r
+\r
+//\r
+// scale to the left (from pixel 31 to shape->leftpix)\r
+//\r
+       srcx = 32;\r
+       slinex = xcenter;\r
+       stopx = shape->leftpix;\r
+       cmdptr = &shape->dataofs[31-stopx];\r
+\r
+       while ( --srcx >=stopx && slinex>0)\r
+       {\r
+               (unsigned)linecmds = *cmdptr--;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               if (slinewidth == 1)\r
+               {\r
+                       slinex--;\r
+                       if (slinex<viewwidth)\r
+                       {\r
+                               if (wallheight[slinex] >= height)\r
+                                       continue;               // obscured by closer wall\r
+                               ScaleLine ();\r
+                       }\r
+                       continue;\r
+               }\r
+\r
+               //\r
+               // handle multi pixel lines\r
+               //\r
+               if (slinex>viewwidth)\r
+               {\r
+                       slinex -= slinewidth;\r
+                       slinewidth = viewwidth-slinex;\r
+                       if (slinewidth<1)\r
+                               continue;               // still off the right side\r
+               }\r
+               else\r
+               {\r
+                       if (slinewidth>slinex)\r
+                               slinewidth = slinex;\r
+                       slinex -= slinewidth;\r
+               }\r
+\r
+\r
+               leftvis = (wallheight[slinex] < height);\r
+               rightvis = (wallheight[slinex+slinewidth-1] < height);\r
+\r
+               if (leftvis)\r
+               {\r
+                       if (rightvis)\r
+                               ScaleLine ();\r
+                       else\r
+                       {\r
+                               while (wallheight[slinex+slinewidth-1] >= height)\r
+                                       slinewidth--;\r
+                               ScaleLine ();\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       if (!rightvis)\r
+                               continue;               // totally obscured\r
+\r
+                       while (wallheight[slinex] >= height)\r
+                       {\r
+                               slinex++;\r
+                               slinewidth--;\r
+                       }\r
+                       ScaleLine ();\r
+                       break;                  // the rest of the shape is gone\r
+               }\r
+       }\r
+\r
+\r
+//\r
+// scale to the right\r
+//\r
+       slinex = xcenter;\r
+       stopx = shape->rightpix;\r
+       if (shape->leftpix<31)\r
+       {\r
+               srcx = 31;\r
+               cmdptr = &shape->dataofs[32-shape->leftpix];\r
+       }\r
+       else\r
+       {\r
+               srcx = shape->leftpix-1;\r
+               cmdptr = &shape->dataofs[0];\r
+       }\r
+       slinewidth = 0;\r
+\r
+       while ( ++srcx <= stopx && (slinex+=slinewidth)<viewwidth)\r
+       {\r
+               (unsigned)linecmds = *cmdptr++;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               if (slinewidth == 1)\r
+               {\r
+                       if (slinex>=0 && wallheight[slinex] < height)\r
+                       {\r
+                               ScaleLine ();\r
+                       }\r
+                       continue;\r
+               }\r
+\r
+               //\r
+               // handle multi pixel lines\r
+               //\r
+               if (slinex<0)\r
+               {\r
+                       if (slinewidth <= -slinex)\r
+                               continue;               // still off the left edge\r
+\r
+                       slinewidth += slinex;\r
+                       slinex = 0;\r
+               }\r
+               else\r
+               {\r
+                       if (slinex + slinewidth > viewwidth)\r
+                               slinewidth = viewwidth-slinex;\r
+               }\r
+\r
+\r
+               leftvis = (wallheight[slinex] < height);\r
+               rightvis = (wallheight[slinex+slinewidth-1] < height);\r
+\r
+               if (leftvis)\r
+               {\r
+                       if (rightvis)\r
+                       {\r
+                               ScaleLine ();\r
+                       }\r
+                       else\r
+                       {\r
+                               while (wallheight[slinex+slinewidth-1] >= height)\r
+                                       slinewidth--;\r
+                               ScaleLine ();\r
+                               break;                  // the rest of the shape is gone\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       if (rightvis)\r
+                       {\r
+                               while (wallheight[slinex] >= height)\r
+                               {\r
+                                       slinex++;\r
+                                       slinewidth--;\r
+                               }\r
+                               ScaleLine ();\r
+                       }\r
+                       else\r
+                               continue;               // totally obscured\r
+               }\r
+       }\r
+}\r
+\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= SimpleScaleShape\r
+=\r
+= NO CLIPPING, height in pixels\r
+=\r
+= Draws a compiled shape at [scale] pixels high\r
+=\r
+= each vertical line of the shape has a pointer to segment data:\r
+=      end of segment pixel*2 (0 terminates line) used to patch rtl in scaler\r
+=      top of virtual line with segment in proper place\r
+=      start of segment pixel*2, used to jsl into compiled scaler\r
+=      <repeat>\r
+=\r
+= Setup for call\r
+= --------------\r
+= GC_MODE                      read mode 1, write mode 2\r
+= GC_COLORDONTCARE  set to 0, so all reads from video memory return 0xff\r
+= GC_INDEX                     pointing at GC_BITMASK\r
+=\r
+=======================\r
+*/\r
+\r
+void SimpleScaleShape (int xcenter, int shapenum, unsigned height)\r
+{\r
+       t_compshape     _seg *shape;\r
+       t_compscale _seg *comptable;\r
+       unsigned        scale,srcx,stopx,tempx;\r
+       int                     t;\r
+       unsigned        far *cmdptr;\r
+       boolean         leftvis,rightvis;\r
+\r
+\r
+       shape = PM_GetSpritePage (shapenum);\r
+\r
+       scale = height>>1;\r
+       comptable = scaledirectory[scale];\r
+\r
+       *(((unsigned *)&linescale)+1)=(unsigned)comptable;      // seg of far call\r
+       *(((unsigned *)&linecmds)+1)=(unsigned)shape;           // seg of shape\r
+\r
+//\r
+// scale to the left (from pixel 31 to shape->leftpix)\r
+//\r
+       srcx = 32;\r
+       slinex = xcenter;\r
+       stopx = shape->leftpix;\r
+       cmdptr = &shape->dataofs[31-stopx];\r
+\r
+       while ( --srcx >=stopx )\r
+       {\r
+               (unsigned)linecmds = *cmdptr--;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               slinex -= slinewidth;\r
+               ScaleLine ();\r
+       }\r
+\r
+\r
+//\r
+// scale to the right\r
+//\r
+       slinex = xcenter;\r
+       stopx = shape->rightpix;\r
+       if (shape->leftpix<31)\r
+       {\r
+               srcx = 31;\r
+               cmdptr = &shape->dataofs[32-shape->leftpix];\r
+       }\r
+       else\r
+       {\r
+               srcx = shape->leftpix-1;\r
+               cmdptr = &shape->dataofs[0];\r
+       }\r
+       slinewidth = 0;\r
+\r
+       while ( ++srcx <= stopx )\r
+       {\r
+               (unsigned)linecmds = *cmdptr++;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               ScaleLine ();\r
+               slinex+=slinewidth;\r
+       }\r
+}\r
+\r
+\r
+\r
+\r
+//\r
+// bit mask tables for drawing scaled strips up to eight pixels wide\r
+//\r
+// down here so the STUPID inline assembler doesn't get confused!\r
+//\r
+\r
+\r
+byte   mapmasks1[4][8] = {\r
+{1 ,3 ,7 ,15,15,15,15,15},\r
+{2 ,6 ,14,14,14,14,14,14},\r
+{4 ,12,12,12,12,12,12,12},\r
+{8 ,8 ,8 ,8 ,8 ,8 ,8 ,8} };\r
+\r
+byte   mapmasks2[4][8] = {\r
+{0 ,0 ,0 ,0 ,1 ,3 ,7 ,15},\r
+{0 ,0 ,0 ,1 ,3 ,7 ,15,15},\r
+{0 ,0 ,1 ,3 ,7 ,15,15,15},\r
+{0 ,1 ,3 ,7 ,15,15,15,15} };\r
+\r
+byte   mapmasks3[4][8] = {\r
+{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0},\r
+{0 ,0 ,0 ,0 ,0 ,0 ,0 ,1},\r
+{0 ,0 ,0 ,0 ,0 ,0 ,1 ,3},\r
+{0 ,0 ,0 ,0 ,0 ,1 ,3 ,7} };\r
+\r
+\r
+unsigned       wordmasks[8][8] = {\r
+{0x0080,0x00c0,0x00e0,0x00f0,0x00f8,0x00fc,0x00fe,0x00ff},\r
+{0x0040,0x0060,0x0070,0x0078,0x007c,0x007e,0x007f,0x807f},\r
+{0x0020,0x0030,0x0038,0x003c,0x003e,0x003f,0x803f,0xc03f},\r
+{0x0010,0x0018,0x001c,0x001e,0x001f,0x801f,0xc01f,0xe01f},\r
+{0x0008,0x000c,0x000e,0x000f,0x800f,0xc00f,0xe00f,0xf00f},\r
+{0x0004,0x0006,0x0007,0x8007,0xc007,0xe007,0xf007,0xf807},\r
+{0x0002,0x0003,0x8003,0xc003,0xe003,0xf003,0xf803,0xfc03},\r
+{0x0001,0x8001,0xc001,0xe001,0xf001,0xf801,0xfc01,0xfe01} };\r
+\r
+int                    slinex,slinewidth;\r
+unsigned       far *linecmds;\r
+long           linescale;\r
+unsigned       maskword;\r
+\r
diff --git a/16/wf3d8086/piclist.h b/16/wf3d8086/piclist.h
new file mode 100755 (executable)
index 0000000..0b42d37
--- /dev/null
@@ -0,0 +1,36 @@
+//////////////////////////////////////\r
+//\r
+// Graphics .H file for .WL1\r
+// IGRAB-ed on Sat May 02 02:32:49 1992\r
+//\r
+//////////////////////////////////////\r
+\r
+typedef enum {\r
+               // Lump Start\r
+               H_BJPIC=3,\r
+               H_CASTLEPIC,                 // 4\r
+               H_KEYBOARDPIC,               // 5\r
+               H_JOYPIC,                    // 6\r
+               H_MOUSEPIC,                  // 7\r
+               H_BOTHPIC,                   // 8\r
+               H_GAMEPADPIC,                // 9\r
+               H_HEALPIC,                   // 10\r
+               H_TREASUREPIC,               // 11\r
+               H_GUNPIC,                    // 12\r
+               H_KEYPIC,                    // 13\r
+               H_BLAZEPIC,                  // 14\r
+               H_WEAPON1234PIC,             // 15\r
+               H_WOLFLOGOPIC,               // 16\r
+               H_VISAPIC,                   // 17\r
+               H_MCPIC,                     // 18\r
+               H_IDLOGOPIC,                 // 19\r
+               H_FAXPIC,                    // 20\r
+               H_GALACTIXPIC,               // 21\r
+               H_FGODMOMPIC,                // 22\r
+               H_AUSTRALIAPIC,              // 23\r
+               H_CANADAPIC,                 // 24\r
+               H_UKPIC,                     // 25\r
+               H_TOPWINDOWPIC,              // 26\r
+               H_LEFTWINDOWPIC,             // 27\r
+               H_RIGHTWINDOWPIC,            // 28\r
+               H_BOTTOMINFOPIC,             // 29\r
diff --git a/16/wf3d8086/readme.uso b/16/wf3d8086/readme.uso
new file mode 100755 (executable)
index 0000000..6287a54
--- /dev/null
@@ -0,0 +1,39 @@
+Wolfenstein Makefile and Compile-Time Patch, Version 1.00\r
+---------------------------------------------------------\r
+\r
+Aha!  Finally, I got it to build...\r
+\r
+Anyway, if you have Borland C++ 3 or later, download the original source\r
+files, and extract this on top of them.  You can then run the compiler\r
+from the command line and get a working build.\r
+\r
+   C:\WOLFDEV>make -f makefile.wl6\r
+\r
+Or rename makefile.wl6 to makefile, being sure to edit the filename in the\r
+makefile itself (used to generate wolf3d.cfg when the makefile is altered)\r
+and then compile by typing simply "MAKE".  Yeah!\r
+\r
+For best results, get a copy of UPX from http://upx.sourceforge.net/ and\r
+compress it thus:\r
+\r
+   C:\WOLFDEV\OBJ>upx --best --8086 wolf3d.exe\r
+\r
+The result will be a binary that works properly and is only 94K - hey, you\r
+out-did id themselves!\r
+\r
+Hey, what else can you expect from a compiler jockey specializing in\r
+Borland products for DOS-16? :)\r
+\r
+Steve "Usotsuki" Nickolas\r
+<steve@dosius.zzn.com>\r
+2003.0501\r
+\r
+P.S.: For best results, change "steve" in the above address to "sysdev".\r
+Both e-mail addresses work, but since I get a LOT (about 50 per day) of\r
+junk mail at the above address, I have to filter it by hand, and I might\r
+miss your message if I think the sender line or subject line looks like\r
+a spammer.  The other e-mail gets no spam, and I would like to keep it\r
+that way!  But if you have serious questions or comments, please e-mail\r
+me there.\r
+\r
+-uso.\r
diff --git a/16/wf3d8086/readme/license.doc b/16/wf3d8086/readme/license.doc
new file mode 100755 (executable)
index 0000000..e58e54a
--- /dev/null
@@ -0,0 +1,129 @@
+       LIMITED USE SOFTWARE LICENSE AGREEMENT\r
+\r
+       This Limited Use Software License Agreement (the "Agreement") \r
+is a legal agreement between you, the end-user, and Id Software, Inc. \r
+("ID").  By continuing the downloading of this Wolfenstein 3D \r
+(the "Trademark") software material, which includes source code \r
+(the "Source Code"), artwork data, music and software tools \r
+(collectively, the "Software"), you are agreeing to be bound by the \r
+terms of this Agreement.  If you do not agree to the terms of this \r
+Agreement, promptly destroy the Software you may have downloaded.  \r
+\r
+ID SOFTWARE LICENSE\r
+\r
+       Grant of License.  ID grants to you the right to use one (1) \r
+copy of the Software on a single computer.  You have no ownership or \r
+proprietary rights in or to the Software, or the Trademark.  For purposes \r
+of this section, "use" means loading the Software into RAM, as well as \r
+installation on a hard disk or other storage device.  The Software, \r
+together with any archive copy thereof, shall be destroyed when no longer \r
+used in accordance with this Agreement, or when the right to use the \r
+Software is terminated.  You agree that the Software will not be shipped, \r
+transferred or exported into any country in violation of the U.S. \r
+Export Administration Act (or any other law governing such matters) and \r
+that you will not utilize, in any other manner, the Software in violation \r
+of any applicable law.\r
+\r
+       Permitted Uses.  For educational purposes only, you, the end-user, \r
+may use portions of the Source Code, such as particular routines, to \r
+develop your own software, but may not duplicate the Source Code, except \r
+as noted in paragraph 4.  The limited right referenced in the preceding \r
+sentence is hereinafter referred to as "Educational Use."  By so exercising \r
+the Educational Use right you shall not obtain any ownership, copyright,\r
+proprietary or other interest in or to the Source Code, or any portion of\r
+the Source Code.  You may dispose of your own software in your sole\r
+discretion.  With the exception of the Educational Use right, you may not\r
+otherwise use the Software, or an portion of the Software, which includes\r
+the Source Code, for commercial gain.\r
+\r
+       Prohibited Uses:  Under no circumstances shall you, the end-user, \r
+be permitted, allowed or authorized to commercially exploit the Software.\r
+Neither you nor anyone at your direction shall do any of the following acts\r
+with regard to the Software, or any portion thereof:\r
+\r
+       Rent;\r
+\r
+       Sell;\r
+\r
+       Lease;\r
+\r
+       Offer on a pay-per-play basis;\r
+\r
+       Distribute for money or any other consideration; or\r
+\r
+       In any other manner and through any medium whatsoever commercially \r
+exploit or use for any commercial purpose.\r
+\r
+Notwithstanding the foregoing prohibitions, you may commercially exploit the\r
+software you develop by exercising the Educational Use right, referenced in\r
+paragraph 2. hereinabove. \r
+\r
+       Copyright.  The Software and all copyrights related thereto \r
+(including all characters and other images generated by the Software \r
+or depicted in the Software) are owned by ID and is protected by \r
+United States copyright laws and international treaty provisions.  \r
+Id shall retain exclusive ownership and copyright in and to the Software \r
+and all portions of the Software and you shall have no ownership or other \r
+proprietary interest in such materials. You must treat the Software like \r
+any other copyrighted material, except that you may either (a) make one \r
+copy of the Software solely for back-up or archival purposes, or (b) \r
+transfer the Software to a single hard disk provided you keep the original \r
+solely for back-up or archival purposes.  You may not otherwise reproduce, \r
+copy or disclose to others, in whole or in any part, the Software.  You \r
+may not copy the written materials accompanying the Software.  You agree \r
+to use your best efforts to see that any user of the Software licensed \r
+hereunder complies with this Agreement.\r
+\r
+       NO WARRANTIES.  ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS IMPLIED,\r
+INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND\r
+FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE SOFTWARE.  THIS LIMITED\r
+WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS.  YOU MAY HAVE OTHER RIGHTS WHICH\r
+VARY FROM JURISDICTION TO JURISDICTION.  ID DOES NOT WARRANT THAT THE\r
+OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR\r
+SPECIFIC REQUIREMENTS.  THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER\r
+EXPRESS WARRANTIES WHETHER ORAL OR WRITTEN.  THE AGENTS, EMPLOYEES,\r
+DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE MODIFICATIONS TO\r
+THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF OF ID. \r
+\r
+       Exclusive Remedies.  The Software is being offered to you free of any\r
+charge.  You agree that you have no remedy against ID, its affiliates,\r
+contractors, suppliers, and agents for loss or damage caused by any defect\r
+or failure in the Software regardless of the form of action, whether in\r
+contract, tort, includinegligence, strict liability or otherwise, with\r
+regard to the Software.  This Agreement shall be construed in accordance\r
+with and governed by the laws of the State of Texas.  Copyright and other\r
+proprietary matters will be governed by United States laws and international\r
+treaties.  IN ANY CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF\r
+PROFITS, LOST SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER\r
+SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT,\r
+NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN ADVISED\r
+OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.\r
+Some jurisdictions do not allow the exclusion or limitation of incidental or\r
+consequential damages, so the above limitation or exclusion may not apply to\r
+you.\r
+\r
+       General Provisions.  Neither this Agreement nor any part or portion \r
+hereof shall be assigned, sublicensed or otherwise transferred by you.  \r
+Should any provision of this Agreement be held to be void, invalid, \r
+unenforceable or illegal by a court, the validity and enforceability of the \r
+other provisions shall not be affected thereby.  If any provision is \r
+determined to be unenforceable, you agree to a modification of such \r
+provision to provide for enforcement of the provision's intent, to the \r
+extent permitted by applicable law.  Failure of a party to enforce any \r
+provision of this Agreement shall not constitute or be construed as a \r
+waiver of such provision or of the right to enforce such provision.  If \r
+you fail to comply with any terms of this Agreement, YOUR LICENSE IS \r
+AUTOMATICALLY TERMINATED and you agree to the issuance of an injunction \r
+against you in favor of Id.  You agree that Id shall not have to post \r
+bond or other security to obtain an injunction against you to prohibit \r
+you from violating Id's rights.\r
+\r
+       YOU ACKNOWLEDGE THAT YOU HAVE READ THIS AGREEMENT, THAT YOU \r
+UNDERSTAND THIS AGREEMENT, AND UNDERSTAND THAT BY CONTINUING THE \r
+DOWNLOADING OF THE SOFTWARE, YOU AGREE TO BE BOUND BY THIS AGREEMENT'S \r
+TERMS AND CONDITIONS. YOU FURTHER AGREE THAT, EXCEPT FOR WRITTEN SEPARATE \r
+AGREEMENTS BETWEEN ID AND YOU, THIS AGREEMENT IS A COMPLETE AND EXCLUSIVE \r
+STATEMENT OF THE RIGHTS AND LIABILITIES OF THE PARTIES.  THIS AGREEMENT \r
+SUPERSEDES ALL PRIOR ORAL AGREEMENTS, PROPOSALS OR UNDERSTANDINGS, AND \r
+ANY OTHER COMMUNICATIONS BETWEEN ID AND YOU RELATING TO THE SUBJECT MATTER \r
+OF THIS AGREEMENT \r
diff --git a/16/wf3d8086/readme/readme.txt b/16/wf3d8086/readme/readme.txt
new file mode 100755 (executable)
index 0000000..b31d9cc
--- /dev/null
@@ -0,0 +1,8 @@
+NOTES:\r
+------\r
+\r
+This version will compile under BORLAND C++ 3.0/3.1 and compiled perfectly\r
+before it was uploaded. \r
+\r
+Please do not send your questions to id Software.\r
+\r
diff --git a/16/wf3d8086/readme/release.txt b/16/wf3d8086/readme/release.txt
new file mode 100755 (executable)
index 0000000..d90bfeb
--- /dev/null
@@ -0,0 +1,53 @@
+We are releasing this code for the entertainment of the \r
+user community.  We don't guarentee that anything even \r
+builds in here.  Projects just seem to rot when you leave \r
+them alone for long periods of time.\r
+\r
+This is all the source we have relating to the original \r
+PC wolfenstein 3D project.  We haven't looked at this \r
+stuff in years, and I would probably be horribly embarassed \r
+to dig through my old code, so please don't ask any questions \r
+about it. The original project was built in borland c++ 3.0.  \r
+I think some minor changes were required for later versions.\r
+\r
+You will need the data from a released version of wolf or spear \r
+to use the exe built from this code.  You can just use a \r
+shareware version if you are really cheap.\r
+\r
+\r
+Some coding comments in retrospect:\r
+\r
+The ray casting refresh architecture is still reasonably \r
+appropriate for the game.  A BSP based texture mapper could \r
+go faster, but ray casting was a lot simpler to do at the time.\r
+\r
+The dynamically compiled scaling routines are now a Bad Thing.  \r
+On uncached machines (the original target) they are the fastest \r
+possible way to scale walls, but on modern processors you just \r
+wind up thrashing the code cash and wrecking performance.  \r
+A simple looping texture mapper would be faster on 486+ machines.\r
+\r
+The whole page manager caching scheme is unecessarily complex.\r
+\r
+Way too many #ifdefs in the code!\r
+\r
+\r
+Some project ideas with this code:\r
+\r
+Add new monsters or weapons.\r
+\r
+Add taller walls and vertical motion.   This should only be \r
+done if the texture mapper is rewritten.\r
+\r
+Convert to a 32 bit compiler.  This would be a fair amount \r
+of work, but I would hate to even mess with crusty old 16 \r
+bit code.  The code would get a LOT smaller.\r
+\r
+Make a multi-player game that runs on DOOM sersetup / ipxsetup drivers.\r
+\r
+\r
+Have fun...\r
+\r
+John Carmack\r
+Technical Director\r
+Id Software\r
diff --git a/16/wf3d8086/rules.asi b/16/wf3d8086/rules.asi
new file mode 100755 (executable)
index 0000000..eba7111
--- /dev/null
@@ -0,0 +1,692 @@
+;[]-----------------------------------------------------------------[]\r
+;|      RULES.ASI  --  Rules & Structures for assembler              |\r
+;|                                                                   |\r
+;|      Turbo C++ Run Time Library                                   |\r
+;|                                                                   |\r
+;|      Copyright (c) 1987, 1991 by Borland International Inc.       |\r
+;|      All Rights Reserved.                                         |\r
+;[]-----------------------------------------------------------------[]\r
+\r
+;*** First we begin with a few of the major constants of C.\r
+\r
+false   equ     0       ; Beware !  For incoming parameters, non-false = true.\r
+true    equ     1       ; For results, we generate the proper numbers.\r
+\r
+lesser  equ    -1       ; Incoming, lesser < 0\r
+equal   equ     0\r
+greater equ     1       ; Incoming, greater > 0\r
+\r
+       PAGE\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;|      Conditional Assembly Directives                         |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+;memory model aliases, for the convenience of building the library\r
+\r
+IFDEF           __s__\r
+__SMALL__       equ     1\r
+ENDIF\r
+\r
+IFDEF           __c__\r
+__COMPACT__     equ     1\r
+ENDIF\r
+\r
+IFDEF           __m__\r
+__MEDIUM__      equ     1\r
+ENDIF\r
+\r
+IFDEF           __l__\r
+__LARGE__       equ     1\r
+ENDIF\r
+\r
+IFDEF           __h__\r
+__HUGE__        equ     1\r
+ENDIF\r
+\r
+IFNDEF __TINY__\r
+    IFNDEF __SMALL__\r
+       IFNDEF __MEDIUM__\r
+           IFNDEF __COMPACT__\r
+               IFNDEF __LARGE__\r
+                   IFNDEF __HUGE__\r
+                       %OUT  You must supply a model symbol.\r
+                       .ERR\r
+                   ENDIF\r
+               ENDIF\r
+           ENDIF\r
+       ENDIF\r
+    ENDIF\r
+ENDIF\r
+\r
+;bit masks to extract default pointer types from MMODEL (at run-time)\r
+FCODE           equ     8000h\r
+FDATA           equ     4000h\r
+\r
+IFDEF   __TINY__                ; Small Code - Small Data\r
+       LPROG           equ     false\r
+       LDATA           equ     false\r
+       MMODEL          equ     0       \r
+       _DSSTACK_       equ     <>\r
+ENDIF\r
+\r
+IFDEF   __SMALL__               ; Small Code - Small Data\r
+       LPROG           equ     false\r
+       LDATA           equ     false\r
+       MMODEL          equ     1       \r
+       _DSSTACK_       equ     <>\r
+ENDIF\r
+\r
+IFDEF   __MEDIUM__              ; Large Code - Small Data\r
+       LPROG           equ     true\r
+       LDATA           equ     false\r
+       MMODEL          equ     FCODE+2 \r
+       _DSSTACK_       equ     <>\r
+ENDIF\r
+\r
+IFDEF   __COMPACT__             ; Small Code - Large Data\r
+       LPROG           equ     false\r
+       LDATA           equ     true\r
+       MMODEL          equ     FDATA+3 \r
+ENDIF\r
+\r
+IFDEF   __LARGE__               ; Large Code - Large Data\r
+       LPROG           equ     true\r
+       LDATA           equ     true\r
+       MMODEL          equ     FCODE+FDATA+4\r
+ENDIF\r
+\r
+IFDEF   __HUGE__                ; Large Code - Large Data\r
+       LPROG           equ     true\r
+       LDATA           equ     true\r
+       MMODEL          equ     FCODE+FDATA+5\r
+ENDIF\r
+\r
+IF      LPROG\r
+       DIST            equ     FAR\r
+ELSE\r
+       DIST            equ     NEAR\r
+ENDIF\r
+\r
+       PAGE\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;|      Segment Declarations Macros                             |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+Code_Seg@       MACRO           ;; Open a Code Segment\r
+IFDEF __WINDOWS__\r
+_TEXT   SEGMENT WORD PUBLIC 'CODE'\r
+ELSE\r
+_TEXT   SEGMENT BYTE PUBLIC 'CODE'\r
+ENDIF\r
+       ASSUME  CS:_TEXT\r
+               ENDM\r
+\r
+Code_EndS@      MACRO           ;; Close a Code Segment\r
+_TEXT   ENDS\r
+               ENDM\r
+\r
+Data_Seg@       MACRO           ;; Open a Data Segment  (initialized)\r
+_DATA   SEGMENT WORD PUBLIC 'DATA'\r
+               ENDM\r
+\r
+Data_EndS@      MACRO           ;; Close a Data Segment (initialized)\r
+_DATA   ENDS\r
+               ENDM\r
+\r
+IFNDEF __HUGE__\r
+    BSS_Seg@        MACRO       ;; Open a Data Segment  (un-initialized)\r
+    _BSS    SEGMENT WORD PUBLIC 'BSS'\r
+           ENDM\r
+\r
+    BSS_EndS@       MACRO       ;; Close a Data Segment (un-initialized)\r
+    _BSS    ENDS\r
+                   ENDM\r
+ENDIF\r
+\r
+FarData_Seg@    MACRO           ;; Open a FAR Data Segment\r
+_FARDATA        SEGMENT PARA PUBLIC 'FAR_DATA'\r
+               ENDM\r
+\r
+FarData_EndS@   MACRO           ;; Close a FAR Data Segment\r
+_FARDATA        ENDS\r
+               ENDM\r
+\r
+FarBSS_Seg@     MACRO           ;; Open a FAR BSS Segment\r
+_FARBSS         SEGMENT PARA PUBLIC 'FAR_BSS'\r
+               ENDM\r
+\r
+FarBSS_EndS@    MACRO           ;; Close a FAR BSS Segment\r
+_FARBSS         ENDS\r
+               ENDM\r
+\r
+Const_Seg@      MACRO           ;; Open a CONST Segment\r
+_CONST  SEGMENT WORD PUBLIC 'CONST'\r
+               ENDM\r
+\r
+Const_EndS@     MACRO           ;; Close a CONST Segment\r
+_CONST  ENDS\r
+               ENDM\r
+\r
+Init_Seg@       MACRO           ;; Open a INIT Segment\r
+_INIT_  SEGMENT WORD PUBLIC 'INITDATA'\r
+               ENDM\r
+\r
+Init_EndS@      MACRO           ;; Close a INIT Segment\r
+_INIT_  ENDS\r
+               ENDM\r
+\r
+Exit_Seg@       MACRO           ;; Open a EXIT Segment\r
+_EXIT_  SEGMENT WORD PUBLIC 'EXITDATA'\r
+               ENDM\r
+\r
+Exit_EndS@      MACRO           ;; Close a EXIT Segment\r
+_EXIT_  ENDS\r
+               ENDM\r
+\r
+CVT_Seg@        MACRO\r
+_CVTSEG SEGMENT WORD PUBLIC 'DATA'\r
+               ENDM\r
+\r
+CVT_EndS@       MACRO\r
+_CVTSEG ENDS\r
+               ENDM\r
+\r
+SCN_Seg@        MACRO\r
+_SCNSEG SEGMENT WORD PUBLIC 'DATA'\r
+               ENDM\r
+\r
+SCN_EndS@       MACRO\r
+_SCNSEG ENDS\r
+               ENDM\r
+\r
+Header@ MACRO\r
+Code_Seg@\r
+Code_EndS@\r
+Data_Seg@\r
+Data_EndS@\r
+BSS_Seg@\r
+BSS_EndS@\r
+       ASSUME  CS:_TEXT, DS:DGROUP\r
+       ENDM\r
+\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;|      Segment Definitions                                     |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+IFDEF __C0__\r
+\r
+IFDEF __WINDOWS__\r
+_TEXT           SEGMENT WORD PUBLIC 'CODE'\r
+               ENDS\r
+ELSE\r
+_TEXT           SEGMENT BYTE PUBLIC 'CODE'\r
+               ENDS\r
+ENDIF\r
+\r
+_FARDATA        SEGMENT PARA PUBLIC 'FAR_DATA'\r
+               ENDS\r
+\r
+_FARBSS         SEGMENT PARA PUBLIC 'FAR_BSS'\r
+               ENDS\r
+\r
+IFNDEF __WINDOWS__\r
+  IFNDEF __TINY__\r
+  _OVERLAY_       SEGMENT PARA PUBLIC 'OVRINFO'\r
+                 ENDS\r
+  _1STUB_         SEGMENT PARA PUBLIC 'STUBSEG'\r
+                 ENDS\r
+  ENDIF\r
+ENDIF\r
+\r
+IFDEF __WINDOWS__\r
+NULL            SEGMENT PARA PUBLIC 'BEGDATA'\r
+               ENDS\r
+ENDIF\r
+\r
+_DATA           SEGMENT PARA PUBLIC 'DATA'\r
+               ENDS\r
+               ENDS\r
+\r
+_CONST          SEGMENT WORD PUBLIC 'CONST'\r
+               ENDS\r
+\r
+IFDEF __WINDOWS__\r
+_FPSEG          SEGMENT WORD PUBLIC 'DATA'\r
+               ENDS\r
+ENDIF\r
+\r
+_CVTSEG         SEGMENT WORD PUBLIC 'DATA'\r
+               ENDS\r
+\r
+_SCNSEG         SEGMENT WORD PUBLIC 'DATA'\r
+               ENDS\r
+\r
+_INIT_          SEGMENT WORD PUBLIC 'INITDATA'\r
+InitStart       label byte\r
+               ENDS\r
+_INITEND_       SEGMENT BYTE PUBLIC 'INITDATA'\r
+InitEnd         label byte\r
+               ENDS\r
+\r
+_EXIT_          SEGMENT WORD PUBLIC 'EXITDATA'\r
+ExitStart       label byte\r
+               ENDS\r
+_EXITEND_       SEGMENT BYTE PUBLIC 'EXITDATA'\r
+ExitEnd         label byte\r
+               ENDS\r
+\r
+IFNDEF __HUGE__\r
+_BSS          SEGMENT WORD PUBLIC 'BSS'\r
+BeginBSS      label byte\r
+             ENDS\r
+_BSSEND       SEGMENT BYTE PUBLIC 'BSSEND'\r
+EndBSS        label byte\r
+             ENDS\r
+ENDIF\r
+\r
+\r
+IFDEF __WINDOWS__\r
+\r
+  IFDEF  __HUGE__\r
+  DGROUP GROUP NULL,_DATA,_CONST,_FPSEG,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_\r
+  ELSE\r
+  DGROUP GROUP NULL,_DATA,_CONST,_FPSEG,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND\r
+  ENDIF\r
+\r
+ELSE\r
+\r
+IFNDEF __NOFLOAT__\r
+  IF LDATA\r
+    IFDEF  __HUGE__\r
+      DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_\r
+    ELSE\r
+      DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND\r
+    ENDIF\r
+  ELSE\r
+    IFDEF __TINY__\r
+      DGROUP GROUP _TEXT,_DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND\r
+    ELSE\r
+      DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND\r
+    ENDIF\r
+  ENDIF\r
+ELSE\r
+  IF LDATA\r
+    IFDEF __HUGE__\r
+      DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_\r
+    ELSE\r
+      DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_BSS,_BSSEND\r
+    ENDIF\r
+  ELSE\r
+    IFDEF __TINY__\r
+      DGROUP GROUP _TEXT,_DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND\r
+    ELSE\r
+      DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND\r
+    ENDIF\r
+  ENDIF\r
+ENDIF ; __NOFLOAT__\r
+\r
+ENDIF ; __WINDOWS__\r
+\r
+ELSE\r
+\r
+Code_Seg@\r
+Code_EndS@\r
+Data_Seg@\r
+Data_EndS@\r
+DGROUP GROUP _DATA\r
+\r
+ENDIF ; __C0__\r
+\r
+       PAGE\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;|      Old Segment Declarations Macros                         |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+\r
+CSeg@           MACRO           ;; Open a Code Segment\r
+IFDEF __WINDOWS__\r
+_TEXT   SEGMENT WORD PUBLIC 'CODE'\r
+ELSE\r
+_TEXT   SEGMENT BYTE PUBLIC 'CODE'\r
+ENDIF\r
+       ASSUME  CS:_TEXT\r
+               ENDM\r
+\r
+CSegEnd@        MACRO           ;; Close a Code Segment\r
+_TEXT   ENDS\r
+               ENDM\r
+\r
+DSeg@           MACRO           ;; Open a Data Segment  (initialized)\r
+_DATA   SEGMENT WORD PUBLIC 'DATA'\r
+               ENDM\r
+\r
+DSegEnd@        MACRO           ;; Close a Data Segment (initialized)\r
+_DATA   ENDS\r
+               ENDM\r
+\r
+IFDEF __BSS__\r
+    IFNDEF __HUGE__\r
+       BSeg@           MACRO           ;; Open a Data Segment  (un-initialized)\r
+       _BSS    SEGMENT WORD PUBLIC 'BSS'\r
+               ENDM\r
+\r
+       BSegEnd@        MACRO           ;; Close a Data Segment (un-initialized)\r
+       _BSS    ENDS\r
+                       ENDM\r
+    ENDIF\r
+ENDIF\r
+\r
+Header@ MACRO\r
+IFDEF __WINDOWS__\r
+_TEXT   SEGMENT WORD PUBLIC 'CODE'\r
+ELSE\r
+_TEXT   SEGMENT BYTE PUBLIC 'CODE'\r
+ENDIF\r
+_TEXT   ENDS\r
+_DATA   SEGMENT WORD PUBLIC 'DATA'\r
+_DATA   ENDS\r
+IFDEF __BSS__\r
+    IFNDEF  __HUGE__\r
+       _BSS    SEGMENT WORD PUBLIC 'BSS'\r
+       _BSS    ENDS\r
+    ENDIF\r
+ENDIF\r
+\r
+       ASSUME  CS:_TEXT, DS:DGROUP\r
+       ENDM\r
+\r
+       PAGE\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;|      C Naming Convention Macros                              |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+UNDERSCORE      EQU     1\r
+\r
+ExtSym@ MACRO   Sym, sType, sName\r
+       IFNB    <sName>\r
+       IFIDN   <sName>, <__PASCAL__>\r
+NAMING      =       0\r
+       ELSE\r
+NAMING      =       UNDERSCORE\r
+       ENDIF\r
+       ENDIF\r
+       IF      NAMING\r
+       EXTRN   _&Sym : sType\r
+Sym&@   equ     _&Sym\r
+       ELSE\r
+       EXTRN   Sym : sType\r
+Sym&@   equ     Sym\r
+       ENDIF\r
+       ENDM\r
+\r
+PubSym@ MACRO   Sym, Definition, sName\r
+       IFNB    <sName>\r
+       IFIDN   <sName>, <__PASCAL__>\r
+NAMING      =       0\r
+       ELSE\r
+NAMING      =       UNDERSCORE\r
+       ENDIF\r
+       ENDIF\r
+       IF      NAMING\r
+       PUBLIC  _&Sym\r
+_&Sym   Definition\r
+Sym&@   equ     _&Sym\r
+       ELSE\r
+       PUBLIC  Sym\r
+Sym     Definition\r
+Sym&@   equ     Sym\r
+       ENDIF\r
+       ENDM\r
+\r
+Static@ MACRO   Sym, Definition, sName\r
+       IFNB    <sName>\r
+       IFIDN   <sName>, <__PASCAL__>\r
+NAMING      =       0\r
+       ELSE\r
+NAMING      =       UNDERSCORE\r
+       ENDIF\r
+       ENDIF\r
+       IF      NAMING\r
+_&Sym   Definition\r
+Sym&@   equ     _&Sym\r
+       ELSE\r
+Sym     Definition\r
+Sym&@   equ     Sym\r
+       ENDIF\r
+       ENDM\r
+\r
+       PAGE\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;|      Macros which are Data Size Dependent                    |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+IF      LDATA\r
+DPTR_           equ     DWORD PTR\r
+dPtrSize        equ     4\r
+LES_            equ     LES\r
+ES_             equ     ES:\r
+SS_             equ     SS:\r
+LDS_            equ     LDS\r
+\r
+pushDS_         MACRO\r
+               PUSH    DS\r
+               ENDM\r
+\r
+popDS_          MACRO\r
+               POP    DS\r
+               ENDM\r
+\r
+PushPtr         MACRO   dPtrOff, dPtrSeg\r
+               PUSH    dPtrSeg\r
+               PUSH    dPtrOff\r
+               ENDM\r
+\r
+\r
+dPtr@           MACRO   Sym, VALUE, sName       ;; Static Data pointer\r
+Static@         Sym, <DD        VALUE>, sName\r
+               ENDM\r
+\r
+dPtrPub@        MACRO   Sym, VALUE, sName       ;; Global Data Pointer\r
+PubSym@         Sym, <DD        VALUE>, sName\r
+               ENDM\r
+\r
+dPtrExt@        MACRO   Sym, sName      ;; External Data Pointer\r
+ExtSym@         Sym, DWORD, sName\r
+               ENDM\r
+ELSE\r
+DPTR_           equ     WORD PTR\r
+dPtrSize        equ     2\r
+LES_            equ     MOV\r
+ES_             equ     DS:\r
+SS_             equ     DS:\r
+LDS_            equ     MOV\r
+\r
+pushDS_         MACRO\r
+               ENDM\r
+\r
+popDS_          MACRO\r
+               ENDM\r
+\r
+PushPtr         MACRO   dPtrOff, dPtrSeg\r
+               PUSH    dPtrOff\r
+               ENDM\r
+\r
+dPtr@           MACRO   Sym, VALUE, sName       ;; Static Data pointer\r
+Static@         Sym, <DW        VALUE>, sName\r
+               ENDM\r
+\r
+dPtrPub@        MACRO   Sym, VALUE, sName       ;; Global Data Pointer\r
+PubSym@         Sym, <DW        VALUE>, sName\r
+               ENDM\r
+\r
+dPtrExt@        MACRO   Sym, sName      ;; External Data Pointer\r
+ExtSym@         Sym, WORD, sName\r
+               ENDM\r
+ENDIF\r
+       PAGE\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;|      Macros which are Code Size Dependent                    |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+IF      LPROG\r
+CPTR_           equ     DWORD PTR\r
+cPtrSize        equ     4\r
+\r
+Proc@           MACRO   Sym, sName      ;; Open a Static function\r
+Static@         Sym, <PROC      FAR>, sName\r
+               ENDM\r
+\r
+PubProc@        MACRO   Sym, sName      ;; Open a Public function\r
+PubSym@         Sym, <PROC      FAR>, sName\r
+               ENDM\r
+\r
+ExtProc@        MACRO   Sym, sName      ;; External Function\r
+ExtSym@         Sym, FAR, sName\r
+               ENDM\r
+\r
+cPtr@           MACRO   Sym, VALUE, sName       ;; Static Function pointer\r
+Static@         Sym, <DD        VALUE>, sName\r
+               ENDM\r
+\r
+cPtrPub@        MACRO   Sym, VALUE, sName;; Global Function Pointer\r
+PubSym@         Sym, <DD        VALUE>, sName\r
+               ENDM\r
+\r
+cPtrExt@        MACRO   Sym, sName      ;; External Function Pointer\r
+ExtSym@         Sym, DWORD, sName\r
+               ENDM\r
+ELSE\r
+CPTR_           equ     WORD PTR\r
+cPtrSize        equ     2\r
+\r
+Proc@           MACRO   Sym, sName      ;; Open a Static function\r
+Static@         Sym, <PROC      NEAR>, sName\r
+               ENDM\r
+\r
+PubProc@        MACRO   Sym, sName      ;; Open a Public function\r
+PubSym@         Sym, <PROC      NEAR>, sName\r
+               ENDM\r
+\r
+ExtProc@        MACRO   Sym, sName      ;; External Function\r
+ExtSym@         Sym, NEAR, sName\r
+               ENDM\r
+\r
+cPtr@           MACRO   Sym, VALUE, sName       ;; Static Function pointer\r
+Static@         Sym, <DW        VALUE>, sName\r
+               ENDM\r
+\r
+cPtrPub@        MACRO   Sym, VALUE, sName       ;; Global Function Pointer\r
+PubSym@         Sym, <DW        VALUE>, sName\r
+               ENDM\r
+\r
+cPtrExt@        MACRO   Sym, sName      ;; External Function Pointer\r
+ExtSym@         Sym, WORD, sName\r
+               ENDM\r
+ENDIF\r
+\r
+EndProc@        MACRO   Sym, sName      ;; Close a function\r
+Static@         Sym, ENDP, sName\r
+               ENDM\r
+\r
+       PAGE\r
+;[]------------------------------------------------------------[]\r
+;|                                                              |\r
+;|      Miscellaneous Definitions                               |\r
+;|                                                              |\r
+;[]------------------------------------------------------------[]\r
+\r
+;*** Set up some macros for procedure parameters and export/import\r
+\r
+nearCall        STRUC\r
+nearBP          dw      ?\r
+nearIP          dw      ?\r
+nearParam       dw      ?\r
+nearCall        ENDS\r
+\r
+farCall         STRUC\r
+farBP           dw      ?\r
+farCSIP         dd      ?\r
+aParam          dw      ?\r
+farCall         ENDS\r
+\r
+;*** Next, we define some convenient structures to access the parts\r
+;       of larger objects.\r
+\r
+_twoBytes       STRUC\r
+BY0     db      ?\r
+BY1     db      ?\r
+_twoBytes       ENDS\r
+\r
+_fourWords      STRUC\r
+W0      dw      ?\r
+W1      dw      ?\r
+W2      dw      ?\r
+W3      dw      ?\r
+_fourWords      ENDS\r
+\r
+_twoDwords      STRUC\r
+DD0     dd      ?\r
+DD1     dd      ?\r
+_twoDwords      ENDS\r
+\r
+_aFloat         STRUC\r
+double          dq      ?\r
+_aFloat         ENDS\r
+\r
+; How to invoke MSDOS.\r
+\r
+MSDOS@  MACRO\r
+       int     21h\r
+       ENDM\r
+       PAGE\r
+\r
+; The next section concerns the use of registers.  SI and DI are used\r
+;       for register variables, and must be conserved.\r
+\r
+; Registers AX, BX, CX, DX will not be preserved across function calls.\r
+\r
+; Firstly, the registers to be conserved through function calls, including\r
+;       the setup of local variables.\r
+\r
+link@   MACRO   _si,_di,_ES,locals\r
+       push    bp\r
+       mov     bp, sp\r
+       IFNB    <locals>\r
+               lea     sp, locals\r
+       ENDIF\r
+       IFNB    <_si>\r
+               push    si\r
+       ENDIF\r
+       IFNB    <_di>\r
+               push    di\r
+       ENDIF\r
+ENDM\r
+\r
+unLink@ MACRO   _si,_di,_ES,locals\r
+       IFNB    <_di>\r
+               pop     di\r
+       ENDIF\r
+       IFNB    <_si>\r
+               pop     si\r
+       ENDIF\r
+       IFNB    <locals>\r
+               mov     sp, bp\r
+       ENDIF\r
+       pop     bp\r
+ENDM\r
+\r
+.LIST\r
diff --git a/16/wf3d8086/sdmver.h b/16/wf3d8086/sdmver.h
new file mode 100755 (executable)
index 0000000..e5f4872
--- /dev/null
@@ -0,0 +1,8 @@
+#define SPEAR\r
+#define SPEARDEMO\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+#define CARMACIZED\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+//#define UPLOAD\r
diff --git a/16/wf3d8086/sharemsg.h b/16/wf3d8086/sharemsg.h
new file mode 100755 (executable)
index 0000000..39c2797
--- /dev/null
@@ -0,0 +1,9 @@
+"This game is shareware.\n"\r
+"Share it with everyone.\n"\r
+"Thanks.\n\n"\r
+"       Id Software\n"\r
+\r
+"This game is NOT shareware.\n"\r
+"Please do not distribute it.\n"\r
+"Thanks.\n\n"\r
+"       Id Software\n"\r
diff --git a/16/wf3d8086/sodver.h b/16/wf3d8086/sodver.h
new file mode 100755 (executable)
index 0000000..b964b80
--- /dev/null
@@ -0,0 +1,7 @@
+#define SPEAR\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+#define CARMACIZED\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+//#define UPLOAD\r
diff --git a/16/wf3d8086/spanish.h b/16/wf3d8086/spanish.h
new file mode 100755 (executable)
index 0000000..361ca49
--- /dev/null
@@ -0,0 +1,112 @@
+#define  QUITSUR       "Estas seguro que quieres\n"\\r
+                                       "parar este gran juego?"\r
+\r
+#define  CURGAME       "Ahora estas en\n"\\r
+                                       "un juego. Si continuas\n"\\r
+                                       "borras el juego viejo. O.K.?"\r
+\r
+#define  GAMESVD  "Ya hay un juego\n"\\r
+                                 "guardado en esta posicion.\n"\\r
+                                 "sobre-escribir?"\r
+\r
+#define  ENDGAMESTR  "Estas seguro que quieres\n"\\r
+                                        "terminar el juego que\n"\\r
+                                        "estas jugando?  (S  o  N):"\r
+\r
+#define   STR_NG    "Juego nuevo"\r
+#define   STR_SD    "Sonido"\r
+#define   STR_CL    "Control"\r
+#define   STR_LG    "Cargar juego"\r
+#define   STR_SG    "Guardar juego"\r
+#define   STR_CV    "Cambiar vista"\r
+#define   STR_VS    "Ver anotacion"\r
+#define  STR_EG     "Abandonar"\r
+#define   STR_BD    "Regresar al demo"\r
+#define  STR_QT     "Parar"\r
+\r
+#define  STR_LOADING  "Cargando"\r
+#define  STR_SAVING   "Guardando"\r
+\r
+#define  STR_GAME  "Regresar, jugar"\r
+#define  STR_DEMO  "Regresar al Demo"\r
+#define  STR_LGC         "Cargar juego llamado\n\""\r
+#define  STR_EMPTY       "vacio"\r
+#define  STR_CALIB       "Calibrar"\r
+#define  STR_JOYST       "Joystick"\r
+#define  STR_MOVEJOY   "Mover joystick a\n"\\r
+                                               "arriba izq y\n"\\r
+                                               "oprimir boton 0\n"\r
+#define  STR_MOVEJOY2          "Mover joystick a\n"\\r
+                                               "abajo derecha y\n"\\r
+                                               "oprimir boton 1\n"\r
+#define  STR_ESCEXIT     "ESC para salir"\r
+#define  STR_NONE  "Ninguno"\r
+#define   STR_PC         "P.C. bocina"\r
+#define   STR_ALSB       "AdLib/Sound Blaster"\r
+#define   STR_DISNEY  "Disney Sound Source"\r
+#define   STR_SB         "Sound Blaster"\r
+\r
+#define   STR_MOUSEEN         "Raton activado"\r
+#define   STR_JOYEN   "Joystick activado"\r
+#define   STR_PORT2   "Use joystick puerto 2"\r
+#define   STR_GAMEPAD         "Gravis Gamepad Activada"\r
+#define   STR_SENS  "Raton Sensibilidad"\r
+#define   STR_CUSTOM     "Modificar controles"\r
+#define   STR_DADDY   "Papi puedo jugar?"\r
+#define   STR_HURTME   "No me hieras."\r
+#define   STR_BRINGEM    "­Echamelos!"\r
+#define   STR_DEATH "La muerte encarnada"\r
+\r
+#define   STR_MOUSEADJ  "Raton ajustar sensibilidad"\r
+#define  STR_SLOW  "Lento"\r
+#define  STR_FAST   "Rapido"\r
+\r
+#define   STR_CRUN  "Corre"\r
+#define  STR_COPEN       "Abre"\r
+#define  STR_CFIRE        "Fuego"\r
+#define  STR_CSTRAFE     "Ametrallar"\r
+\r
+#define   STR_LEFT       "Izquierda"\r
+#define   STR_RIGHT "Derecha"\r
+#define   STR_FRWD  "Adelante"\r
+#define   STR_BKWD  "Atras"\r
+#define   STR_THINK "Pensando"\r
+\r
+#define   STR_SIZE1 "Use flechas para ajustar"\r
+#define   STR_SIZE2 "Enter para aceptar"\r
+#define   STR_SIZE3 "Esc para cancelar"\r
+\r
+#define   STR_YOUWIN     "Tu ganas"\r
+\r
+#define   STR_TOTALTIME  "Tiempo total"\r
+\r
+#define   STR_RATKILL       "Muertes    %"\r
+#define   STR_RATSECRET        "Secreto    %"\r
+#define   STR_RATTREASURE   "Tesoros    %"\r
+\r
+#define   STR_BONUS    "Bono"\r
+#define   STR_TIME      "Tiempo"\r
+#define   STR_PAR       "Par"\r
+\r
+#define   STR_RAT2KILL         "Muertes    %" // ratio = promedio\r
+#define   STR_RAT2SECRET       "Secreto    %"\r
+#define   STR_RAT2TREASURE  "Tesoros    %"\r
+\r
+#define   STR_DEFEATED   "Derrotado!"\r
+\r
+#define   STR_CHEATER1  "Ahora tienes 100% salud"\r
+#define   STR_CHEATER2   "99 balas y dos llaves"\r
+#define   STR_CHEATER3   "Notar que has basicamente"\r
+#define   STR_CHEATER4   "eliminado tus chances de"\r
+#define   STR_CHEATER5   "obtener puntos altos"\r
+\r
+#define   STR_NOSPACE1   "No hay suficiente espacio"\r
+#define   STR_NOSPACE2   "en tu disco para guardar juego"\r
+\r
+#define   STR_SAVECHT1   "Tu archivo para guardar juego es"\r
+#define   STR_SAVECHT2   "diremos,\"corrupto\"."\r
+#define   STR_SAVECHT3   "Pero te dire, sigue y"\r
+#define  STR_SAVECHT4   "de todos modos juega"\r
+\r
+#define   STR_SEEAGAIN      "Veamos eso de nuevo"\r
+\r
diff --git a/16/wf3d8086/spanver.h b/16/wf3d8086/spanver.h
new file mode 100755 (executable)
index 0000000..b0f3f62
--- /dev/null
@@ -0,0 +1,8 @@
+//#define SPEAR\r
+#define SPANISH\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+#define CARMACIZED\r
+//#define UPLOAD\r
diff --git a/16/wf3d8086/sv.exe b/16/wf3d8086/sv.exe
new file mode 100755 (executable)
index 0000000..72d3ff0
Binary files /dev/null and b/16/wf3d8086/sv.exe differ
diff --git a/16/wf3d8086/version.h b/16/wf3d8086/version.h
new file mode 100755 (executable)
index 0000000..05abb0e
--- /dev/null
@@ -0,0 +1,10 @@
+//#define SPEAR\r
+//#define JAPAN\r
+#define GOODTIMES\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+#define CARMACIZED\r
+//#define UPLOAD\r
+\1a
\ No newline at end of file
diff --git a/16/wf3d8086/whack_a.asm b/16/wf3d8086/whack_a.asm
new file mode 100755 (executable)
index 0000000..45fd098
--- /dev/null
@@ -0,0 +1,112 @@
+; WOLFHACK.ASM\r
+\r
+.386C\r
+IDEAL\r
+MODEL  MEDIUM,C\r
+\r
+\r
+;============================================================================\r
+\r
+DATASEG\r
+\r
+EXTRN  mr_rowofs:WORD\r
+EXTRN  mr_count:WORD\r
+EXTRN  mr_xstep:WORD\r
+EXTRN  mr_ystep:WORD\r
+EXTRN  mr_xfrac:WORD\r
+EXTRN  mr_yfrac:WORD\r
+EXTRN  mr_dest:WORD\r
+\r
+FARDATA\r
+\r
+planepics      db      8192 dup(?)     ;       // 4k of ceiling, 4k of floor\r
+PUBLIC planepics\r
+\r
+\r
+;============================================================================\r
+\r
+CODESEG\r
+\r
+;============================\r
+;\r
+; MapRow\r
+;\r
+;\r
+;============================\r
+\r
+PROC   MapRow\r
+PUBLIC MapRow\r
+       push    esi\r
+       push    edi\r
+       push    ebp\r
+       push    ds\r
+\r
+       mov     bp,[mr_rowofs]\r
+       mov             cx,[mr_count]\r
+       mov             dx,[mr_ystep]\r
+       ;begin 8086 hack\r
+       ;shl            edx,16\r
+       push cx\r
+       mov             cl,16\r
+       shl             edx,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       mov             dx,[mr_xstep]\r
+       mov             si,[mr_yfrac]\r
+       ;begin 8086 hack\r
+       ;shl            esi,16\r
+       push cx\r
+       mov             cl,16\r
+       shl             esi,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       mov             si,[mr_xfrac]\r
+       mov             di,[mr_dest]\r
+       mov             ax,SEG planepics\r
+       mov             ds,ax\r
+       mov             ax,0a000h\r
+       mov             es,ax\r
+       mov             ax,1111111111110b\r
+\r
+; eax          color lookup\r
+; ebx          scratch offset and pixel values\r
+; ecx          loop counter\r
+; edx          packed x / y step values\r
+; esi          packed x / y fractional values\r
+; edi          write pointer\r
+; ebp          toprow to bottomrow delta\r
+; es:          screenseg\r
+; ds:          pictures\r
+\r
+; mov  al,[esi]\r
+; mov  al,[eax]\r
+; mov  [edi],al\r
+\r
+; mov   ax,[_variable+ebx+2]\r
+\r
+\r
+pixelloop:\r
+       shld    ebx,esi,22                              ; shift y units in\r
+       shld    ebx,esi,7                               ; shift x units in and one extra bit\r
+       and             bx,63*65*2                              ; mask off extra top bits and 0 low bit\r
+       add             esi,edx                                 ; position += step\r
+       mov             al,[bx]\r
+       mov             al,[eax]\r
+       mov     [es:di],al                      ; write ceiling pixel\r
+       mov             al,[bx+1]\r
+       mov             al,[eax]\r
+       mov     [es:di+bp],al                   ; write floor pixel\r
+       inc             di\r
+       loop    pixelloop\r
+\r
+       pop             ds\r
+       pop             ebp\r
+       pop             edi\r
+       pop             esi\r
+\r
+       retf\r
+\r
+ENDP\r
+\r
+END\r
+\r
diff --git a/16/wf3d8086/wl_act1.c b/16/wf3d8086/wl_act1.c
new file mode 100755 (executable)
index 0000000..10d84e4
--- /dev/null
@@ -0,0 +1,900 @@
+// WL_ACT1.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       STATICS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+statobj_t      statobjlist[MAXSTATS],*laststatobj;\r
+\r
+\r
+struct\r
+{\r
+       int             picnum;\r
+       stat_t  type;\r
+} statinfo[] =\r
+{\r
+{SPR_STAT_0},                                  // puddle          spr1v\r
+{SPR_STAT_1,block},                            // Green Barrel    "\r
+{SPR_STAT_2,block},                            // Table/chairs    "\r
+{SPR_STAT_3,block},                            // Floor lamp      "\r
+{SPR_STAT_4},                                  // Chandelier      "\r
+{SPR_STAT_5,block},                            // Hanged man      "\r
+{SPR_STAT_6,bo_alpo},                  // Bad food        "\r
+{SPR_STAT_7,block},                            // Red pillar      "\r
+//\r
+// NEW PAGE\r
+//\r
+{SPR_STAT_8,block},                            // Tree            spr2v\r
+{SPR_STAT_9},                                  // Skeleton flat   "\r
+{SPR_STAT_10,block},                   // Sink            " (SOD:gibs)\r
+{SPR_STAT_11,block},                   // Potted plant    "\r
+{SPR_STAT_12,block},                   // Urn             "\r
+{SPR_STAT_13,block},                   // Bare table      "\r
+{SPR_STAT_14},                                 // Ceiling light   "\r
+#ifndef SPEAR\r
+{SPR_STAT_15},                                 // Kitchen stuff   "\r
+#else\r
+{SPR_STAT_15,block},                   // Gibs!\r
+#endif\r
+//\r
+// NEW PAGE\r
+//\r
+{SPR_STAT_16,block},                   // suit of armor   spr3v\r
+{SPR_STAT_17,block},                   // Hanging cage    "\r
+{SPR_STAT_18,block},                   // SkeletoninCage  "\r
+{SPR_STAT_19},                                 // Skeleton relax  "\r
+{SPR_STAT_20,bo_key1},                 // Key 1           "\r
+{SPR_STAT_21,bo_key2},                 // Key 2           "\r
+{SPR_STAT_22,block},                   // stuff                                (SOD:gibs)\r
+{SPR_STAT_23},                                 // stuff\r
+//\r
+// NEW PAGE\r
+//\r
+{SPR_STAT_24,bo_food},                         // Good food       spr4v\r
+{SPR_STAT_25,bo_firstaid},             // First aid       "\r
+{SPR_STAT_26,bo_clip},                 // Clip            "\r
+{SPR_STAT_27,bo_machinegun},   // Machine gun     "\r
+{SPR_STAT_28,bo_chaingun},             // Gatling gun     "\r
+{SPR_STAT_29,bo_cross},                        // Cross           "\r
+{SPR_STAT_30,bo_chalice},              // Chalice         "\r
+{SPR_STAT_31,bo_bible},                        // Bible           "\r
+//\r
+// NEW PAGE\r
+//\r
+{SPR_STAT_32,bo_crown},                        // crown           spr5v\r
+{SPR_STAT_33,bo_fullheal},             // one up          "\r
+{SPR_STAT_34,bo_gibs},                 // gibs            "\r
+{SPR_STAT_35,block},                   // barrel          "\r
+{SPR_STAT_36,block},                   // well            "\r
+{SPR_STAT_37,block},                   // Empty well      "\r
+{SPR_STAT_38,bo_gibs},                 // Gibs 2          "\r
+{SPR_STAT_39,block},                   // flag                         "\r
+//\r
+// NEW PAGE\r
+//\r
+#ifndef SPEAR\r
+{SPR_STAT_40,block},                   // Call Apogee          spr7v\r
+#else\r
+{SPR_STAT_40},                                 // Red light\r
+#endif\r
+//\r
+// NEW PAGE\r
+//\r
+{SPR_STAT_41},                                 // junk            "\r
+{SPR_STAT_42},                                 // junk                    "\r
+{SPR_STAT_43},                                 // junk            "\r
+#ifndef SPEAR\r
+{SPR_STAT_44},                                 // pots            "\r
+#else\r
+{SPR_STAT_44,block},                   // Gibs!\r
+#endif\r
+{SPR_STAT_45,block},                   // stove           " (SOD:gibs)\r
+{SPR_STAT_46,block},                   // spears          " (SOD:gibs)\r
+{SPR_STAT_47},                                 // vines                        "\r
+//\r
+// NEW PAGE\r
+//\r
+#ifdef SPEAR\r
+{SPR_STAT_48,block},                   // marble pillar\r
+{SPR_STAT_49,bo_25clip},               // bonus 25 clip\r
+{SPR_STAT_50,block},                   // truck\r
+{SPR_STAT_51,bo_spear},                        // SPEAR OF DESTINY!\r
+#endif\r
+\r
+{SPR_STAT_26,bo_clip2},                        // Clip            "\r
+{-1}                                                   // terminator\r
+};\r
+\r
+/*\r
+===============\r
+=\r
+= InitStaticList\r
+=\r
+===============\r
+*/\r
+\r
+void InitStaticList (void)\r
+{\r
+       laststatobj = &statobjlist[0];\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnStatic\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnStatic (int tilex, int tiley, int type)\r
+{\r
+       laststatobj->shapenum = statinfo[type].picnum;\r
+       laststatobj->tilex = tilex;\r
+       laststatobj->tiley = tiley;\r
+       laststatobj->visspot = &spotvis[tilex][tiley];\r
+\r
+       switch (statinfo[type].type)\r
+       {\r
+       case block:\r
+               (unsigned)actorat[tilex][tiley] = 1;            // consider it a blocking tile\r
+       case dressing:\r
+               laststatobj->flags = 0;\r
+               break;\r
+\r
+       case    bo_cross:\r
+       case    bo_chalice:\r
+       case    bo_bible:\r
+       case    bo_crown:\r
+       case    bo_fullheal:\r
+               if (!loadedgame)\r
+                 gamestate.treasuretotal++;\r
+\r
+       case    bo_firstaid:\r
+       case    bo_key1:\r
+       case    bo_key2:\r
+       case    bo_key3:\r
+       case    bo_key4:\r
+       case    bo_clip:\r
+       case    bo_25clip:\r
+       case    bo_machinegun:\r
+       case    bo_chaingun:\r
+       case    bo_food:\r
+       case    bo_alpo:\r
+       case    bo_gibs:\r
+       case    bo_spear:\r
+               laststatobj->flags = FL_BONUS;\r
+               laststatobj->itemnumber = statinfo[type].type;\r
+               break;\r
+       }\r
+\r
+       laststatobj++;\r
+\r
+       if (laststatobj == &statobjlist[MAXSTATS])\r
+               Quit ("Too many static objects!\n");\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= PlaceItemType\r
+=\r
+= Called during game play to drop actors' items.  It finds the proper\r
+= item number based on the item type (bo_???).  If there are no free item\r
+= spots, nothing is done.\r
+=\r
+===============\r
+*/\r
+\r
+void PlaceItemType (int itemtype, int tilex, int tiley)\r
+{\r
+       int                     type;\r
+       statobj_t       *spot;\r
+\r
+//\r
+// find the item number\r
+//\r
+       for (type=0 ;  ; type++)\r
+       {\r
+               if (statinfo[type].picnum == -1)                // end of list\r
+                       Quit ("PlaceItemType: couldn't find type!");\r
+               if (statinfo[type].type == itemtype)\r
+                       break;\r
+       }\r
+\r
+//\r
+// find a spot in statobjlist to put it in\r
+//\r
+       for (spot=&statobjlist[0] ; ; spot++)\r
+       {\r
+               if (spot==laststatobj)\r
+               {\r
+                       if (spot == &statobjlist[MAXSTATS])\r
+                               return;                                                 // no free spots\r
+                       laststatobj++;                                          // space at end\r
+                       break;\r
+               }\r
+\r
+               if (spot->shapenum == -1)                               // -1 is a free spot\r
+                       break;\r
+       }\r
+//\r
+// place it\r
+//\r
+       spot->shapenum = statinfo[type].picnum;\r
+       spot->tilex = tilex;\r
+       spot->tiley = tiley;\r
+       spot->visspot = &spotvis[tilex][tiley];\r
+       spot->flags = FL_BONUS;\r
+       spot->itemnumber = statinfo[type].type;\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       DOORS\r
+\r
+doorobjlist[] holds most of the information for the doors\r
+\r
+doorposition[] holds the amount the door is open, ranging from 0 to 0xffff\r
+       this is directly accessed by AsmRefresh during rendering\r
+\r
+The number of doors is limited to 64 because a spot in tilemap holds the\r
+       door number in the low 6 bits, with the high bit meaning a door center\r
+       and bit 6 meaning a door side tile\r
+\r
+Open doors conect two areas, so sounds will travel between them and sight\r
+       will be checked when the player is in a connected area.\r
+\r
+Areaconnect is incremented/decremented by each door. If >0 they connect\r
+\r
+Every time a door opens or closes the areabyplayer matrix gets recalculated.\r
+       An area is true if it connects with the player's current spor.\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define DOORWIDTH      0x7800\r
+#define OPENTICS       300\r
+\r
+doorobj_t      doorobjlist[MAXDOORS],*lastdoorobj;\r
+int                    doornum;\r
+\r
+unsigned       doorposition[MAXDOORS];         // leading edge of door 0=closed\r
+                                                                               // 0xffff = fully open\r
+\r
+byte           far areaconnect[NUMAREAS][NUMAREAS];\r
+\r
+boolean                areabyplayer[NUMAREAS];\r
+\r
+\r
+/*\r
+==============\r
+=\r
+= ConnectAreas\r
+=\r
+= Scans outward from playerarea, marking all connected areas\r
+=\r
+==============\r
+*/\r
+\r
+void RecursiveConnect (int areanumber)\r
+{\r
+       int     i;\r
+\r
+       for (i=0;i<NUMAREAS;i++)\r
+       {\r
+               if (areaconnect[areanumber][i] && !areabyplayer[i])\r
+               {\r
+                       areabyplayer[i] = true;\r
+                       RecursiveConnect (i);\r
+               }\r
+       }\r
+}\r
+\r
+\r
+void ConnectAreas (void)\r
+{\r
+       memset (areabyplayer,0,sizeof(areabyplayer));\r
+       areabyplayer[player->areanumber] = true;\r
+       RecursiveConnect (player->areanumber);\r
+}\r
+\r
+\r
+void InitAreas (void)\r
+{\r
+       memset (areabyplayer,0,sizeof(areabyplayer));\r
+       areabyplayer[player->areanumber] = true;\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= InitDoorList\r
+=\r
+===============\r
+*/\r
+\r
+void InitDoorList (void)\r
+{\r
+       memset (areabyplayer,0,sizeof(areabyplayer));\r
+       _fmemset (areaconnect,0,sizeof(areaconnect));\r
+\r
+       lastdoorobj = &doorobjlist[0];\r
+       doornum = 0;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnDoor\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)\r
+{\r
+       int     areanumber;\r
+       unsigned        far *map;\r
+\r
+       if (doornum==64)\r
+               Quit ("64+ doors on level!");\r
+\r
+       doorposition[doornum] = 0;              // doors start out fully closed\r
+       lastdoorobj->tilex = tilex;\r
+       lastdoorobj->tiley = tiley;\r
+       lastdoorobj->vertical = vertical;\r
+       lastdoorobj->lock = lock;\r
+       lastdoorobj->action = dr_closed;\r
+\r
+       (unsigned)actorat[tilex][tiley] = doornum | 0x80;       // consider it a solid wall\r
+\r
+//\r
+// make the door tile a special tile, and mark the adjacent tiles\r
+// for door sides\r
+//\r
+       tilemap[tilex][tiley] = doornum | 0x80;\r
+       map = mapsegs[0] + farmapylookup[tiley]+tilex;\r
+       if (vertical)\r
+       {\r
+               *map = *(map-1);                        // set area number\r
+               tilemap[tilex][tiley-1] |= 0x40;\r
+               tilemap[tilex][tiley+1] |= 0x40;\r
+       }\r
+       else\r
+       {\r
+               *map = *(map-mapwidth);                                 // set area number\r
+               tilemap[tilex-1][tiley] |= 0x40;\r
+               tilemap[tilex+1][tiley] |= 0x40;\r
+       }\r
+\r
+       doornum++;\r
+       lastdoorobj++;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= OpenDoor\r
+=\r
+=====================\r
+*/\r
+\r
+void OpenDoor (int door)\r
+{\r
+       if (doorobjlist[door].action == dr_open)\r
+               doorobjlist[door].ticcount = 0;                 // reset open time\r
+       else\r
+               doorobjlist[door].action = dr_opening;  // start it opening\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= CloseDoor\r
+=\r
+=====================\r
+*/\r
+\r
+void CloseDoor (int door)\r
+{\r
+       int     tilex,tiley,area;\r
+       objtype *check;\r
+\r
+//\r
+// don't close on anything solid\r
+//\r
+       tilex = doorobjlist[door].tilex;\r
+       tiley = doorobjlist[door].tiley;\r
+\r
+       if (actorat[tilex][tiley])\r
+               return;\r
+\r
+       if (player->tilex == tilex && player->tiley == tiley)\r
+               return;\r
+\r
+       if (doorobjlist[door].vertical)\r
+       {\r
+               if ( player->tiley == tiley )\r
+               {\r
+                       if ( ((player->x+MINDIST) >>TILESHIFT) == tilex )\r
+                               return;\r
+                       if ( ((player->x-MINDIST) >>TILESHIFT) == tilex )\r
+                               return;\r
+               }\r
+               check = actorat[tilex-1][tiley];\r
+               if (check && ((check->x+MINDIST) >> TILESHIFT) == tilex )\r
+                       return;\r
+               check = actorat[tilex+1][tiley];\r
+               if (check && ((check->x-MINDIST) >> TILESHIFT) == tilex )\r
+                       return;\r
+       }\r
+       else if (!doorobjlist[door].vertical)\r
+       {\r
+               if (player->tilex == tilex)\r
+               {\r
+                       if ( ((player->y+MINDIST) >>TILESHIFT) == tiley )\r
+                               return;\r
+                       if ( ((player->y-MINDIST) >>TILESHIFT) == tiley )\r
+                               return;\r
+               }\r
+               check = actorat[tilex][tiley-1];\r
+               if (check && ((check->y+MINDIST) >> TILESHIFT) == tiley )\r
+                       return;\r
+               check = actorat[tilex][tiley+1];\r
+               if (check && ((check->y-MINDIST) >> TILESHIFT) == tiley )\r
+                       return;\r
+       }\r
+\r
+\r
+//\r
+// play door sound if in a connected area\r
+//\r
+       area = *(mapsegs[0] + farmapylookup[doorobjlist[door].tiley]\r
+                       +doorobjlist[door].tilex)-AREATILE;\r
+       if (areabyplayer[area])\r
+       {\r
+               PlaySoundLocTile(CLOSEDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB\r
+       }\r
+\r
+       doorobjlist[door].action = dr_closing;\r
+//\r
+// make the door space solid\r
+//\r
+       (unsigned)actorat[tilex][tiley]\r
+               = door | 0x80;\r
+}\r
+\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= OperateDoor\r
+=\r
+= The player wants to change the door's direction\r
+=\r
+=====================\r
+*/\r
+\r
+void OperateDoor (int door)\r
+{\r
+       int     lock;\r
+\r
+       lock = doorobjlist[door].lock;\r
+       if (lock >= dr_lock1 && lock <= dr_lock4)\r
+       {\r
+               if ( ! (gamestate.keys & (1 << (lock-dr_lock1) ) ) )\r
+               {\r
+                       SD_PlaySound (NOWAYSND);                // locked\r
+                       return;\r
+               }\r
+       }\r
+\r
+       switch (doorobjlist[door].action)\r
+       {\r
+       case dr_closed:\r
+       case dr_closing:\r
+               OpenDoor (door);\r
+               break;\r
+       case dr_open:\r
+       case dr_opening:\r
+               CloseDoor (door);\r
+               break;\r
+       }\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===============\r
+=\r
+= DoorOpen\r
+=\r
+= Close the door after three seconds\r
+=\r
+===============\r
+*/\r
+\r
+void DoorOpen (int door)\r
+{\r
+       if ( (doorobjlist[door].ticcount += tics) >= OPENTICS)\r
+               CloseDoor (door);\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= DoorOpening\r
+=\r
+===============\r
+*/\r
+\r
+void DoorOpening (int door)\r
+{\r
+       int             area1,area2;\r
+       unsigned        far     *map;\r
+       long    position;\r
+\r
+       position = doorposition[door];\r
+       if (!position)\r
+       {\r
+       //\r
+       // door is just starting to open, so connect the areas\r
+       //\r
+               map = mapsegs[0] + farmapylookup[doorobjlist[door].tiley]\r
+                       +doorobjlist[door].tilex;\r
+\r
+               if (doorobjlist[door].vertical)\r
+               {\r
+                       area1 = *(map+1);\r
+                       area2 = *(map-1);\r
+               }\r
+               else\r
+               {\r
+                       area1 = *(map-mapwidth);\r
+                       area2 = *(map+mapwidth);\r
+               }\r
+               area1 -= AREATILE;\r
+               area2 -= AREATILE;\r
+               areaconnect[area1][area2]++;\r
+               areaconnect[area2][area1]++;\r
+               ConnectAreas ();\r
+               if (areabyplayer[area1])\r
+               {\r
+                       PlaySoundLocTile(OPENDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley);  // JAB\r
+               }\r
+       }\r
+\r
+//\r
+// slide the door by an adaptive amount\r
+//\r
+       position += tics<<10;\r
+       if (position >= 0xffff)\r
+       {\r
+       //\r
+       // door is all the way open\r
+       //\r
+               position = 0xffff;\r
+               doorobjlist[door].ticcount = 0;\r
+               doorobjlist[door].action = dr_open;\r
+               actorat[doorobjlist[door].tilex][doorobjlist[door].tiley] = 0;\r
+       }\r
+\r
+       doorposition[door] = position;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= DoorClosing\r
+=\r
+===============\r
+*/\r
+\r
+void DoorClosing (int door)\r
+{\r
+       int             area1,area2,move;\r
+       unsigned        far     *map;\r
+       long    position;\r
+       int             tilex,tiley;\r
+\r
+       tilex = doorobjlist[door].tilex;\r
+       tiley = doorobjlist[door].tiley;\r
+\r
+       if ( ((unsigned)actorat[tilex][tiley] != (door | 0x80))\r
+       || (player->tilex == tilex && player->tiley == tiley) )\r
+       {                       // something got inside the door\r
+               OpenDoor (door);\r
+               return;\r
+       };\r
+\r
+       position = doorposition[door];\r
+\r
+//\r
+// slide the door by an adaptive amount\r
+//\r
+       position -= tics<<10;\r
+       if (position <= 0)\r
+       {\r
+       //\r
+       // door is closed all the way, so disconnect the areas\r
+       //\r
+               position = 0;\r
+\r
+               doorobjlist[door].action = dr_closed;\r
+\r
+               map = mapsegs[0] + farmapylookup[doorobjlist[door].tiley]\r
+                       +doorobjlist[door].tilex;\r
+\r
+               if (doorobjlist[door].vertical)\r
+               {\r
+                       area1 = *(map+1);\r
+                       area2 = *(map-1);\r
+               }\r
+               else\r
+               {\r
+                       area1 = *(map-mapwidth);\r
+                       area2 = *(map+mapwidth);\r
+               }\r
+               area1 -= AREATILE;\r
+               area2 -= AREATILE;\r
+               areaconnect[area1][area2]--;\r
+               areaconnect[area2][area1]--;\r
+\r
+               ConnectAreas ();\r
+       }\r
+\r
+       doorposition[door] = position;\r
+}\r
+\r
+\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= MoveDoors\r
+=\r
+= Called from PlayLoop\r
+=\r
+=====================\r
+*/\r
+\r
+void MoveDoors (void)\r
+{\r
+       int             door;\r
+\r
+       if (gamestate.victoryflag)              // don't move door during victory sequence\r
+               return;\r
+\r
+       for (door = 0 ; door < doornum ; door++)\r
+               switch (doorobjlist[door].action)\r
+               {\r
+               case dr_open:\r
+                       DoorOpen (door);\r
+                       break;\r
+\r
+               case dr_opening:\r
+                       DoorOpening(door);\r
+                       break;\r
+\r
+               case dr_closing:\r
+                       DoorClosing(door);\r
+                       break;\r
+               }\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               PUSHABLE WALLS\r
+\r
+=============================================================================\r
+*/\r
+\r
+unsigned       pwallstate;\r
+unsigned       pwallpos;                       // amount a pushable wall has been moved (0-63)\r
+unsigned       pwallx,pwally;\r
+int                    pwalldir;\r
+\r
+/*\r
+===============\r
+=\r
+= PushWall\r
+=\r
+===============\r
+*/\r
+\r
+void PushWall (int checkx, int checky, int dir)\r
+{\r
+       int             oldtile;\r
+\r
+       if (pwallstate)\r
+         return;\r
+\r
+\r
+       oldtile = tilemap[checkx][checky];\r
+       if (!oldtile)\r
+               return;\r
+\r
+       switch (dir)\r
+       {\r
+       case di_north:\r
+               if (actorat[checkx][checky-1])\r
+               {\r
+                       SD_PlaySound (NOWAYSND);\r
+                       return;\r
+               }\r
+               (unsigned)actorat[checkx][checky-1] =\r
+               tilemap[checkx][checky-1] = oldtile;\r
+               break;\r
+\r
+       case di_east:\r
+               if (actorat[checkx+1][checky])\r
+               {\r
+                       SD_PlaySound (NOWAYSND);\r
+                       return;\r
+               }\r
+               (unsigned)actorat[checkx+1][checky] =\r
+               tilemap[checkx+1][checky] = oldtile;\r
+               break;\r
+\r
+       case di_south:\r
+               if (actorat[checkx][checky+1])\r
+               {\r
+                       SD_PlaySound (NOWAYSND);\r
+                       return;\r
+               }\r
+               (unsigned)actorat[checkx][checky+1] =\r
+               tilemap[checkx][checky+1] = oldtile;\r
+               break;\r
+\r
+       case di_west:\r
+               if (actorat[checkx-1][checky])\r
+               {\r
+                       SD_PlaySound (NOWAYSND);\r
+                       return;\r
+               }\r
+               (unsigned)actorat[checkx-1][checky] =\r
+               tilemap[checkx-1][checky] = oldtile;\r
+               break;\r
+       }\r
+\r
+       gamestate.secretcount++;\r
+       pwallx = checkx;\r
+       pwally = checky;\r
+       pwalldir = dir;\r
+       pwallstate = 1;\r
+       pwallpos = 0;\r
+       tilemap[pwallx][pwally] |= 0xc0;\r
+       *(mapsegs[1]+farmapylookup[pwally]+pwallx) = 0; // remove P tile info\r
+\r
+       SD_PlaySound (PUSHWALLSND);\r
+}\r
+\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= MovePWalls\r
+=\r
+=================\r
+*/\r
+\r
+void MovePWalls (void)\r
+{\r
+       int             oldblock,oldtile;\r
+\r
+       if (!pwallstate)\r
+               return;\r
+\r
+       oldblock = pwallstate/128;\r
+\r
+       pwallstate += tics;\r
+\r
+       if (pwallstate/128 != oldblock)\r
+       {\r
+       // block crossed into a new block\r
+               oldtile = tilemap[pwallx][pwally] & 63;\r
+\r
+               //\r
+               // the tile can now be walked into\r
+               //\r
+               tilemap[pwallx][pwally] = 0;\r
+               (unsigned)actorat[pwallx][pwally] = 0;\r
+               *(mapsegs[0]+farmapylookup[pwally]+pwallx) = player->areanumber+AREATILE;\r
+\r
+               //\r
+               // see if it should be pushed farther\r
+               //\r
+               if (pwallstate>256)\r
+               {\r
+               //\r
+               // the block has been pushed two tiles\r
+               //\r
+                       pwallstate = 0;\r
+                       return;\r
+               }\r
+               else\r
+               {\r
+                       switch (pwalldir)\r
+                       {\r
+                       case di_north:\r
+                               pwally--;\r
+                               if (actorat[pwallx][pwally-1])\r
+                               {\r
+                                       pwallstate = 0;\r
+                                       return;\r
+                               }\r
+                               (unsigned)actorat[pwallx][pwally-1] =\r
+                               tilemap[pwallx][pwally-1] = oldtile;\r
+                               break;\r
+\r
+                       case di_east:\r
+                               pwallx++;\r
+                               if (actorat[pwallx+1][pwally])\r
+                               {\r
+                                       pwallstate = 0;\r
+                                       return;\r
+                               }\r
+                               (unsigned)actorat[pwallx+1][pwally] =\r
+                               tilemap[pwallx+1][pwally] = oldtile;\r
+                               break;\r
+\r
+                       case di_south:\r
+                               pwally++;\r
+                               if (actorat[pwallx][pwally+1])\r
+                               {\r
+                                       pwallstate = 0;\r
+                                       return;\r
+                               }\r
+                               (unsigned)actorat[pwallx][pwally+1] =\r
+                               tilemap[pwallx][pwally+1] = oldtile;\r
+                               break;\r
+\r
+                       case di_west:\r
+                               pwallx--;\r
+                               if (actorat[pwallx-1][pwally])\r
+                               {\r
+                                       pwallstate = 0;\r
+                                       return;\r
+                               }\r
+                               (unsigned)actorat[pwallx-1][pwally] =\r
+                               tilemap[pwallx-1][pwally] = oldtile;\r
+                               break;\r
+                       }\r
+\r
+                       tilemap[pwallx][pwally] = oldtile | 0xc0;\r
+               }\r
+       }\r
+\r
+\r
+       pwallpos = (pwallstate/2)&63;\r
+\r
+}\r
+\r
diff --git a/16/wf3d8086/wl_act2.c b/16/wf3d8086/wl_act2.c
new file mode 100755 (executable)
index 0000000..d9d99a0
--- /dev/null
@@ -0,0 +1,3872 @@
+// WL_ACT2.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define PROJECTILESIZE 0xc000l\r
+\r
+#define BJRUNSPEED     2048\r
+#define BJJUMPSPEED    680\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+dirtype dirtable[9] = {northwest,north,northeast,west,nodir,east,\r
+       southwest,south,southeast};\r
+\r
+int    starthitpoints[4][NUMENEMIES] =\r
+        //\r
+        // BABY MODE\r
+        //\r
+        {\r
+        {25,   // guards\r
+         50,   // officer\r
+         100,  // SS\r
+         1,    // dogs\r
+         850,  // Hans\r
+         850,  // Schabbs\r
+         200,  // fake hitler\r
+         800,  // mecha hitler\r
+         45,   // mutants\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+\r
+         850,  // Gretel\r
+         850,  // Gift\r
+         850,  // Fat\r
+         5,    // en_spectre,\r
+         1450, // en_angel,\r
+         850,  // en_trans,\r
+         1050, // en_uber,\r
+         950,  // en_will,\r
+         1250  // en_death\r
+         },\r
+        //\r
+        // DON'T HURT ME MODE\r
+        //\r
+        {25,   // guards\r
+         50,   // officer\r
+         100,  // SS\r
+         1,    // dogs\r
+         950,  // Hans\r
+         950,  // Schabbs\r
+         300,  // fake hitler\r
+         950,  // mecha hitler\r
+         55,   // mutants\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+\r
+         950,  // Gretel\r
+         950,  // Gift\r
+         950,  // Fat\r
+         10,   // en_spectre,\r
+         1550, // en_angel,\r
+         950,  // en_trans,\r
+         1150, // en_uber,\r
+         1050, // en_will,\r
+         1350  // en_death\r
+         },\r
+        //\r
+        // BRING 'EM ON MODE\r
+        //\r
+        {25,   // guards\r
+         50,   // officer\r
+         100,  // SS\r
+         1,    // dogs\r
+\r
+         1050, // Hans\r
+         1550, // Schabbs\r
+         400,  // fake hitler\r
+         1050, // mecha hitler\r
+\r
+         55,   // mutants\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+\r
+         1050, // Gretel\r
+         1050, // Gift\r
+         1050, // Fat\r
+         15,   // en_spectre,\r
+         1650, // en_angel,\r
+         1050, // en_trans,\r
+         1250, // en_uber,\r
+         1150, // en_will,\r
+         1450  // en_death\r
+         },\r
+        //\r
+        // DEATH INCARNATE MODE\r
+        //\r
+        {25,   // guards\r
+         50,   // officer\r
+         100,  // SS\r
+         1,    // dogs\r
+\r
+         1200, // Hans\r
+         2400, // Schabbs\r
+         500,  // fake hitler\r
+         1200, // mecha hitler\r
+\r
+         65,   // mutants\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+         25,   // ghosts\r
+\r
+         1200, // Gretel\r
+         1200, // Gift\r
+         1200, // Fat\r
+         25,   // en_spectre,\r
+         2000, // en_angel,\r
+         1200, // en_trans,\r
+         1400, // en_uber,\r
+         1300, // en_will,\r
+         1600  // en_death\r
+         }}\r
+         ;\r
+\r
+void   A_StartDeathCam (objtype *ob);\r
+\r
+\r
+void   T_Path (objtype *ob);\r
+void   T_Shoot (objtype *ob);\r
+void   T_Bite (objtype *ob);\r
+void   T_DogChase (objtype *ob);\r
+void   T_Chase (objtype *ob);\r
+void   T_Projectile (objtype *ob);\r
+void   T_Stand (objtype *ob);\r
+\r
+void A_DeathScream (objtype *ob);\r
+\r
+extern statetype s_rocket;\r
+extern statetype s_smoke1;\r
+extern statetype s_smoke2;\r
+extern statetype s_smoke3;\r
+extern statetype s_smoke4;\r
+extern statetype s_boom2;\r
+extern statetype s_boom3;\r
+\r
+void A_Smoke (objtype *ob);\r
+\r
+statetype s_rocket             = {true,SPR_ROCKET_1,3,T_Projectile,A_Smoke,&s_rocket};\r
+statetype s_smoke1             = {false,SPR_SMOKE_1,3,NULL,NULL,&s_smoke2};\r
+statetype s_smoke2             = {false,SPR_SMOKE_2,3,NULL,NULL,&s_smoke3};\r
+statetype s_smoke3             = {false,SPR_SMOKE_3,3,NULL,NULL,&s_smoke4};\r
+statetype s_smoke4             = {false,SPR_SMOKE_4,3,NULL,NULL,NULL};\r
+\r
+statetype s_boom1              = {false,SPR_BOOM_1,6,NULL,NULL,&s_boom2};\r
+statetype s_boom2              = {false,SPR_BOOM_2,6,NULL,NULL,&s_boom3};\r
+statetype s_boom3              = {false,SPR_BOOM_3,6,NULL,NULL,NULL};\r
+\r
+#ifdef SPEAR\r
+\r
+extern statetype s_hrocket;\r
+extern statetype s_hsmoke1;\r
+extern statetype s_hsmoke2;\r
+extern statetype s_hsmoke3;\r
+extern statetype s_hsmoke4;\r
+extern statetype s_hboom2;\r
+extern statetype s_hboom3;\r
+\r
+void A_Smoke (objtype *ob);\r
+\r
+statetype s_hrocket            = {true,SPR_HROCKET_1,3,T_Projectile,A_Smoke,&s_hrocket};\r
+statetype s_hsmoke1            = {false,SPR_HSMOKE_1,3,NULL,NULL,&s_hsmoke2};\r
+statetype s_hsmoke2            = {false,SPR_HSMOKE_2,3,NULL,NULL,&s_hsmoke3};\r
+statetype s_hsmoke3            = {false,SPR_HSMOKE_3,3,NULL,NULL,&s_hsmoke4};\r
+statetype s_hsmoke4            = {false,SPR_HSMOKE_4,3,NULL,NULL,NULL};\r
+\r
+statetype s_hboom1             = {false,SPR_HBOOM_1,6,NULL,NULL,&s_hboom2};\r
+statetype s_hboom2             = {false,SPR_HBOOM_2,6,NULL,NULL,&s_hboom3};\r
+statetype s_hboom3             = {false,SPR_HBOOM_3,6,NULL,NULL,NULL};\r
+\r
+#endif\r
+\r
+void   T_Schabb (objtype *ob);\r
+void   T_SchabbThrow (objtype *ob);\r
+void   T_Fake (objtype *ob);\r
+void   T_FakeFire (objtype *ob);\r
+void   T_Ghosts (objtype *ob);\r
+\r
+void A_Slurpie (objtype *ob);\r
+void A_HitlerMorph (objtype *ob);\r
+void A_MechaSound (objtype *ob);\r
+\r
+/*\r
+=================\r
+=\r
+= A_Smoke\r
+=\r
+=================\r
+*/\r
+\r
+void A_Smoke (objtype *ob)\r
+{\r
+       GetNewActor ();\r
+#ifdef SPEAR\r
+       if (ob->obclass == hrocketobj)\r
+               new->state = &s_hsmoke1;\r
+       else\r
+#endif\r
+               new->state = &s_smoke1;\r
+       new->ticcount = 6;\r
+\r
+       new->tilex = ob->tilex;\r
+       new->tiley = ob->tiley;\r
+       new->x = ob->x;\r
+       new->y = ob->y;\r
+       new->obclass = inertobj;\r
+       new->active = true;\r
+\r
+       new->flags = FL_NEVERMARK;\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= ProjectileTryMove\r
+=\r
+= returns true if move ok\r
+===================\r
+*/\r
+\r
+#define PROJSIZE       0x2000\r
+\r
+boolean ProjectileTryMove (objtype *ob)\r
+{\r
+       int                     xl,yl,xh,yh,x,y;\r
+       objtype         *check;\r
+       long            deltax,deltay;\r
+\r
+       xl = (ob->x-PROJSIZE) >>TILESHIFT;\r
+       yl = (ob->y-PROJSIZE) >>TILESHIFT;\r
+\r
+       xh = (ob->x+PROJSIZE) >>TILESHIFT;\r
+       yh = (ob->y+PROJSIZE) >>TILESHIFT;\r
+\r
+//\r
+// check for solid walls\r
+//\r
+       for (y=yl;y<=yh;y++)\r
+               for (x=xl;x<=xh;x++)\r
+               {\r
+                       check = actorat[x][y];\r
+                       if (check && check<objlist)\r
+                               return false;\r
+               }\r
+\r
+       return true;\r
+}\r
+\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= T_Projectile\r
+=\r
+=================\r
+*/\r
+\r
+void T_Projectile (objtype *ob)\r
+{\r
+       long    deltax,deltay;\r
+       int             damage;\r
+       long    speed;\r
+\r
+       speed = (long)ob->speed*tics;\r
+\r
+       deltax = FixedByFrac(speed,costable[ob->angle]);\r
+       deltay = -FixedByFrac(speed,sintable[ob->angle]);\r
+\r
+       if (deltax>0x10000l)\r
+               deltax = 0x10000l;\r
+       if (deltay>0x10000l)\r
+               deltay = 0x10000l;\r
+\r
+       ob->x += deltax;\r
+       ob->y += deltay;\r
+\r
+       deltax = LABS(ob->x - player->x);\r
+       deltay = LABS(ob->y - player->y);\r
+\r
+       if (!ProjectileTryMove (ob))\r
+       {\r
+               if (ob->obclass == rocketobj)\r
+               {\r
+                       PlaySoundLocActor(MISSILEHITSND,ob);\r
+                       ob->state = &s_boom1;\r
+               }\r
+#ifdef SPEAR\r
+               else if (ob->obclass == hrocketobj)\r
+               {\r
+                       PlaySoundLocActor(MISSILEHITSND,ob);\r
+                       ob->state = &s_hboom1;\r
+               }\r
+#endif\r
+               else\r
+                       ob->state = NULL;               // mark for removal\r
+\r
+               return;\r
+       }\r
+\r
+       if (deltax < PROJECTILESIZE && deltay < PROJECTILESIZE)\r
+       {       // hit the player\r
+               switch (ob->obclass)\r
+               {\r
+               case needleobj:\r
+                       damage = (US_RndT() >>3) + 20;\r
+                       break;\r
+               case rocketobj:\r
+               case hrocketobj:\r
+               case sparkobj:\r
+                       damage = (US_RndT() >>3) + 30;\r
+                       break;\r
+               case fireobj:\r
+                       damage = (US_RndT() >>3);\r
+                       break;\r
+               }\r
+\r
+               TakeDamage (damage,ob);\r
+               ob->state = NULL;               // mark for removal\r
+               return;\r
+       }\r
+\r
+       ob->tilex = ob->x >> TILESHIFT;\r
+       ob->tiley = ob->y >> TILESHIFT;\r
+\r
+}\r
+\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       GUARD\r
+\r
+=============================================================================\r
+*/\r
+\r
+//\r
+// guards\r
+//\r
+\r
+extern statetype s_grdstand;\r
+\r
+extern statetype s_grdpath1;\r
+extern statetype s_grdpath1s;\r
+extern statetype s_grdpath2;\r
+extern statetype s_grdpath3;\r
+extern statetype s_grdpath3s;\r
+extern statetype s_grdpath4;\r
+\r
+extern statetype s_grdpain;\r
+extern statetype s_grdpain1;\r
+\r
+extern statetype s_grdgiveup;\r
+\r
+extern statetype s_grdshoot1;\r
+extern statetype s_grdshoot2;\r
+extern statetype s_grdshoot3;\r
+extern statetype s_grdshoot4;\r
+\r
+extern statetype s_grdchase1;\r
+extern statetype s_grdchase1s;\r
+extern statetype s_grdchase2;\r
+extern statetype s_grdchase3;\r
+extern statetype s_grdchase3s;\r
+extern statetype s_grdchase4;\r
+\r
+extern statetype s_grddie1;\r
+extern statetype s_grddie1d;\r
+extern statetype s_grddie2;\r
+extern statetype s_grddie3;\r
+extern statetype s_grddie4;\r
+\r
+statetype s_grdstand   = {true,SPR_GRD_S_1,0,T_Stand,NULL,&s_grdstand};\r
+\r
+statetype s_grdpath1   = {true,SPR_GRD_W1_1,20,T_Path,NULL,&s_grdpath1s};\r
+statetype s_grdpath1s  = {true,SPR_GRD_W1_1,5,NULL,NULL,&s_grdpath2};\r
+statetype s_grdpath2   = {true,SPR_GRD_W2_1,15,T_Path,NULL,&s_grdpath3};\r
+statetype s_grdpath3   = {true,SPR_GRD_W3_1,20,T_Path,NULL,&s_grdpath3s};\r
+statetype s_grdpath3s  = {true,SPR_GRD_W3_1,5,NULL,NULL,&s_grdpath4};\r
+statetype s_grdpath4   = {true,SPR_GRD_W4_1,15,T_Path,NULL,&s_grdpath1};\r
+\r
+statetype s_grdpain    = {2,SPR_GRD_PAIN_1,10,NULL,NULL,&s_grdchase1};\r
+statetype s_grdpain1   = {2,SPR_GRD_PAIN_2,10,NULL,NULL,&s_grdchase1};\r
+\r
+statetype s_grdshoot1  = {false,SPR_GRD_SHOOT1,20,NULL,NULL,&s_grdshoot2};\r
+statetype s_grdshoot2  = {false,SPR_GRD_SHOOT2,20,NULL,T_Shoot,&s_grdshoot3};\r
+statetype s_grdshoot3  = {false,SPR_GRD_SHOOT3,20,NULL,NULL,&s_grdchase1};\r
+\r
+statetype s_grdchase1  = {true,SPR_GRD_W1_1,10,T_Chase,NULL,&s_grdchase1s};\r
+statetype s_grdchase1s         = {true,SPR_GRD_W1_1,3,NULL,NULL,&s_grdchase2};\r
+statetype s_grdchase2  = {true,SPR_GRD_W2_1,8,T_Chase,NULL,&s_grdchase3};\r
+statetype s_grdchase3  = {true,SPR_GRD_W3_1,10,T_Chase,NULL,&s_grdchase3s};\r
+statetype s_grdchase3s         = {true,SPR_GRD_W3_1,3,NULL,NULL,&s_grdchase4};\r
+statetype s_grdchase4  = {true,SPR_GRD_W4_1,8,T_Chase,NULL,&s_grdchase1};\r
+\r
+statetype s_grddie1            = {false,SPR_GRD_DIE_1,15,NULL,A_DeathScream,&s_grddie2};\r
+statetype s_grddie2            = {false,SPR_GRD_DIE_2,15,NULL,NULL,&s_grddie3};\r
+statetype s_grddie3            = {false,SPR_GRD_DIE_3,15,NULL,NULL,&s_grddie4};\r
+statetype s_grddie4            = {false,SPR_GRD_DEAD,0,NULL,NULL,&s_grddie4};\r
+\r
+\r
+#ifndef SPEAR\r
+//\r
+// ghosts\r
+//\r
+extern statetype s_blinkychase1;\r
+extern statetype s_blinkychase2;\r
+extern statetype s_inkychase1;\r
+extern statetype s_inkychase2;\r
+extern statetype s_pinkychase1;\r
+extern statetype s_pinkychase2;\r
+extern statetype s_clydechase1;\r
+extern statetype s_clydechase2;\r
+\r
+statetype s_blinkychase1       = {false,SPR_BLINKY_W1,10,T_Ghosts,NULL,&s_blinkychase2};\r
+statetype s_blinkychase2       = {false,SPR_BLINKY_W2,10,T_Ghosts,NULL,&s_blinkychase1};\r
+\r
+statetype s_inkychase1                 = {false,SPR_INKY_W1,10,T_Ghosts,NULL,&s_inkychase2};\r
+statetype s_inkychase2                 = {false,SPR_INKY_W2,10,T_Ghosts,NULL,&s_inkychase1};\r
+\r
+statetype s_pinkychase1        = {false,SPR_PINKY_W1,10,T_Ghosts,NULL,&s_pinkychase2};\r
+statetype s_pinkychase2        = {false,SPR_PINKY_W2,10,T_Ghosts,NULL,&s_pinkychase1};\r
+\r
+statetype s_clydechase1        = {false,SPR_CLYDE_W1,10,T_Ghosts,NULL,&s_clydechase2};\r
+statetype s_clydechase2        = {false,SPR_CLYDE_W2,10,T_Ghosts,NULL,&s_clydechase1};\r
+#endif\r
+\r
+//\r
+// dogs\r
+//\r
+\r
+extern statetype s_dogpath1;\r
+extern statetype s_dogpath1s;\r
+extern statetype s_dogpath2;\r
+extern statetype s_dogpath3;\r
+extern statetype s_dogpath3s;\r
+extern statetype s_dogpath4;\r
+\r
+extern statetype s_dogjump1;\r
+extern statetype s_dogjump2;\r
+extern statetype s_dogjump3;\r
+extern statetype s_dogjump4;\r
+extern statetype s_dogjump5;\r
+\r
+extern statetype s_dogchase1;\r
+extern statetype s_dogchase1s;\r
+extern statetype s_dogchase2;\r
+extern statetype s_dogchase3;\r
+extern statetype s_dogchase3s;\r
+extern statetype s_dogchase4;\r
+\r
+extern statetype s_dogdie1;\r
+extern statetype s_dogdie1d;\r
+extern statetype s_dogdie2;\r
+extern statetype s_dogdie3;\r
+extern statetype s_dogdead;\r
+\r
+statetype s_dogpath1   = {true,SPR_DOG_W1_1,20,T_Path,NULL,&s_dogpath1s};\r
+statetype s_dogpath1s  = {true,SPR_DOG_W1_1,5,NULL,NULL,&s_dogpath2};\r
+statetype s_dogpath2   = {true,SPR_DOG_W2_1,15,T_Path,NULL,&s_dogpath3};\r
+statetype s_dogpath3   = {true,SPR_DOG_W3_1,20,T_Path,NULL,&s_dogpath3s};\r
+statetype s_dogpath3s  = {true,SPR_DOG_W3_1,5,NULL,NULL,&s_dogpath4};\r
+statetype s_dogpath4   = {true,SPR_DOG_W4_1,15,T_Path,NULL,&s_dogpath1};\r
+\r
+statetype s_dogjump1   = {false,SPR_DOG_JUMP1,10,NULL,NULL,&s_dogjump2};\r
+statetype s_dogjump2   = {false,SPR_DOG_JUMP2,10,NULL,T_Bite,&s_dogjump3};\r
+statetype s_dogjump3   = {false,SPR_DOG_JUMP3,10,NULL,NULL,&s_dogjump4};\r
+statetype s_dogjump4   = {false,SPR_DOG_JUMP1,10,NULL,NULL,&s_dogjump5};\r
+statetype s_dogjump5   = {false,SPR_DOG_W1_1,10,NULL,NULL,&s_dogchase1};\r
+\r
+statetype s_dogchase1  = {true,SPR_DOG_W1_1,10,T_DogChase,NULL,&s_dogchase1s};\r
+statetype s_dogchase1s         = {true,SPR_DOG_W1_1,3,NULL,NULL,&s_dogchase2};\r
+statetype s_dogchase2  = {true,SPR_DOG_W2_1,8,T_DogChase,NULL,&s_dogchase3};\r
+statetype s_dogchase3  = {true,SPR_DOG_W3_1,10,T_DogChase,NULL,&s_dogchase3s};\r
+statetype s_dogchase3s         = {true,SPR_DOG_W3_1,3,NULL,NULL,&s_dogchase4};\r
+statetype s_dogchase4  = {true,SPR_DOG_W4_1,8,T_DogChase,NULL,&s_dogchase1};\r
+\r
+statetype s_dogdie1            = {false,SPR_DOG_DIE_1,15,NULL,A_DeathScream,&s_dogdie2};\r
+statetype s_dogdie2            = {false,SPR_DOG_DIE_2,15,NULL,NULL,&s_dogdie3};\r
+statetype s_dogdie3            = {false,SPR_DOG_DIE_3,15,NULL,NULL,&s_dogdead};\r
+statetype s_dogdead            = {false,SPR_DOG_DEAD,15,NULL,NULL,&s_dogdead};\r
+\r
+\r
+//\r
+// officers\r
+//\r
+\r
+extern statetype s_ofcstand;\r
+\r
+extern statetype s_ofcpath1;\r
+extern statetype s_ofcpath1s;\r
+extern statetype s_ofcpath2;\r
+extern statetype s_ofcpath3;\r
+extern statetype s_ofcpath3s;\r
+extern statetype s_ofcpath4;\r
+\r
+extern statetype s_ofcpain;\r
+extern statetype s_ofcpain1;\r
+\r
+extern statetype s_ofcgiveup;\r
+\r
+extern statetype s_ofcshoot1;\r
+extern statetype s_ofcshoot2;\r
+extern statetype s_ofcshoot3;\r
+extern statetype s_ofcshoot4;\r
+\r
+extern statetype s_ofcchase1;\r
+extern statetype s_ofcchase1s;\r
+extern statetype s_ofcchase2;\r
+extern statetype s_ofcchase3;\r
+extern statetype s_ofcchase3s;\r
+extern statetype s_ofcchase4;\r
+\r
+extern statetype s_ofcdie1;\r
+extern statetype s_ofcdie2;\r
+extern statetype s_ofcdie3;\r
+extern statetype s_ofcdie4;\r
+extern statetype s_ofcdie5;\r
+\r
+statetype s_ofcstand   = {true,SPR_OFC_S_1,0,T_Stand,NULL,&s_ofcstand};\r
+\r
+statetype s_ofcpath1   = {true,SPR_OFC_W1_1,20,T_Path,NULL,&s_ofcpath1s};\r
+statetype s_ofcpath1s  = {true,SPR_OFC_W1_1,5,NULL,NULL,&s_ofcpath2};\r
+statetype s_ofcpath2   = {true,SPR_OFC_W2_1,15,T_Path,NULL,&s_ofcpath3};\r
+statetype s_ofcpath3   = {true,SPR_OFC_W3_1,20,T_Path,NULL,&s_ofcpath3s};\r
+statetype s_ofcpath3s  = {true,SPR_OFC_W3_1,5,NULL,NULL,&s_ofcpath4};\r
+statetype s_ofcpath4   = {true,SPR_OFC_W4_1,15,T_Path,NULL,&s_ofcpath1};\r
+\r
+statetype s_ofcpain    = {2,SPR_OFC_PAIN_1,10,NULL,NULL,&s_ofcchase1};\r
+statetype s_ofcpain1   = {2,SPR_OFC_PAIN_2,10,NULL,NULL,&s_ofcchase1};\r
+\r
+statetype s_ofcshoot1  = {false,SPR_OFC_SHOOT1,6,NULL,NULL,&s_ofcshoot2};\r
+statetype s_ofcshoot2  = {false,SPR_OFC_SHOOT2,20,NULL,T_Shoot,&s_ofcshoot3};\r
+statetype s_ofcshoot3  = {false,SPR_OFC_SHOOT3,10,NULL,NULL,&s_ofcchase1};\r
+\r
+statetype s_ofcchase1  = {true,SPR_OFC_W1_1,10,T_Chase,NULL,&s_ofcchase1s};\r
+statetype s_ofcchase1s         = {true,SPR_OFC_W1_1,3,NULL,NULL,&s_ofcchase2};\r
+statetype s_ofcchase2  = {true,SPR_OFC_W2_1,8,T_Chase,NULL,&s_ofcchase3};\r
+statetype s_ofcchase3  = {true,SPR_OFC_W3_1,10,T_Chase,NULL,&s_ofcchase3s};\r
+statetype s_ofcchase3s         = {true,SPR_OFC_W3_1,3,NULL,NULL,&s_ofcchase4};\r
+statetype s_ofcchase4  = {true,SPR_OFC_W4_1,8,T_Chase,NULL,&s_ofcchase1};\r
+\r
+statetype s_ofcdie1            = {false,SPR_OFC_DIE_1,11,NULL,A_DeathScream,&s_ofcdie2};\r
+statetype s_ofcdie2            = {false,SPR_OFC_DIE_2,11,NULL,NULL,&s_ofcdie3};\r
+statetype s_ofcdie3            = {false,SPR_OFC_DIE_3,11,NULL,NULL,&s_ofcdie4};\r
+statetype s_ofcdie4            = {false,SPR_OFC_DIE_4,11,NULL,NULL,&s_ofcdie5};\r
+statetype s_ofcdie5            = {false,SPR_OFC_DEAD,0,NULL,NULL,&s_ofcdie5};\r
+\r
+\r
+//\r
+// mutant\r
+//\r
+\r
+extern statetype s_mutstand;\r
+\r
+extern statetype s_mutpath1;\r
+extern statetype s_mutpath1s;\r
+extern statetype s_mutpath2;\r
+extern statetype s_mutpath3;\r
+extern statetype s_mutpath3s;\r
+extern statetype s_mutpath4;\r
+\r
+extern statetype s_mutpain;\r
+extern statetype s_mutpain1;\r
+\r
+extern statetype s_mutgiveup;\r
+\r
+extern statetype s_mutshoot1;\r
+extern statetype s_mutshoot2;\r
+extern statetype s_mutshoot3;\r
+extern statetype s_mutshoot4;\r
+\r
+extern statetype s_mutchase1;\r
+extern statetype s_mutchase1s;\r
+extern statetype s_mutchase2;\r
+extern statetype s_mutchase3;\r
+extern statetype s_mutchase3s;\r
+extern statetype s_mutchase4;\r
+\r
+extern statetype s_mutdie1;\r
+extern statetype s_mutdie2;\r
+extern statetype s_mutdie3;\r
+extern statetype s_mutdie4;\r
+extern statetype s_mutdie5;\r
+\r
+statetype s_mutstand   = {true,SPR_MUT_S_1,0,T_Stand,NULL,&s_mutstand};\r
+\r
+statetype s_mutpath1   = {true,SPR_MUT_W1_1,20,T_Path,NULL,&s_mutpath1s};\r
+statetype s_mutpath1s  = {true,SPR_MUT_W1_1,5,NULL,NULL,&s_mutpath2};\r
+statetype s_mutpath2   = {true,SPR_MUT_W2_1,15,T_Path,NULL,&s_mutpath3};\r
+statetype s_mutpath3   = {true,SPR_MUT_W3_1,20,T_Path,NULL,&s_mutpath3s};\r
+statetype s_mutpath3s  = {true,SPR_MUT_W3_1,5,NULL,NULL,&s_mutpath4};\r
+statetype s_mutpath4   = {true,SPR_MUT_W4_1,15,T_Path,NULL,&s_mutpath1};\r
+\r
+statetype s_mutpain    = {2,SPR_MUT_PAIN_1,10,NULL,NULL,&s_mutchase1};\r
+statetype s_mutpain1   = {2,SPR_MUT_PAIN_2,10,NULL,NULL,&s_mutchase1};\r
+\r
+statetype s_mutshoot1  = {false,SPR_MUT_SHOOT1,6,NULL,T_Shoot,&s_mutshoot2};\r
+statetype s_mutshoot2  = {false,SPR_MUT_SHOOT2,20,NULL,NULL,&s_mutshoot3};\r
+statetype s_mutshoot3  = {false,SPR_MUT_SHOOT3,10,NULL,T_Shoot,&s_mutshoot4};\r
+statetype s_mutshoot4  = {false,SPR_MUT_SHOOT4,20,NULL,NULL,&s_mutchase1};\r
+\r
+statetype s_mutchase1  = {true,SPR_MUT_W1_1,10,T_Chase,NULL,&s_mutchase1s};\r
+statetype s_mutchase1s         = {true,SPR_MUT_W1_1,3,NULL,NULL,&s_mutchase2};\r
+statetype s_mutchase2  = {true,SPR_MUT_W2_1,8,T_Chase,NULL,&s_mutchase3};\r
+statetype s_mutchase3  = {true,SPR_MUT_W3_1,10,T_Chase,NULL,&s_mutchase3s};\r
+statetype s_mutchase3s         = {true,SPR_MUT_W3_1,3,NULL,NULL,&s_mutchase4};\r
+statetype s_mutchase4  = {true,SPR_MUT_W4_1,8,T_Chase,NULL,&s_mutchase1};\r
+\r
+statetype s_mutdie1            = {false,SPR_MUT_DIE_1,7,NULL,A_DeathScream,&s_mutdie2};\r
+statetype s_mutdie2            = {false,SPR_MUT_DIE_2,7,NULL,NULL,&s_mutdie3};\r
+statetype s_mutdie3            = {false,SPR_MUT_DIE_3,7,NULL,NULL,&s_mutdie4};\r
+statetype s_mutdie4            = {false,SPR_MUT_DIE_4,7,NULL,NULL,&s_mutdie5};\r
+statetype s_mutdie5            = {false,SPR_MUT_DEAD,0,NULL,NULL,&s_mutdie5};\r
+\r
+\r
+//\r
+// SS\r
+//\r
+\r
+extern statetype s_ssstand;\r
+\r
+extern statetype s_sspath1;\r
+extern statetype s_sspath1s;\r
+extern statetype s_sspath2;\r
+extern statetype s_sspath3;\r
+extern statetype s_sspath3s;\r
+extern statetype s_sspath4;\r
+\r
+extern statetype s_sspain;\r
+extern statetype s_sspain1;\r
+\r
+extern statetype s_ssshoot1;\r
+extern statetype s_ssshoot2;\r
+extern statetype s_ssshoot3;\r
+extern statetype s_ssshoot4;\r
+extern statetype s_ssshoot5;\r
+extern statetype s_ssshoot6;\r
+extern statetype s_ssshoot7;\r
+extern statetype s_ssshoot8;\r
+extern statetype s_ssshoot9;\r
+\r
+extern statetype s_sschase1;\r
+extern statetype s_sschase1s;\r
+extern statetype s_sschase2;\r
+extern statetype s_sschase3;\r
+extern statetype s_sschase3s;\r
+extern statetype s_sschase4;\r
+\r
+extern statetype s_ssdie1;\r
+extern statetype s_ssdie2;\r
+extern statetype s_ssdie3;\r
+extern statetype s_ssdie4;\r
+\r
+statetype s_ssstand    = {true,SPR_SS_S_1,0,T_Stand,NULL,&s_ssstand};\r
+\r
+statetype s_sspath1    = {true,SPR_SS_W1_1,20,T_Path,NULL,&s_sspath1s};\r
+statetype s_sspath1s   = {true,SPR_SS_W1_1,5,NULL,NULL,&s_sspath2};\r
+statetype s_sspath2    = {true,SPR_SS_W2_1,15,T_Path,NULL,&s_sspath3};\r
+statetype s_sspath3    = {true,SPR_SS_W3_1,20,T_Path,NULL,&s_sspath3s};\r
+statetype s_sspath3s   = {true,SPR_SS_W3_1,5,NULL,NULL,&s_sspath4};\r
+statetype s_sspath4    = {true,SPR_SS_W4_1,15,T_Path,NULL,&s_sspath1};\r
+\r
+statetype s_sspain             = {2,SPR_SS_PAIN_1,10,NULL,NULL,&s_sschase1};\r
+statetype s_sspain1    = {2,SPR_SS_PAIN_2,10,NULL,NULL,&s_sschase1};\r
+\r
+statetype s_ssshoot1   = {false,SPR_SS_SHOOT1,20,NULL,NULL,&s_ssshoot2};\r
+statetype s_ssshoot2   = {false,SPR_SS_SHOOT2,20,NULL,T_Shoot,&s_ssshoot3};\r
+statetype s_ssshoot3   = {false,SPR_SS_SHOOT3,10,NULL,NULL,&s_ssshoot4};\r
+statetype s_ssshoot4   = {false,SPR_SS_SHOOT2,10,NULL,T_Shoot,&s_ssshoot5};\r
+statetype s_ssshoot5   = {false,SPR_SS_SHOOT3,10,NULL,NULL,&s_ssshoot6};\r
+statetype s_ssshoot6   = {false,SPR_SS_SHOOT2,10,NULL,T_Shoot,&s_ssshoot7};\r
+statetype s_ssshoot7   = {false,SPR_SS_SHOOT3,10,NULL,NULL,&s_ssshoot8};\r
+statetype s_ssshoot8   = {false,SPR_SS_SHOOT2,10,NULL,T_Shoot,&s_ssshoot9};\r
+statetype s_ssshoot9   = {false,SPR_SS_SHOOT3,10,NULL,NULL,&s_sschase1};\r
+\r
+statetype s_sschase1   = {true,SPR_SS_W1_1,10,T_Chase,NULL,&s_sschase1s};\r
+statetype s_sschase1s  = {true,SPR_SS_W1_1,3,NULL,NULL,&s_sschase2};\r
+statetype s_sschase2   = {true,SPR_SS_W2_1,8,T_Chase,NULL,&s_sschase3};\r
+statetype s_sschase3   = {true,SPR_SS_W3_1,10,T_Chase,NULL,&s_sschase3s};\r
+statetype s_sschase3s  = {true,SPR_SS_W3_1,3,NULL,NULL,&s_sschase4};\r
+statetype s_sschase4   = {true,SPR_SS_W4_1,8,T_Chase,NULL,&s_sschase1};\r
+\r
+statetype s_ssdie1             = {false,SPR_SS_DIE_1,15,NULL,A_DeathScream,&s_ssdie2};\r
+statetype s_ssdie2             = {false,SPR_SS_DIE_2,15,NULL,NULL,&s_ssdie3};\r
+statetype s_ssdie3             = {false,SPR_SS_DIE_3,15,NULL,NULL,&s_ssdie4};\r
+statetype s_ssdie4             = {false,SPR_SS_DEAD,0,NULL,NULL,&s_ssdie4};\r
+\r
+\r
+#ifndef SPEAR\r
+//\r
+// hans\r
+//\r
+extern statetype s_bossstand;\r
+\r
+extern statetype s_bosschase1;\r
+extern statetype s_bosschase1s;\r
+extern statetype s_bosschase2;\r
+extern statetype s_bosschase3;\r
+extern statetype s_bosschase3s;\r
+extern statetype s_bosschase4;\r
+\r
+extern statetype s_bossdie1;\r
+extern statetype s_bossdie2;\r
+extern statetype s_bossdie3;\r
+extern statetype s_bossdie4;\r
+\r
+extern statetype s_bossshoot1;\r
+extern statetype s_bossshoot2;\r
+extern statetype s_bossshoot3;\r
+extern statetype s_bossshoot4;\r
+extern statetype s_bossshoot5;\r
+extern statetype s_bossshoot6;\r
+extern statetype s_bossshoot7;\r
+extern statetype s_bossshoot8;\r
+\r
+\r
+statetype s_bossstand  = {false,SPR_BOSS_W1,0,T_Stand,NULL,&s_bossstand};\r
+\r
+statetype s_bosschase1         = {false,SPR_BOSS_W1,10,T_Chase,NULL,&s_bosschase1s};\r
+statetype s_bosschase1s        = {false,SPR_BOSS_W1,3,NULL,NULL,&s_bosschase2};\r
+statetype s_bosschase2         = {false,SPR_BOSS_W2,8,T_Chase,NULL,&s_bosschase3};\r
+statetype s_bosschase3         = {false,SPR_BOSS_W3,10,T_Chase,NULL,&s_bosschase3s};\r
+statetype s_bosschase3s        = {false,SPR_BOSS_W3,3,NULL,NULL,&s_bosschase4};\r
+statetype s_bosschase4         = {false,SPR_BOSS_W4,8,T_Chase,NULL,&s_bosschase1};\r
+\r
+statetype s_bossdie1   = {false,SPR_BOSS_DIE1,15,NULL,A_DeathScream,&s_bossdie2};\r
+statetype s_bossdie2   = {false,SPR_BOSS_DIE2,15,NULL,NULL,&s_bossdie3};\r
+statetype s_bossdie3   = {false,SPR_BOSS_DIE3,15,NULL,NULL,&s_bossdie4};\r
+statetype s_bossdie4   = {false,SPR_BOSS_DEAD,0,NULL,NULL,&s_bossdie4};\r
+\r
+statetype s_bossshoot1         = {false,SPR_BOSS_SHOOT1,30,NULL,NULL,&s_bossshoot2};\r
+statetype s_bossshoot2         = {false,SPR_BOSS_SHOOT2,10,NULL,T_Shoot,&s_bossshoot3};\r
+statetype s_bossshoot3         = {false,SPR_BOSS_SHOOT3,10,NULL,T_Shoot,&s_bossshoot4};\r
+statetype s_bossshoot4         = {false,SPR_BOSS_SHOOT2,10,NULL,T_Shoot,&s_bossshoot5};\r
+statetype s_bossshoot5         = {false,SPR_BOSS_SHOOT3,10,NULL,T_Shoot,&s_bossshoot6};\r
+statetype s_bossshoot6         = {false,SPR_BOSS_SHOOT2,10,NULL,T_Shoot,&s_bossshoot7};\r
+statetype s_bossshoot7         = {false,SPR_BOSS_SHOOT3,10,NULL,T_Shoot,&s_bossshoot8};\r
+statetype s_bossshoot8         = {false,SPR_BOSS_SHOOT1,10,NULL,NULL,&s_bosschase1};\r
+\r
+\r
+//\r
+// gretel\r
+//\r
+extern statetype s_gretelstand;\r
+\r
+extern statetype s_gretelchase1;\r
+extern statetype s_gretelchase1s;\r
+extern statetype s_gretelchase2;\r
+extern statetype s_gretelchase3;\r
+extern statetype s_gretelchase3s;\r
+extern statetype s_gretelchase4;\r
+\r
+extern statetype s_greteldie1;\r
+extern statetype s_greteldie2;\r
+extern statetype s_greteldie3;\r
+extern statetype s_greteldie4;\r
+\r
+extern statetype s_gretelshoot1;\r
+extern statetype s_gretelshoot2;\r
+extern statetype s_gretelshoot3;\r
+extern statetype s_gretelshoot4;\r
+extern statetype s_gretelshoot5;\r
+extern statetype s_gretelshoot6;\r
+extern statetype s_gretelshoot7;\r
+extern statetype s_gretelshoot8;\r
+\r
+\r
+statetype s_gretelstand        = {false,SPR_GRETEL_W1,0,T_Stand,NULL,&s_gretelstand};\r
+\r
+statetype s_gretelchase1       = {false,SPR_GRETEL_W1,10,T_Chase,NULL,&s_gretelchase1s};\r
+statetype s_gretelchase1s      = {false,SPR_GRETEL_W1,3,NULL,NULL,&s_gretelchase2};\r
+statetype s_gretelchase2       = {false,SPR_GRETEL_W2,8,T_Chase,NULL,&s_gretelchase3};\r
+statetype s_gretelchase3       = {false,SPR_GRETEL_W3,10,T_Chase,NULL,&s_gretelchase3s};\r
+statetype s_gretelchase3s      = {false,SPR_GRETEL_W3,3,NULL,NULL,&s_gretelchase4};\r
+statetype s_gretelchase4       = {false,SPR_GRETEL_W4,8,T_Chase,NULL,&s_gretelchase1};\r
+\r
+statetype s_greteldie1 = {false,SPR_GRETEL_DIE1,15,NULL,A_DeathScream,&s_greteldie2};\r
+statetype s_greteldie2 = {false,SPR_GRETEL_DIE2,15,NULL,NULL,&s_greteldie3};\r
+statetype s_greteldie3 = {false,SPR_GRETEL_DIE3,15,NULL,NULL,&s_greteldie4};\r
+statetype s_greteldie4 = {false,SPR_GRETEL_DEAD,0,NULL,NULL,&s_greteldie4};\r
+\r
+statetype s_gretelshoot1       = {false,SPR_GRETEL_SHOOT1,30,NULL,NULL,&s_gretelshoot2};\r
+statetype s_gretelshoot2       = {false,SPR_GRETEL_SHOOT2,10,NULL,T_Shoot,&s_gretelshoot3};\r
+statetype s_gretelshoot3       = {false,SPR_GRETEL_SHOOT3,10,NULL,T_Shoot,&s_gretelshoot4};\r
+statetype s_gretelshoot4       = {false,SPR_GRETEL_SHOOT2,10,NULL,T_Shoot,&s_gretelshoot5};\r
+statetype s_gretelshoot5       = {false,SPR_GRETEL_SHOOT3,10,NULL,T_Shoot,&s_gretelshoot6};\r
+statetype s_gretelshoot6       = {false,SPR_GRETEL_SHOOT2,10,NULL,T_Shoot,&s_gretelshoot7};\r
+statetype s_gretelshoot7       = {false,SPR_GRETEL_SHOOT3,10,NULL,T_Shoot,&s_gretelshoot8};\r
+statetype s_gretelshoot8       = {false,SPR_GRETEL_SHOOT1,10,NULL,NULL,&s_gretelchase1};\r
+#endif\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnStand\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnStand (enemy_t which, int tilex, int tiley, int dir)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       switch (which)\r
+       {\r
+       case en_guard:\r
+               SpawnNewObj (tilex,tiley,&s_grdstand);\r
+               new->speed = SPDPATROL;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+\r
+       case en_officer:\r
+               SpawnNewObj (tilex,tiley,&s_ofcstand);\r
+               new->speed = SPDPATROL;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+\r
+       case en_mutant:\r
+               SpawnNewObj (tilex,tiley,&s_mutstand);\r
+               new->speed = SPDPATROL;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+\r
+       case en_ss:\r
+               SpawnNewObj (tilex,tiley,&s_ssstand);\r
+               new->speed = SPDPATROL;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+       }\r
+\r
+\r
+       map = mapsegs[0]+farmapylookup[tiley]+tilex;\r
+       if (*map == AMBUSHTILE)\r
+       {\r
+               tilemap[tilex][tiley] = 0;\r
+\r
+               if (*(map+1) >= AREATILE)\r
+                       tile = *(map+1);\r
+               if (*(map-mapwidth) >= AREATILE)\r
+                       tile = *(map-mapwidth);\r
+               if (*(map+mapwidth) >= AREATILE)\r
+                       tile = *(map+mapwidth);\r
+               if ( *(map-1) >= AREATILE)\r
+                       tile = *(map-1);\r
+\r
+               *map = tile;\r
+               new->areanumber = tile-AREATILE;\r
+\r
+               new->flags |= FL_AMBUSH;\r
+       }\r
+\r
+       new->obclass = guardobj+which;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][which];\r
+       new->dir = dir*2;\r
+       new->flags |= FL_SHOOTABLE;\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnDeadGuard\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnDeadGuard (int tilex, int tiley)\r
+{\r
+       SpawnNewObj (tilex,tiley,&s_grddie4);\r
+       new->obclass = inertobj;\r
+}\r
+\r
+\r
+\r
+#ifndef SPEAR\r
+/*\r
+===============\r
+=\r
+= SpawnBoss\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnBoss (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_bossstand);\r
+       new->speed = SPDPATROL;\r
+\r
+       new->obclass = bossobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_boss];\r
+       new->dir = south;\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnGretel\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnGretel (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_gretelstand);\r
+       new->speed = SPDPATROL;\r
+\r
+       new->obclass = gretelobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_gretel];\r
+       new->dir = north;\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+#endif\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnPatrol\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir)\r
+{\r
+       switch (which)\r
+       {\r
+       case en_guard:\r
+               SpawnNewObj (tilex,tiley,&s_grdpath1);\r
+               new->speed = SPDPATROL;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+\r
+       case en_officer:\r
+               SpawnNewObj (tilex,tiley,&s_ofcpath1);\r
+               new->speed = SPDPATROL;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+\r
+       case en_ss:\r
+               SpawnNewObj (tilex,tiley,&s_sspath1);\r
+               new->speed = SPDPATROL;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+\r
+       case en_mutant:\r
+               SpawnNewObj (tilex,tiley,&s_mutpath1);\r
+               new->speed = SPDPATROL;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+\r
+       case en_dog:\r
+               SpawnNewObj (tilex,tiley,&s_dogpath1);\r
+               new->speed = SPDDOG;\r
+               if (!loadedgame)\r
+                 gamestate.killtotal++;\r
+               break;\r
+       }\r
+\r
+       new->obclass = guardobj+which;\r
+       new->dir = dir*2;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][which];\r
+       new->distance = tileglobal;\r
+       new->flags |= FL_SHOOTABLE;\r
+       new->active = true;\r
+\r
+       actorat[new->tilex][new->tiley] = NULL;         // don't use original spot\r
+\r
+       switch (dir)\r
+       {\r
+       case 0:\r
+               new->tilex++;\r
+               break;\r
+       case 1:\r
+               new->tiley--;\r
+               break;\r
+       case 2:\r
+               new->tilex--;\r
+               break;\r
+       case 3:\r
+               new->tiley++;\r
+               break;\r
+       }\r
+\r
+       actorat[new->tilex][new->tiley] = new;\r
+}\r
+\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= A_DeathScream\r
+=\r
+==================\r
+*/\r
+\r
+void A_DeathScream (objtype *ob)\r
+{\r
+#ifndef UPLOAD\r
+#ifndef SPEAR\r
+       if (mapon==9 && !US_RndT())\r
+#else\r
+       if ((mapon==18 || mapon==19) && !US_RndT())\r
+#endif\r
+       {\r
+        switch(ob->obclass)\r
+        {\r
+         case mutantobj:\r
+         case guardobj:\r
+         case officerobj:\r
+         case ssobj:\r
+         case dogobj:\r
+               PlaySoundLocActor(DEATHSCREAM6SND,ob);\r
+               return;\r
+        }\r
+       }\r
+#endif\r
+\r
+       switch (ob->obclass)\r
+       {\r
+       case mutantobj:\r
+               PlaySoundLocActor(AHHHGSND,ob);\r
+               break;\r
+\r
+       case guardobj:\r
+               {\r
+                int sounds[9]={ DEATHSCREAM1SND,\r
+                                DEATHSCREAM2SND,\r
+                                DEATHSCREAM3SND,\r
+                                DEATHSCREAM4SND,\r
+                                DEATHSCREAM5SND,\r
+                                DEATHSCREAM7SND,\r
+                                DEATHSCREAM8SND,\r
+                                DEATHSCREAM9SND\r
+                                };\r
+\r
+                #ifndef UPLOAD\r
+                PlaySoundLocActor(sounds[US_RndT()%8],ob);\r
+                #else\r
+                PlaySoundLocActor(sounds[US_RndT()%2],ob);\r
+                #endif\r
+               }\r
+               break;\r
+       case officerobj:\r
+               PlaySoundLocActor(NEINSOVASSND,ob);\r
+               break;\r
+       case ssobj:\r
+               PlaySoundLocActor(LEBENSND,ob); // JAB\r
+               break;\r
+       case dogobj:\r
+               PlaySoundLocActor(DOGDEATHSND,ob);      // JAB\r
+               break;\r
+#ifndef SPEAR\r
+       case bossobj:\r
+               SD_PlaySound(MUTTISND);                         // JAB\r
+               break;\r
+       case schabbobj:\r
+               SD_PlaySound(MEINGOTTSND);\r
+               break;\r
+       case fakeobj:\r
+               SD_PlaySound(HITLERHASND);\r
+               break;\r
+       case mechahitlerobj:\r
+               SD_PlaySound(SCHEISTSND);\r
+               break;\r
+       case realhitlerobj:\r
+               SD_PlaySound(EVASND);\r
+               break;\r
+       case gretelobj:\r
+               SD_PlaySound(MEINSND);\r
+               break;\r
+       case giftobj:\r
+               SD_PlaySound(DONNERSND);\r
+               break;\r
+       case fatobj:\r
+               SD_PlaySound(ROSESND);\r
+               break;\r
+#else\r
+       case spectreobj:\r
+               SD_PlaySound(GHOSTFADESND);\r
+               break;\r
+       case angelobj:\r
+               SD_PlaySound(ANGELDEATHSND);\r
+               break;\r
+       case transobj:\r
+               SD_PlaySound(TRANSDEATHSND);\r
+               break;\r
+       case uberobj:\r
+               SD_PlaySound(UBERDEATHSND);\r
+               break;\r
+       case willobj:\r
+               SD_PlaySound(WILHELMDEATHSND);\r
+               break;\r
+       case deathobj:\r
+               SD_PlaySound(KNIGHTDEATHSND);\r
+               break;\r
+#endif\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                SPEAR ACTORS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#ifdef SPEAR\r
+\r
+void T_Launch (objtype *ob);\r
+void T_Will (objtype *ob);\r
+\r
+extern statetype s_angelshoot1;\r
+extern statetype s_deathshoot1;\r
+extern statetype s_spark1;\r
+\r
+//\r
+// trans\r
+//\r
+extern statetype s_transstand;\r
+\r
+extern statetype s_transchase1;\r
+extern statetype s_transchase1s;\r
+extern statetype s_transchase2;\r
+extern statetype s_transchase3;\r
+extern statetype s_transchase3s;\r
+extern statetype s_transchase4;\r
+\r
+extern statetype s_transdie0;\r
+extern statetype s_transdie01;\r
+extern statetype s_transdie1;\r
+extern statetype s_transdie2;\r
+extern statetype s_transdie3;\r
+extern statetype s_transdie4;\r
+\r
+extern statetype s_transshoot1;\r
+extern statetype s_transshoot2;\r
+extern statetype s_transshoot3;\r
+extern statetype s_transshoot4;\r
+extern statetype s_transshoot5;\r
+extern statetype s_transshoot6;\r
+extern statetype s_transshoot7;\r
+extern statetype s_transshoot8;\r
+\r
+\r
+statetype s_transstand = {false,SPR_TRANS_W1,0,T_Stand,NULL,&s_transstand};\r
+\r
+statetype s_transchase1        = {false,SPR_TRANS_W1,10,T_Chase,NULL,&s_transchase1s};\r
+statetype s_transchase1s       = {false,SPR_TRANS_W1,3,NULL,NULL,&s_transchase2};\r
+statetype s_transchase2        = {false,SPR_TRANS_W2,8,T_Chase,NULL,&s_transchase3};\r
+statetype s_transchase3        = {false,SPR_TRANS_W3,10,T_Chase,NULL,&s_transchase3s};\r
+statetype s_transchase3s       = {false,SPR_TRANS_W3,3,NULL,NULL,&s_transchase4};\r
+statetype s_transchase4        = {false,SPR_TRANS_W4,8,T_Chase,NULL,&s_transchase1};\r
+\r
+statetype s_transdie0  = {false,SPR_TRANS_W1,1,NULL,A_DeathScream,&s_transdie01};\r
+statetype s_transdie01 = {false,SPR_TRANS_W1,1,NULL,NULL,&s_transdie1};\r
+statetype s_transdie1  = {false,SPR_TRANS_DIE1,15,NULL,NULL,&s_transdie2};\r
+statetype s_transdie2  = {false,SPR_TRANS_DIE2,15,NULL,NULL,&s_transdie3};\r
+statetype s_transdie3  = {false,SPR_TRANS_DIE3,15,NULL,NULL,&s_transdie4};\r
+statetype s_transdie4  = {false,SPR_TRANS_DEAD,0,NULL,NULL,&s_transdie4};\r
+\r
+statetype s_transshoot1        = {false,SPR_TRANS_SHOOT1,30,NULL,NULL,&s_transshoot2};\r
+statetype s_transshoot2        = {false,SPR_TRANS_SHOOT2,10,NULL,T_Shoot,&s_transshoot3};\r
+statetype s_transshoot3        = {false,SPR_TRANS_SHOOT3,10,NULL,T_Shoot,&s_transshoot4};\r
+statetype s_transshoot4        = {false,SPR_TRANS_SHOOT2,10,NULL,T_Shoot,&s_transshoot5};\r
+statetype s_transshoot5        = {false,SPR_TRANS_SHOOT3,10,NULL,T_Shoot,&s_transshoot6};\r
+statetype s_transshoot6        = {false,SPR_TRANS_SHOOT2,10,NULL,T_Shoot,&s_transshoot7};\r
+statetype s_transshoot7        = {false,SPR_TRANS_SHOOT3,10,NULL,T_Shoot,&s_transshoot8};\r
+statetype s_transshoot8        = {false,SPR_TRANS_SHOOT1,10,NULL,NULL,&s_transchase1};\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnTrans\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnTrans (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       if (SoundBlasterPresent && DigiMode != sds_Off)\r
+               s_transdie01.tictime = 105;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_transstand);\r
+       new->obclass = transobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_trans];\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+//\r
+// uber\r
+//\r
+void T_UShoot (objtype *ob);\r
+\r
+extern statetype s_uberstand;\r
+\r
+extern statetype s_uberchase1;\r
+extern statetype s_uberchase1s;\r
+extern statetype s_uberchase2;\r
+extern statetype s_uberchase3;\r
+extern statetype s_uberchase3s;\r
+extern statetype s_uberchase4;\r
+\r
+extern statetype s_uberdie0;\r
+extern statetype s_uberdie01;\r
+extern statetype s_uberdie1;\r
+extern statetype s_uberdie2;\r
+extern statetype s_uberdie3;\r
+extern statetype s_uberdie4;\r
+extern statetype s_uberdie5;\r
+\r
+extern statetype s_ubershoot1;\r
+extern statetype s_ubershoot2;\r
+extern statetype s_ubershoot3;\r
+extern statetype s_ubershoot4;\r
+extern statetype s_ubershoot5;\r
+extern statetype s_ubershoot6;\r
+extern statetype s_ubershoot7;\r
+\r
+\r
+statetype s_uberstand  = {false,SPR_UBER_W1,0,T_Stand,NULL,&s_uberstand};\r
+\r
+statetype s_uberchase1         = {false,SPR_UBER_W1,10,T_Chase,NULL,&s_uberchase1s};\r
+statetype s_uberchase1s        = {false,SPR_UBER_W1,3,NULL,NULL,&s_uberchase2};\r
+statetype s_uberchase2         = {false,SPR_UBER_W2,8,T_Chase,NULL,&s_uberchase3};\r
+statetype s_uberchase3         = {false,SPR_UBER_W3,10,T_Chase,NULL,&s_uberchase3s};\r
+statetype s_uberchase3s        = {false,SPR_UBER_W3,3,NULL,NULL,&s_uberchase4};\r
+statetype s_uberchase4         = {false,SPR_UBER_W4,8,T_Chase,NULL,&s_uberchase1};\r
+\r
+statetype s_uberdie0   = {false,SPR_UBER_W1,1,NULL,A_DeathScream,&s_uberdie01};\r
+statetype s_uberdie01  = {false,SPR_UBER_W1,1,NULL,NULL,&s_uberdie1};\r
+statetype s_uberdie1   = {false,SPR_UBER_DIE1,15,NULL,NULL,&s_uberdie2};\r
+statetype s_uberdie2   = {false,SPR_UBER_DIE2,15,NULL,NULL,&s_uberdie3};\r
+statetype s_uberdie3   = {false,SPR_UBER_DIE3,15,NULL,NULL,&s_uberdie4};\r
+statetype s_uberdie4   = {false,SPR_UBER_DIE4,15,NULL,NULL,&s_uberdie5};\r
+statetype s_uberdie5   = {false,SPR_UBER_DEAD,0,NULL,NULL,&s_uberdie5};\r
+\r
+statetype s_ubershoot1         = {false,SPR_UBER_SHOOT1,30,NULL,NULL,&s_ubershoot2};\r
+statetype s_ubershoot2         = {false,SPR_UBER_SHOOT2,12,NULL,T_UShoot,&s_ubershoot3};\r
+statetype s_ubershoot3         = {false,SPR_UBER_SHOOT3,12,NULL,T_UShoot,&s_ubershoot4};\r
+statetype s_ubershoot4         = {false,SPR_UBER_SHOOT4,12,NULL,T_UShoot,&s_ubershoot5};\r
+statetype s_ubershoot5         = {false,SPR_UBER_SHOOT3,12,NULL,T_UShoot,&s_ubershoot6};\r
+statetype s_ubershoot6         = {false,SPR_UBER_SHOOT2,12,NULL,T_UShoot,&s_ubershoot7};\r
+statetype s_ubershoot7         = {false,SPR_UBER_SHOOT1,12,NULL,NULL,&s_uberchase1};\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnUber\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnUber (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       if (SoundBlasterPresent && DigiMode != sds_Off)\r
+               s_uberdie01.tictime = 70;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_uberstand);\r
+       new->obclass = uberobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_uber];\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_UShoot\r
+=\r
+===============\r
+*/\r
+\r
+void T_UShoot (objtype *ob)\r
+{\r
+       int     dx,dy,dist;\r
+\r
+       T_Shoot (ob);\r
+\r
+       dx = abs(ob->tilex - player->tilex);\r
+       dy = abs(ob->tiley - player->tiley);\r
+       dist = dx>dy ? dx : dy;\r
+       if (dist <= 1)\r
+               TakeDamage (10,ob);\r
+}\r
+\r
+\r
+//\r
+// will\r
+//\r
+extern statetype s_willstand;\r
+\r
+extern statetype s_willchase1;\r
+extern statetype s_willchase1s;\r
+extern statetype s_willchase2;\r
+extern statetype s_willchase3;\r
+extern statetype s_willchase3s;\r
+extern statetype s_willchase4;\r
+\r
+extern statetype s_willdie1;\r
+extern statetype s_willdie2;\r
+extern statetype s_willdie3;\r
+extern statetype s_willdie4;\r
+extern statetype s_willdie5;\r
+extern statetype s_willdie6;\r
+\r
+extern statetype s_willshoot1;\r
+extern statetype s_willshoot2;\r
+extern statetype s_willshoot3;\r
+extern statetype s_willshoot4;\r
+extern statetype s_willshoot5;\r
+extern statetype s_willshoot6;\r
+\r
+\r
+statetype s_willstand  = {false,SPR_WILL_W1,0,T_Stand,NULL,&s_willstand};\r
+\r
+statetype s_willchase1         = {false,SPR_WILL_W1,10,T_Will,NULL,&s_willchase1s};\r
+statetype s_willchase1s        = {false,SPR_WILL_W1,3,NULL,NULL,&s_willchase2};\r
+statetype s_willchase2         = {false,SPR_WILL_W2,8,T_Will,NULL,&s_willchase3};\r
+statetype s_willchase3         = {false,SPR_WILL_W3,10,T_Will,NULL,&s_willchase3s};\r
+statetype s_willchase3s        = {false,SPR_WILL_W3,3,NULL,NULL,&s_willchase4};\r
+statetype s_willchase4         = {false,SPR_WILL_W4,8,T_Will,NULL,&s_willchase1};\r
+\r
+statetype s_willdeathcam       = {false,SPR_WILL_W1,1,NULL,NULL,&s_willdie1};\r
+\r
+statetype s_willdie1   = {false,SPR_WILL_W1,1,NULL,A_DeathScream,&s_willdie2};\r
+statetype s_willdie2   = {false,SPR_WILL_W1,10,NULL,NULL,&s_willdie3};\r
+statetype s_willdie3   = {false,SPR_WILL_DIE1,10,NULL,NULL,&s_willdie4};\r
+statetype s_willdie4   = {false,SPR_WILL_DIE2,10,NULL,NULL,&s_willdie5};\r
+statetype s_willdie5   = {false,SPR_WILL_DIE3,10,NULL,NULL,&s_willdie6};\r
+statetype s_willdie6   = {false,SPR_WILL_DEAD,20,NULL,NULL,&s_willdie6};\r
+\r
+statetype s_willshoot1         = {false,SPR_WILL_SHOOT1,30,NULL,NULL,&s_willshoot2};\r
+statetype s_willshoot2         = {false,SPR_WILL_SHOOT2,10,NULL,T_Launch,&s_willshoot3};\r
+statetype s_willshoot3         = {false,SPR_WILL_SHOOT3,10,NULL,T_Shoot,&s_willshoot4};\r
+statetype s_willshoot4         = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willshoot5};\r
+statetype s_willshoot5         = {false,SPR_WILL_SHOOT3,10,NULL,T_Shoot,&s_willshoot6};\r
+statetype s_willshoot6         = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willchase1};\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnWill\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnWill (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       if (SoundBlasterPresent && DigiMode != sds_Off)\r
+               s_willdie2.tictime = 70;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_willstand);\r
+       new->obclass = willobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_will];\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+================\r
+=\r
+= T_Will\r
+=\r
+================\r
+*/\r
+\r
+void T_Will (objtype *ob)\r
+{\r
+       long move;\r
+       int     dx,dy,dist;\r
+       boolean dodge;\r
+\r
+       dodge = false;\r
+       dx = abs(ob->tilex - player->tilex);\r
+       dy = abs(ob->tiley - player->tiley);\r
+       dist = dx>dy ? dx : dy;\r
+\r
+       if (CheckLine(ob))                                              // got a shot at player?\r
+       {\r
+               if ( US_RndT() < (tics<<3) )\r
+               {\r
+               //\r
+               // go into attack frame\r
+               //\r
+                       if (ob->obclass == willobj)\r
+                               NewState (ob,&s_willshoot1);\r
+                       else if (ob->obclass == angelobj)\r
+                               NewState (ob,&s_angelshoot1);\r
+                       else\r
+                               NewState (ob,&s_deathshoot1);\r
+                       return;\r
+               }\r
+               dodge = true;\r
+       }\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (ob->distance < 0)\r
+               {\r
+               //\r
+               // waiting for a door to open\r
+               //\r
+                       OpenDoor (-ob->distance-1);\r
+                       if (doorobjlist[-ob->distance-1].action != dr_open)\r
+                               return;\r
+                       ob->distance = TILEGLOBAL;      // go ahead, the door is now opoen\r
+               }\r
+\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               //\r
+               // reached goal tile, so select another one\r
+               //\r
+\r
+               //\r
+               // fix position to account for round off during moving\r
+               //\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+\r
+               move -= ob->distance;\r
+\r
+               if (dist <4)\r
+                       SelectRunDir (ob);\r
+               else if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+}\r
+\r
+\r
+//\r
+// death\r
+//\r
+extern statetype s_deathstand;\r
+\r
+extern statetype s_deathchase1;\r
+extern statetype s_deathchase1s;\r
+extern statetype s_deathchase2;\r
+extern statetype s_deathchase3;\r
+extern statetype s_deathchase3s;\r
+extern statetype s_deathchase4;\r
+\r
+extern statetype s_deathdie1;\r
+extern statetype s_deathdie2;\r
+extern statetype s_deathdie3;\r
+extern statetype s_deathdie4;\r
+extern statetype s_deathdie5;\r
+extern statetype s_deathdie6;\r
+extern statetype s_deathdie7;\r
+extern statetype s_deathdie8;\r
+extern statetype s_deathdie9;\r
+\r
+extern statetype s_deathshoot1;\r
+extern statetype s_deathshoot2;\r
+extern statetype s_deathshoot3;\r
+extern statetype s_deathshoot4;\r
+extern statetype s_deathshoot5;\r
+\r
+\r
+statetype s_deathstand = {false,SPR_DEATH_W1,0,T_Stand,NULL,&s_deathstand};\r
+\r
+statetype s_deathchase1        = {false,SPR_DEATH_W1,10,T_Will,NULL,&s_deathchase1s};\r
+statetype s_deathchase1s       = {false,SPR_DEATH_W1,3,NULL,NULL,&s_deathchase2};\r
+statetype s_deathchase2        = {false,SPR_DEATH_W2,8,T_Will,NULL,&s_deathchase3};\r
+statetype s_deathchase3        = {false,SPR_DEATH_W3,10,T_Will,NULL,&s_deathchase3s};\r
+statetype s_deathchase3s       = {false,SPR_DEATH_W3,3,NULL,NULL,&s_deathchase4};\r
+statetype s_deathchase4        = {false,SPR_DEATH_W4,8,T_Will,NULL,&s_deathchase1};\r
+\r
+statetype s_deathdeathcam      = {false,SPR_DEATH_W1,1,NULL,NULL,&s_deathdie1};\r
+\r
+statetype s_deathdie1  = {false,SPR_DEATH_W1,1,NULL,A_DeathScream,&s_deathdie2};\r
+statetype s_deathdie2  = {false,SPR_DEATH_W1,10,NULL,NULL,&s_deathdie3};\r
+statetype s_deathdie3  = {false,SPR_DEATH_DIE1,10,NULL,NULL,&s_deathdie4};\r
+statetype s_deathdie4  = {false,SPR_DEATH_DIE2,10,NULL,NULL,&s_deathdie5};\r
+statetype s_deathdie5  = {false,SPR_DEATH_DIE3,10,NULL,NULL,&s_deathdie6};\r
+statetype s_deathdie6  = {false,SPR_DEATH_DIE4,10,NULL,NULL,&s_deathdie7};\r
+statetype s_deathdie7  = {false,SPR_DEATH_DIE5,10,NULL,NULL,&s_deathdie8};\r
+statetype s_deathdie8  = {false,SPR_DEATH_DIE6,10,NULL,NULL,&s_deathdie9};\r
+statetype s_deathdie9  = {false,SPR_DEATH_DEAD,0,NULL,NULL,&s_deathdie9};\r
+\r
+statetype s_deathshoot1        = {false,SPR_DEATH_SHOOT1,30,NULL,NULL,&s_deathshoot2};\r
+statetype s_deathshoot2        = {false,SPR_DEATH_SHOOT2,10,NULL,T_Launch,&s_deathshoot3};\r
+statetype s_deathshoot3        = {false,SPR_DEATH_SHOOT4,10,NULL,T_Shoot,&s_deathshoot4};\r
+statetype s_deathshoot4        = {false,SPR_DEATH_SHOOT3,10,NULL,T_Launch,&s_deathshoot5};\r
+statetype s_deathshoot5        = {false,SPR_DEATH_SHOOT4,10,NULL,T_Shoot,&s_deathchase1};\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnDeath\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnDeath (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       if (SoundBlasterPresent && DigiMode != sds_Off)\r
+               s_deathdie2.tictime = 105;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_deathstand);\r
+       new->obclass = deathobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_death];\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= T_Launch\r
+=\r
+===============\r
+*/\r
+\r
+void T_Launch (objtype *ob)\r
+{\r
+       long    deltax,deltay;\r
+       float   angle;\r
+       int             iangle;\r
+\r
+       deltax = player->x - ob->x;\r
+       deltay = ob->y - player->y;\r
+       angle = atan2 (deltay,deltax);\r
+       if (angle<0)\r
+               angle = M_PI*2+angle;\r
+       iangle = angle/(M_PI*2)*ANGLES;\r
+       if (ob->obclass == deathobj)\r
+       {\r
+               T_Shoot (ob);\r
+               if (ob->state == &s_deathshoot2)\r
+               {\r
+                       iangle-=4;\r
+                       if (iangle<0)\r
+                               iangle+=ANGLES;\r
+               }\r
+               else\r
+               {\r
+                       iangle+=4;\r
+                       if (iangle>=ANGLES)\r
+                               iangle-=ANGLES;\r
+               }\r
+       }\r
+\r
+       GetNewActor ();\r
+       new->state = &s_rocket;\r
+       new->ticcount = 1;\r
+\r
+       new->tilex = ob->tilex;\r
+       new->tiley = ob->tiley;\r
+       new->x = ob->x;\r
+       new->y = ob->y;\r
+       new->obclass = rocketobj;\r
+       switch(ob->obclass)\r
+       {\r
+       case deathobj:\r
+               new->state = &s_hrocket;\r
+               new->obclass = hrocketobj;\r
+               PlaySoundLocActor (KNIGHTMISSILESND,new);\r
+               break;\r
+       case angelobj:\r
+               new->state = &s_spark1;\r
+               new->obclass = sparkobj;\r
+               PlaySoundLocActor (ANGELFIRESND,new);\r
+               break;\r
+       default:\r
+               PlaySoundLocActor (MISSILEFIRESND,new);\r
+       }\r
+\r
+       new->dir = nodir;\r
+       new->angle = iangle;\r
+       new->speed = 0x2000l;\r
+       new->flags = FL_NONMARK;\r
+       new->active = true;\r
+}\r
+\r
+\r
+\r
+//\r
+// angel\r
+//\r
+void A_Relaunch (objtype *ob);\r
+void A_Victory (objtype *ob);\r
+void A_StartAttack (objtype *ob);\r
+void A_Breathing (objtype *ob);\r
+\r
+extern statetype s_angelstand;\r
+\r
+extern statetype s_angelchase1;\r
+extern statetype s_angelchase1s;\r
+extern statetype s_angelchase2;\r
+extern statetype s_angelchase3;\r
+extern statetype s_angelchase3s;\r
+extern statetype s_angelchase4;\r
+\r
+extern statetype s_angeldie1;\r
+extern statetype s_angeldie11;\r
+extern statetype s_angeldie2;\r
+extern statetype s_angeldie3;\r
+extern statetype s_angeldie4;\r
+extern statetype s_angeldie5;\r
+extern statetype s_angeldie6;\r
+extern statetype s_angeldie7;\r
+extern statetype s_angeldie8;\r
+extern statetype s_angeldie9;\r
+\r
+extern statetype s_angelshoot1;\r
+extern statetype s_angelshoot2;\r
+extern statetype s_angelshoot3;\r
+extern statetype s_angelshoot4;\r
+extern statetype s_angelshoot5;\r
+extern statetype s_angelshoot6;\r
+\r
+extern statetype s_angeltired;\r
+extern statetype s_angeltired2;\r
+extern statetype s_angeltired3;\r
+extern statetype s_angeltired4;\r
+extern statetype s_angeltired5;\r
+extern statetype s_angeltired6;\r
+extern statetype s_angeltired7;\r
+\r
+extern statetype s_spark1;\r
+extern statetype s_spark2;\r
+extern statetype s_spark3;\r
+extern statetype s_spark4;\r
+\r
+\r
+statetype s_angelstand = {false,SPR_ANGEL_W1,0,T_Stand,NULL,&s_angelstand};\r
+\r
+statetype s_angelchase1        = {false,SPR_ANGEL_W1,10,T_Will,NULL,&s_angelchase1s};\r
+statetype s_angelchase1s       = {false,SPR_ANGEL_W1,3,NULL,NULL,&s_angelchase2};\r
+statetype s_angelchase2        = {false,SPR_ANGEL_W2,8,T_Will,NULL,&s_angelchase3};\r
+statetype s_angelchase3        = {false,SPR_ANGEL_W3,10,T_Will,NULL,&s_angelchase3s};\r
+statetype s_angelchase3s       = {false,SPR_ANGEL_W3,3,NULL,NULL,&s_angelchase4};\r
+statetype s_angelchase4        = {false,SPR_ANGEL_W4,8,T_Will,NULL,&s_angelchase1};\r
+\r
+statetype s_angeldie1  = {false,SPR_ANGEL_W1,1,NULL,A_DeathScream,&s_angeldie11};\r
+statetype s_angeldie11 = {false,SPR_ANGEL_W1,1,NULL,NULL,&s_angeldie2};\r
+statetype s_angeldie2  = {false,SPR_ANGEL_DIE1,10,NULL,A_Slurpie,&s_angeldie3};\r
+statetype s_angeldie3  = {false,SPR_ANGEL_DIE2,10,NULL,NULL,&s_angeldie4};\r
+statetype s_angeldie4  = {false,SPR_ANGEL_DIE3,10,NULL,NULL,&s_angeldie5};\r
+statetype s_angeldie5  = {false,SPR_ANGEL_DIE4,10,NULL,NULL,&s_angeldie6};\r
+statetype s_angeldie6  = {false,SPR_ANGEL_DIE5,10,NULL,NULL,&s_angeldie7};\r
+statetype s_angeldie7  = {false,SPR_ANGEL_DIE6,10,NULL,NULL,&s_angeldie8};\r
+statetype s_angeldie8  = {false,SPR_ANGEL_DIE7,10,NULL,NULL,&s_angeldie9};\r
+statetype s_angeldie9  = {false,SPR_ANGEL_DEAD,130,NULL,A_Victory,&s_angeldie9};\r
+\r
+statetype s_angelshoot1        = {false,SPR_ANGEL_SHOOT1,10,NULL,A_StartAttack,&s_angelshoot2};\r
+statetype s_angelshoot2        = {false,SPR_ANGEL_SHOOT2,20,NULL,T_Launch,&s_angelshoot3};\r
+statetype s_angelshoot3        = {false,SPR_ANGEL_SHOOT1,10,NULL,A_Relaunch,&s_angelshoot2};\r
+\r
+statetype s_angeltired         = {false,SPR_ANGEL_TIRED1,40,NULL,A_Breathing,&s_angeltired2};\r
+statetype s_angeltired2        = {false,SPR_ANGEL_TIRED2,40,NULL,NULL,&s_angeltired3};\r
+statetype s_angeltired3        = {false,SPR_ANGEL_TIRED1,40,NULL,A_Breathing,&s_angeltired4};\r
+statetype s_angeltired4        = {false,SPR_ANGEL_TIRED2,40,NULL,NULL,&s_angeltired5};\r
+statetype s_angeltired5        = {false,SPR_ANGEL_TIRED1,40,NULL,A_Breathing,&s_angeltired6};\r
+statetype s_angeltired6        = {false,SPR_ANGEL_TIRED2,40,NULL,NULL,&s_angeltired7};\r
+statetype s_angeltired7        = {false,SPR_ANGEL_TIRED1,40,NULL,A_Breathing,&s_angelchase1};\r
+\r
+statetype s_spark1     = {false,SPR_SPARK1,6,T_Projectile,NULL,&s_spark2};\r
+statetype s_spark2     = {false,SPR_SPARK2,6,T_Projectile,NULL,&s_spark3};\r
+statetype s_spark3     = {false,SPR_SPARK3,6,T_Projectile,NULL,&s_spark4};\r
+statetype s_spark4     = {false,SPR_SPARK4,6,T_Projectile,NULL,&s_spark1};\r
+\r
+\r
+#pragma argsused\r
+void A_Slurpie (objtype *ob)\r
+{\r
+ SD_PlaySound(SLURPIESND);\r
+}\r
+\r
+#pragma argsused\r
+void A_Breathing (objtype *ob)\r
+{\r
+ SD_PlaySound(ANGELTIREDSND);\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnAngel\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnAngel (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+\r
+       if (SoundBlasterPresent && DigiMode != sds_Off)\r
+               s_angeldie11.tictime = 105;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_angelstand);\r
+       new->obclass = angelobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_angel];\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= A_Victory\r
+=\r
+=================\r
+*/\r
+\r
+#pragma argsused\r
+void A_Victory (objtype *ob)\r
+{\r
+       playstate = ex_victorious;\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= A_StartAttack\r
+=\r
+=================\r
+*/\r
+\r
+void A_StartAttack (objtype *ob)\r
+{\r
+       ob->temp1 = 0;\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= A_Relaunch\r
+=\r
+=================\r
+*/\r
+\r
+void A_Relaunch (objtype *ob)\r
+{\r
+       if (++ob->temp1 == 3)\r
+       {\r
+               NewState (ob,&s_angeltired);\r
+               return;\r
+       }\r
+\r
+       if (US_RndT()&1)\r
+       {\r
+               NewState (ob,&s_angelchase1);\r
+               return;\r
+       }\r
+}\r
+\r
+\r
+\r
+\r
+//\r
+// spectre\r
+//\r
+void T_SpectreWait (objtype *ob);\r
+void A_Dormant (objtype *ob);\r
+\r
+extern statetype s_spectrewait1;\r
+extern statetype s_spectrewait2;\r
+extern statetype s_spectrewait3;\r
+extern statetype s_spectrewait4;\r
+\r
+extern statetype s_spectrechase1;\r
+extern statetype s_spectrechase2;\r
+extern statetype s_spectrechase3;\r
+extern statetype s_spectrechase4;\r
+\r
+extern statetype s_spectredie1;\r
+extern statetype s_spectredie2;\r
+extern statetype s_spectredie3;\r
+extern statetype s_spectredie4;\r
+\r
+extern statetype s_spectrewake;\r
+\r
+statetype s_spectrewait1       = {false,SPR_SPECTRE_W1,10,T_Stand,NULL,&s_spectrewait2};\r
+statetype s_spectrewait2       = {false,SPR_SPECTRE_W2,10,T_Stand,NULL,&s_spectrewait3};\r
+statetype s_spectrewait3       = {false,SPR_SPECTRE_W3,10,T_Stand,NULL,&s_spectrewait4};\r
+statetype s_spectrewait4       = {false,SPR_SPECTRE_W4,10,T_Stand,NULL,&s_spectrewait1};\r
+\r
+statetype s_spectrechase1      = {false,SPR_SPECTRE_W1,10,T_Ghosts,NULL,&s_spectrechase2};\r
+statetype s_spectrechase2      = {false,SPR_SPECTRE_W2,10,T_Ghosts,NULL,&s_spectrechase3};\r
+statetype s_spectrechase3      = {false,SPR_SPECTRE_W3,10,T_Ghosts,NULL,&s_spectrechase4};\r
+statetype s_spectrechase4      = {false,SPR_SPECTRE_W4,10,T_Ghosts,NULL,&s_spectrechase1};\r
+\r
+statetype s_spectredie1        = {false,SPR_SPECTRE_F1,10,NULL,NULL,&s_spectredie2};\r
+statetype s_spectredie2        = {false,SPR_SPECTRE_F2,10,NULL,NULL,&s_spectredie3};\r
+statetype s_spectredie3        = {false,SPR_SPECTRE_F3,10,NULL,NULL,&s_spectredie4};\r
+statetype s_spectredie4        = {false,SPR_SPECTRE_F4,300,NULL,NULL,&s_spectrewake};\r
+statetype s_spectrewake        = {false,SPR_SPECTRE_F4,10,NULL,A_Dormant,&s_spectrewake};\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnSpectre\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnSpectre (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_spectrewait1);\r
+       new->obclass = spectreobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_spectre];\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH; // |FL_NEVERMARK|FL_NONMARK;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= A_Dormant\r
+=\r
+===============\r
+*/\r
+\r
+void A_Dormant (objtype *ob)\r
+{\r
+       long    deltax,deltay;\r
+       int     xl,xh,yl,yh;\r
+       int     x,y;\r
+       unsigned        tile;\r
+\r
+       deltax = ob->x - player->x;\r
+       if (deltax < -MINACTORDIST || deltax > MINACTORDIST)\r
+               goto moveok;\r
+       deltay = ob->y - player->y;\r
+       if (deltay < -MINACTORDIST || deltay > MINACTORDIST)\r
+               goto moveok;\r
+\r
+       return;\r
+moveok:\r
+\r
+       xl = (ob->x-MINDIST) >> TILESHIFT;\r
+       xh = (ob->x+MINDIST) >> TILESHIFT;\r
+       yl = (ob->y-MINDIST) >> TILESHIFT;\r
+       yh = (ob->y+MINDIST) >> TILESHIFT;\r
+\r
+       for (y=yl ; y<=yh ; y++)\r
+               for (x=xl ; x<=xh ; x++)\r
+               {\r
+                       tile = actorat[x][y];\r
+                       if (!tile)\r
+                               continue;\r
+                       if (tile<256)\r
+                               return;\r
+                       if (((objtype *)tile)->flags&FL_SHOOTABLE)\r
+                               return;\r
+               }\r
+\r
+       ob->flags |= FL_AMBUSH | FL_SHOOTABLE;\r
+       ob->flags &= ~FL_ATTACKMODE;\r
+       ob->dir = nodir;\r
+       NewState (ob,&s_spectrewait1);\r
+}\r
+\r
+\r
+#endif\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                SCHABBS / GIFT / FAT\r
+\r
+=============================================================================\r
+*/\r
+\r
+#ifndef SPEAR\r
+/*\r
+===============\r
+=\r
+= SpawnGhosts\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnGhosts (int which, int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       switch(which)\r
+       {\r
+        case en_blinky:\r
+          SpawnNewObj (tilex,tiley,&s_blinkychase1);\r
+          break;\r
+        case en_clyde:\r
+          SpawnNewObj (tilex,tiley,&s_clydechase1);\r
+          break;\r
+        case en_pinky:\r
+          SpawnNewObj (tilex,tiley,&s_pinkychase1);\r
+          break;\r
+        case en_inky:\r
+          SpawnNewObj (tilex,tiley,&s_inkychase1);\r
+          break;\r
+       }\r
+\r
+       new->obclass = ghostobj;\r
+       new->speed = SPDDOG;\r
+\r
+       new->dir = east;\r
+       new->flags |= FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+\r
+void   T_Gift (objtype *ob);\r
+void   T_GiftThrow (objtype *ob);\r
+\r
+void   T_Fat (objtype *ob);\r
+void   T_FatThrow (objtype *ob);\r
+\r
+//\r
+// schabb\r
+//\r
+extern statetype s_schabbstand;\r
+\r
+extern statetype s_schabbchase1;\r
+extern statetype s_schabbchase1s;\r
+extern statetype s_schabbchase2;\r
+extern statetype s_schabbchase3;\r
+extern statetype s_schabbchase3s;\r
+extern statetype s_schabbchase4;\r
+\r
+extern statetype s_schabbdie1;\r
+extern statetype s_schabbdie2;\r
+extern statetype s_schabbdie3;\r
+extern statetype s_schabbdie4;\r
+extern statetype s_schabbdie5;\r
+extern statetype s_schabbdie6;\r
+\r
+extern statetype s_schabbshoot1;\r
+extern statetype s_schabbshoot2;\r
+\r
+extern statetype s_needle1;\r
+extern statetype s_needle2;\r
+extern statetype s_needle3;\r
+extern statetype s_needle4;\r
+\r
+extern statetype s_schabbdeathcam;\r
+\r
+\r
+statetype s_schabbstand        = {false,SPR_SCHABB_W1,0,T_Stand,NULL,&s_schabbstand};\r
+\r
+statetype s_schabbchase1       = {false,SPR_SCHABB_W1,10,T_Schabb,NULL,&s_schabbchase1s};\r
+statetype s_schabbchase1s      = {false,SPR_SCHABB_W1,3,NULL,NULL,&s_schabbchase2};\r
+statetype s_schabbchase2       = {false,SPR_SCHABB_W2,8,T_Schabb,NULL,&s_schabbchase3};\r
+statetype s_schabbchase3       = {false,SPR_SCHABB_W3,10,T_Schabb,NULL,&s_schabbchase3s};\r
+statetype s_schabbchase3s      = {false,SPR_SCHABB_W3,3,NULL,NULL,&s_schabbchase4};\r
+statetype s_schabbchase4       = {false,SPR_SCHABB_W4,8,T_Schabb,NULL,&s_schabbchase1};\r
+\r
+statetype s_schabbdeathcam     = {false,SPR_SCHABB_W1,1,NULL,NULL,&s_schabbdie1};\r
+\r
+statetype s_schabbdie1 = {false,SPR_SCHABB_W1,10,NULL,A_DeathScream,&s_schabbdie2};\r
+statetype s_schabbdie2 = {false,SPR_SCHABB_W1,10,NULL,NULL,&s_schabbdie3};\r
+statetype s_schabbdie3 = {false,SPR_SCHABB_DIE1,10,NULL,NULL,&s_schabbdie4};\r
+statetype s_schabbdie4 = {false,SPR_SCHABB_DIE2,10,NULL,NULL,&s_schabbdie5};\r
+statetype s_schabbdie5 = {false,SPR_SCHABB_DIE3,10,NULL,NULL,&s_schabbdie6};\r
+statetype s_schabbdie6 = {false,SPR_SCHABB_DEAD,20,NULL,A_StartDeathCam,&s_schabbdie6};\r
+\r
+statetype s_schabbshoot1       = {false,SPR_SCHABB_SHOOT1,30,NULL,NULL,&s_schabbshoot2};\r
+statetype s_schabbshoot2       = {false,SPR_SCHABB_SHOOT2,10,NULL,T_SchabbThrow,&s_schabbchase1};\r
+\r
+statetype s_needle1    = {false,SPR_HYPO1,6,T_Projectile,NULL,&s_needle2};\r
+statetype s_needle2    = {false,SPR_HYPO2,6,T_Projectile,NULL,&s_needle3};\r
+statetype s_needle3    = {false,SPR_HYPO3,6,T_Projectile,NULL,&s_needle4};\r
+statetype s_needle4    = {false,SPR_HYPO4,6,T_Projectile,NULL,&s_needle1};\r
+\r
+\r
+//\r
+// gift\r
+//\r
+extern statetype s_giftstand;\r
+\r
+extern statetype s_giftchase1;\r
+extern statetype s_giftchase1s;\r
+extern statetype s_giftchase2;\r
+extern statetype s_giftchase3;\r
+extern statetype s_giftchase3s;\r
+extern statetype s_giftchase4;\r
+\r
+extern statetype s_giftdie1;\r
+extern statetype s_giftdie2;\r
+extern statetype s_giftdie3;\r
+extern statetype s_giftdie4;\r
+extern statetype s_giftdie5;\r
+extern statetype s_giftdie6;\r
+\r
+extern statetype s_giftshoot1;\r
+extern statetype s_giftshoot2;\r
+\r
+extern statetype s_needle1;\r
+extern statetype s_needle2;\r
+extern statetype s_needle3;\r
+extern statetype s_needle4;\r
+\r
+extern statetype s_giftdeathcam;\r
+\r
+extern statetype s_boom1;\r
+extern statetype s_boom2;\r
+extern statetype s_boom3;\r
+\r
+\r
+statetype s_giftstand  = {false,SPR_GIFT_W1,0,T_Stand,NULL,&s_giftstand};\r
+\r
+statetype s_giftchase1         = {false,SPR_GIFT_W1,10,T_Gift,NULL,&s_giftchase1s};\r
+statetype s_giftchase1s        = {false,SPR_GIFT_W1,3,NULL,NULL,&s_giftchase2};\r
+statetype s_giftchase2         = {false,SPR_GIFT_W2,8,T_Gift,NULL,&s_giftchase3};\r
+statetype s_giftchase3         = {false,SPR_GIFT_W3,10,T_Gift,NULL,&s_giftchase3s};\r
+statetype s_giftchase3s        = {false,SPR_GIFT_W3,3,NULL,NULL,&s_giftchase4};\r
+statetype s_giftchase4         = {false,SPR_GIFT_W4,8,T_Gift,NULL,&s_giftchase1};\r
+\r
+statetype s_giftdeathcam       = {false,SPR_GIFT_W1,1,NULL,NULL,&s_giftdie1};\r
+\r
+statetype s_giftdie1   = {false,SPR_GIFT_W1,1,NULL,A_DeathScream,&s_giftdie2};\r
+statetype s_giftdie2   = {false,SPR_GIFT_W1,10,NULL,NULL,&s_giftdie3};\r
+statetype s_giftdie3   = {false,SPR_GIFT_DIE1,10,NULL,NULL,&s_giftdie4};\r
+statetype s_giftdie4   = {false,SPR_GIFT_DIE2,10,NULL,NULL,&s_giftdie5};\r
+statetype s_giftdie5   = {false,SPR_GIFT_DIE3,10,NULL,NULL,&s_giftdie6};\r
+statetype s_giftdie6   = {false,SPR_GIFT_DEAD,20,NULL,A_StartDeathCam,&s_giftdie6};\r
+\r
+statetype s_giftshoot1         = {false,SPR_GIFT_SHOOT1,30,NULL,NULL,&s_giftshoot2};\r
+statetype s_giftshoot2         = {false,SPR_GIFT_SHOOT2,10,NULL,T_GiftThrow,&s_giftchase1};\r
+\r
+\r
+//\r
+// fat\r
+//\r
+extern statetype s_fatstand;\r
+\r
+extern statetype s_fatchase1;\r
+extern statetype s_fatchase1s;\r
+extern statetype s_fatchase2;\r
+extern statetype s_fatchase3;\r
+extern statetype s_fatchase3s;\r
+extern statetype s_fatchase4;\r
+\r
+extern statetype s_fatdie1;\r
+extern statetype s_fatdie2;\r
+extern statetype s_fatdie3;\r
+extern statetype s_fatdie4;\r
+extern statetype s_fatdie5;\r
+extern statetype s_fatdie6;\r
+\r
+extern statetype s_fatshoot1;\r
+extern statetype s_fatshoot2;\r
+extern statetype s_fatshoot3;\r
+extern statetype s_fatshoot4;\r
+extern statetype s_fatshoot5;\r
+extern statetype s_fatshoot6;\r
+\r
+extern statetype s_needle1;\r
+extern statetype s_needle2;\r
+extern statetype s_needle3;\r
+extern statetype s_needle4;\r
+\r
+extern statetype s_fatdeathcam;\r
+\r
+\r
+statetype s_fatstand   = {false,SPR_FAT_W1,0,T_Stand,NULL,&s_fatstand};\r
+\r
+statetype s_fatchase1  = {false,SPR_FAT_W1,10,T_Fat,NULL,&s_fatchase1s};\r
+statetype s_fatchase1s = {false,SPR_FAT_W1,3,NULL,NULL,&s_fatchase2};\r
+statetype s_fatchase2  = {false,SPR_FAT_W2,8,T_Fat,NULL,&s_fatchase3};\r
+statetype s_fatchase3  = {false,SPR_FAT_W3,10,T_Fat,NULL,&s_fatchase3s};\r
+statetype s_fatchase3s = {false,SPR_FAT_W3,3,NULL,NULL,&s_fatchase4};\r
+statetype s_fatchase4  = {false,SPR_FAT_W4,8,T_Fat,NULL,&s_fatchase1};\r
+\r
+statetype s_fatdeathcam        = {false,SPR_FAT_W1,1,NULL,NULL,&s_fatdie1};\r
+\r
+statetype s_fatdie1    = {false,SPR_FAT_W1,1,NULL,A_DeathScream,&s_fatdie2};\r
+statetype s_fatdie2    = {false,SPR_FAT_W1,10,NULL,NULL,&s_fatdie3};\r
+statetype s_fatdie3    = {false,SPR_FAT_DIE1,10,NULL,NULL,&s_fatdie4};\r
+statetype s_fatdie4    = {false,SPR_FAT_DIE2,10,NULL,NULL,&s_fatdie5};\r
+statetype s_fatdie5    = {false,SPR_FAT_DIE3,10,NULL,NULL,&s_fatdie6};\r
+statetype s_fatdie6    = {false,SPR_FAT_DEAD,20,NULL,A_StartDeathCam,&s_fatdie6};\r
+\r
+statetype s_fatshoot1  = {false,SPR_FAT_SHOOT1,30,NULL,NULL,&s_fatshoot2};\r
+statetype s_fatshoot2  = {false,SPR_FAT_SHOOT2,10,NULL,T_GiftThrow,&s_fatshoot3};\r
+statetype s_fatshoot3  = {false,SPR_FAT_SHOOT3,10,NULL,T_Shoot,&s_fatshoot4};\r
+statetype s_fatshoot4  = {false,SPR_FAT_SHOOT4,10,NULL,T_Shoot,&s_fatshoot5};\r
+statetype s_fatshoot5  = {false,SPR_FAT_SHOOT3,10,NULL,T_Shoot,&s_fatshoot6};\r
+statetype s_fatshoot6  = {false,SPR_FAT_SHOOT4,10,NULL,T_Shoot,&s_fatchase1};\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnSchabbs\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnSchabbs (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       if (DigiMode != sds_Off)\r
+               s_schabbdie2.tictime = 140;\r
+       else\r
+               s_schabbdie2.tictime = 5;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_schabbstand);\r
+       new->speed = SPDPATROL;\r
+\r
+       new->obclass = schabbobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_schabbs];\r
+       new->dir = south;\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnGift\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnGift (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       if (DigiMode != sds_Off)\r
+         s_giftdie2.tictime = 140;\r
+       else\r
+         s_giftdie2.tictime = 5;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_giftstand);\r
+       new->speed = SPDPATROL;\r
+\r
+       new->obclass = giftobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_gift];\r
+       new->dir = north;\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnFat\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnFat (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       if (DigiMode != sds_Off)\r
+         s_fatdie2.tictime = 140;\r
+       else\r
+         s_fatdie2.tictime = 5;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_fatstand);\r
+       new->speed = SPDPATROL;\r
+\r
+       new->obclass = fatobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_fat];\r
+       new->dir = south;\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= T_SchabbThrow\r
+=\r
+=================\r
+*/\r
+\r
+void T_SchabbThrow (objtype *ob)\r
+{\r
+       long    deltax,deltay;\r
+       float   angle;\r
+       int             iangle;\r
+\r
+       deltax = player->x - ob->x;\r
+       deltay = ob->y - player->y;\r
+       angle = atan2 (deltay,deltax);\r
+       if (angle<0)\r
+               angle = M_PI*2+angle;\r
+       iangle = angle/(M_PI*2)*ANGLES;\r
+\r
+       GetNewActor ();\r
+       new->state = &s_needle1;\r
+       new->ticcount = 1;\r
+\r
+       new->tilex = ob->tilex;\r
+       new->tiley = ob->tiley;\r
+       new->x = ob->x;\r
+       new->y = ob->y;\r
+       new->obclass = needleobj;\r
+       new->dir = nodir;\r
+       new->angle = iangle;\r
+       new->speed = 0x2000l;\r
+\r
+       new->flags = FL_NONMARK;\r
+       new->active = true;\r
+\r
+       PlaySoundLocActor (SCHABBSTHROWSND,new);\r
+}\r
+\r
+/*\r
+=================\r
+=\r
+= T_GiftThrow\r
+=\r
+=================\r
+*/\r
+\r
+void T_GiftThrow (objtype *ob)\r
+{\r
+       long    deltax,deltay;\r
+       float   angle;\r
+       int             iangle;\r
+\r
+       deltax = player->x - ob->x;\r
+       deltay = ob->y - player->y;\r
+       angle = atan2 (deltay,deltax);\r
+       if (angle<0)\r
+               angle = M_PI*2+angle;\r
+       iangle = angle/(M_PI*2)*ANGLES;\r
+\r
+       GetNewActor ();\r
+       new->state = &s_rocket;\r
+       new->ticcount = 1;\r
+\r
+       new->tilex = ob->tilex;\r
+       new->tiley = ob->tiley;\r
+       new->x = ob->x;\r
+       new->y = ob->y;\r
+       new->obclass = rocketobj;\r
+       new->dir = nodir;\r
+       new->angle = iangle;\r
+       new->speed = 0x2000l;\r
+       new->flags = FL_NONMARK;\r
+       new->active = true;\r
+\r
+       PlaySoundLocActor (MISSILEFIRESND,new);\r
+}\r
+\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= T_Schabb\r
+=\r
+=================\r
+*/\r
+\r
+void T_Schabb (objtype *ob)\r
+{\r
+       long move;\r
+       int     dx,dy,dist;\r
+       boolean dodge;\r
+\r
+       dodge = false;\r
+       dx = abs(ob->tilex - player->tilex);\r
+       dy = abs(ob->tiley - player->tiley);\r
+       dist = dx>dy ? dx : dy;\r
+\r
+       if (CheckLine(ob))                                              // got a shot at player?\r
+       {\r
+\r
+               if ( US_RndT() < (tics<<3) )\r
+               {\r
+               //\r
+               // go into attack frame\r
+               //\r
+                       NewState (ob,&s_schabbshoot1);\r
+                       return;\r
+               }\r
+               dodge = true;\r
+       }\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (ob->distance < 0)\r
+               {\r
+               //\r
+               // waiting for a door to open\r
+               //\r
+                       OpenDoor (-ob->distance-1);\r
+                       if (doorobjlist[-ob->distance-1].action != dr_open)\r
+                               return;\r
+                       ob->distance = TILEGLOBAL;      // go ahead, the door is now opoen\r
+               }\r
+\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               //\r
+               // reached goal tile, so select another one\r
+               //\r
+\r
+               //\r
+               // fix position to account for round off during moving\r
+               //\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+\r
+               move -= ob->distance;\r
+\r
+               if (dist <4)\r
+                       SelectRunDir (ob);\r
+               else if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+}\r
+\r
+\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= T_Gift\r
+=\r
+=================\r
+*/\r
+\r
+void T_Gift (objtype *ob)\r
+{\r
+       long move;\r
+       int     dx,dy,dist;\r
+       boolean dodge;\r
+\r
+       dodge = false;\r
+       dx = abs(ob->tilex - player->tilex);\r
+       dy = abs(ob->tiley - player->tiley);\r
+       dist = dx>dy ? dx : dy;\r
+\r
+       if (CheckLine(ob))                                              // got a shot at player?\r
+       {\r
+\r
+               if ( US_RndT() < (tics<<3) )\r
+               {\r
+               //\r
+               // go into attack frame\r
+               //\r
+                       NewState (ob,&s_giftshoot1);\r
+                       return;\r
+               }\r
+               dodge = true;\r
+       }\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (ob->distance < 0)\r
+               {\r
+               //\r
+               // waiting for a door to open\r
+               //\r
+                       OpenDoor (-ob->distance-1);\r
+                       if (doorobjlist[-ob->distance-1].action != dr_open)\r
+                               return;\r
+                       ob->distance = TILEGLOBAL;      // go ahead, the door is now opoen\r
+               }\r
+\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               //\r
+               // reached goal tile, so select another one\r
+               //\r
+\r
+               //\r
+               // fix position to account for round off during moving\r
+               //\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+\r
+               move -= ob->distance;\r
+\r
+               if (dist <4)\r
+                       SelectRunDir (ob);\r
+               else if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+}\r
+\r
+\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= T_Fat\r
+=\r
+=================\r
+*/\r
+\r
+void T_Fat (objtype *ob)\r
+{\r
+       long move;\r
+       int     dx,dy,dist;\r
+       boolean dodge;\r
+\r
+       dodge = false;\r
+       dx = abs(ob->tilex - player->tilex);\r
+       dy = abs(ob->tiley - player->tiley);\r
+       dist = dx>dy ? dx : dy;\r
+\r
+       if (CheckLine(ob))                                              // got a shot at player?\r
+       {\r
+\r
+               if ( US_RndT() < (tics<<3) )\r
+               {\r
+               //\r
+               // go into attack frame\r
+               //\r
+                       NewState (ob,&s_fatshoot1);\r
+                       return;\r
+               }\r
+               dodge = true;\r
+       }\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (ob->distance < 0)\r
+               {\r
+               //\r
+               // waiting for a door to open\r
+               //\r
+                       OpenDoor (-ob->distance-1);\r
+                       if (doorobjlist[-ob->distance-1].action != dr_open)\r
+                               return;\r
+                       ob->distance = TILEGLOBAL;      // go ahead, the door is now opoen\r
+               }\r
+\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               //\r
+               // reached goal tile, so select another one\r
+               //\r
+\r
+               //\r
+               // fix position to account for round off during moving\r
+               //\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+\r
+               move -= ob->distance;\r
+\r
+               if (dist <4)\r
+                       SelectRunDir (ob);\r
+               else if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       HITLERS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+//\r
+// fake\r
+//\r
+extern statetype s_fakestand;\r
+\r
+extern statetype s_fakechase1;\r
+extern statetype s_fakechase1s;\r
+extern statetype s_fakechase2;\r
+extern statetype s_fakechase3;\r
+extern statetype s_fakechase3s;\r
+extern statetype s_fakechase4;\r
+\r
+extern statetype s_fakedie1;\r
+extern statetype s_fakedie2;\r
+extern statetype s_fakedie3;\r
+extern statetype s_fakedie4;\r
+extern statetype s_fakedie5;\r
+extern statetype s_fakedie6;\r
+\r
+extern statetype s_fakeshoot1;\r
+extern statetype s_fakeshoot2;\r
+extern statetype s_fakeshoot3;\r
+extern statetype s_fakeshoot4;\r
+extern statetype s_fakeshoot5;\r
+extern statetype s_fakeshoot6;\r
+extern statetype s_fakeshoot7;\r
+extern statetype s_fakeshoot8;\r
+extern statetype s_fakeshoot9;\r
+\r
+extern statetype s_fire1;\r
+extern statetype s_fire2;\r
+\r
+statetype s_fakestand  = {false,SPR_FAKE_W1,0,T_Stand,NULL,&s_fakestand};\r
+\r
+statetype s_fakechase1         = {false,SPR_FAKE_W1,10,T_Fake,NULL,&s_fakechase1s};\r
+statetype s_fakechase1s        = {false,SPR_FAKE_W1,3,NULL,NULL,&s_fakechase2};\r
+statetype s_fakechase2         = {false,SPR_FAKE_W2,8,T_Fake,NULL,&s_fakechase3};\r
+statetype s_fakechase3         = {false,SPR_FAKE_W3,10,T_Fake,NULL,&s_fakechase3s};\r
+statetype s_fakechase3s        = {false,SPR_FAKE_W3,3,NULL,NULL,&s_fakechase4};\r
+statetype s_fakechase4         = {false,SPR_FAKE_W4,8,T_Fake,NULL,&s_fakechase1};\r
+\r
+statetype s_fakedie1   = {false,SPR_FAKE_DIE1,10,NULL,A_DeathScream,&s_fakedie2};\r
+statetype s_fakedie2   = {false,SPR_FAKE_DIE2,10,NULL,NULL,&s_fakedie3};\r
+statetype s_fakedie3   = {false,SPR_FAKE_DIE3,10,NULL,NULL,&s_fakedie4};\r
+statetype s_fakedie4   = {false,SPR_FAKE_DIE4,10,NULL,NULL,&s_fakedie5};\r
+statetype s_fakedie5   = {false,SPR_FAKE_DIE5,10,NULL,NULL,&s_fakedie6};\r
+statetype s_fakedie6   = {false,SPR_FAKE_DEAD,0,NULL,NULL,&s_fakedie6};\r
+\r
+statetype s_fakeshoot1         = {false,SPR_FAKE_SHOOT,8,NULL,T_FakeFire,&s_fakeshoot2};\r
+statetype s_fakeshoot2         = {false,SPR_FAKE_SHOOT,8,NULL,T_FakeFire,&s_fakeshoot3};\r
+statetype s_fakeshoot3         = {false,SPR_FAKE_SHOOT,8,NULL,T_FakeFire,&s_fakeshoot4};\r
+statetype s_fakeshoot4         = {false,SPR_FAKE_SHOOT,8,NULL,T_FakeFire,&s_fakeshoot5};\r
+statetype s_fakeshoot5         = {false,SPR_FAKE_SHOOT,8,NULL,T_FakeFire,&s_fakeshoot6};\r
+statetype s_fakeshoot6         = {false,SPR_FAKE_SHOOT,8,NULL,T_FakeFire,&s_fakeshoot7};\r
+statetype s_fakeshoot7         = {false,SPR_FAKE_SHOOT,8,NULL,T_FakeFire,&s_fakeshoot8};\r
+statetype s_fakeshoot8         = {false,SPR_FAKE_SHOOT,8,NULL,T_FakeFire,&s_fakeshoot9};\r
+statetype s_fakeshoot9         = {false,SPR_FAKE_SHOOT,8,NULL,NULL,&s_fakechase1};\r
+\r
+statetype s_fire1      = {false,SPR_FIRE1,6,NULL,T_Projectile,&s_fire2};\r
+statetype s_fire2      = {false,SPR_FIRE2,6,NULL,T_Projectile,&s_fire1};\r
+\r
+//\r
+// hitler\r
+//\r
+extern statetype s_mechachase1;\r
+extern statetype s_mechachase1s;\r
+extern statetype s_mechachase2;\r
+extern statetype s_mechachase3;\r
+extern statetype s_mechachase3s;\r
+extern statetype s_mechachase4;\r
+\r
+extern statetype s_mechadie1;\r
+extern statetype s_mechadie2;\r
+extern statetype s_mechadie3;\r
+extern statetype s_mechadie4;\r
+\r
+extern statetype s_mechashoot1;\r
+extern statetype s_mechashoot2;\r
+extern statetype s_mechashoot3;\r
+extern statetype s_mechashoot4;\r
+extern statetype s_mechashoot5;\r
+extern statetype s_mechashoot6;\r
+\r
+\r
+extern statetype s_hitlerchase1;\r
+extern statetype s_hitlerchase1s;\r
+extern statetype s_hitlerchase2;\r
+extern statetype s_hitlerchase3;\r
+extern statetype s_hitlerchase3s;\r
+extern statetype s_hitlerchase4;\r
+\r
+extern statetype s_hitlerdie1;\r
+extern statetype s_hitlerdie2;\r
+extern statetype s_hitlerdie3;\r
+extern statetype s_hitlerdie4;\r
+extern statetype s_hitlerdie5;\r
+extern statetype s_hitlerdie6;\r
+extern statetype s_hitlerdie7;\r
+extern statetype s_hitlerdie8;\r
+extern statetype s_hitlerdie9;\r
+extern statetype s_hitlerdie10;\r
+\r
+extern statetype s_hitlershoot1;\r
+extern statetype s_hitlershoot2;\r
+extern statetype s_hitlershoot3;\r
+extern statetype s_hitlershoot4;\r
+extern statetype s_hitlershoot5;\r
+extern statetype s_hitlershoot6;\r
+\r
+extern statetype s_hitlerdeathcam;\r
+\r
+statetype s_mechastand = {false,SPR_MECHA_W1,0,T_Stand,NULL,&s_mechastand};\r
+\r
+statetype s_mechachase1        = {false,SPR_MECHA_W1,10,T_Chase,A_MechaSound,&s_mechachase1s};\r
+statetype s_mechachase1s       = {false,SPR_MECHA_W1,6,NULL,NULL,&s_mechachase2};\r
+statetype s_mechachase2        = {false,SPR_MECHA_W2,8,T_Chase,NULL,&s_mechachase3};\r
+statetype s_mechachase3        = {false,SPR_MECHA_W3,10,T_Chase,A_MechaSound,&s_mechachase3s};\r
+statetype s_mechachase3s       = {false,SPR_MECHA_W3,6,NULL,NULL,&s_mechachase4};\r
+statetype s_mechachase4        = {false,SPR_MECHA_W4,8,T_Chase,NULL,&s_mechachase1};\r
+\r
+statetype s_mechadie1  = {false,SPR_MECHA_DIE1,10,NULL,A_DeathScream,&s_mechadie2};\r
+statetype s_mechadie2  = {false,SPR_MECHA_DIE2,10,NULL,NULL,&s_mechadie3};\r
+statetype s_mechadie3  = {false,SPR_MECHA_DIE3,10,NULL,A_HitlerMorph,&s_mechadie4};\r
+statetype s_mechadie4  = {false,SPR_MECHA_DEAD,0,NULL,NULL,&s_mechadie4};\r
+\r
+statetype s_mechashoot1        = {false,SPR_MECHA_SHOOT1,30,NULL,NULL,&s_mechashoot2};\r
+statetype s_mechashoot2        = {false,SPR_MECHA_SHOOT2,10,NULL,T_Shoot,&s_mechashoot3};\r
+statetype s_mechashoot3        = {false,SPR_MECHA_SHOOT3,10,NULL,T_Shoot,&s_mechashoot4};\r
+statetype s_mechashoot4        = {false,SPR_MECHA_SHOOT2,10,NULL,T_Shoot,&s_mechashoot5};\r
+statetype s_mechashoot5        = {false,SPR_MECHA_SHOOT3,10,NULL,T_Shoot,&s_mechashoot6};\r
+statetype s_mechashoot6        = {false,SPR_MECHA_SHOOT2,10,NULL,T_Shoot,&s_mechachase1};\r
+\r
+\r
+statetype s_hitlerchase1       = {false,SPR_HITLER_W1,6,T_Chase,NULL,&s_hitlerchase1s};\r
+statetype s_hitlerchase1s      = {false,SPR_HITLER_W1,4,NULL,NULL,&s_hitlerchase2};\r
+statetype s_hitlerchase2       = {false,SPR_HITLER_W2,2,T_Chase,NULL,&s_hitlerchase3};\r
+statetype s_hitlerchase3       = {false,SPR_HITLER_W3,6,T_Chase,NULL,&s_hitlerchase3s};\r
+statetype s_hitlerchase3s      = {false,SPR_HITLER_W3,4,NULL,NULL,&s_hitlerchase4};\r
+statetype s_hitlerchase4       = {false,SPR_HITLER_W4,2,T_Chase,NULL,&s_hitlerchase1};\r
+\r
+statetype s_hitlerdeathcam     = {false,SPR_HITLER_W1,10,NULL,NULL,&s_hitlerdie1};\r
+\r
+statetype s_hitlerdie1 = {false,SPR_HITLER_W1,1,NULL,A_DeathScream,&s_hitlerdie2};\r
+statetype s_hitlerdie2 = {false,SPR_HITLER_W1,10,NULL,NULL,&s_hitlerdie3};\r
+statetype s_hitlerdie3 = {false,SPR_HITLER_DIE1,10,NULL,A_Slurpie,&s_hitlerdie4};\r
+statetype s_hitlerdie4 = {false,SPR_HITLER_DIE2,10,NULL,NULL,&s_hitlerdie5};\r
+statetype s_hitlerdie5 = {false,SPR_HITLER_DIE3,10,NULL,NULL,&s_hitlerdie6};\r
+statetype s_hitlerdie6 = {false,SPR_HITLER_DIE4,10,NULL,NULL,&s_hitlerdie7};\r
+statetype s_hitlerdie7 = {false,SPR_HITLER_DIE5,10,NULL,NULL,&s_hitlerdie8};\r
+statetype s_hitlerdie8 = {false,SPR_HITLER_DIE6,10,NULL,NULL,&s_hitlerdie9};\r
+statetype s_hitlerdie9 = {false,SPR_HITLER_DIE7,10,NULL,NULL,&s_hitlerdie10};\r
+statetype s_hitlerdie10        = {false,SPR_HITLER_DEAD,20,NULL,A_StartDeathCam,&s_hitlerdie10};\r
+\r
+statetype s_hitlershoot1       = {false,SPR_HITLER_SHOOT1,30,NULL,NULL,&s_hitlershoot2};\r
+statetype s_hitlershoot2       = {false,SPR_HITLER_SHOOT2,10,NULL,T_Shoot,&s_hitlershoot3};\r
+statetype s_hitlershoot3       = {false,SPR_HITLER_SHOOT3,10,NULL,T_Shoot,&s_hitlershoot4};\r
+statetype s_hitlershoot4       = {false,SPR_HITLER_SHOOT2,10,NULL,T_Shoot,&s_hitlershoot5};\r
+statetype s_hitlershoot5       = {false,SPR_HITLER_SHOOT3,10,NULL,T_Shoot,&s_hitlershoot6};\r
+statetype s_hitlershoot6       = {false,SPR_HITLER_SHOOT2,10,NULL,T_Shoot,&s_hitlerchase1};\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnFakeHitler\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnFakeHitler (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+\r
+       if (DigiMode != sds_Off)\r
+         s_hitlerdie2.tictime = 140;\r
+       else\r
+         s_hitlerdie2.tictime = 5;\r
+\r
+       SpawnNewObj (tilex,tiley,&s_fakestand);\r
+       new->speed = SPDPATROL;\r
+\r
+       new->obclass = fakeobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_fake];\r
+       new->dir = north;\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnHitler\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnHitler (int tilex, int tiley)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       if (DigiMode != sds_Off)\r
+               s_hitlerdie2.tictime = 140;\r
+       else\r
+               s_hitlerdie2.tictime = 5;\r
+\r
+\r
+       SpawnNewObj (tilex,tiley,&s_mechastand);\r
+       new->speed = SPDPATROL;\r
+\r
+       new->obclass = mechahitlerobj;\r
+       new->hitpoints = starthitpoints[gamestate.difficulty][en_hitler];\r
+       new->dir = south;\r
+       new->flags |= FL_SHOOTABLE|FL_AMBUSH;\r
+       if (!loadedgame)\r
+         gamestate.killtotal++;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= A_HitlerMorph\r
+=\r
+===============\r
+*/\r
+\r
+void A_HitlerMorph (objtype *ob)\r
+{\r
+       unsigned        far *map,tile,hitpoints[4]={500,700,800,900};\r
+\r
+\r
+       SpawnNewObj (ob->tilex,ob->tiley,&s_hitlerchase1);\r
+       new->speed = SPDPATROL*5;\r
+\r
+       new->x = ob->x;\r
+       new->y = ob->y;\r
+\r
+       new->distance = ob->distance;\r
+       new->dir = ob->dir;\r
+       new->flags = ob->flags | FL_SHOOTABLE;\r
+\r
+       new->obclass = realhitlerobj;\r
+       new->hitpoints = hitpoints[gamestate.difficulty];\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////\r
+//\r
+// A_MechaSound\r
+// A_Slurpie\r
+//\r
+////////////////////////////////////////////////////////\r
+void A_MechaSound (objtype *ob)\r
+{\r
+       if (areabyplayer[ob->areanumber])\r
+               PlaySoundLocActor (MECHSTEPSND,ob);\r
+}\r
+\r
+\r
+#pragma argsused\r
+void A_Slurpie (objtype *ob)\r
+{\r
+ SD_PlaySound(SLURPIESND);\r
+}\r
+\r
+/*\r
+=================\r
+=\r
+= T_FakeFire\r
+=\r
+=================\r
+*/\r
+\r
+void T_FakeFire (objtype *ob)\r
+{\r
+       long    deltax,deltay;\r
+       float   angle;\r
+       int             iangle;\r
+\r
+       deltax = player->x - ob->x;\r
+       deltay = ob->y - player->y;\r
+       angle = atan2 (deltay,deltax);\r
+       if (angle<0)\r
+               angle = M_PI*2+angle;\r
+       iangle = angle/(M_PI*2)*ANGLES;\r
+\r
+       GetNewActor ();\r
+       new->state = &s_fire1;\r
+       new->ticcount = 1;\r
+\r
+       new->tilex = ob->tilex;\r
+       new->tiley = ob->tiley;\r
+       new->x = ob->x;\r
+       new->y = ob->y;\r
+       new->dir = nodir;\r
+       new->angle = iangle;\r
+       new->obclass = fireobj;\r
+       new->speed = 0x1200l;\r
+       new->flags = FL_NEVERMARK;\r
+       new->active = true;\r
+\r
+       PlaySoundLocActor (FLAMETHROWERSND,new);\r
+}\r
+\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= T_Fake\r
+=\r
+=================\r
+*/\r
+\r
+void T_Fake (objtype *ob)\r
+{\r
+       long move;\r
+       int     dx,dy,dist;\r
+       boolean dodge;\r
+\r
+       if (CheckLine(ob))                      // got a shot at player?\r
+       {\r
+               if ( US_RndT() < (tics<<1) )\r
+               {\r
+               //\r
+               // go into attack frame\r
+               //\r
+                       NewState (ob,&s_fakeshoot1);\r
+                       return;\r
+               }\r
+       }\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               SelectDodgeDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               //\r
+               // reached goal tile, so select another one\r
+               //\r
+\r
+               //\r
+               // fix position to account for round off during moving\r
+               //\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+\r
+               move -= ob->distance;\r
+\r
+               SelectDodgeDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+}\r
+\r
+#endif\r
+/*\r
+============================================================================\r
+\r
+                                                       STAND\r
+\r
+============================================================================\r
+*/\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_Stand\r
+=\r
+===============\r
+*/\r
+\r
+void T_Stand (objtype *ob)\r
+{\r
+       SightPlayer (ob);\r
+}\r
+\r
+\r
+/*\r
+============================================================================\r
+\r
+                                                               CHASE\r
+\r
+============================================================================\r
+*/\r
+\r
+/*\r
+=================\r
+=\r
+= T_Chase\r
+=\r
+=================\r
+*/\r
+\r
+void T_Chase (objtype *ob)\r
+{\r
+       long move;\r
+       int     dx,dy,dist,chance;\r
+       boolean dodge;\r
+\r
+       if (gamestate.victoryflag)\r
+               return;\r
+\r
+       dodge = false;\r
+       if (CheckLine(ob))      // got a shot at player?\r
+       {\r
+               dx = abs(ob->tilex - player->tilex);\r
+               dy = abs(ob->tiley - player->tiley);\r
+               dist = dx>dy ? dx : dy;\r
+               if (!dist || (dist==1 && ob->distance<0x4000) )\r
+                       chance = 300;\r
+               else\r
+                       chance = (tics<<4)/dist;\r
+\r
+               if ( US_RndT()<chance)\r
+               {\r
+               //\r
+               // go into attack frame\r
+               //\r
+                       switch (ob->obclass)\r
+                       {\r
+                       case guardobj:\r
+                               NewState (ob,&s_grdshoot1);\r
+                               break;\r
+                       case officerobj:\r
+                               NewState (ob,&s_ofcshoot1);\r
+                               break;\r
+                       case mutantobj:\r
+                               NewState (ob,&s_mutshoot1);\r
+                               break;\r
+                       case ssobj:\r
+                               NewState (ob,&s_ssshoot1);\r
+                               break;\r
+#ifndef SPEAR\r
+                       case bossobj:\r
+                               NewState (ob,&s_bossshoot1);\r
+                               break;\r
+                       case gretelobj:\r
+                               NewState (ob,&s_gretelshoot1);\r
+                               break;\r
+                       case mechahitlerobj:\r
+                               NewState (ob,&s_mechashoot1);\r
+                               break;\r
+                       case realhitlerobj:\r
+                               NewState (ob,&s_hitlershoot1);\r
+                               break;\r
+#else\r
+                       case angelobj:\r
+                               NewState (ob,&s_angelshoot1);\r
+                               break;\r
+                       case transobj:\r
+                               NewState (ob,&s_transshoot1);\r
+                               break;\r
+                       case uberobj:\r
+                               NewState (ob,&s_ubershoot1);\r
+                               break;\r
+                       case willobj:\r
+                               NewState (ob,&s_willshoot1);\r
+                               break;\r
+                       case deathobj:\r
+                               NewState (ob,&s_deathshoot1);\r
+                               break;\r
+#endif\r
+                       }\r
+                       return;\r
+               }\r
+               dodge = true;\r
+       }\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (ob->distance < 0)\r
+               {\r
+               //\r
+               // waiting for a door to open\r
+               //\r
+                       OpenDoor (-ob->distance-1);\r
+                       if (doorobjlist[-ob->distance-1].action != dr_open)\r
+                               return;\r
+                       ob->distance = TILEGLOBAL;      // go ahead, the door is now opoen\r
+               }\r
+\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               //\r
+               // reached goal tile, so select another one\r
+               //\r
+\r
+               //\r
+               // fix position to account for round off during moving\r
+               //\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+\r
+               move -= ob->distance;\r
+\r
+               if (dodge)\r
+                       SelectDodgeDir (ob);\r
+               else\r
+                       SelectChaseDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= T_Ghosts\r
+=\r
+=================\r
+*/\r
+\r
+void T_Ghosts (objtype *ob)\r
+{\r
+       long move;\r
+\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               SelectChaseDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               //\r
+               // reached goal tile, so select another one\r
+               //\r
+\r
+               //\r
+               // fix position to account for round off during moving\r
+               //\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+\r
+               move -= ob->distance;\r
+\r
+               SelectChaseDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+}\r
+\r
+/*\r
+=================\r
+=\r
+= T_DogChase\r
+=\r
+=================\r
+*/\r
+\r
+void T_DogChase (objtype *ob)\r
+{\r
+       long    move;\r
+       int             dist,chance;\r
+       long    dx,dy;\r
+\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               SelectDodgeDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+       //\r
+       // check for byte range\r
+       //\r
+               dx = player->x - ob->x;\r
+               if (dx<0)\r
+                       dx = -dx;\r
+               dx -= move;\r
+               if (dx <= MINACTORDIST)\r
+               {\r
+                       dy = player->y - ob->y;\r
+                       if (dy<0)\r
+                               dy = -dy;\r
+                       dy -= move;\r
+                       if (dy <= MINACTORDIST)\r
+                       {\r
+                               NewState (ob,&s_dogjump1);\r
+                               return;\r
+                       }\r
+               }\r
+\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               //\r
+               // reached goal tile, so select another one\r
+               //\r
+\r
+               //\r
+               // fix position to account for round off during moving\r
+               //\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+\r
+               move -= ob->distance;\r
+\r
+               SelectDodgeDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                                 // object is blocked in\r
+       }\r
+\r
+}\r
+\r
+\r
+\r
+/*\r
+============================================================================\r
+\r
+                                                               PATH\r
+\r
+============================================================================\r
+*/\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SelectPathDir\r
+=\r
+===============\r
+*/\r
+\r
+void SelectPathDir (objtype *ob)\r
+{\r
+       unsigned spot;\r
+\r
+       spot = MAPSPOT(ob->tilex,ob->tiley,1)-ICONARROWS;\r
+\r
+       if (spot<8)\r
+       {\r
+       // new direction\r
+               ob->dir = spot;\r
+       }\r
+\r
+       ob->distance = TILEGLOBAL;\r
+\r
+       if (!TryWalk (ob))\r
+               ob->dir = nodir;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_Path\r
+=\r
+===============\r
+*/\r
+\r
+void T_Path (objtype *ob)\r
+{\r
+       long    move;\r
+       long    deltax,deltay,size;\r
+\r
+       if (SightPlayer (ob))\r
+               return;\r
+\r
+       if (ob->dir == nodir)\r
+       {\r
+               SelectPathDir (ob);\r
+               if (ob->dir == nodir)\r
+                       return;                                 // all movement is blocked\r
+       }\r
+\r
+\r
+       move = ob->speed*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (ob->distance < 0)\r
+               {\r
+               //\r
+               // waiting for a door to open\r
+               //\r
+                       OpenDoor (-ob->distance-1);\r
+                       if (doorobjlist[-ob->distance-1].action != dr_open)\r
+                               return;\r
+                       ob->distance = TILEGLOBAL;      // go ahead, the door is now opoen\r
+               }\r
+\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               if (ob->tilex>MAPSIZE || ob->tiley>MAPSIZE)\r
+               {\r
+                       sprintf (str,"T_Path hit a wall at %u,%u, dir %u"\r
+                       ,ob->tilex,ob->tiley,ob->dir);\r
+                       Quit (str);\r
+               }\r
+\r
+\r
+\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+               move -= ob->distance;\r
+\r
+               SelectPathDir (ob);\r
+\r
+               if (ob->dir == nodir)\r
+                       return;                                 // all movement is blocked\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                               FIGHT\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_Shoot\r
+=\r
+= Try to damage the player, based on skill level and player's speed\r
+=\r
+===============\r
+*/\r
+\r
+void T_Shoot (objtype *ob)\r
+{\r
+       int     dx,dy,dist;\r
+       int     hitchance,damage;\r
+\r
+       hitchance = 128;\r
+\r
+       if (!areabyplayer[ob->areanumber])\r
+               return;\r
+\r
+       if (!CheckLine (ob))                    // player is behind a wall\r
+         return;\r
+\r
+       dx = abs(ob->tilex - player->tilex);\r
+       dy = abs(ob->tiley - player->tiley);\r
+       dist = dx>dy ? dx:dy;\r
+\r
+       if (ob->obclass == ssobj || ob->obclass == bossobj)\r
+               dist = dist*2/3;                                        // ss are better shots\r
+\r
+       if (thrustspeed >= RUNSPEED)\r
+       {\r
+               if (ob->flags&FL_VISABLE)\r
+                       hitchance = 160-dist*16;                // player can see to dodge\r
+               else\r
+                       hitchance = 160-dist*8;\r
+       }\r
+       else\r
+       {\r
+               if (ob->flags&FL_VISABLE)\r
+                       hitchance = 256-dist*16;                // player can see to dodge\r
+               else\r
+                       hitchance = 256-dist*8;\r
+       }\r
+\r
+// see if the shot was a hit\r
+\r
+       if (US_RndT()<hitchance)\r
+       {\r
+               if (dist<2)\r
+                       damage = US_RndT()>>2;\r
+               else if (dist<4)\r
+                       damage = US_RndT()>>3;\r
+               else\r
+                       damage = US_RndT()>>4;\r
+\r
+               TakeDamage (damage,ob);\r
+       }\r
+\r
+       switch(ob->obclass)\r
+       {\r
+        case ssobj:\r
+          PlaySoundLocActor(SSFIRESND,ob);\r
+          break;\r
+#ifndef SPEAR\r
+        case giftobj:\r
+        case fatobj:\r
+          PlaySoundLocActor(MISSILEFIRESND,ob);\r
+          break;\r
+        case mechahitlerobj:\r
+        case realhitlerobj:\r
+        case bossobj:\r
+          PlaySoundLocActor(BOSSFIRESND,ob);\r
+          break;\r
+        case schabbobj:\r
+          PlaySoundLocActor(SCHABBSTHROWSND,ob);\r
+          break;\r
+        case fakeobj:\r
+          PlaySoundLocActor(FLAMETHROWERSND,ob);\r
+          break;\r
+#endif\r
+        default:\r
+          PlaySoundLocActor(NAZIFIRESND,ob);\r
+       }\r
+\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_Bite\r
+=\r
+===============\r
+*/\r
+\r
+void T_Bite (objtype *ob)\r
+{\r
+       long    dx,dy;\r
+       int     hitchance,damage;\r
+\r
+\r
+       PlaySoundLocActor(DOGATTACKSND,ob);     // JAB\r
+\r
+       dx = player->x - ob->x;\r
+       if (dx<0)\r
+               dx = -dx;\r
+       dx -= TILEGLOBAL;\r
+       if (dx <= MINACTORDIST)\r
+       {\r
+               dy = player->y - ob->y;\r
+               if (dy<0)\r
+                       dy = -dy;\r
+               dy -= TILEGLOBAL;\r
+               if (dy <= MINACTORDIST)\r
+               {\r
+                  if (US_RndT()<180)\r
+                  {\r
+                          TakeDamage (US_RndT()>>4,ob);\r
+                          return;\r
+                  }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+\r
+#ifndef SPEAR\r
+/*\r
+============================================================================\r
+\r
+                                                       BJ VICTORY\r
+\r
+============================================================================\r
+*/\r
+\r
+\r
+//\r
+// BJ victory\r
+//\r
+\r
+void T_BJRun (objtype *ob);\r
+void T_BJJump (objtype *ob);\r
+void T_BJDone (objtype *ob);\r
+void T_BJYell (objtype *ob);\r
+\r
+void T_DeathCam (objtype *ob);\r
+\r
+extern statetype s_bjrun1;\r
+extern statetype s_bjrun1s;\r
+extern statetype s_bjrun2;\r
+extern statetype s_bjrun3;\r
+extern statetype s_bjrun3s;\r
+extern statetype s_bjrun4;\r
+\r
+extern statetype s_bjjump1;\r
+extern statetype s_bjjump2;\r
+extern statetype s_bjjump3;\r
+extern statetype s_bjjump4;\r
+\r
+\r
+statetype s_bjrun1     = {false,SPR_BJ_W1,12,T_BJRun,NULL,&s_bjrun1s};\r
+statetype s_bjrun1s    = {false,SPR_BJ_W1,3, NULL,NULL,&s_bjrun2};\r
+statetype s_bjrun2     = {false,SPR_BJ_W2,8,T_BJRun,NULL,&s_bjrun3};\r
+statetype s_bjrun3     = {false,SPR_BJ_W3,12,T_BJRun,NULL,&s_bjrun3s};\r
+statetype s_bjrun3s    = {false,SPR_BJ_W3,3, NULL,NULL,&s_bjrun4};\r
+statetype s_bjrun4     = {false,SPR_BJ_W4,8,T_BJRun,NULL,&s_bjrun1};\r
+\r
+\r
+statetype s_bjjump1    = {false,SPR_BJ_JUMP1,14,T_BJJump,NULL,&s_bjjump2};\r
+statetype s_bjjump2    = {false,SPR_BJ_JUMP2,14,T_BJJump,T_BJYell,&s_bjjump3};\r
+statetype s_bjjump3    = {false,SPR_BJ_JUMP3,14,T_BJJump,NULL,&s_bjjump4};\r
+statetype s_bjjump4    = {false,SPR_BJ_JUMP4,300,NULL,T_BJDone,&s_bjjump4};\r
+\r
+\r
+statetype s_deathcam = {false,0,0,NULL,NULL,NULL};\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnBJVictory\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnBJVictory (void)\r
+{\r
+       unsigned        far *map,tile;\r
+\r
+       SpawnNewObj (player->tilex,player->tiley+1,&s_bjrun1);\r
+       new->x = player->x;\r
+       new->y = player->y;\r
+       new->obclass = bjobj;\r
+       new->dir = north;\r
+       new->temp1 = 6;                 // tiles to run forward\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_BJRun\r
+=\r
+===============\r
+*/\r
+\r
+void T_BJRun (objtype *ob)\r
+{\r
+       long    move;\r
+\r
+       move = BJRUNSPEED*tics;\r
+\r
+       while (move)\r
+       {\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+               move -= ob->distance;\r
+\r
+               SelectPathDir (ob);\r
+\r
+               if ( !(--ob->temp1) )\r
+               {\r
+                       NewState (ob,&s_bjjump1);\r
+                       return;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_BJJump\r
+=\r
+===============\r
+*/\r
+\r
+void T_BJJump (objtype *ob)\r
+{\r
+       long    move;\r
+\r
+       move = BJJUMPSPEED*tics;\r
+       MoveObj (ob,move);\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_BJYell\r
+=\r
+===============\r
+*/\r
+\r
+void T_BJYell (objtype *ob)\r
+{\r
+       PlaySoundLocActor(YEAHSND,ob);  // JAB\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_BJDone\r
+=\r
+===============\r
+*/\r
+\r
+#pragma argsused\r
+void T_BJDone (objtype *ob)\r
+{\r
+       playstate = ex_victorious;                              // exit castle tile\r
+}\r
+\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= CheckPosition\r
+=\r
+===============\r
+*/\r
+\r
+boolean        CheckPosition (objtype *ob)\r
+{\r
+       int     x,y,xl,yl,xh,yh;\r
+       objtype *check;\r
+\r
+       xl = (ob->x-PLAYERSIZE) >>TILESHIFT;\r
+       yl = (ob->y-PLAYERSIZE) >>TILESHIFT;\r
+\r
+       xh = (ob->x+PLAYERSIZE) >>TILESHIFT;\r
+       yh = (ob->y+PLAYERSIZE) >>TILESHIFT;\r
+\r
+       //\r
+       // check for solid walls\r
+       //\r
+       for (y=yl;y<=yh;y++)\r
+               for (x=xl;x<=xh;x++)\r
+               {\r
+                       check = actorat[x][y];\r
+                       if (check && check<objlist)\r
+                               return false;\r
+               }\r
+\r
+       return true;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= A_StartDeathCam\r
+=\r
+===============\r
+*/\r
+\r
+void   A_StartDeathCam (objtype *ob)\r
+{\r
+       long    dx,dy;\r
+       float   fangle;\r
+       long    xmove,ymove;\r
+       long    dist;\r
+       int             temp,i;\r
+\r
+       FinishPaletteShifts ();\r
+\r
+       VW_WaitVBL (100);\r
+\r
+       if (gamestate.victoryflag)\r
+       {\r
+               playstate = ex_victorious;                              // exit castle tile\r
+               return;\r
+       }\r
+\r
+       gamestate.victoryflag = true;\r
+       VW_Bar (0,0,320,200-STATUSLINES,127);\r
+       FizzleFade(bufferofs,displayofs,320,200-STATUSLINES,70,false);\r
+\r
+       PM_UnlockMainMem ();\r
+       CA_UpLevel ();\r
+       CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END);\r
+       #ifdef JAPAN\r
+       #ifndef JAPDEMO\r
+       CA_CacheScreen(C_LETSSEEPIC);\r
+       #endif\r
+       #else\r
+       Write(0,7,STR_SEEAGAIN);\r
+       #endif\r
+       CA_DownLevel ();\r
+       PM_CheckMainMem ();\r
+\r
+       VW_UpdateScreen ();\r
+\r
+       IN_UserInput(300);\r
+\r
+//\r
+// line angle up exactly\r
+//\r
+       NewState (player,&s_deathcam);\r
+\r
+       player->x = gamestate.killx;\r
+       player->y = gamestate.killy;\r
+\r
+       dx = ob->x - player->x;\r
+       dy = player->y - ob->y;\r
+\r
+       fangle = atan2(dy,dx);                  // returns -pi to pi\r
+       if (fangle<0)\r
+               fangle = M_PI*2+fangle;\r
+\r
+       player->angle = fangle/(M_PI*2)*ANGLES;\r
+\r
+//\r
+// try to position as close as possible without being in a wall\r
+//\r
+       dist = 0x14000l;\r
+       do\r
+       {\r
+               xmove = FixedByFrac(dist,costable[player->angle]);\r
+               ymove = -FixedByFrac(dist,sintable[player->angle]);\r
+\r
+               player->x = ob->x - xmove;\r
+               player->y = ob->y - ymove;\r
+               dist += 0x1000;\r
+\r
+       } while (!CheckPosition (player));\r
+       plux = player->x >> UNSIGNEDSHIFT;                      // scale to fit in unsigned\r
+       pluy = player->y >> UNSIGNEDSHIFT;\r
+       player->tilex = player->x >> TILESHIFT;         // scale to tile values\r
+       player->tiley = player->y >> TILESHIFT;\r
+\r
+//\r
+// go back to the game\r
+//\r
+       temp = bufferofs;\r
+       for (i=0;i<3;i++)\r
+       {\r
+               bufferofs = screenloc[i];\r
+               DrawPlayBorder ();\r
+       }\r
+       bufferofs = temp;\r
+\r
+       fizzlein = true;\r
+       switch (ob->obclass)\r
+       {\r
+#ifndef SPEAR\r
+       case schabbobj:\r
+               NewState (ob,&s_schabbdeathcam);\r
+               break;\r
+       case realhitlerobj:\r
+               NewState (ob,&s_hitlerdeathcam);\r
+               break;\r
+       case giftobj:\r
+               NewState (ob,&s_giftdeathcam);\r
+               break;\r
+       case fatobj:\r
+               NewState (ob,&s_fatdeathcam);\r
+               break;\r
+#endif\r
+       }\r
+\r
+}\r
+\r
+#endif\r
diff --git a/16/wf3d8086/wl_agent.c b/16/wf3d8086/wl_agent.c
new file mode 100755 (executable)
index 0000000..631478d
--- /dev/null
@@ -0,0 +1,1421 @@
+// WL_AGENT.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define MAXMOUSETURN   10\r
+\r
+\r
+#define MOVESCALE              150l\r
+#define BACKMOVESCALE  100l\r
+#define ANGLESCALE             20\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+//\r
+// player state info\r
+//\r
+boolean                running;\r
+long           thrustspeed;\r
+\r
+unsigned       plux,pluy;                      // player coordinates scaled to unsigned\r
+\r
+int                    anglefrac;\r
+int                    gotgatgun;      // JR\r
+\r
+objtype                *LastAttacker;\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+void   T_Player (objtype *ob);\r
+void   T_Attack (objtype *ob);\r
+\r
+statetype s_player = {false,0,0,T_Player,NULL,NULL};\r
+statetype s_attack = {false,0,0,T_Attack,NULL,NULL};\r
+\r
+\r
+long   playerxmove,playerymove;\r
+\r
+struct atkinf\r
+{\r
+       char    tics,attack,frame;              // attack is 1 for gun, 2 for knife\r
+} attackinfo[4][14] =\r
+\r
+{\r
+{ {6,0,1},{6,2,2},{6,0,3},{6,-1,4} },\r
+{ {6,0,1},{6,1,2},{6,0,3},{6,-1,4} },\r
+{ {6,0,1},{6,1,2},{6,3,3},{6,-1,4} },\r
+{ {6,0,1},{6,1,2},{6,4,3},{6,-1,4} },\r
+};\r
+\r
+\r
+int    strafeangle[9] = {0,90,180,270,45,135,225,315,0};\r
+\r
+void DrawWeapon (void);\r
+void GiveWeapon (int weapon);\r
+void   GiveAmmo (int ammo);\r
+\r
+//===========================================================================\r
+\r
+//----------\r
+\r
+void Attack (void);\r
+void Use (void);\r
+void Search (objtype *ob);\r
+void SelectWeapon (void);\r
+void SelectItem (void);\r
+\r
+//----------\r
+\r
+boolean TryMove (objtype *ob);\r
+void T_Player (objtype *ob);\r
+\r
+void ClipMove (objtype *ob, long xmove, long ymove);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               CONTROL STUFF\r
+\r
+=============================================================================\r
+*/\r
+\r
+/*\r
+======================\r
+=\r
+= CheckWeaponChange\r
+=\r
+= Keys 1-4 change weapons\r
+=\r
+======================\r
+*/\r
+\r
+void CheckWeaponChange (void)\r
+{\r
+       int     i,buttons;\r
+\r
+       if (!gamestate.ammo)            // must use knife with no ammo\r
+               return;\r
+\r
+       for (i=wp_knife ; i<=gamestate.bestweapon ; i++)\r
+               if (buttonstate[bt_readyknife+i-wp_knife])\r
+               {\r
+                       gamestate.weapon = gamestate.chosenweapon = i;\r
+                       DrawWeapon ();\r
+                       return;\r
+               }\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= ControlMovement\r
+=\r
+= Takes controlx,controly, and buttonstate[bt_strafe]\r
+=\r
+= Changes the player's angle and position\r
+=\r
+= There is an angle hack because when going 70 fps, the roundoff becomes\r
+= significant\r
+=\r
+=======================\r
+*/\r
+\r
+void ControlMovement (objtype *ob)\r
+{\r
+       long    oldx,oldy;\r
+       int             angle,maxxmove;\r
+       int             angleunits;\r
+       long    speed;\r
+\r
+       thrustspeed = 0;\r
+\r
+       oldx = player->x;\r
+       oldy = player->y;\r
+\r
+//\r
+// side to side move\r
+//\r
+       if (buttonstate[bt_strafe])\r
+       {\r
+       //\r
+       // strafing\r
+       //\r
+       //\r
+               if (controlx > 0)\r
+               {\r
+                       angle = ob->angle - ANGLES/4;\r
+                       if (angle < 0)\r
+                               angle += ANGLES;\r
+                       Thrust (angle,controlx*MOVESCALE);      // move to left\r
+               }\r
+               else if (controlx < 0)\r
+               {\r
+                       angle = ob->angle + ANGLES/4;\r
+                       if (angle >= ANGLES)\r
+                               angle -= ANGLES;\r
+                       Thrust (angle,-controlx*MOVESCALE);     // move to right\r
+               }\r
+       }\r
+       else\r
+       {\r
+       //\r
+       // not strafing\r
+       //\r
+               anglefrac += controlx;\r
+               angleunits = anglefrac/ANGLESCALE;\r
+               anglefrac -= angleunits*ANGLESCALE;\r
+               ob->angle -= angleunits;\r
+\r
+               if (ob->angle >= ANGLES)\r
+                       ob->angle -= ANGLES;\r
+               if (ob->angle < 0)\r
+                       ob->angle += ANGLES;\r
+\r
+       }\r
+\r
+//\r
+// forward/backwards move\r
+//\r
+       if (controly < 0)\r
+       {\r
+               Thrust (ob->angle,-controly*MOVESCALE); // move forwards\r
+       }\r
+       else if (controly > 0)\r
+       {\r
+               angle = ob->angle + ANGLES/2;\r
+               if (angle >= ANGLES)\r
+                       angle -= ANGLES;\r
+               Thrust (angle,controly*BACKMOVESCALE);          // move backwards\r
+       }\r
+\r
+       if (gamestate.victoryflag)              // watching the BJ actor\r
+               return;\r
+\r
+//\r
+// calculate total move\r
+//\r
+       playerxmove = player->x - oldx;\r
+       playerymove = player->y - oldy;\r
+}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       STATUS WINDOW STUFF\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= StatusDrawPic\r
+=\r
+==================\r
+*/\r
+\r
+void StatusDrawPic (unsigned x, unsigned y, unsigned picnum)\r
+{\r
+       unsigned        temp;\r
+\r
+       temp = bufferofs;\r
+       bufferofs = 0;\r
+\r
+       bufferofs = PAGE1START+(200-STATUSLINES)*SCREENWIDTH;\r
+       LatchDrawPic (x,y,picnum);\r
+       bufferofs = PAGE2START+(200-STATUSLINES)*SCREENWIDTH;\r
+       LatchDrawPic (x,y,picnum);\r
+       bufferofs = PAGE3START+(200-STATUSLINES)*SCREENWIDTH;\r
+       LatchDrawPic (x,y,picnum);\r
+\r
+       bufferofs = temp;\r
+}\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= DrawFace\r
+=\r
+==================\r
+*/\r
+\r
+void DrawFace (void)\r
+{\r
+       if (gamestate.health)\r
+       {\r
+               #ifdef SPEAR\r
+               if (godmode)\r
+                       StatusDrawPic (17,4,GODMODEFACE1PIC+gamestate.faceframe);\r
+               else\r
+               #endif\r
+               StatusDrawPic (17,4,FACE1APIC+3*((100-gamestate.health)/16)+gamestate.faceframe);\r
+       }\r
+       else\r
+       {\r
+#ifndef SPEAR\r
+        if (LastAttacker->obclass == needleobj)\r
+          StatusDrawPic (17,4,MUTANTBJPIC);\r
+        else\r
+#endif\r
+          StatusDrawPic (17,4,FACE8APIC);\r
+       }\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= UpdateFace\r
+=\r
+= Calls draw face if time to change\r
+=\r
+===============\r
+*/\r
+\r
+#define FACETICS       70\r
+\r
+int    facecount;\r
+\r
+void   UpdateFace (void)\r
+{\r
+\r
+       if (SD_SoundPlaying() == GETGATLINGSND)\r
+         return;\r
+\r
+       facecount += tics;\r
+       if (facecount > US_RndT())\r
+       {\r
+               gamestate.faceframe = (US_RndT()>>6);\r
+               if (gamestate.faceframe==3)\r
+                       gamestate.faceframe = 1;\r
+\r
+               facecount = 0;\r
+               DrawFace ();\r
+       }\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= LatchNumber\r
+=\r
+= right justifies and pads with blanks\r
+=\r
+===============\r
+*/\r
+\r
+void   LatchNumber (int x, int y, int width, long number)\r
+{\r
+       unsigned        length,c;\r
+       char    str[20];\r
+\r
+       ltoa (number,str,10);\r
+\r
+       length = strlen (str);\r
+\r
+       while (length<width)\r
+       {\r
+               StatusDrawPic (x,y,N_BLANKPIC);\r
+               x++;\r
+               width--;\r
+       }\r
+\r
+       c= length <= width ? 0 : length-width;\r
+\r
+       while (c<length)\r
+       {\r
+               StatusDrawPic (x,y,str[c]-'0'+ N_0PIC);\r
+               x++;\r
+               c++;\r
+       }\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= DrawHealth\r
+=\r
+===============\r
+*/\r
+\r
+void   DrawHealth (void)\r
+{\r
+       LatchNumber (21,16,3,gamestate.health);\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= TakeDamage\r
+=\r
+===============\r
+*/\r
+\r
+void   TakeDamage (int points,objtype *attacker)\r
+{\r
+       LastAttacker = attacker;\r
+\r
+       if (gamestate.victoryflag)\r
+               return;\r
+       if (gamestate.difficulty==gd_baby)\r
+         points>>=2;\r
+\r
+       if (!godmode)\r
+               gamestate.health -= points;\r
+\r
+       if (gamestate.health<=0)\r
+       {\r
+               gamestate.health = 0;\r
+               playstate = ex_died;\r
+               killerobj = attacker;\r
+       }\r
+\r
+       StartDamageFlash (points);\r
+\r
+       gotgatgun=0;\r
+\r
+       DrawHealth ();\r
+       DrawFace ();\r
+\r
+       //\r
+       // MAKE BJ'S EYES BUG IF MAJOR DAMAGE!\r
+       //\r
+       #ifdef SPEAR\r
+       if (points > 30 && gamestate.health!=0 && !godmode)\r
+       {\r
+               StatusDrawPic (17,4,BJOUCHPIC);\r
+               facecount = 0;\r
+       }\r
+       #endif\r
+\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= HealSelf\r
+=\r
+===============\r
+*/\r
+\r
+void   HealSelf (int points)\r
+{\r
+       gamestate.health += points;\r
+       if (gamestate.health>100)\r
+               gamestate.health = 100;\r
+\r
+       DrawHealth ();\r
+       gotgatgun = 0;  // JR\r
+       DrawFace ();\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= DrawLevel\r
+=\r
+===============\r
+*/\r
+\r
+void   DrawLevel (void)\r
+{\r
+#ifdef SPEAR\r
+       if (gamestate.mapon == 20)\r
+               LatchNumber (2,16,2,18);\r
+       else\r
+#endif\r
+       LatchNumber (2,16,2,gamestate.mapon+1);\r
+}\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= DrawLives\r
+=\r
+===============\r
+*/\r
+\r
+void   DrawLives (void)\r
+{\r
+       LatchNumber (14,16,1,gamestate.lives);\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= GiveExtraMan\r
+=\r
+===============\r
+*/\r
+\r
+void   GiveExtraMan (void)\r
+{\r
+       if (gamestate.lives<9)\r
+               gamestate.lives++;\r
+       DrawLives ();\r
+       SD_PlaySound (BONUS1UPSND);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===============\r
+=\r
+= DrawScore\r
+=\r
+===============\r
+*/\r
+\r
+void   DrawScore (void)\r
+{\r
+       LatchNumber (6,16,6,gamestate.score);\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= GivePoints\r
+=\r
+===============\r
+*/\r
+\r
+void   GivePoints (long points)\r
+{\r
+       gamestate.score += points;\r
+       while (gamestate.score >= gamestate.nextextra)\r
+       {\r
+               gamestate.nextextra += EXTRAPOINTS;\r
+               GiveExtraMan ();\r
+       }\r
+       DrawScore ();\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= DrawWeapon\r
+=\r
+==================\r
+*/\r
+\r
+void DrawWeapon (void)\r
+{\r
+       StatusDrawPic (32,8,KNIFEPIC+gamestate.weapon);\r
+}\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= DrawKeys\r
+=\r
+==================\r
+*/\r
+\r
+void DrawKeys (void)\r
+{\r
+       if (gamestate.keys & 1)\r
+               StatusDrawPic (30,4,GOLDKEYPIC);\r
+       else\r
+               StatusDrawPic (30,4,NOKEYPIC);\r
+\r
+       if (gamestate.keys & 2)\r
+               StatusDrawPic (30,20,SILVERKEYPIC);\r
+       else\r
+               StatusDrawPic (30,20,NOKEYPIC);\r
+}\r
+\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= GiveWeapon\r
+=\r
+==================\r
+*/\r
+\r
+void GiveWeapon (int weapon)\r
+{\r
+       GiveAmmo (6);\r
+\r
+       if (gamestate.bestweapon<weapon)\r
+               gamestate.bestweapon = gamestate.weapon\r
+               = gamestate.chosenweapon = weapon;\r
+\r
+       DrawWeapon ();\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===============\r
+=\r
+= DrawAmmo\r
+=\r
+===============\r
+*/\r
+\r
+void   DrawAmmo (void)\r
+{\r
+       LatchNumber (27,16,2,gamestate.ammo);\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= GiveAmmo\r
+=\r
+===============\r
+*/\r
+\r
+void   GiveAmmo (int ammo)\r
+{\r
+       if (!gamestate.ammo)                            // knife was out\r
+       {\r
+               if (!gamestate.attackframe)\r
+               {\r
+                       gamestate.weapon = gamestate.chosenweapon;\r
+                       DrawWeapon ();\r
+               }\r
+       }\r
+       gamestate.ammo += ammo;\r
+       if (gamestate.ammo > 99)\r
+               gamestate.ammo = 99;\r
+       DrawAmmo ();\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= GiveKey\r
+=\r
+==================\r
+*/\r
+\r
+void GiveKey (int key)\r
+{\r
+       gamestate.keys |= (1<<key);\r
+       DrawKeys ();\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       MOVEMENT\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= GetBonus\r
+=\r
+===================\r
+*/\r
+void GetBonus (statobj_t *check)\r
+{\r
+       switch (check->itemnumber)\r
+       {\r
+       case    bo_firstaid:\r
+               if (gamestate.health == 100)\r
+                       return;\r
+\r
+               SD_PlaySound (HEALTH2SND);\r
+               HealSelf (25);\r
+               break;\r
+\r
+       case    bo_key1:\r
+       case    bo_key2:\r
+       case    bo_key3:\r
+       case    bo_key4:\r
+               GiveKey (check->itemnumber - bo_key1);\r
+               SD_PlaySound (GETKEYSND);\r
+               break;\r
+\r
+       case    bo_cross:\r
+               SD_PlaySound (BONUS1SND);\r
+               GivePoints (100);\r
+               gamestate.treasurecount++;\r
+               break;\r
+       case    bo_chalice:\r
+               SD_PlaySound (BONUS2SND);\r
+               GivePoints (500);\r
+               gamestate.treasurecount++;\r
+               break;\r
+       case    bo_bible:\r
+               SD_PlaySound (BONUS3SND);\r
+               GivePoints (1000);\r
+               gamestate.treasurecount++;\r
+               break;\r
+       case    bo_crown:\r
+               SD_PlaySound (BONUS4SND);\r
+               GivePoints (5000);\r
+               gamestate.treasurecount++;\r
+               break;\r
+\r
+       case    bo_clip:\r
+               if (gamestate.ammo == 99)\r
+                       return;\r
+\r
+               SD_PlaySound (GETAMMOSND);\r
+               GiveAmmo (8);\r
+               break;\r
+       case    bo_clip2:\r
+               if (gamestate.ammo == 99)\r
+                       return;\r
+\r
+               SD_PlaySound (GETAMMOSND);\r
+               GiveAmmo (4);\r
+               break;\r
+\r
+#ifdef SPEAR\r
+       case    bo_25clip:\r
+               if (gamestate.ammo == 99)\r
+                 return;\r
+\r
+               SD_PlaySound (GETAMMOBOXSND);\r
+               GiveAmmo (25);\r
+               break;\r
+#endif\r
+\r
+       case    bo_machinegun:\r
+               SD_PlaySound (GETMACHINESND);\r
+               GiveWeapon (wp_machinegun);\r
+               break;\r
+       case    bo_chaingun:\r
+               SD_PlaySound (GETGATLINGSND);\r
+               GiveWeapon (wp_chaingun);\r
+\r
+               StatusDrawPic (17,4,GOTGATLINGPIC);\r
+               facecount = 0;\r
+               gotgatgun = 1;\r
+               break;\r
+\r
+       case    bo_fullheal:\r
+               SD_PlaySound (BONUS1UPSND);\r
+               HealSelf (99);\r
+               GiveAmmo (25);\r
+               GiveExtraMan ();\r
+               gamestate.treasurecount++;\r
+               break;\r
+\r
+       case    bo_food:\r
+               if (gamestate.health == 100)\r
+                       return;\r
+\r
+               SD_PlaySound (HEALTH1SND);\r
+               HealSelf (10);\r
+               break;\r
+\r
+       case    bo_alpo:\r
+               if (gamestate.health == 100)\r
+                       return;\r
+\r
+               SD_PlaySound (HEALTH1SND);\r
+               HealSelf (4);\r
+               break;\r
+\r
+       case    bo_gibs:\r
+               if (gamestate.health >10)\r
+                       return;\r
+\r
+               SD_PlaySound (SLURPIESND);\r
+               HealSelf (1);\r
+               break;\r
+\r
+       case    bo_spear:\r
+               spearflag = true;\r
+               spearx = player->x;\r
+               speary = player->y;\r
+               spearangle = player->angle;\r
+               playstate = ex_completed;\r
+       }\r
+\r
+       StartBonusFlash ();\r
+       check->shapenum = -1;                   // remove from list\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= TryMove\r
+=\r
+= returns true if move ok\r
+= debug: use pointers to optimize\r
+===================\r
+*/\r
+\r
+boolean TryMove (objtype *ob)\r
+{\r
+       int                     xl,yl,xh,yh,x,y;\r
+       objtype         *check;\r
+       long            deltax,deltay;\r
+\r
+       xl = (ob->x-PLAYERSIZE) >>TILESHIFT;\r
+       yl = (ob->y-PLAYERSIZE) >>TILESHIFT;\r
+\r
+       xh = (ob->x+PLAYERSIZE) >>TILESHIFT;\r
+       yh = (ob->y+PLAYERSIZE) >>TILESHIFT;\r
+\r
+//\r
+// check for solid walls\r
+//\r
+       for (y=yl;y<=yh;y++)\r
+               for (x=xl;x<=xh;x++)\r
+               {\r
+                       check = actorat[x][y];\r
+                       if (check && check<objlist)\r
+                               return false;\r
+               }\r
+\r
+//\r
+// check for actors\r
+//\r
+       if (yl>0)\r
+               yl--;\r
+       if (yh<MAPSIZE-1)\r
+               yh++;\r
+       if (xl>0)\r
+               xl--;\r
+       if (xh<MAPSIZE-1)\r
+               xh++;\r
+\r
+       for (y=yl;y<=yh;y++)\r
+               for (x=xl;x<=xh;x++)\r
+               {\r
+                       check = actorat[x][y];\r
+                       if (check > objlist\r
+                       && (check->flags & FL_SHOOTABLE) )\r
+                       {\r
+                               deltax = ob->x - check->x;\r
+                               if (deltax < -MINACTORDIST || deltax > MINACTORDIST)\r
+                                       continue;\r
+                               deltay = ob->y - check->y;\r
+                               if (deltay < -MINACTORDIST || deltay > MINACTORDIST)\r
+                                       continue;\r
+\r
+                               return false;\r
+                       }\r
+               }\r
+\r
+       return true;\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= ClipMove\r
+=\r
+===================\r
+*/\r
+\r
+void ClipMove (objtype *ob, long xmove, long ymove)\r
+{\r
+       long    basex,basey;\r
+\r
+       basex = ob->x;\r
+       basey = ob->y;\r
+\r
+       ob->x = basex+xmove;\r
+       ob->y = basey+ymove;\r
+       if (TryMove (ob))\r
+               return;\r
+\r
+       if (noclip && ob->x > 2*TILEGLOBAL && ob->y > 2*TILEGLOBAL &&\r
+       ob->x < (((long)(mapwidth-1))<<TILESHIFT)\r
+       && ob->y < (((long)(mapheight-1))<<TILESHIFT) )\r
+               return;         // walk through walls\r
+\r
+       if (!SD_SoundPlaying())\r
+               SD_PlaySound (HITWALLSND);\r
+\r
+       ob->x = basex+xmove;\r
+       ob->y = basey;\r
+       if (TryMove (ob))\r
+               return;\r
+\r
+       ob->x = basex;\r
+       ob->y = basey+ymove;\r
+       if (TryMove (ob))\r
+               return;\r
+\r
+       ob->x = basex;\r
+       ob->y = basey;\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= VictoryTile\r
+=\r
+===================\r
+*/\r
+\r
+void VictoryTile (void)\r
+{\r
+#ifndef SPEAR\r
+       SpawnBJVictory ();\r
+#endif\r
+\r
+       gamestate.victoryflag = true;\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= Thrust\r
+=\r
+===================\r
+*/\r
+\r
+void Thrust (int angle, long speed)\r
+{\r
+       long xmove,ymove;\r
+       long    slowmax;\r
+       unsigned        offset;\r
+\r
+\r
+       //\r
+       // ZERO FUNNY COUNTER IF MOVED!\r
+       //\r
+       #ifdef SPEAR\r
+       if (speed)\r
+               funnyticount = 0;\r
+       #endif\r
+\r
+       thrustspeed += speed;\r
+//\r
+// moving bounds speed\r
+//\r
+       if (speed >= MINDIST*2)\r
+               speed = MINDIST*2-1;\r
+\r
+       xmove = FixedByFrac(speed,costable[angle]);\r
+       ymove = -FixedByFrac(speed,sintable[angle]);\r
+\r
+       ClipMove(player,xmove,ymove);\r
+\r
+       player->tilex = player->x >> TILESHIFT;         // scale to tile values\r
+       player->tiley = player->y >> TILESHIFT;\r
+\r
+       offset = farmapylookup[player->tiley]+player->tilex;\r
+       player->areanumber = *(mapsegs[0] + offset) -AREATILE;\r
+\r
+       if (*(mapsegs[1] + offset) == EXITTILE)\r
+               VictoryTile ();\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                               ACTIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= Cmd_Fire\r
+=\r
+===============\r
+*/\r
+\r
+void Cmd_Fire (void)\r
+{\r
+       buttonheld[bt_attack] = true;\r
+\r
+       gamestate.weaponframe = 0;\r
+\r
+       player->state = &s_attack;\r
+\r
+       gamestate.attackframe = 0;\r
+       gamestate.attackcount =\r
+               attackinfo[gamestate.weapon][gamestate.attackframe].tics;\r
+       gamestate.weaponframe =\r
+               attackinfo[gamestate.weapon][gamestate.attackframe].frame;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===============\r
+=\r
+= Cmd_Use\r
+=\r
+===============\r
+*/\r
+\r
+void Cmd_Use (void)\r
+{\r
+       objtype         *check;\r
+       int                     checkx,checky,doornum,dir;\r
+       boolean         elevatorok;\r
+\r
+\r
+//\r
+// find which cardinal direction the player is facing\r
+//\r
+       if (player->angle < ANGLES/8 || player->angle > 7*ANGLES/8)\r
+       {\r
+               checkx = player->tilex + 1;\r
+               checky = player->tiley;\r
+               dir = di_east;\r
+               elevatorok = true;\r
+       }\r
+       else if (player->angle < 3*ANGLES/8)\r
+       {\r
+               checkx = player->tilex;\r
+               checky = player->tiley-1;\r
+               dir = di_north;\r
+               elevatorok = false;\r
+       }\r
+       else if (player->angle < 5*ANGLES/8)\r
+       {\r
+               checkx = player->tilex - 1;\r
+               checky = player->tiley;\r
+               dir = di_west;\r
+               elevatorok = true;\r
+       }\r
+       else\r
+       {\r
+               checkx = player->tilex;\r
+               checky = player->tiley + 1;\r
+               dir = di_south;\r
+               elevatorok = false;\r
+       }\r
+\r
+       doornum = tilemap[checkx][checky];\r
+       if (*(mapsegs[1]+farmapylookup[checky]+checkx) == PUSHABLETILE)\r
+       {\r
+       //\r
+       // pushable wall\r
+       //\r
+\r
+               PushWall (checkx,checky,dir);\r
+               return;\r
+       }\r
+       if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)\r
+       {\r
+       //\r
+       // use elevator\r
+       //\r
+               buttonheld[bt_use] = true;\r
+\r
+               tilemap[checkx][checky]++;              // flip switch\r
+               if (*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) == ALTELEVATORTILE)\r
+                       playstate = ex_secretlevel;\r
+               else\r
+                       playstate = ex_completed;\r
+               SD_PlaySound (LEVELDONESND);\r
+               SD_WaitSoundDone();\r
+       }\r
+       else if (!buttonheld[bt_use] && doornum & 0x80)\r
+       {\r
+               buttonheld[bt_use] = true;\r
+               OperateDoor (doornum & ~0x80);\r
+       }\r
+       else\r
+               SD_PlaySound (DONOTHINGSND);\r
+\r
+}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                  PLAYER CONTROL\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnPlayer\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnPlayer (int tilex, int tiley, int dir)\r
+{\r
+       player->obclass = playerobj;\r
+       player->active = true;\r
+       player->tilex = tilex;\r
+       player->tiley = tiley;\r
+       player->areanumber =\r
+               *(mapsegs[0] + farmapylookup[player->tiley]+player->tilex);\r
+       player->x = ((long)tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+       player->y = ((long)tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+       player->state = &s_player;\r
+       player->angle = (1-dir)*90;\r
+       if (player->angle<0)\r
+               player->angle += ANGLES;\r
+       player->flags = FL_NEVERMARK;\r
+       Thrust (0,0);                           // set some variables\r
+\r
+       InitAreas ();\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===============\r
+=\r
+= T_KnifeAttack\r
+=\r
+= Update player hands, and try to do damage when the proper frame is reached\r
+=\r
+===============\r
+*/\r
+\r
+void   KnifeAttack (objtype *ob)\r
+{\r
+       objtype *check,*closest;\r
+       long    dist;\r
+\r
+       SD_PlaySound (ATKKNIFESND);\r
+// actually fire\r
+       dist = 0x7fffffff;\r
+       closest = NULL;\r
+       for (check=ob->next ; check ; check=check->next)\r
+               if ( (check->flags & FL_SHOOTABLE)\r
+               && (check->flags & FL_VISABLE)\r
+               && abs (check->viewx-centerx) < shootdelta\r
+               )\r
+               {\r
+                       if (check->transx < dist)\r
+                       {\r
+                               dist = check->transx;\r
+                               closest = check;\r
+                       }\r
+               }\r
+\r
+       if (!closest || dist> 0x18000l)\r
+       {\r
+       // missed\r
+\r
+               return;\r
+       }\r
+\r
+// hit something\r
+       DamageActor (closest,US_RndT() >> 4);\r
+}\r
+\r
+\r
+\r
+void   GunAttack (objtype *ob)\r
+{\r
+       objtype *check,*closest,*oldclosest;\r
+       int             damage;\r
+       int             dx,dy,dist;\r
+       long    viewdist;\r
+\r
+       switch (gamestate.weapon)\r
+       {\r
+       case wp_pistol:\r
+               SD_PlaySound (ATKPISTOLSND);\r
+               break;\r
+       case wp_machinegun:\r
+               SD_PlaySound (ATKMACHINEGUNSND);\r
+               break;\r
+       case wp_chaingun:\r
+               SD_PlaySound (ATKGATLINGSND);\r
+               break;\r
+       }\r
+\r
+       madenoise = true;\r
+\r
+//\r
+// find potential targets\r
+//\r
+       viewdist = 0x7fffffffl;\r
+       closest = NULL;\r
+\r
+       while (1)\r
+       {\r
+               oldclosest = closest;\r
+\r
+               for (check=ob->next ; check ; check=check->next)\r
+                       if ( (check->flags & FL_SHOOTABLE)\r
+                       && (check->flags & FL_VISABLE)\r
+                       && abs (check->viewx-centerx) < shootdelta\r
+                       )\r
+                       {\r
+                               if (check->transx < viewdist)\r
+                               {\r
+                                       viewdist = check->transx;\r
+                                       closest = check;\r
+                               }\r
+                       }\r
+\r
+               if (closest == oldclosest)\r
+                       return;                                         // no more targets, all missed\r
+\r
+       //\r
+       // trace a line from player to enemey\r
+       //\r
+               if (CheckLine(closest))\r
+                       break;\r
+\r
+       }\r
+\r
+//\r
+// hit something\r
+//\r
+       dx = abs(closest->tilex - player->tilex);\r
+       dy = abs(closest->tiley - player->tiley);\r
+       dist = dx>dy ? dx:dy;\r
+\r
+       if (dist<2)\r
+               damage = US_RndT() / 4;\r
+       else if (dist<4)\r
+               damage = US_RndT() / 6;\r
+       else\r
+       {\r
+               if ( (US_RndT() / 12) < dist)           // missed\r
+                       return;\r
+               damage = US_RndT() / 6;\r
+       }\r
+\r
+       DamageActor (closest,damage);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===============\r
+=\r
+= VictorySpin\r
+=\r
+===============\r
+*/\r
+\r
+void VictorySpin (void)\r
+{\r
+       long    desty;\r
+\r
+       if (player->angle > 270)\r
+       {\r
+               player->angle -= tics * 3;\r
+               if (player->angle < 270)\r
+                       player->angle = 270;\r
+       }\r
+       else if (player->angle < 270)\r
+       {\r
+               player->angle += tics * 3;\r
+               if (player->angle > 270)\r
+                       player->angle = 270;\r
+       }\r
+\r
+       desty = (((long)player->tiley-5)<<TILESHIFT)-0x3000;\r
+\r
+       if (player->y > desty)\r
+       {\r
+               player->y -= tics*4096;\r
+               if (player->y < desty)\r
+                       player->y = desty;\r
+       }\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===============\r
+=\r
+= T_Attack\r
+=\r
+===============\r
+*/\r
+\r
+void   T_Attack (objtype *ob)\r
+{\r
+       struct  atkinf  *cur;\r
+\r
+       UpdateFace ();\r
+\r
+       if (gamestate.victoryflag)              // watching the BJ actor\r
+       {\r
+               VictorySpin ();\r
+               return;\r
+       }\r
+\r
+       if ( buttonstate[bt_use] && !buttonheld[bt_use] )\r
+               buttonstate[bt_use] = false;\r
+\r
+       if ( buttonstate[bt_attack] && !buttonheld[bt_attack])\r
+               buttonstate[bt_attack] = false;\r
+\r
+       ControlMovement (ob);\r
+       if (gamestate.victoryflag)              // watching the BJ actor\r
+               return;\r
+\r
+       plux = player->x >> UNSIGNEDSHIFT;                      // scale to fit in unsigned\r
+       pluy = player->y >> UNSIGNEDSHIFT;\r
+       player->tilex = player->x >> TILESHIFT;         // scale to tile values\r
+       player->tiley = player->y >> TILESHIFT;\r
+\r
+//\r
+// change frame and fire\r
+//\r
+       gamestate.attackcount -= tics;\r
+       while (gamestate.attackcount <= 0)\r
+       {\r
+               cur = &attackinfo[gamestate.weapon][gamestate.attackframe];\r
+               switch (cur->attack)\r
+               {\r
+               case -1:\r
+                       ob->state = &s_player;\r
+                       if (!gamestate.ammo)\r
+                       {\r
+                               gamestate.weapon = wp_knife;\r
+                               DrawWeapon ();\r
+                       }\r
+                       else\r
+                       {\r
+                               if (gamestate.weapon != gamestate.chosenweapon)\r
+                               {\r
+                                       gamestate.weapon = gamestate.chosenweapon;\r
+                                       DrawWeapon ();\r
+                               }\r
+                       };\r
+                       gamestate.attackframe = gamestate.weaponframe = 0;\r
+                       return;\r
+\r
+               case 4:\r
+                       if (!gamestate.ammo)\r
+                               break;\r
+                       if (buttonstate[bt_attack])\r
+                               gamestate.attackframe -= 2;\r
+               case 1:\r
+                       if (!gamestate.ammo)\r
+                       {       // can only happen with chain gun\r
+                               gamestate.attackframe++;\r
+                               break;\r
+                       }\r
+                       GunAttack (ob);\r
+                       gamestate.ammo--;\r
+                       DrawAmmo ();\r
+                       break;\r
+\r
+               case 2:\r
+                       KnifeAttack (ob);\r
+                       break;\r
+\r
+               case 3:\r
+                       if (gamestate.ammo && buttonstate[bt_attack])\r
+                               gamestate.attackframe -= 2;\r
+                       break;\r
+               }\r
+\r
+               gamestate.attackcount += cur->tics;\r
+               gamestate.attackframe++;\r
+               gamestate.weaponframe =\r
+                       attackinfo[gamestate.weapon][gamestate.attackframe].frame;\r
+       }\r
+\r
+}\r
+\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===============\r
+=\r
+= T_Player\r
+=\r
+===============\r
+*/\r
+\r
+void   T_Player (objtype *ob)\r
+{\r
+       if (gamestate.victoryflag)              // watching the BJ actor\r
+       {\r
+               VictorySpin ();\r
+               return;\r
+       }\r
+\r
+       UpdateFace ();\r
+       CheckWeaponChange ();\r
+\r
+       if ( buttonstate[bt_use] )\r
+               Cmd_Use ();\r
+\r
+       if ( buttonstate[bt_attack] && !buttonheld[bt_attack])\r
+               Cmd_Fire ();\r
+\r
+       ControlMovement (ob);\r
+       if (gamestate.victoryflag)              // watching the BJ actor\r
+               return;\r
+\r
+\r
+       plux = player->x >> UNSIGNEDSHIFT;                      // scale to fit in unsigned\r
+       pluy = player->y >> UNSIGNEDSHIFT;\r
+       player->tilex = player->x >> TILESHIFT;         // scale to tile values\r
+       player->tiley = player->y >> TILESHIFT;\r
+}\r
+\r
+\r
diff --git a/16/wf3d8086/wl_asm.asm b/16/wf3d8086/wl_asm.asm
new file mode 100755 (executable)
index 0000000..cca5d69
--- /dev/null
@@ -0,0 +1,69 @@
+; JABHACK.ASM\r
+\r
+.386C\r
+IDEAL\r
+MODEL  MEDIUM\r
+\r
+EXTRN  LDIV@:far\r
+\r
+;============================================================================\r
+\r
+DATASEG\r
+\r
+;============================================================================\r
+\r
+CODESEG\r
+\r
+;      Hacked up Juan Jimenez's code a bit to just return 386/not 386\r
+PROC   _CheckIs386\r
+PUBLIC _CheckIs386\r
+\r
+;hack to never look for a 386, for benchmark comparisons of same code on all CPUs\r
+;      pushf                   ; Save flag registers, we use them here\r
+;      xor     ax,ax           ; Clear AX and...\r
+;      push ax                 ; ...push it onto the stack\r
+;      popf                    ; Pop 0 into flag registers (all bits to 0),\r
+;      pushf                   ; attempting to set bits 12-15 of flags to 0's\r
+;      pop     ax                      ; Recover the save flags\r
+;      and     ax,08000h       ; If bits 12-15 of flags are set to\r
+;      cmp     ax,08000h       ; zero then it's 8088/86 or 80188/186\r
+;      jz      not386\r
+;\r
+;      mov     ax,07000h       ; Try to set flag bits 12-14 to 1's\r
+;      push ax                 ; Push the test value onto the stack\r
+;      popf                    ; Pop it into the flag register\r
+;      pushf                   ; Push it back onto the stack\r
+;      pop     ax                      ; Pop it into AX for check\r
+;      and     ax,07000h       ; if bits 12-14 are cleared then\r
+;      jz      not386          ; the chip is an 80286\r
+;\r
+;      mov     ax,1            ; We now assume it's a 80386 or better\r
+;      popf\r
+;      retf\r
+;end benchmark hack\r
+\r
+not386:\r
+       xor     ax,ax\r
+       popf\r
+       retf\r
+\r
+       ENDP\r
+\r
+\r
+PROC   _jabhack2\r
+PUBLIC _jabhack2\r
+\r
+       push    es\r
+\r
+       mov     ax,seg LDIV@\r
+       mov     es,ax\r
+       mov     ax,9090h                                        ;Two NOP's\r
+       mov     [WORD FAR es:LDIV@],ax          ;Patch over XOR AX,AX\r
+       mov     [WORD FAR es:LDIV@+2],ax        ;and over JMP SHORT COMMON\r
+\r
+       pop     es\r
+       retf\r
+\r
+       ENDP\r
+\r
+       END\r
diff --git a/16/wf3d8086/wl_debug.c b/16/wf3d8086/wl_debug.c
new file mode 100755 (executable)
index 0000000..dd4674b
--- /dev/null
@@ -0,0 +1,722 @@
+// WL_DEBUG.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+#include <BIOS.H>\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define VIEWTILEX      (viewwidth/16)\r
+#define VIEWTILEY      (viewheight/16)\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+int DebugKeys (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+int    maporgx;\r
+int    maporgy;\r
+enum {mapview,tilemapview,actoratview,visview} viewtype;\r
+\r
+void ViewMap (void);\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= DebugMemory\r
+=\r
+==================\r
+*/\r
+\r
+void DebugMemory (void)\r
+{\r
+       int     i;\r
+       char    scratch[80],str[10];\r
+       long    mem;\r
+       spritetype _seg *block;\r
+\r
+       CenterWindow (16,7);\r
+\r
+       US_CPrint ("Memory Usage");\r
+       US_CPrint ("------------");\r
+       US_Print ("Total     :");\r
+       US_PrintUnsigned (mminfo.mainmem/1024);\r
+       US_Print ("k\nFree      :");\r
+       US_PrintUnsigned (MM_UnusedMemory()/1024);\r
+       US_Print ("k\nWith purge:");\r
+       US_PrintUnsigned (MM_TotalFree()/1024);\r
+       US_Print ("k\n");\r
+       VW_UpdateScreen();\r
+       IN_Ack ();\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= CountObjects\r
+=\r
+==================\r
+*/\r
+\r
+void CountObjects (void)\r
+{\r
+       int     i,total,count,active,inactive,doors;\r
+       objtype *obj;\r
+\r
+       CenterWindow (16,7);\r
+       active = inactive = count = doors = 0;\r
+\r
+       US_Print ("Total statics :");\r
+       total = laststatobj-&statobjlist[0];\r
+       US_PrintUnsigned (total);\r
+\r
+       US_Print ("\nIn use statics:");\r
+       for (i=0;i<total;i++)\r
+               if (statobjlist[i].shapenum != -1)\r
+                       count++;\r
+               else\r
+                       doors++;        //debug\r
+       US_PrintUnsigned (count);\r
+\r
+       US_Print ("\nDoors         :");\r
+       US_PrintUnsigned (doornum);\r
+\r
+       for (obj=player->next;obj;obj=obj->next)\r
+       {\r
+               if (obj->active)\r
+                       active++;\r
+               else\r
+                       inactive++;\r
+       }\r
+\r
+       US_Print ("\nTotal actors  :");\r
+       US_PrintUnsigned (active+inactive);\r
+\r
+       US_Print ("\nActive actors :");\r
+       US_PrintUnsigned (active);\r
+\r
+       VW_UpdateScreen();\r
+       IN_Ack ();\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+================\r
+=\r
+= PicturePause\r
+=\r
+================\r
+*/\r
+\r
+void PicturePause (void)\r
+{\r
+       int                     i;\r
+       byte            p;\r
+       unsigned        x;\r
+       byte            far     *dest,far *src;\r
+       memptr          buffer;\r
+\r
+       VW_ColorBorder (15);\r
+       FinishPaletteShifts ();\r
+\r
+       LastScan = 0;\r
+       while (!LastScan)\r
+       ;\r
+       if (LastScan != sc_Enter)\r
+       {\r
+               VW_ColorBorder (0);\r
+               return;\r
+       }\r
+\r
+       VW_ColorBorder (1);\r
+       VW_SetScreen (0,0);\r
+//\r
+// vga stuff...\r
+//\r
+\r
+       ClearMemory ();\r
+       CA_SetAllPurge();\r
+       MM_GetPtr (&buffer,64000);\r
+       for (p=0;p<4;p++)\r
+       {\r
+          src = MK_FP(0xa000,displayofs);\r
+          dest = (byte far *)buffer+p;\r
+          VGAREADMAP(p);\r
+          for (x=0;x<16000;x++,dest+=4)\r
+                  *dest = *src++;\r
+       }\r
+\r
+\r
+#if 0\r
+       for (p=0;p<4;p++)\r
+       {\r
+               src = MK_FP(0xa000,0);\r
+               dest = (byte far *)buffer+51200+p;\r
+               VGAREADMAP(p);\r
+               for (x=0;x<3200;x++,dest+=4)\r
+                       *dest = *src++;\r
+       }\r
+#endif\r
+\r
+       asm     mov     ax,0x13\r
+       asm     int     0x10\r
+\r
+       dest = MK_FP(0xa000,0);\r
+       _fmemcpy (dest,buffer,64000);\r
+\r
+       VL_SetPalette (&gamepal);\r
+\r
+\r
+       IN_Shutdown ();\r
+\r
+       VW_WaitVBL(70);\r
+       bioskey(0);\r
+       VW_WaitVBL(70);\r
+       Quit (NULL);\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+================\r
+=\r
+= ShapeTest\r
+=\r
+================\r
+*/\r
+\r
+#pragma warn -pia\r
+void ShapeTest (void)\r
+{\r
+extern word    NumDigi;\r
+extern word    _seg *DigiList;\r
+static char    buf[10];\r
+\r
+       boolean                 done;\r
+       ScanCode                scan;\r
+       int                             i,j,k,x;\r
+       longword                l;\r
+       memptr                  addr;\r
+       PageListStruct  far *page;\r
+\r
+       CenterWindow(20,16);\r
+       VW_UpdateScreen();\r
+       for (i = 0,done = false;!done;)\r
+       {\r
+               US_ClearWindow();\r
+//             sound = -1;\r
+\r
+               page = &PMPages[i];\r
+               US_Print(" Page #");\r
+               US_PrintUnsigned(i);\r
+               if (i < PMSpriteStart)\r
+                       US_Print(" (Wall)");\r
+               else if (i < PMSoundStart)\r
+                       US_Print(" (Sprite)");\r
+               else if (i == ChunksInFile - 1)\r
+                       US_Print(" (Sound Info)");\r
+               else\r
+                       US_Print(" (Sound)");\r
+\r
+               US_Print("\n XMS: ");\r
+               if (page->xmsPage != -1)\r
+                       US_PrintUnsigned(page->xmsPage);\r
+               else\r
+                       US_Print("No");\r
+\r
+               US_Print("\n Main: ");\r
+               if (page->mainPage != -1)\r
+                       US_PrintUnsigned(page->mainPage);\r
+               else if (page->emsPage != -1)\r
+               {\r
+                       US_Print("EMS ");\r
+                       US_PrintUnsigned(page->emsPage);\r
+               }\r
+               else\r
+                       US_Print("No");\r
+\r
+               US_Print("\n Last hit: ");\r
+               US_PrintUnsigned(page->lastHit);\r
+\r
+               US_Print("\n Address: ");\r
+               addr = PM_GetPageAddress(i);\r
+               sprintf(buf,"0x%04x",(word)addr);\r
+               US_Print(buf);\r
+\r
+               if (addr)\r
+               {\r
+                       if (i < PMSpriteStart)\r
+                       {\r
+                       //\r
+                       // draw the wall\r
+                       //\r
+                               bufferofs += 32*SCREENWIDTH;\r
+                               postx = 128;\r
+                               postwidth = 1;\r
+                               postsource = ((long)((unsigned)addr))<<16;\r
+                               for (x=0;x<64;x++,postx++,postsource+=64)\r
+                               {\r
+                                       wallheight[postx] = 256;\r
+                                       FarScalePost ();\r
+                               }\r
+                               bufferofs -= 32*SCREENWIDTH;\r
+                       }\r
+                       else if (i < PMSoundStart)\r
+                       {\r
+                       //\r
+                       // draw the sprite\r
+                       //\r
+                               bufferofs += 32*SCREENWIDTH;\r
+                               SimpleScaleShape (160, i-PMSpriteStart, 64);\r
+                               bufferofs -= 32*SCREENWIDTH;\r
+                       }\r
+                       else if (i == ChunksInFile - 1)\r
+                       {\r
+                               US_Print("\n\n Number of sounds: ");\r
+                               US_PrintUnsigned(NumDigi);\r
+                               for (l = j = k = 0;j < NumDigi;j++)\r
+                               {\r
+                                       l += DigiList[(j * 2) + 1];\r
+                                       k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;\r
+                               }\r
+                               US_Print("\n Total bytes: ");\r
+                               US_PrintUnsigned(l);\r
+                               US_Print("\n Total pages: ");\r
+                               US_PrintUnsigned(k);\r
+                       }\r
+                       else\r
+                       {\r
+                               byte far *dp = (byte far *)MK_FP(addr,0);\r
+                               for (j = 0;j < NumDigi;j++)\r
+                               {\r
+                                       k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;\r
+                                       if\r
+                                       (\r
+                                               (i >= PMSoundStart + DigiList[j * 2])\r
+                                       &&      (i < PMSoundStart + DigiList[j * 2] + k)\r
+                                       )\r
+                                               break;\r
+                               }\r
+                               if (j < NumDigi)\r
+                               {\r
+//                                     sound = j;\r
+                                       US_Print("\n Sound #");\r
+                                       US_PrintUnsigned(j);\r
+                                       US_Print("\n Segment #");\r
+                                       US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]);\r
+                               }\r
+                               for (j = 0;j < page->length;j += 32)\r
+                               {\r
+                                       byte v = dp[j];\r
+                                       int v2 = (unsigned)v;\r
+                                       v2 -= 128;\r
+                                       v2 /= 4;\r
+                                       if (v2 < 0)\r
+                                               VWB_Vlin(WindowY + WindowH - 32 + v2,\r
+                                                               WindowY + WindowH - 32,\r
+                                                               WindowX + 8 + (j / 32),BLACK);\r
+                                       else\r
+                                               VWB_Vlin(WindowY + WindowH - 32,\r
+                                                               WindowY + WindowH - 32 + v2,\r
+                                                               WindowX + 8 + (j / 32),BLACK);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               VW_UpdateScreen();\r
+\r
+               while (!(scan = LastScan))\r
+                       SD_Poll();\r
+\r
+               IN_ClearKey(scan);\r
+               switch (scan)\r
+               {\r
+               case sc_LeftArrow:\r
+                       if (i)\r
+                               i--;\r
+                       break;\r
+               case sc_RightArrow:\r
+                       if (++i >= ChunksInFile)\r
+                               i--;\r
+                       break;\r
+               case sc_W:      // Walls\r
+                       i = 0;\r
+                       break;\r
+               case sc_S:      // Sprites\r
+                       i = PMSpriteStart;\r
+                       break;\r
+               case sc_D:      // Digitized\r
+                       i = PMSoundStart;\r
+                       break;\r
+               case sc_I:      // Digitized info\r
+                       i = ChunksInFile - 1;\r
+                       break;\r
+               case sc_L:      // Load all pages\r
+                       for (j = 0;j < ChunksInFile;j++)\r
+                               PM_GetPage(j);\r
+                       break;\r
+               case sc_P:\r
+//                     if (sound != -1)\r
+//                             SD_PlayDigitized(sound);\r
+                       break;\r
+               case sc_Escape:\r
+                       done = true;\r
+                       break;\r
+               case sc_Enter:\r
+                       PM_GetPage(i);\r
+                       break;\r
+               }\r
+       }\r
+       SD_StopDigitized();\r
+}\r
+#pragma warn +pia\r
+\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+================\r
+=\r
+= DebugKeys\r
+=\r
+================\r
+*/\r
+\r
+int DebugKeys (void)\r
+{\r
+       boolean esc;\r
+       int level,i;\r
+\r
+       if (Keyboard[sc_B])             // B = border color\r
+       {\r
+               CenterWindow(24,3);\r
+               PrintY+=6;\r
+               US_Print(" Border color (0-15):");\r
+               VW_UpdateScreen();\r
+               esc = !US_LineInput (px,py,str,NULL,true,2,0);\r
+               if (!esc)\r
+               {\r
+                       level = atoi (str);\r
+                       if (level>=0 && level<=15)\r
+                               VW_ColorBorder (level);\r
+               }\r
+               return 1;\r
+       }\r
+\r
+       if (Keyboard[sc_C])             // C = count objects\r
+       {\r
+               CountObjects();\r
+               return 1;\r
+       }\r
+\r
+       if (Keyboard[sc_E])             // E = quit level\r
+       {\r
+               if (tedlevel)\r
+                       Quit (NULL);\r
+               playstate = ex_completed;\r
+//             gamestate.mapon++;\r
+       }\r
+\r
+       if (Keyboard[sc_F])             // F = facing spot\r
+       {\r
+               CenterWindow (14,4);\r
+               US_Print ("X:");\r
+               US_PrintUnsigned (player->x);\r
+               US_Print ("\nY:");\r
+               US_PrintUnsigned (player->y);\r
+               US_Print ("\nA:");\r
+               US_PrintUnsigned (player->angle);\r
+               VW_UpdateScreen();\r
+               IN_Ack();\r
+               return 1;\r
+       }\r
+\r
+       if (Keyboard[sc_G])             // G = god mode\r
+       {\r
+               CenterWindow (12,2);\r
+               if (godmode)\r
+                 US_PrintCentered ("God mode OFF");\r
+               else\r
+                 US_PrintCentered ("God mode ON");\r
+               VW_UpdateScreen();\r
+               IN_Ack();\r
+               godmode ^= 1;\r
+               return 1;\r
+       }\r
+       if (Keyboard[sc_H])             // H = hurt self\r
+       {\r
+               IN_ClearKeysDown ();\r
+               TakeDamage (16,NULL);\r
+       }\r
+       else if (Keyboard[sc_I])                        // I = item cheat\r
+       {\r
+               CenterWindow (12,3);\r
+               US_PrintCentered ("Free items!");\r
+               VW_UpdateScreen();\r
+               GivePoints (100000);\r
+               HealSelf (99);\r
+               if (gamestate.bestweapon<wp_chaingun)\r
+                       GiveWeapon (gamestate.bestweapon+1);\r
+               gamestate.ammo += 50;\r
+               if (gamestate.ammo > 99)\r
+                       gamestate.ammo = 99;\r
+               DrawAmmo ();\r
+               IN_Ack ();\r
+               return 1;\r
+       }\r
+       else if (Keyboard[sc_M])                        // M = memory info\r
+       {\r
+               DebugMemory();\r
+               return 1;\r
+       }\r
+#ifdef SPEAR\r
+       else if (Keyboard[sc_N])                        // N = no clip\r
+       {\r
+               noclip^=1;\r
+               CenterWindow (18,3);\r
+               if (noclip)\r
+                       US_PrintCentered ("No clipping ON");\r
+               else\r
+                       US_PrintCentered ("No clipping OFF");\r
+               VW_UpdateScreen();\r
+               IN_Ack ();\r
+               return 1;\r
+       }\r
+#endif\r
+#if 0\r
+       else if (Keyboard[sc_O])                        // O = overhead\r
+       {\r
+               ViewMap();\r
+               return 1;\r
+       }\r
+#endif\r
+       else if (Keyboard[sc_P])                        // P = pause with no screen disruptioon\r
+       {\r
+               PicturePause ();\r
+               return 1;\r
+       }\r
+       else if (Keyboard[sc_Q])                        // Q = fast quit\r
+               Quit (NULL);\r
+       else if (Keyboard[sc_S])                        // S = slow motion\r
+       {\r
+               singlestep^=1;\r
+               CenterWindow (18,3);\r
+               if (singlestep)\r
+                       US_PrintCentered ("Slow motion ON");\r
+               else\r
+                       US_PrintCentered ("Slow motion OFF");\r
+               VW_UpdateScreen();\r
+               IN_Ack ();\r
+               return 1;\r
+       }\r
+       else if (Keyboard[sc_T])                        // T = shape test\r
+       {\r
+               ShapeTest ();\r
+               return 1;\r
+       }\r
+       else if (Keyboard[sc_V])                        // V = extra VBLs\r
+       {\r
+               CenterWindow(30,3);\r
+               PrintY+=6;\r
+               US_Print("  Add how many extra VBLs(0-8):");\r
+               VW_UpdateScreen();\r
+               esc = !US_LineInput (px,py,str,NULL,true,2,0);\r
+               if (!esc)\r
+               {\r
+                       level = atoi (str);\r
+                       if (level>=0 && level<=8)\r
+                               extravbls = level;\r
+               }\r
+               return 1;\r
+       }\r
+       else if (Keyboard[sc_W])                        // W = warp to level\r
+       {\r
+               CenterWindow(26,3);\r
+               PrintY+=6;\r
+#ifndef SPEAR\r
+               US_Print("  Warp to which level(1-10):");\r
+#else\r
+               US_Print("  Warp to which level(1-21):");\r
+#endif\r
+               VW_UpdateScreen();\r
+               esc = !US_LineInput (px,py,str,NULL,true,2,0);\r
+               if (!esc)\r
+               {\r
+                       level = atoi (str);\r
+#ifndef SPEAR\r
+                       if (level>0 && level<11)\r
+#else\r
+                       if (level>0 && level<22)\r
+#endif\r
+                       {\r
+                               gamestate.mapon = level-1;\r
+                               playstate = ex_warped;\r
+                       }\r
+               }\r
+               return 1;\r
+       }\r
+       else if (Keyboard[sc_X])                        // X = item cheat\r
+       {\r
+               CenterWindow (12,3);\r
+               US_PrintCentered ("Extra stuff!");\r
+               VW_UpdateScreen();\r
+               // DEBUG: put stuff here\r
+               IN_Ack ();\r
+               return 1;\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+\r
+#if 0\r
+/*\r
+===================\r
+=\r
+= OverheadRefresh\r
+=\r
+===================\r
+*/\r
+\r
+void OverheadRefresh (void)\r
+{\r
+       unsigned        x,y,endx,endy,sx,sy;\r
+       unsigned        tile;\r
+\r
+\r
+       endx = maporgx+VIEWTILEX;\r
+       endy = maporgy+VIEWTILEY;\r
+\r
+       for (y=maporgy;y<endy;y++)\r
+               for (x=maporgx;x<endx;x++)\r
+               {\r
+                       sx = (x-maporgx)*16;\r
+                       sy = (y-maporgy)*16;\r
+\r
+                       switch (viewtype)\r
+                       {\r
+#if 0\r
+                       case mapview:\r
+                               tile = *(mapsegs[0]+farmapylookup[y]+x);\r
+                               break;\r
+\r
+                       case tilemapview:\r
+                               tile = tilemap[x][y];\r
+                               break;\r
+\r
+                       case visview:\r
+                               tile = spotvis[x][y];\r
+                               break;\r
+#endif\r
+                       case actoratview:\r
+                               tile = (unsigned)actorat[x][y];\r
+                               break;\r
+                       }\r
+\r
+                       if (tile<MAXWALLTILES)\r
+                               LatchDrawTile(sx,sy,tile);\r
+                       else\r
+                       {\r
+                               LatchDrawChar(sx,sy,NUMBERCHARS+((tile&0xf000)>>12));\r
+                               LatchDrawChar(sx+8,sy,NUMBERCHARS+((tile&0x0f00)>>8));\r
+                               LatchDrawChar(sx,sy+8,NUMBERCHARS+((tile&0x00f0)>>4));\r
+                               LatchDrawChar(sx+8,sy+8,NUMBERCHARS+(tile&0x000f));\r
+                       }\r
+               }\r
+\r
+}\r
+#endif\r
+\r
+#if 0\r
+/*\r
+===================\r
+=\r
+= ViewMap\r
+=\r
+===================\r
+*/\r
+\r
+void ViewMap (void)\r
+{\r
+       boolean         button0held;\r
+\r
+       viewtype = actoratview;\r
+//     button0held = false;\r
+\r
+\r
+       maporgx = player->tilex - VIEWTILEX/2;\r
+       if (maporgx<0)\r
+               maporgx = 0;\r
+       if (maporgx>MAPSIZE-VIEWTILEX)\r
+               maporgx=MAPSIZE-VIEWTILEX;\r
+       maporgy = player->tiley - VIEWTILEY/2;\r
+       if (maporgy<0)\r
+               maporgy = 0;\r
+       if (maporgy>MAPSIZE-VIEWTILEY)\r
+               maporgy=MAPSIZE-VIEWTILEY;\r
+\r
+       do\r
+       {\r
+//\r
+// let user pan around\r
+//\r
+               PollControls ();\r
+               if (controlx < 0 && maporgx>0)\r
+                       maporgx--;\r
+               if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)\r
+                       maporgx++;\r
+               if (controly < 0 && maporgy>0)\r
+                       maporgy--;\r
+               if (controly > 0 && maporgy<mapheight-VIEWTILEY)\r
+                       maporgy++;\r
+\r
+#if 0\r
+               if (c.button0 && !button0held)\r
+               {\r
+                       button0held = true;\r
+                       viewtype++;\r
+                       if (viewtype>visview)\r
+                               viewtype = mapview;\r
+               }\r
+               if (!c.button0)\r
+                       button0held = false;\r
+#endif\r
+\r
+               OverheadRefresh ();\r
+\r
+       } while (!Keyboard[sc_Escape]);\r
+\r
+       IN_ClearKeysDown ();\r
+}\r
+#endif\r
+\r
diff --git a/16/wf3d8086/wl_def.h b/16/wf3d8086/wl_def.h
new file mode 100755 (executable)
index 0000000..d1bc080
--- /dev/null
@@ -0,0 +1,1276 @@
+//#define BETA\r
+#define YEAR   1992\r
+#define MONTH  9\r
+#define DAY            30\r
+\r
+#include "ID_HEADS.H"\r
+#include <MATH.H>\r
+#include <VALUES.H>\r
+\r
+#include "WL_MENU.H"\r
+\r
+#ifdef SPANISH\r
+#include "SPANISH.H"\r
+#else\r
+#include "FOREIGN.H"\r
+#endif\r
+\r
+#ifdef SPEAR\r
+#include "F_SPEAR.H"\r
+#endif\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       MACROS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+#define COLORBORDER(color)             asm{mov dx,STATUS_REGISTER_1;in al,dx;\\r
+       mov dx,ATR_INDEX;mov al,ATR_OVERSCAN;out dx,al;mov al,color;out dx,al;\\r
+       mov     al,32;out dx,al};\r
+\r
+#define MAPSPOT(x,y,plane)             (*(mapsegs[plane]+farmapylookup[y]+x))\r
+\r
+#define SIGN(x)        ((x)>0?1:-1)\r
+#define ABS(x)                 ((int)(x)>0?(x):-(x))\r
+#define LABS(x)        ((long)(x)>0?(x):-(x))\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define MAXACTORS              150                             // max number of nazis, etc / map\r
+#define MAXSTATS               400                             // max number of lamps, bonus, etc\r
+#define MAXDOORS               64                              // max number of sliding doors\r
+#define MAXWALLTILES   64                              // max number of wall tiles\r
+\r
+//\r
+// tile constants\r
+//\r
+\r
+#define        ICONARROWS              90\r
+#define PUSHABLETILE   98\r
+#define EXITTILE               99                              // at end of castle\r
+#define AREATILE               107                             // first of NUMAREAS floor tiles\r
+#define NUMAREAS               37\r
+#define ELEVATORTILE   21\r
+#define AMBUSHTILE             106\r
+#define        ALTELEVATORTILE 107\r
+\r
+#define NUMBERCHARS    9\r
+\r
+\r
+//----------------\r
+\r
+#define EXTRAPOINTS            40000\r
+\r
+#define PLAYERSPEED            3000\r
+#define RUNSPEED               6000\r
+\r
+#define        SCREENSEG               0xa000\r
+\r
+#define SCREENBWIDE            80\r
+\r
+#define HEIGHTRATIO            0.50            // also defined in id_mm.c\r
+\r
+#define BORDERCOLOR    3\r
+#define FLASHCOLOR     5\r
+#define FLASHTICS      4\r
+\r
+\r
+#define PLAYERSIZE             MINDIST                 // player radius\r
+#define MINACTORDIST   0x10000l                // minimum dist from player center\r
+                                                                               // to any actor center\r
+\r
+#define NUMLATCHPICS   100\r
+\r
+\r
+#define PI     3.141592657\r
+\r
+#define GLOBAL1                (1l<<16)\r
+#define TILEGLOBAL  GLOBAL1\r
+#define PIXGLOBAL      (GLOBAL1/64)\r
+#define TILESHIFT              16l\r
+#define UNSIGNEDSHIFT  8\r
+\r
+#define ANGLES         360                                     // must be divisable by 4\r
+#define ANGLEQUAD      (ANGLES/4)\r
+#define FINEANGLES     3600\r
+#define ANG90          (FINEANGLES/4)\r
+#define ANG180         (ANG90*2)\r
+#define ANG270         (ANG90*3)\r
+#define ANG360         (ANG90*4)\r
+#define VANG90         (ANGLES/4)\r
+#define VANG180                (VANG90*2)\r
+#define VANG270                (VANG90*3)\r
+#define VANG360                (VANG90*4)\r
+\r
+#define MINDIST                (0x5800l)\r
+\r
+\r
+#define        MAXSCALEHEIGHT  256                             // largest scale on largest view\r
+\r
+#define MAXVIEWWIDTH           320\r
+\r
+#define MAPSIZE                64                                      // maps are 64*64 max\r
+#define NORTH  0\r
+#define EAST   1\r
+#define SOUTH  2\r
+#define WEST   3\r
+\r
+\r
+#define STATUSLINES            40\r
+\r
+#define SCREENSIZE             (SCREENBWIDE*208)\r
+#define PAGE1START             0\r
+#define PAGE2START             (SCREENSIZE)\r
+#define PAGE3START             (SCREENSIZE*2u)\r
+#define        FREESTART               (SCREENSIZE*3u)\r
+\r
+\r
+#define PIXRADIUS              512\r
+\r
+#define STARTAMMO              8\r
+\r
+\r
+// object flag values\r
+\r
+#define FL_SHOOTABLE   1\r
+#define FL_BONUS               2\r
+#define FL_NEVERMARK   4\r
+#define FL_VISABLE             8\r
+#define FL_ATTACKMODE  16\r
+#define FL_FIRSTATTACK 32\r
+#define FL_AMBUSH              64\r
+#define FL_NONMARK             128\r
+\r
+\r
+//\r
+// sprite constants\r
+//\r
+\r
+enum   {\r
+               SPR_DEMO,\r
+               SPR_DEATHCAM,\r
+//\r
+// static sprites\r
+//\r
+               SPR_STAT_0,SPR_STAT_1,SPR_STAT_2,SPR_STAT_3,\r
+               SPR_STAT_4,SPR_STAT_5,SPR_STAT_6,SPR_STAT_7,\r
+\r
+               SPR_STAT_8,SPR_STAT_9,SPR_STAT_10,SPR_STAT_11,\r
+               SPR_STAT_12,SPR_STAT_13,SPR_STAT_14,SPR_STAT_15,\r
+\r
+               SPR_STAT_16,SPR_STAT_17,SPR_STAT_18,SPR_STAT_19,\r
+               SPR_STAT_20,SPR_STAT_21,SPR_STAT_22,SPR_STAT_23,\r
+\r
+               SPR_STAT_24,SPR_STAT_25,SPR_STAT_26,SPR_STAT_27,\r
+               SPR_STAT_28,SPR_STAT_29,SPR_STAT_30,SPR_STAT_31,\r
+\r
+               SPR_STAT_32,SPR_STAT_33,SPR_STAT_34,SPR_STAT_35,\r
+               SPR_STAT_36,SPR_STAT_37,SPR_STAT_38,SPR_STAT_39,\r
+\r
+               SPR_STAT_40,SPR_STAT_41,SPR_STAT_42,SPR_STAT_43,\r
+               SPR_STAT_44,SPR_STAT_45,SPR_STAT_46,SPR_STAT_47,\r
+\r
+#ifdef SPEAR\r
+               SPR_STAT_48,SPR_STAT_49,SPR_STAT_50,SPR_STAT_51,\r
+#endif\r
+\r
+//\r
+// guard\r
+//\r
+               SPR_GRD_S_1,SPR_GRD_S_2,SPR_GRD_S_3,SPR_GRD_S_4,\r
+               SPR_GRD_S_5,SPR_GRD_S_6,SPR_GRD_S_7,SPR_GRD_S_8,\r
+\r
+               SPR_GRD_W1_1,SPR_GRD_W1_2,SPR_GRD_W1_3,SPR_GRD_W1_4,\r
+               SPR_GRD_W1_5,SPR_GRD_W1_6,SPR_GRD_W1_7,SPR_GRD_W1_8,\r
+\r
+               SPR_GRD_W2_1,SPR_GRD_W2_2,SPR_GRD_W2_3,SPR_GRD_W2_4,\r
+               SPR_GRD_W2_5,SPR_GRD_W2_6,SPR_GRD_W2_7,SPR_GRD_W2_8,\r
+\r
+               SPR_GRD_W3_1,SPR_GRD_W3_2,SPR_GRD_W3_3,SPR_GRD_W3_4,\r
+               SPR_GRD_W3_5,SPR_GRD_W3_6,SPR_GRD_W3_7,SPR_GRD_W3_8,\r
+\r
+               SPR_GRD_W4_1,SPR_GRD_W4_2,SPR_GRD_W4_3,SPR_GRD_W4_4,\r
+               SPR_GRD_W4_5,SPR_GRD_W4_6,SPR_GRD_W4_7,SPR_GRD_W4_8,\r
+\r
+               SPR_GRD_PAIN_1,SPR_GRD_DIE_1,SPR_GRD_DIE_2,SPR_GRD_DIE_3,\r
+               SPR_GRD_PAIN_2,SPR_GRD_DEAD,\r
+\r
+               SPR_GRD_SHOOT1,SPR_GRD_SHOOT2,SPR_GRD_SHOOT3,\r
+\r
+//\r
+// dogs\r
+//\r
+               SPR_DOG_W1_1,SPR_DOG_W1_2,SPR_DOG_W1_3,SPR_DOG_W1_4,\r
+               SPR_DOG_W1_5,SPR_DOG_W1_6,SPR_DOG_W1_7,SPR_DOG_W1_8,\r
+\r
+               SPR_DOG_W2_1,SPR_DOG_W2_2,SPR_DOG_W2_3,SPR_DOG_W2_4,\r
+               SPR_DOG_W2_5,SPR_DOG_W2_6,SPR_DOG_W2_7,SPR_DOG_W2_8,\r
+\r
+               SPR_DOG_W3_1,SPR_DOG_W3_2,SPR_DOG_W3_3,SPR_DOG_W3_4,\r
+               SPR_DOG_W3_5,SPR_DOG_W3_6,SPR_DOG_W3_7,SPR_DOG_W3_8,\r
+\r
+               SPR_DOG_W4_1,SPR_DOG_W4_2,SPR_DOG_W4_3,SPR_DOG_W4_4,\r
+               SPR_DOG_W4_5,SPR_DOG_W4_6,SPR_DOG_W4_7,SPR_DOG_W4_8,\r
+\r
+               SPR_DOG_DIE_1,SPR_DOG_DIE_2,SPR_DOG_DIE_3,SPR_DOG_DEAD,\r
+               SPR_DOG_JUMP1,SPR_DOG_JUMP2,SPR_DOG_JUMP3,\r
+\r
+\r
+\r
+//\r
+// ss\r
+//\r
+               SPR_SS_S_1,SPR_SS_S_2,SPR_SS_S_3,SPR_SS_S_4,\r
+               SPR_SS_S_5,SPR_SS_S_6,SPR_SS_S_7,SPR_SS_S_8,\r
+\r
+               SPR_SS_W1_1,SPR_SS_W1_2,SPR_SS_W1_3,SPR_SS_W1_4,\r
+               SPR_SS_W1_5,SPR_SS_W1_6,SPR_SS_W1_7,SPR_SS_W1_8,\r
+\r
+               SPR_SS_W2_1,SPR_SS_W2_2,SPR_SS_W2_3,SPR_SS_W2_4,\r
+               SPR_SS_W2_5,SPR_SS_W2_6,SPR_SS_W2_7,SPR_SS_W2_8,\r
+\r
+               SPR_SS_W3_1,SPR_SS_W3_2,SPR_SS_W3_3,SPR_SS_W3_4,\r
+               SPR_SS_W3_5,SPR_SS_W3_6,SPR_SS_W3_7,SPR_SS_W3_8,\r
+\r
+               SPR_SS_W4_1,SPR_SS_W4_2,SPR_SS_W4_3,SPR_SS_W4_4,\r
+               SPR_SS_W4_5,SPR_SS_W4_6,SPR_SS_W4_7,SPR_SS_W4_8,\r
+\r
+               SPR_SS_PAIN_1,SPR_SS_DIE_1,SPR_SS_DIE_2,SPR_SS_DIE_3,\r
+               SPR_SS_PAIN_2,SPR_SS_DEAD,\r
+\r
+               SPR_SS_SHOOT1,SPR_SS_SHOOT2,SPR_SS_SHOOT3,\r
+\r
+//\r
+// mutant\r
+//\r
+               SPR_MUT_S_1,SPR_MUT_S_2,SPR_MUT_S_3,SPR_MUT_S_4,\r
+               SPR_MUT_S_5,SPR_MUT_S_6,SPR_MUT_S_7,SPR_MUT_S_8,\r
+\r
+               SPR_MUT_W1_1,SPR_MUT_W1_2,SPR_MUT_W1_3,SPR_MUT_W1_4,\r
+               SPR_MUT_W1_5,SPR_MUT_W1_6,SPR_MUT_W1_7,SPR_MUT_W1_8,\r
+\r
+               SPR_MUT_W2_1,SPR_MUT_W2_2,SPR_MUT_W2_3,SPR_MUT_W2_4,\r
+               SPR_MUT_W2_5,SPR_MUT_W2_6,SPR_MUT_W2_7,SPR_MUT_W2_8,\r
+\r
+               SPR_MUT_W3_1,SPR_MUT_W3_2,SPR_MUT_W3_3,SPR_MUT_W3_4,\r
+               SPR_MUT_W3_5,SPR_MUT_W3_6,SPR_MUT_W3_7,SPR_MUT_W3_8,\r
+\r
+               SPR_MUT_W4_1,SPR_MUT_W4_2,SPR_MUT_W4_3,SPR_MUT_W4_4,\r
+               SPR_MUT_W4_5,SPR_MUT_W4_6,SPR_MUT_W4_7,SPR_MUT_W4_8,\r
+\r
+               SPR_MUT_PAIN_1,SPR_MUT_DIE_1,SPR_MUT_DIE_2,SPR_MUT_DIE_3,\r
+               SPR_MUT_PAIN_2,SPR_MUT_DIE_4,SPR_MUT_DEAD,\r
+\r
+               SPR_MUT_SHOOT1,SPR_MUT_SHOOT2,SPR_MUT_SHOOT3,SPR_MUT_SHOOT4,\r
+\r
+//\r
+// officer\r
+//\r
+               SPR_OFC_S_1,SPR_OFC_S_2,SPR_OFC_S_3,SPR_OFC_S_4,\r
+               SPR_OFC_S_5,SPR_OFC_S_6,SPR_OFC_S_7,SPR_OFC_S_8,\r
+\r
+               SPR_OFC_W1_1,SPR_OFC_W1_2,SPR_OFC_W1_3,SPR_OFC_W1_4,\r
+               SPR_OFC_W1_5,SPR_OFC_W1_6,SPR_OFC_W1_7,SPR_OFC_W1_8,\r
+\r
+               SPR_OFC_W2_1,SPR_OFC_W2_2,SPR_OFC_W2_3,SPR_OFC_W2_4,\r
+               SPR_OFC_W2_5,SPR_OFC_W2_6,SPR_OFC_W2_7,SPR_OFC_W2_8,\r
+\r
+               SPR_OFC_W3_1,SPR_OFC_W3_2,SPR_OFC_W3_3,SPR_OFC_W3_4,\r
+               SPR_OFC_W3_5,SPR_OFC_W3_6,SPR_OFC_W3_7,SPR_OFC_W3_8,\r
+\r
+               SPR_OFC_W4_1,SPR_OFC_W4_2,SPR_OFC_W4_3,SPR_OFC_W4_4,\r
+               SPR_OFC_W4_5,SPR_OFC_W4_6,SPR_OFC_W4_7,SPR_OFC_W4_8,\r
+\r
+               SPR_OFC_PAIN_1,SPR_OFC_DIE_1,SPR_OFC_DIE_2,SPR_OFC_DIE_3,\r
+               SPR_OFC_PAIN_2,SPR_OFC_DIE_4,SPR_OFC_DEAD,\r
+\r
+               SPR_OFC_SHOOT1,SPR_OFC_SHOOT2,SPR_OFC_SHOOT3,\r
+\r
+#ifndef SPEAR\r
+//\r
+// ghosts\r
+//\r
+               SPR_BLINKY_W1,SPR_BLINKY_W2,SPR_PINKY_W1,SPR_PINKY_W2,\r
+               SPR_CLYDE_W1,SPR_CLYDE_W2,SPR_INKY_W1,SPR_INKY_W2,\r
+\r
+//\r
+// hans\r
+//\r
+               SPR_BOSS_W1,SPR_BOSS_W2,SPR_BOSS_W3,SPR_BOSS_W4,\r
+               SPR_BOSS_SHOOT1,SPR_BOSS_SHOOT2,SPR_BOSS_SHOOT3,SPR_BOSS_DEAD,\r
+\r
+               SPR_BOSS_DIE1,SPR_BOSS_DIE2,SPR_BOSS_DIE3,\r
+\r
+//\r
+// schabbs\r
+//\r
+               SPR_SCHABB_W1,SPR_SCHABB_W2,SPR_SCHABB_W3,SPR_SCHABB_W4,\r
+               SPR_SCHABB_SHOOT1,SPR_SCHABB_SHOOT2,\r
+\r
+               SPR_SCHABB_DIE1,SPR_SCHABB_DIE2,SPR_SCHABB_DIE3,SPR_SCHABB_DEAD,\r
+               SPR_HYPO1,SPR_HYPO2,SPR_HYPO3,SPR_HYPO4,\r
+\r
+//\r
+// fake\r
+//\r
+               SPR_FAKE_W1,SPR_FAKE_W2,SPR_FAKE_W3,SPR_FAKE_W4,\r
+               SPR_FAKE_SHOOT,SPR_FIRE1,SPR_FIRE2,\r
+\r
+               SPR_FAKE_DIE1,SPR_FAKE_DIE2,SPR_FAKE_DIE3,SPR_FAKE_DIE4,\r
+               SPR_FAKE_DIE5,SPR_FAKE_DEAD,\r
+\r
+//\r
+// hitler\r
+//\r
+               SPR_MECHA_W1,SPR_MECHA_W2,SPR_MECHA_W3,SPR_MECHA_W4,\r
+               SPR_MECHA_SHOOT1,SPR_MECHA_SHOOT2,SPR_MECHA_SHOOT3,SPR_MECHA_DEAD,\r
+\r
+               SPR_MECHA_DIE1,SPR_MECHA_DIE2,SPR_MECHA_DIE3,\r
+\r
+               SPR_HITLER_W1,SPR_HITLER_W2,SPR_HITLER_W3,SPR_HITLER_W4,\r
+               SPR_HITLER_SHOOT1,SPR_HITLER_SHOOT2,SPR_HITLER_SHOOT3,SPR_HITLER_DEAD,\r
+\r
+               SPR_HITLER_DIE1,SPR_HITLER_DIE2,SPR_HITLER_DIE3,SPR_HITLER_DIE4,\r
+               SPR_HITLER_DIE5,SPR_HITLER_DIE6,SPR_HITLER_DIE7,\r
+\r
+//\r
+// giftmacher\r
+//\r
+               SPR_GIFT_W1,SPR_GIFT_W2,SPR_GIFT_W3,SPR_GIFT_W4,\r
+               SPR_GIFT_SHOOT1,SPR_GIFT_SHOOT2,\r
+\r
+               SPR_GIFT_DIE1,SPR_GIFT_DIE2,SPR_GIFT_DIE3,SPR_GIFT_DEAD,\r
+#endif\r
+//\r
+// Rocket, smoke and small explosion\r
+//\r
+               SPR_ROCKET_1,SPR_ROCKET_2,SPR_ROCKET_3,SPR_ROCKET_4,\r
+               SPR_ROCKET_5,SPR_ROCKET_6,SPR_ROCKET_7,SPR_ROCKET_8,\r
+\r
+               SPR_SMOKE_1,SPR_SMOKE_2,SPR_SMOKE_3,SPR_SMOKE_4,\r
+               SPR_BOOM_1,SPR_BOOM_2,SPR_BOOM_3,\r
+\r
+//\r
+// Angel of Death's DeathSparks(tm)\r
+//\r
+#ifdef SPEAR\r
+               SPR_HROCKET_1,SPR_HROCKET_2,SPR_HROCKET_3,SPR_HROCKET_4,\r
+               SPR_HROCKET_5,SPR_HROCKET_6,SPR_HROCKET_7,SPR_HROCKET_8,\r
+\r
+               SPR_HSMOKE_1,SPR_HSMOKE_2,SPR_HSMOKE_3,SPR_HSMOKE_4,\r
+               SPR_HBOOM_1,SPR_HBOOM_2,SPR_HBOOM_3,\r
+\r
+               SPR_SPARK1,SPR_SPARK2,SPR_SPARK3,SPR_SPARK4,\r
+#endif\r
+\r
+#ifndef SPEAR\r
+//\r
+// gretel\r
+//\r
+               SPR_GRETEL_W1,SPR_GRETEL_W2,SPR_GRETEL_W3,SPR_GRETEL_W4,\r
+               SPR_GRETEL_SHOOT1,SPR_GRETEL_SHOOT2,SPR_GRETEL_SHOOT3,SPR_GRETEL_DEAD,\r
+\r
+               SPR_GRETEL_DIE1,SPR_GRETEL_DIE2,SPR_GRETEL_DIE3,\r
+\r
+//\r
+// fat face\r
+//\r
+               SPR_FAT_W1,SPR_FAT_W2,SPR_FAT_W3,SPR_FAT_W4,\r
+               SPR_FAT_SHOOT1,SPR_FAT_SHOOT2,SPR_FAT_SHOOT3,SPR_FAT_SHOOT4,\r
+\r
+               SPR_FAT_DIE1,SPR_FAT_DIE2,SPR_FAT_DIE3,SPR_FAT_DEAD,\r
+\r
+//\r
+// bj\r
+//\r
+               SPR_BJ_W1,SPR_BJ_W2,SPR_BJ_W3,SPR_BJ_W4,\r
+               SPR_BJ_JUMP1,SPR_BJ_JUMP2,SPR_BJ_JUMP3,SPR_BJ_JUMP4,\r
+#else\r
+//\r
+// THESE ARE FOR 'SPEAR OF DESTINY'\r
+//\r
+\r
+//\r
+// Trans Grosse\r
+//\r
+               SPR_TRANS_W1,SPR_TRANS_W2,SPR_TRANS_W3,SPR_TRANS_W4,\r
+               SPR_TRANS_SHOOT1,SPR_TRANS_SHOOT2,SPR_TRANS_SHOOT3,SPR_TRANS_DEAD,\r
+\r
+               SPR_TRANS_DIE1,SPR_TRANS_DIE2,SPR_TRANS_DIE3,\r
+\r
+//\r
+// Wilhelm\r
+//\r
+               SPR_WILL_W1,SPR_WILL_W2,SPR_WILL_W3,SPR_WILL_W4,\r
+               SPR_WILL_SHOOT1,SPR_WILL_SHOOT2,SPR_WILL_SHOOT3,SPR_WILL_SHOOT4,\r
+\r
+               SPR_WILL_DIE1,SPR_WILL_DIE2,SPR_WILL_DIE3,SPR_WILL_DEAD,\r
+\r
+//\r
+// UberMutant\r
+//\r
+               SPR_UBER_W1,SPR_UBER_W2,SPR_UBER_W3,SPR_UBER_W4,\r
+               SPR_UBER_SHOOT1,SPR_UBER_SHOOT2,SPR_UBER_SHOOT3,SPR_UBER_SHOOT4,\r
+\r
+               SPR_UBER_DIE1,SPR_UBER_DIE2,SPR_UBER_DIE3,SPR_UBER_DIE4,\r
+               SPR_UBER_DEAD,\r
+\r
+//\r
+// Death Knight\r
+//\r
+               SPR_DEATH_W1,SPR_DEATH_W2,SPR_DEATH_W3,SPR_DEATH_W4,\r
+               SPR_DEATH_SHOOT1,SPR_DEATH_SHOOT2,SPR_DEATH_SHOOT3,SPR_DEATH_SHOOT4,\r
+\r
+               SPR_DEATH_DIE1,SPR_DEATH_DIE2,SPR_DEATH_DIE3,SPR_DEATH_DIE4,\r
+               SPR_DEATH_DIE5,SPR_DEATH_DIE6,SPR_DEATH_DEAD,\r
+\r
+//\r
+// Ghost\r
+//\r
+               SPR_SPECTRE_W1,SPR_SPECTRE_W2,SPR_SPECTRE_W3,SPR_SPECTRE_W4,\r
+               SPR_SPECTRE_F1,SPR_SPECTRE_F2,SPR_SPECTRE_F3,SPR_SPECTRE_F4,\r
+\r
+//\r
+// Angel of Death\r
+//\r
+               SPR_ANGEL_W1,SPR_ANGEL_W2,SPR_ANGEL_W3,SPR_ANGEL_W4,\r
+               SPR_ANGEL_SHOOT1,SPR_ANGEL_SHOOT2,SPR_ANGEL_TIRED1,SPR_ANGEL_TIRED2,\r
+\r
+               SPR_ANGEL_DIE1,SPR_ANGEL_DIE2,SPR_ANGEL_DIE3,SPR_ANGEL_DIE4,\r
+               SPR_ANGEL_DIE5,SPR_ANGEL_DIE6,SPR_ANGEL_DIE7,SPR_ANGEL_DEAD,\r
+\r
+#endif\r
+\r
+//\r
+// player attack frames\r
+//\r
+               SPR_KNIFEREADY,SPR_KNIFEATK1,SPR_KNIFEATK2,SPR_KNIFEATK3,\r
+               SPR_KNIFEATK4,\r
+\r
+               SPR_PISTOLREADY,SPR_PISTOLATK1,SPR_PISTOLATK2,SPR_PISTOLATK3,\r
+               SPR_PISTOLATK4,\r
+\r
+               SPR_MACHINEGUNREADY,SPR_MACHINEGUNATK1,SPR_MACHINEGUNATK2,MACHINEGUNATK3,\r
+               SPR_MACHINEGUNATK4,\r
+\r
+               SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3,\r
+               SPR_CHAINATK4,\r
+\r
+               };\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                  GLOBAL TYPES\r
+\r
+=============================================================================\r
+*/\r
+\r
+typedef long fixed;\r
+\r
+typedef enum {\r
+       di_north,\r
+       di_east,\r
+       di_south,\r
+       di_west\r
+} controldir_t;\r
+\r
+typedef enum {\r
+       dr_normal,\r
+       dr_lock1,\r
+       dr_lock2,\r
+       dr_lock3,\r
+       dr_lock4,\r
+       dr_elevator\r
+} door_t;\r
+\r
+typedef enum {\r
+       ac_badobject = -1,\r
+       ac_no,\r
+       ac_yes,\r
+       ac_allways\r
+} activetype;\r
+\r
+typedef enum {\r
+       nothing,\r
+       playerobj,\r
+       inertobj,\r
+       guardobj,\r
+       officerobj,\r
+       ssobj,\r
+       dogobj,\r
+       bossobj,\r
+       schabbobj,\r
+       fakeobj,\r
+       mechahitlerobj,\r
+       mutantobj,\r
+       needleobj,\r
+       fireobj,\r
+       bjobj,\r
+       ghostobj,\r
+       realhitlerobj,\r
+       gretelobj,\r
+       giftobj,\r
+       fatobj,\r
+       rocketobj,\r
+\r
+       spectreobj,\r
+       angelobj,\r
+       transobj,\r
+       uberobj,\r
+       willobj,\r
+       deathobj,\r
+       hrocketobj,\r
+       sparkobj\r
+} classtype;\r
+\r
+typedef enum {\r
+       dressing,\r
+       block,\r
+       bo_gibs,\r
+       bo_alpo,\r
+       bo_firstaid,\r
+       bo_key1,\r
+       bo_key2,\r
+       bo_key3,\r
+       bo_key4,\r
+       bo_cross,\r
+       bo_chalice,\r
+       bo_bible,\r
+       bo_crown,\r
+       bo_clip,\r
+       bo_clip2,\r
+       bo_machinegun,\r
+       bo_chaingun,\r
+       bo_food,\r
+       bo_fullheal,\r
+       bo_25clip,\r
+       bo_spear\r
+} stat_t;\r
+\r
+typedef enum {\r
+       east,\r
+       northeast,\r
+       north,\r
+       northwest,\r
+       west,\r
+       southwest,\r
+       south,\r
+       southeast,\r
+       nodir\r
+} dirtype;\r
+\r
+\r
+#define NUMENEMIES             22\r
+typedef enum {\r
+       en_guard,\r
+       en_officer,\r
+       en_ss,\r
+       en_dog,\r
+       en_boss,\r
+       en_schabbs,\r
+       en_fake,\r
+       en_hitler,\r
+       en_mutant,\r
+       en_blinky,\r
+       en_clyde,\r
+       en_pinky,\r
+       en_inky,\r
+       en_gretel,\r
+       en_gift,\r
+       en_fat,\r
+       en_spectre,\r
+       en_angel,\r
+       en_trans,\r
+       en_uber,\r
+       en_will,\r
+       en_death\r
+} enemy_t;\r
+\r
+\r
+typedef struct statestruct\r
+{\r
+       boolean rotate;\r
+       int             shapenum;                       // a shapenum of -1 means get from ob->temp1\r
+       int             tictime;\r
+       void    (*think) (),(*action) ();\r
+       struct  statestruct     *next;\r
+} statetype;\r
+\r
+\r
+//---------------------\r
+//\r
+// trivial actor structure\r
+//\r
+//---------------------\r
+\r
+typedef struct statstruct\r
+{\r
+       byte    tilex,tiley;\r
+       byte    *visspot;\r
+       int             shapenum;                       // if shapenum == -1 the obj has been removed\r
+       byte    flags;\r
+       byte    itemnumber;\r
+} statobj_t;\r
+\r
+\r
+//---------------------\r
+//\r
+// door actor structure\r
+//\r
+//---------------------\r
+\r
+typedef struct doorstruct\r
+{\r
+       byte    tilex,tiley;\r
+       boolean vertical;\r
+       byte    lock;\r
+       enum    {dr_open,dr_closed,dr_opening,dr_closing}       action;\r
+       int             ticcount;\r
+} doorobj_t;\r
+\r
+\r
+//--------------------\r
+//\r
+// thinking actor structure\r
+//\r
+//--------------------\r
+\r
+typedef struct objstruct\r
+{\r
+       activetype      active;\r
+       int                     ticcount;\r
+       classtype       obclass;\r
+       statetype       *state;\r
+\r
+       byte            flags;                          //      FL_SHOOTABLE, etc\r
+\r
+       long            distance;                       // if negative, wait for that door to open\r
+       dirtype         dir;\r
+\r
+       fixed           x,y;\r
+       unsigned        tilex,tiley;\r
+       byte            areanumber;\r
+\r
+       int                     viewx;\r
+       unsigned        viewheight;\r
+       fixed           transx,transy;          // in global coord\r
+\r
+       int             angle;\r
+       int                     hitpoints;\r
+       long            speed;\r
+\r
+       int                     temp1,temp2,temp3;\r
+       struct          objstruct       *next,*prev;\r
+} objtype;\r
+\r
+\r
+#define NUMBUTTONS     8\r
+enum   {\r
+       bt_nobutton=-1,\r
+       bt_attack=0,\r
+       bt_strafe,\r
+       bt_run,\r
+       bt_use,\r
+       bt_readyknife,\r
+       bt_readypistol,\r
+       bt_readymachinegun,\r
+       bt_readychaingun\r
+};\r
+\r
+\r
+#define NUMWEAPONS     5\r
+typedef enum   {\r
+       wp_knife,\r
+       wp_pistol,\r
+       wp_machinegun,\r
+       wp_chaingun\r
+} weapontype;\r
+\r
+\r
+typedef enum   {\r
+       gd_baby,\r
+       gd_easy,\r
+       gd_medium,\r
+       gd_hard\r
+};\r
+\r
+//---------------\r
+//\r
+// gamestate structure\r
+//\r
+//---------------\r
+\r
+typedef        struct\r
+{\r
+       int                     difficulty;\r
+       int                     mapon;\r
+       long            oldscore,score,nextextra;\r
+       int                     lives;\r
+       int                     health;\r
+       int                     ammo;\r
+       int                     keys;\r
+       weapontype              bestweapon,weapon,chosenweapon;\r
+\r
+       int                     faceframe;\r
+       int                     attackframe,attackcount,weaponframe;\r
+\r
+       int                     episode,secretcount,treasurecount,killcount,\r
+                               secrettotal,treasuretotal,killtotal;\r
+       long            TimeCount;\r
+       long            killx,killy;\r
+       boolean         victoryflag;            // set during victory animations\r
+} gametype;\r
+\r
+\r
+typedef        enum    {\r
+       ex_stillplaying,\r
+       ex_completed,\r
+       ex_died,\r
+       ex_warped,\r
+       ex_resetgame,\r
+       ex_loadedgame,\r
+       ex_victorious,\r
+       ex_abort,\r
+       ex_demodone,\r
+       ex_secretlevel\r
+} exit_t;\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_MAIN DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern boolean         MS_CheckParm (char far *string);\r
+\r
+extern char            str[80],str2[20];\r
+extern int                     tedlevelnum;\r
+extern boolean         tedlevel;\r
+extern boolean         nospr;\r
+extern boolean         IsA386;\r
+\r
+extern byte far        *scalermemory;\r
+\r
+extern fixed           focallength;\r
+extern unsigned        viewangles;\r
+extern unsigned        screenofs;\r
+extern int                 viewwidth;\r
+extern int                     viewheight;\r
+extern int                     centerx;\r
+extern int                     shootdelta;\r
+\r
+extern int                     dirangle[9];\r
+\r
+extern boolean         startgame,loadedgame,virtualreality;\r
+extern int             mouseadjustment;\r
+//\r
+// math tables\r
+//\r
+extern int                     pixelangle[MAXVIEWWIDTH];\r
+extern long            far finetangent[FINEANGLES/4];\r
+extern fixed           far sintable[],far *costable;\r
+\r
+//\r
+// derived constants\r
+//\r
+extern fixed   scale,maxslope;\r
+extern long    heightnumerator;\r
+extern int             minheightdiv;\r
+\r
+extern char    configname[13];\r
+\r
+\r
+\r
+void           HelpScreens (void);\r
+void           OrderingInfo (void);\r
+void           TEDDeath(void);\r
+void           Quit (char *error);\r
+void           CalcProjection (long focal);\r
+boolean                SetViewSize (unsigned width, unsigned height);\r
+void           NewGame (int difficulty,int episode);\r
+void           NewViewSize (int width);\r
+boolean        LoadTheGame(int file,int x,int y);\r
+boolean                SaveTheGame(int file,int x,int y);\r
+void           ShowViewSize (int width);\r
+void           ShutdownId (void);\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_GAME DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+extern boolean         ingame,fizzlein;\r
+extern unsigned        latchpics[NUMLATCHPICS];\r
+extern gametype        gamestate;\r
+extern int                     doornum;\r
+\r
+extern char            demoname[13];\r
+\r
+extern long            spearx,speary;\r
+extern unsigned        spearangle;\r
+extern boolean         spearflag;\r
+\r
+\r
+void   DrawPlayBorder (void);\r
+void   ScanInfoPlane (void);\r
+void   SetupGameLevel (void);\r
+void   NormalScreen (void);\r
+void   DrawPlayScreen (void);\r
+void   FizzleOut (void);\r
+void   GameLoop (void);\r
+void ClearMemory (void);\r
+void PlayDemo (int demonumber);\r
+void RecordDemo (void);\r
+void DrawAllPlayBorder (void);\r
+void   DrawHighScores(void);\r
+void DrawAllPlayBorderSides (void);\r
+\r
+\r
+// JAB\r
+#define        PlaySoundLocTile(s,tx,ty)       PlaySoundLocGlobal(s,(((long)(tx) << TILESHIFT) + (1L << (TILESHIFT - 1))),(((long)ty << TILESHIFT) + (1L << (TILESHIFT - 1))))\r
+#define        PlaySoundLocActor(s,ob)         PlaySoundLocGlobal(s,(ob)->x,(ob)->y)\r
+void   PlaySoundLocGlobal(word s,fixed gx,fixed gy);\r
+void UpdateSoundLoc(void);\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_PLAY DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#ifdef SPEAR\r
+extern long            funnyticount;           // FOR FUNNY BJ FACE\r
+#endif\r
+\r
+extern exit_t          playstate;\r
+\r
+extern boolean         madenoise;\r
+\r
+extern objtype         objlist[MAXACTORS],*new,*obj,*player,*lastobj,\r
+                                       *objfreelist,*killerobj;\r
+extern statobj_t       statobjlist[MAXSTATS],*laststatobj;\r
+extern doorobj_t       doorobjlist[MAXDOORS],*lastdoorobj;\r
+\r
+extern unsigned        farmapylookup[MAPSIZE];\r
+extern byte            *nearmapylookup[MAPSIZE];\r
+\r
+extern byte            tilemap[MAPSIZE][MAPSIZE];      // wall values only\r
+extern byte            spotvis[MAPSIZE][MAPSIZE];\r
+extern objtype         *actorat[MAPSIZE][MAPSIZE];\r
+\r
+#define UPDATESIZE                     (UPDATEWIDE*UPDATEHIGH)\r
+extern byte            update[UPDATESIZE];\r
+\r
+extern boolean         singlestep,godmode,noclip;\r
+extern int                     extravbls;\r
+\r
+//\r
+// control info\r
+//\r
+extern boolean         mouseenabled,joystickenabled,joypadenabled,joystickprogressive;\r
+extern int                     joystickport;\r
+extern int                     dirscan[4];\r
+extern int                     buttonscan[NUMBUTTONS];\r
+extern int                     buttonmouse[4];\r
+extern int                     buttonjoy[4];\r
+\r
+extern boolean         buttonheld[NUMBUTTONS];\r
+\r
+extern int                     viewsize;\r
+\r
+//\r
+// curent user input\r
+//\r
+extern int                     controlx,controly;              // range from -100 to 100\r
+extern boolean         buttonstate[NUMBUTTONS];\r
+\r
+extern boolean         demorecord,demoplayback;\r
+extern char            far *demoptr, far *lastdemoptr;\r
+extern memptr          demobuffer;\r
+\r
+\r
+\r
+void   InitRedShifts (void);\r
+void   FinishPaletteShifts (void);\r
+\r
+void   CenterWindow(word w,word h);\r
+void   InitActorList (void);\r
+void   GetNewActor (void);\r
+void   RemoveObj (objtype *gone);\r
+void   PollControls (void);\r
+void   StopMusic(void);\r
+void   StartMusic(void);\r
+void   PlayLoop (void);\r
+void StartDamageFlash (int damage);\r
+void StartBonusFlash (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       WL_INTER\r
+\r
+=============================================================================\r
+*/\r
+\r
+void IntroScreen (void);\r
+void PreloadGraphics(void);\r
+void LevelCompleted (void);\r
+void   CheckHighScore (long score,word other);\r
+void Victory (void);\r
+void ClearSplitVWB (void);\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       WL_DEBUG\r
+\r
+=============================================================================\r
+*/\r
+\r
+int DebugKeys (void);\r
+void PicturePause (void);\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_DRAW DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern unsigned screenloc[3];\r
+extern unsigned freelatch;\r
+\r
+extern long    lasttimecount;\r
+extern long    frameon;\r
+extern boolean fizzlein;\r
+\r
+extern unsigned        wallheight[MAXVIEWWIDTH];\r
+\r
+extern fixed   tileglobal;\r
+extern fixed   focallength;\r
+extern fixed   mindist;\r
+\r
+//\r
+// math tables\r
+//\r
+extern int                     pixelangle[MAXVIEWWIDTH];\r
+extern long            far finetangent[FINEANGLES/4];\r
+extern fixed           far sintable[],far *costable;\r
+\r
+//\r
+// derived constants\r
+//\r
+extern fixed   scale;\r
+extern long    heightnumerator,mindist;\r
+\r
+//\r
+// refresh variables\r
+//\r
+extern fixed   viewx,viewy;                    // the focal point\r
+extern int             viewangle;\r
+extern fixed   viewsin,viewcos;\r
+\r
+extern long            postsource;\r
+extern unsigned        postx;\r
+extern unsigned        postwidth;\r
+\r
+\r
+extern int             horizwall[],vertwall[];\r
+\r
+extern unsigned        pwallpos;\r
+\r
+\r
+fixed  FixedByFrac (fixed a, fixed b);\r
+void   TransformActor (objtype *ob);\r
+void   BuildTables (void);\r
+void   ClearScreen (void);\r
+int            CalcRotate (objtype *ob);\r
+void   DrawScaleds (void);\r
+void   CalcTics (void);\r
+void   FixOfs (void);\r
+void   ThreeDRefresh (void);\r
+void  FarScalePost (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_STATE DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+#define TURNTICS       10\r
+#define SPDPATROL      512\r
+#define SPDDOG         1500\r
+\r
+\r
+extern dirtype opposite[9];\r
+extern dirtype diagonal[9][9];\r
+\r
+\r
+void   InitHitRect (objtype *ob, unsigned radius);\r
+void   SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state);\r
+void   NewState (objtype *ob, statetype *state);\r
+\r
+boolean TryWalk (objtype *ob);\r
+void   SelectChaseDir (objtype *ob);\r
+void   SelectDodgeDir (objtype *ob);\r
+void   SelectRunDir (objtype *ob);\r
+void   MoveObj (objtype *ob, long move);\r
+boolean SightPlayer (objtype *ob);\r
+\r
+void   KillActor (objtype *ob);\r
+void   DamageActor (objtype *ob, unsigned damage);\r
+\r
+boolean CheckLine (objtype *ob);\r
+boolean        CheckSight (objtype *ob);\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_SCALE DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+#define COMPSCALECODESTART     (65*4)          // offset to start of code in comp scaler\r
+\r
+typedef struct\r
+{\r
+       unsigned        codeofs[65];\r
+       unsigned        width[65];\r
+       byte            code[];\r
+}      t_compscale;\r
+\r
+typedef struct\r
+{\r
+       unsigned        leftpix,rightpix;\r
+       unsigned        dataofs[64];\r
+// table data after dataofs[rightpix-leftpix+1]\r
+}      t_compshape;\r
+\r
+\r
+extern t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1];\r
+extern long                    fullscalefarcall[MAXSCALEHEIGHT+1];\r
+\r
+extern byte            bitmasks1[8][8];\r
+extern byte            bitmasks2[8][8];\r
+extern unsigned        wordmasks[8][8];\r
+\r
+extern byte            mapmasks1[4][8];\r
+extern byte            mapmasks2[4][8];\r
+extern byte            mapmasks3[4][8];\r
+\r
+extern int                     maxscale,maxscaleshl2;\r
+\r
+extern boolean insetupscaling;\r
+\r
+void SetupScaling (int maxscaleheight);\r
+void ScaleShape (int xcenter, int shapenum, unsigned height);\r
+void SimpleScaleShape (int xcenter, int shapenum, unsigned height);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_AGENT DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+//\r
+// player state info\r
+//\r
+extern boolean         running;\r
+extern long            thrustspeed;\r
+extern unsigned        plux,pluy;              // player coordinates scaled to unsigned\r
+\r
+extern int                     anglefrac;\r
+extern int                     facecount;\r
+\r
+void   SpawnPlayer (int tilex, int tiley, int dir);\r
+void   DrawFace (void);\r
+void   DrawHealth (void);\r
+void   TakeDamage (int points,objtype *attacker);\r
+void   HealSelf (int points);\r
+void   DrawLevel (void);\r
+void   DrawLives (void);\r
+void   GiveExtraMan (void);\r
+void   DrawScore (void);\r
+void   GivePoints (long points);\r
+void   DrawWeapon (void);\r
+void   DrawKeys (void);\r
+void   GiveWeapon (int weapon);\r
+void   DrawAmmo (void);\r
+void   GiveAmmo (int ammo);\r
+void   GiveKey (int key);\r
+void   GetBonus (statobj_t *check);\r
+\r
+void   Thrust (int angle, long speed);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_ACT1 DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern doorobj_t       doorobjlist[MAXDOORS],*lastdoorobj;\r
+extern int                     doornum;\r
+\r
+extern unsigned        doorposition[MAXDOORS],pwallstate;\r
+\r
+extern byte            far areaconnect[NUMAREAS][NUMAREAS];\r
+\r
+extern boolean         areabyplayer[NUMAREAS];\r
+\r
+extern unsigned        pwallstate;\r
+extern unsigned        pwallpos;                       // amount a pushable wall has been moved (0-63)\r
+extern unsigned        pwallx,pwally;\r
+extern int                     pwalldir;\r
+\r
+\r
+void InitDoorList (void);\r
+void InitStaticList (void);\r
+void SpawnStatic (int tilex, int tiley, int type);\r
+void SpawnDoor (int tilex, int tiley, boolean vertical, int lock);\r
+void MoveDoors (void);\r
+void MovePWalls (void);\r
+void OpenDoor (int door);\r
+void PlaceItemType (int itemtype, int tilex, int tiley);\r
+void PushWall (int checkx, int checky, int dir);\r
+void OperateDoor (int door);\r
+void InitAreas (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_ACT2 DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define s_nakedbody s_static10\r
+\r
+extern statetype s_grddie1;\r
+extern statetype s_dogdie1;\r
+extern statetype s_ofcdie1;\r
+extern statetype s_mutdie1;\r
+extern statetype s_ssdie1;\r
+extern statetype s_bossdie1;\r
+extern statetype s_schabbdie1;\r
+extern statetype s_fakedie1;\r
+extern statetype s_mechadie1;\r
+extern statetype s_hitlerdie1;\r
+extern statetype s_greteldie1;\r
+extern statetype s_giftdie1;\r
+extern statetype s_fatdie1;\r
+\r
+extern statetype s_spectredie1;\r
+extern statetype s_angeldie1;\r
+extern statetype s_transdie0;\r
+extern statetype s_uberdie0;\r
+extern statetype s_willdie1;\r
+extern statetype s_deathdie1;\r
+\r
+\r
+extern statetype s_grdchase1;\r
+extern statetype s_dogchase1;\r
+extern statetype s_ofcchase1;\r
+extern statetype s_sschase1;\r
+extern statetype s_mutchase1;\r
+extern statetype s_bosschase1;\r
+extern statetype s_schabbchase1;\r
+extern statetype s_fakechase1;\r
+extern statetype s_mechachase1;\r
+extern statetype s_gretelchase1;\r
+extern statetype s_giftchase1;\r
+extern statetype s_fatchase1;\r
+\r
+extern statetype s_spectrechase1;\r
+extern statetype s_angelchase1;\r
+extern statetype s_transchase1;\r
+extern statetype s_uberchase1;\r
+extern statetype s_willchase1;\r
+extern statetype s_deathchase1;\r
+\r
+extern statetype s_blinkychase1;\r
+extern statetype s_hitlerchase1;\r
+\r
+extern statetype s_grdpain;\r
+extern statetype s_grdpain1;\r
+extern statetype s_ofcpain;\r
+extern statetype s_ofcpain1;\r
+extern statetype s_sspain;\r
+extern statetype s_sspain1;\r
+extern statetype s_mutpain;\r
+extern statetype s_mutpain1;\r
+\r
+extern statetype s_deathcam;\r
+\r
+extern statetype s_schabbdeathcam2;\r
+extern statetype s_hitlerdeathcam2;\r
+extern statetype s_giftdeathcam2;\r
+extern statetype s_fatdeathcam2;\r
+\r
+void SpawnStand (enemy_t which, int tilex, int tiley, int dir);\r
+void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir);\r
+void KillActor (objtype *ob);\r
+\r
+void   US_ControlPanel(byte);\r
+\r
+void SpawnDeadGuard (int tilex, int tiley);\r
+void SpawnBoss (int tilex, int tiley);\r
+void SpawnGretel (int tilex, int tiley);\r
+void SpawnTrans (int tilex, int tiley);\r
+void SpawnUber (int tilex, int tiley);\r
+void SpawnWill (int tilex, int tiley);\r
+void SpawnDeath (int tilex, int tiley);\r
+void SpawnAngel (int tilex, int tiley);\r
+void SpawnSpectre (int tilex, int tiley);\r
+void SpawnGhosts (int which, int tilex, int tiley);\r
+void SpawnSchabbs (int tilex, int tiley);\r
+void SpawnGift (int tilex, int tiley);\r
+void SpawnFat (int tilex, int tiley);\r
+void SpawnFakeHitler (int tilex, int tiley);\r
+void SpawnHitler (int tilex, int tiley);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                WL_TEXT DEFINITIONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern char    helpfilename[],endfilename[];\r
+\r
+extern void    HelpScreens(void);\r
+extern void    EndText(void);\r
diff --git a/16/wf3d8086/wl_dr_a.asm b/16/wf3d8086/wl_dr_a.asm
new file mode 100755 (executable)
index 0000000..aec139a
--- /dev/null
@@ -0,0 +1,795 @@
+       IDEAL\r
+       MODEL   MEDIUM,C\r
+       P286\r
+\r
+SCREENSEG      =       0a000h\r
+\r
+FINEANGLES     =       3600\r
+DEG90          =       900\r
+DEG180         =       1800\r
+DEG270         =       2700\r
+DEG360         =       3600\r
+\r
+OP_JLE         =       07eh\r
+OP_JGE         =       07dh\r
+\r
+EXTRN  finetangent:DWORD       ; far array, starts at offset 0\r
+\r
+EXTRN  HitHorizWall:FAR\r
+EXTRN  HitVertWall:FAR\r
+EXTRN  HitHorizDoor:FAR\r
+EXTRN  HitVertDoor:FAR\r
+EXTRN  HitHorizPWall:FAR\r
+EXTRN  HitVertPWall:FAR\r
+\r
+\r
+DATASEG\r
+\r
+EXTRN  viewwidth:WORD\r
+\r
+EXTRN  tilemap:BYTE\r
+EXTRN  spotvis:BYTE\r
+EXTRN  pixelangle:WORD\r
+\r
+\r
+EXTRN  midangle:WORD\r
+EXTRN  angle:WORD\r
+\r
+EXTRN  focaltx:WORD\r
+EXTRN  focalty:WORD\r
+EXTRN  viewtx:WORD\r
+EXTRN  viewty:WORD\r
+EXTRN  viewx:DWORD\r
+EXTRN  viewy:DWORD\r
+\r
+EXTRN  xpartialup:WORD\r
+EXTRN  ypartialup:WORD\r
+EXTRN  xpartialdown:WORD\r
+EXTRN  ypartialdown:WORD\r
+\r
+EXTRN  tilehit:WORD\r
+EXTRN  pixx:WORD\r
+EXTRN  wallheight:WORD                 ; array of VIEWWIDTH entries\r
+\r
+EXTRN  xtile:WORD\r
+EXTRN  ytile:WORD\r
+EXTRN  xtilestep:WORD\r
+EXTRN  ytilestep:WORD\r
+EXTRN  xintercept:DWORD\r
+EXTRN  yintercept:DWORD\r
+EXTRN  xstep:DWORD\r
+EXTRN  ystep:DWORD\r
+\r
+EXTRN  doorposition:WORD               ; table of door position values\r
+\r
+\r
+EXTRN  pwallpos:WORD                   ; amound a pushable wall has been moved\r
+\r
+CODESEG\r
+\r
+;-------------------\r
+;\r
+; xpartialbyystep\r
+;\r
+; multiplies long [ystep] (possibly negative), by word [xpartial] (in BX)\r
+;\r
+; returns dx:ax\r
+; trashes bx,cx,di\r
+;\r
+;-------------------\r
+\r
+PROC xpartialbyystep NEAR\r
+;\r
+; setup\r
+;\r
+       mov     ax,[WORD ystep]\r
+       mov     cx,[WORD ystep+2]\r
+       or      cx,cx               ; is ystep negatice?\r
+       jns     @@multpos\r
+;\r
+; multiply negative cx:ax by bx\r
+;\r
+       neg     cx\r
+       neg     ax\r
+       sbb     cx,0\r
+\r
+       mul     bx                                      ; fraction*fraction\r
+       mov     di,dx                           ; di is low word of result\r
+       mov     ax,cx                           ;\r
+       mul     bx                                      ; units*fraction\r
+       add     ax,di\r
+       adc     dx,0\r
+\r
+       neg     dx\r
+       neg     ax\r
+       sbb     dx,0\r
+       ret\r
+;\r
+; multiply positive cx:ax by bx\r
+;\r
+EVEN\r
+@@multpos:\r
+       mul     bx                                      ; fraction*fraction\r
+       mov     di,dx                           ; di is low word of result\r
+       mov     ax,cx                           ;\r
+       mul     bx                                      ; units*fraction\r
+       add     ax,di\r
+       adc     dx,0\r
+\r
+       ret\r
+\r
+ENDP\r
+\r
+\r
+\r
+;-------------------\r
+;\r
+; ypartialbyxstep\r
+;\r
+; multiplies long [xstep] (possibly negative), by word [ypartial] (in BP)\r
+;\r
+; returns dx:ax\r
+; trashes cx,di,bp\r
+;\r
+;-------------------\r
+\r
+PROC ypartialbyxstep NEAR\r
+;\r
+; setup\r
+;\r
+       mov     ax,[WORD xstep]\r
+       mov     cx,[WORD xstep+2]\r
+       or      cx,cx               ; is ystep negatice?\r
+       jns     @@multpos\r
+;\r
+; multiply negative cx:ax by bx\r
+;\r
+       neg     cx\r
+       neg     ax\r
+       sbb     cx,0\r
+\r
+       mul     bp                                      ; fraction*fraction\r
+       mov     di,dx                           ; di is low word of result\r
+       mov     ax,cx                           ;\r
+       mul     bp                                      ; units*fraction\r
+       add     ax,di\r
+       adc     dx,0\r
+\r
+       neg     dx\r
+       neg     ax\r
+       sbb     dx,0\r
+       ret\r
+;\r
+; multiply positive cx:ax by bx\r
+;\r
+EVEN\r
+@@multpos:\r
+       mul     bp                                      ; fraction*fraction\r
+       mov     di,dx                           ; di is low word of result\r
+       mov     ax,cx                           ;\r
+       mul     bp                                      ; units*fraction\r
+       add     ax,di\r
+       adc     dx,0\r
+       ret\r
+\r
+ENDP\r
+\r
+\r
+;============================\r
+;\r
+; AsmRefresh\r
+;\r
+;\r
+;============================\r
+\r
+PROC   AsmRefresh\r
+PUBLIC AsmRefresh\r
+\r
+       push    si\r
+       push    di\r
+       push    bp\r
+\r
+       mov     [pixx],0\r
+;---------------------------------------------------------------------------\r
+;\r
+; Setup to trace a ray through pixx view pixel\r
+;\r
+; CX : angle of the ray through pixx\r
+; ES : points to segment of finetangent array for this block of code\r
+;\r
+; Upon entrance to initialize block\r
+;\r
+; BX : xpartial\r
+; BP : ypartial\r
+;\r
+;---------------------------------------------------------------------------\r
+       EVEN\r
+pixxloop:\r
+       mov     ax,SEG finetangent\r
+       mov     es,ax\r
+       mov     cx,[midangle]                   ; center of view area\r
+       mov     bx,[pixx]\r
+       shl     bx,1\r
+       add     cx,[pixelangle+bx]              ; delta for this pixel\r
+       cmp     cx,0\r
+       jge     not0\r
+;----------\r
+;\r
+; -90 - -1 degree arc\r
+;\r
+;----------\r
+       add     cx,FINEANGLES                   ; -90 is the same as 270\r
+       jmp     entry360\r
+\r
+not0:\r
+       cmp     cx,DEG90\r
+       jge     not90\r
+;----------\r
+;\r
+; 0-89 degree arc\r
+;\r
+;----------\r
+entry90:\r
+       mov     [xtilestep],1                   ; xtilestep = 1\r
+       mov     [ytilestep],-1                  ; ytilestep = -1\r
+       mov     [BYTE cs:horizop],OP_JGE        ; patch a jge in\r
+       mov     [BYTE cs:vertop],OP_JLE         ; patch a jle in\r
+       mov     bx,DEG90-1\r
+       sub     bx,cx\r
+       ;begin 8086 hack\r
+       ;shl    bx,2\r
+       shl bx,1\r
+       shl bx,1\r
+       ;end 8086 hack\r
+       mov     ax,[es:bx]\r
+       mov     dx,[es:bx+2]\r
+       mov     [WORD xstep],ax\r
+       mov     [WORD xstep+2],dx               ; xstep = finetangent[DEG90-1-angle]\r
+       mov     bx,cx\r
+       ;begin 8086 hack\r
+       ;shl    bx,2\r
+       shl bx,1\r
+       shl bx,1\r
+       ;end 8086 hack\r
+       mov     ax,[es:bx]\r
+       mov     dx,[es:bx+2]\r
+       neg     dx\r
+       neg     ax\r
+       sbb     dx,0\r
+       mov     [WORD ystep],ax\r
+       mov     [WORD ystep+2],dx               ; ystep = -finetangent[angle]\r
+\r
+       mov     bx,[xpartialup]                 ; xpartial = xpartialup\r
+       mov     bp,[ypartialdown]               ; ypartial = ypartialdown\r
+       jmp     initvars\r
+\r
+not90:\r
+       cmp     cx,DEG180\r
+       jge     not180\r
+;----------\r
+;\r
+; 90-179 degree arc\r
+;\r
+;----------\r
+       mov     ax,-1\r
+       mov     [xtilestep],ax                  ; xtilestep = -1\r
+       mov     [ytilestep],ax                  ; ytilestep = -1\r
+       mov     [BYTE cs:horizop],OP_JLE        ; patch a jle in\r
+       mov     [BYTE cs:vertop],OP_JLE         ; patch a jle in\r
+\r
+       mov     bx,cx\r
+       ;begin 8086 hack\r
+       ;shl    bx,2\r
+       shl bx,1\r
+       shl bx,1\r
+       ;end 8086 hack\r
+       mov     ax,[es:bx-DEG90*4]\r
+       mov     dx,[es:bx+2-DEG90*4]\r
+       neg     dx\r
+       neg     ax\r
+       sbb     dx,0\r
+       mov     [WORD xstep],ax\r
+       mov     [WORD xstep+2],dx               ; xstep = -finetangent[angle-DEG90]\r
+       mov     bx,DEG180-1\r
+       sub     bx,cx\r
+       ;begin 8086 hack\r
+       ;shl    bx,2\r
+       shl bx,1\r
+       shl bx,1\r
+       ;end 8086 hack\r
+       mov     ax,[es:bx]\r
+       mov     dx,[es:bx+2]\r
+       neg     dx\r
+       neg     ax\r
+       sbb     dx,0\r
+       mov     [WORD ystep],ax\r
+       mov     [WORD ystep+2],dx               ; ystep = -finetangent[DEG180-1-angle]\r
+\r
+       mov     bx,[xpartialdown]               ; xpartial = xpartialdown\r
+       mov     bp,[ypartialdown]               ; ypartial = ypartialdown\r
+       jmp     initvars\r
+\r
+not180:\r
+       cmp     cx,DEG270\r
+       jge     not270\r
+;----------\r
+;\r
+; 180-269 degree arc\r
+;\r
+;----------\r
+       mov     [xtilestep],-1                  ; xtilestep = -1\r
+       mov     [ytilestep],1                   ; ytilestep = 1\r
+       mov     [BYTE cs:horizop],OP_JLE        ; patch a jle in\r
+       mov     [BYTE cs:vertop],OP_JGE         ; patch a jge in\r
+\r
+       mov     bx,DEG270-1\r
+       sub     bx,cx\r
+       ;begin 8086 hack\r
+       ;shl    bx,2\r
+       shl bx,1\r
+       shl bx,1\r
+       ;end 8086 hack\r
+       mov     ax,[es:bx]\r
+       mov     dx,[es:bx+2]\r
+       neg     dx\r
+       neg     ax\r
+       sbb     dx,0\r
+       mov     [WORD xstep],ax\r
+       mov     [WORD xstep+2],dx               ; xstep = -finetangent[DEG270-1-angle]\r
+       mov     bx,cx\r
+       ;begin 8086 hack\r
+       ;shl    bx,2\r
+       shl bx,1\r
+       shl bx,1\r
+       ;end 8086 hack\r
+       mov     ax,[es:bx-DEG180*4]\r
+       mov     dx,[es:bx+2-DEG180*4]\r
+       mov     [WORD ystep],ax\r
+       mov     [WORD ystep+2],dx               ; ystep = finetangent[angle-DEG180]\r
+\r
+       mov     bx,[xpartialdown]               ; xpartial = xpartialdown\r
+       mov     bp,[ypartialup]                 ; ypartial = ypartialup\r
+       jmp     initvars\r
+\r
+\r
+not270:\r
+       cmp     cx,DEG360\r
+       jge     not360\r
+;----------\r
+;\r
+; 270-359 degree arc\r
+;\r
+;----------\r
+entry360:\r
+       mov     ax,1\r
+       mov     [xtilestep],ax                  ; xtilestep = 1\r
+       mov     [ytilestep],ax                  ; ytilestep = 1\r
+       mov     [BYTE cs:horizop],OP_JGE        ; patch a jge in\r
+       mov     [BYTE cs:vertop],OP_JGE         ; patch a jge in\r
+\r
+       mov     bx,cx\r
+       ;begin 8086 hack\r
+       ;shl    bx,2\r
+       shl bx,1\r
+       shl bx,1\r
+       ;end 8086 hack\r
+       mov     ax,[es:bx-DEG270*4]\r
+       mov     dx,[es:bx+2-DEG270*4]\r
+       mov     [WORD xstep],ax\r
+       mov     [WORD xstep+2],dx               ; xstep = finetangent[angle-DEG270]\r
+       mov     bx,DEG360-1\r
+       sub     bx,cx\r
+       ;begin 8086 hack\r
+       ;shl    bx,2\r
+       shl bx,1\r
+       shl bx,1\r
+       ;end 8086 hack\r
+       mov     ax,[es:bx]\r
+       mov     dx,[es:bx+2]\r
+       mov     [WORD ystep],ax\r
+       mov     [WORD ystep+2],dx               ; ystep = finetangent[DEG360-1-angle]\r
+\r
+       mov     bx,[xpartialup]                 ; xpartial = xpartialup\r
+       mov     bp,[ypartialup]                 ; ypartial = ypartialup\r
+       jmp     initvars\r
+\r
+\r
+not360:\r
+;----------\r
+;\r
+; 360-449 degree arc\r
+;\r
+;----------\r
+       sub     cx,FINEANGLES                   ; -449 is the same as 89\r
+       jmp     entry90\r
+\r
+;---------------------------------------------------------------------------\r
+;\r
+; initialise variables for intersection testing\r
+;\r
+;---------------------------------------------------------------------------\r
+initvars:\r
+       call    NEAR xpartialbyystep    ; xpartial is in BX\r
+       add     ax,[WORD viewy]\r
+       adc     dx,[WORD viewy+2]\r
+       mov     [WORD yintercept],ax\r
+       mov     [WORD yintercept+2],dx\r
+\r
+       mov     si,[focaltx]\r
+       add     si,[xtilestep]\r
+       mov     [xtile],si                                      ; xtile = focaltx+xtilestep\r
+       ;begin 8086 hack\r
+       ;shl    si,6\r
+       push cx\r
+       mov cl,6\r
+       shl si,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       add     si,dx                                           ; xspot = (xtile<<6) + yinttile\r
+\r
+\r
+       call    NEAR ypartialbyxstep    ; ypartial is in BP\r
+       add     ax,[WORD viewx]\r
+       adc     dx,[WORD viewx+2]\r
+       mov     [WORD xintercept],ax\r
+       mov     cx,dx\r
+\r
+       mov     bx,[focalty]\r
+       add     bx,[ytilestep]\r
+       mov     bp,bx                                           ; ytile = focalty+ytilestep\r
+       mov     di,dx\r
+       ;begin 8086 hack\r
+       ;shl    di,6\r
+       push cx\r
+       mov cl,6\r
+       shl di,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       add     di,bx                                           ; yspot = (xinttile<<6) + ytile\r
+\r
+       mov     bx,[xtile]\r
+       mov     dx,[WORD yintercept+2]\r
+       mov     ax,SCREENSEG\r
+       mov     es,ax                                           ; faster than mov es,[screenseg]\r
+\r
+\r
+;---------------------------------------------------------------------------\r
+;\r
+; trace along this angle until we hit a wall\r
+;\r
+; CORE LOOP!\r
+;\r
+; All variables are killed when a wall is hit\r
+;\r
+; AX : scratch\r
+; BX : xtile\r
+; CX : high word of xintercept\r
+; DX : high word of yintercept\r
+; SI : xspot (yinttile<<6)+xtile (index into tilemap and spotvis)\r
+; DI : yspot (xinttile<<6)+ytile (index into tilemap and spotvis)\r
+; BP : ytile\r
+; ES : screenseg\r
+;\r
+;---------------------------------------------------------------------------\r
+\r
+;-----------\r
+;\r
+; check intersections with vertical walls\r
+;\r
+;-----------\r
+\r
+       EVEN\r
+vertcheck:\r
+       cmp     dx,bp\r
+vertop:                                                                ; 0x7e = jle (ytilestep==-1)\r
+       jle     horizentry                                      ; 0x7d = jge (ytilestep==1)\r
+vertentry:\r
+       test [BYTE tilemap+si],0ffh             ; tilehit = *((byte *)tilemap+xspot);\r
+       jnz     hitvert\r
+passvert:\r
+       mov     [BYTE spotvis+si],1                     ; *((byte *)spotvis+xspot) = true;\r
+       add     bx,[xtilestep]                          ; xtile+=xtilestep\r
+       mov     ax,[WORD ystep]\r
+       add     [WORD yintercept],ax            ; yintercept += ystep\r
+       adc     dx,[WORD ystep+2]\r
+       mov     si,bx\r
+       ;begin 8086 hack\r
+       ;shl    si,6\r
+       push cx\r
+       mov cl,6\r
+       shl si,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       add     si,dx                                           ; xspot = (xtile<<6)+yinttile\r
+       jmp     vertcheck\r
+\r
+       EVEN\r
+hitvert:\r
+       mov     al,[BYTE tilemap+si]            ; tilehit = *((byte *)tilemap+xspot);\r
+       mov     [BYTE tilehit],al\r
+       or      al,al                                           ; set flags\r
+       jns     notvertdoor\r
+       jmp     vertdoor\r
+notvertdoor:\r
+       mov     [WORD xintercept],0\r
+       mov     [WORD xintercept+2],bx\r
+       mov     [xtile],bx\r
+       mov     [WORD yintercept+2],dx\r
+       mov     [ytile],dx\r
+       call FAR HitVertWall\r
+       jmp nextpix\r
+\r
+\r
+;-----------\r
+;\r
+; check intersections with horizontal walls\r
+;\r
+;-----------\r
+       EVEN\r
+horizcheck:\r
+       cmp     cx,bx\r
+horizop:                                                       ; 0x7e = jle (xtilestep==-1)\r
+       jle     vertentry                                       ; 0x7d = jge (xtilestep==1)\r
+horizentry:\r
+       test [BYTE tilemap+di],0ffh             ; tilehit = *((byte *)tilemap+yspot);\r
+       jnz     hithoriz\r
+passhoriz:\r
+       mov     [BYTE spotvis+di],1                     ; *((byte *)spotvis+yspot) = true;\r
+       add     bp,[ytilestep]                          ; ytile+=ytilestep\r
+       mov     ax,[WORD xstep]\r
+       add     [WORD xintercept],ax            ; xintercept += xstep\r
+       adc     cx,[WORD xstep+2]\r
+       mov     di,cx\r
+       ;begin 8086 hack\r
+       ;shl    di,6\r
+       push cx\r
+       mov cl,6\r
+       shl di,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       add     di,bp                                           ; yspot = (xinttile<<6)+ytile\r
+       jmp     horizcheck\r
+\r
+       EVEN\r
+hithoriz:\r
+       mov     al,[BYTE tilemap+di]            ; tilehit = *((byte *)tilemap+yspot);\r
+       mov     [BYTE tilehit],al\r
+       or      al,al                                           ; set flags\r
+       js      horizdoor\r
+       mov     [WORD xintercept+2],cx\r
+       mov     [xtile],cx\r
+       mov     [WORD yintercept],0\r
+       mov     [WORD yintercept+2],bp\r
+       mov     [ytile],bp\r
+       call FAR HitHorizWall\r
+       jmp nextpix\r
+\r
+;---------------------------------------------------------------------------\r
+;\r
+; next pixel over\r
+;\r
+;---------------------------------------------------------------------------\r
+\r
+nextpix:\r
+       mov     ax,[pixx]\r
+       inc     ax\r
+       mov     [pixx],ax\r
+       cmp     ax,[viewwidth]\r
+       jge     done\r
+       jmp     pixxloop\r
+done:\r
+       pop     bp\r
+       pop     di\r
+       pop     si\r
+       retf\r
+\r
+;===========================================================================\r
+\r
+;=============\r
+;\r
+; hit a special horizontal wall, so find which coordinate a door would be\r
+; intersected at, and check to see if the door is open past that point\r
+;\r
+;=============\r
+horizdoor:\r
+       mov     [xtile],bx                                      ; save off live register variables\r
+       mov     [WORD yintercept+2],dx\r
+\r
+       test al,040h                                    ; both high bits set == pushable wall\r
+       jnz     horizpushwall\r
+\r
+       mov     bx,ax\r
+       and     bx,7fh                                          ; strip high bit\r
+       shl     bx,1                        ; index into word width door table\r
+\r
+       mov     ax,[WORD xstep]\r
+       mov     dx,[WORD xstep+2]\r
+       sar     dx,1\r
+       rcr ax,1                                                ; half a step gets to door position\r
+\r
+       add     ax,[WORD xintercept]            ; add half step to current intercept pos\r
+       adc     dx,cx                                           ; CX hold high word of xintercept\r
+\r
+       cmp     cx,dx                                           ; is it still in the same tile?\r
+       je      hithmid\r
+;\r
+; midpoint is outside tile, so it hit the side of the wall before a door\r
+;\r
+continuehoriz:\r
+       mov     bx,[xtile]                                      ; reload register variables\r
+       mov     dx,[WORD yintercept+2]\r
+       jmp     passhoriz                                       ; continue tracing\r
+;\r
+; the trace hit the door plane at pixel position AX, see if the door is\r
+; closed that much\r
+;\r
+hithmid:\r
+       cmp     ax,[doorposition+bx]            ; position of leading edge of door\r
+       jb      continuehoriz\r
+;\r
+; draw the door\r
+;\r
+       mov     [WORD xintercept],ax            ; save pixel intercept position\r
+       mov     [WORD xintercept+2],cx\r
+\r
+       mov     [WORD yintercept],8000h         ; intercept in middle of tile\r
+       mov     [WORD yintercept+2],bp\r
+\r
+       call    FAR HitHorizDoor\r
+       jmp     nextpix\r
+\r
+;============\r
+;\r
+; hit a sliding horizontal wall\r
+;\r
+;============\r
+\r
+horizpushwall:\r
+       mov     ax,[WORD xstep+2]                       ; multiply xstep by pwallmove (0-63)\r
+       mul     [pwallpos]\r
+       mov     bx,ax\r
+       mov     ax,[WORD xstep]\r
+       mul     [pwallpos]\r
+       add     dx,bx\r
+\r
+       sar     dx,1                                            ; then divide by 64 to accomplish a\r
+       rcr ax,1                                                ; fixed point multiplication\r
+       sar     dx,1\r
+       rcr ax,1\r
+       sar     dx,1\r
+       rcr ax,1\r
+       sar     dx,1\r
+       rcr ax,1\r
+       sar     dx,1\r
+       rcr ax,1\r
+       sar     dx,1\r
+       rcr ax,1\r
+\r
+       add     ax,[WORD xintercept]            ; add partial step to current intercept\r
+       adc     dx,cx                                           ; CX hold high word of xintercept\r
+\r
+       cmp     cx,dx                                           ; is it still in the same tile?\r
+       jne     continuehoriz                           ; no, it hit the side\r
+\r
+;\r
+; draw the pushable wall at the new height\r
+;\r
+       mov     [WORD xintercept],ax            ; save pixel intercept position\r
+       mov     [WORD xintercept+2],dx\r
+\r
+       mov     [WORD yintercept+2],bp\r
+       mov     [WORD yintercept],0\r
+\r
+       call    FAR HitHorizPWall\r
+       jmp     nextpix\r
+\r
+\r
+\r
+;===========================================================================\r
+\r
+;=============\r
+;\r
+; hit a special vertical wall, so find which coordinate a door would be\r
+; intersected at, and check to see if the door is open past that point\r
+;\r
+;=============\r
+vertdoor:\r
+       mov     [xtile],bx                                      ; save off live register variables\r
+       mov     [WORD yintercept+2],dx\r
+\r
+       test al,040h                                    ; both high bits set == pushable wall\r
+       jnz     vertpushwall\r
+\r
+       mov     bx,ax\r
+       and     bx,7fh                                          ; strip high bit\r
+       shl     bx,1                        ; index into word width doorposition\r
+\r
+       mov     ax,[WORD ystep]\r
+       mov     dx,[WORD ystep+2]\r
+       sar     dx,1\r
+       rcr ax,1                                                ; half a step gets to door position\r
+\r
+       add     ax,[WORD yintercept]            ; add half step to current intercept pos\r
+       adc     dx,[WORD yintercept+2]\r
+\r
+       cmp     [WORD yintercept+2],dx          ; is it still in the same tile?\r
+       je      hitvmid\r
+;\r
+; midpoint is outside tile, so it hit the side of the wall before a door\r
+;\r
+continuevert:\r
+       mov     bx,[xtile]                                      ; reload register variables\r
+       mov     dx,[WORD yintercept+2]\r
+       jmp     passvert                                        ; continue tracing\r
+;\r
+; the trace hit the door plane at pixel position AX, see if the door is\r
+; closed that much\r
+;\r
+hitvmid:\r
+       cmp     ax,[doorposition+bx]            ; position of leading edge of door\r
+       jb      continuevert\r
+;\r
+; draw the door\r
+;\r
+       mov     [WORD yintercept],ax            ; save pixel intercept position\r
+       mov     [WORD xintercept],8000h         ; intercept in middle of tile\r
+       mov     ax,[xtile]\r
+       mov     [WORD xintercept+2],ax\r
+\r
+       call    FAR HitVertDoor\r
+       jmp     nextpix\r
+\r
+;============\r
+;\r
+; hit a sliding vertical wall\r
+;\r
+;============\r
+\r
+vertpushwall:\r
+       mov     ax,[WORD ystep+2]                       ; multiply ystep by pwallmove (0-63)\r
+       mul     [pwallpos]\r
+       mov     bx,ax\r
+       mov     ax,[WORD ystep]\r
+       mul     [pwallpos]\r
+       add     dx,bx\r
+\r
+       sar     dx,1                                            ; then divide by 64 to accomplish a\r
+       rcr ax,1                                                ; fixed point multiplication\r
+       sar     dx,1\r
+       rcr ax,1\r
+       sar     dx,1\r
+       rcr ax,1\r
+       sar     dx,1\r
+       rcr ax,1\r
+       sar     dx,1\r
+       rcr ax,1\r
+       sar     dx,1\r
+       rcr ax,1\r
+\r
+       add     ax,[WORD yintercept]            ; add partial step to current intercept\r
+       adc     dx,[WORD yintercept+2]\r
+\r
+       cmp     [WORD yintercept+2],dx          ; is it still in the same tile?\r
+       jne     continuevert                            ; no, it hit the side\r
+\r
+;\r
+; draw the pushable wall at the new height\r
+;\r
+       mov     [WORD yintercept],ax            ; save pixel intercept position\r
+       mov     [WORD yintercept+2],dx\r
+\r
+       mov     bx,[xtile]\r
+       mov     [WORD xintercept+2],bx\r
+       mov     [WORD xintercept],0\r
+\r
+       call    FAR HitVertPWall\r
+       jmp     nextpix\r
+\r
+\r
+\r
+ENDP\r
+\r
+\r
+END\r
+\r
+\r
diff --git a/16/wf3d8086/wl_draw.c b/16/wf3d8086/wl_draw.c
new file mode 100755 (executable)
index 0000000..3c32e39
--- /dev/null
@@ -0,0 +1,1419 @@
+// WL_DRAW.C\r
+\r
+#include "WL_DEF.H"\r
+#include <DOS.H>\r
+#pragma hdrstop\r
+\r
+//#define DEBUGWALLS\r
+//#define DEBUGTICS\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+// the door is the last picture before the sprites\r
+#define DOORWALL       (PMSpriteStart-8)\r
+\r
+#define ACTORSIZE      0x4000\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+#ifdef DEBUGWALLS\r
+unsigned screenloc[3]= {0,0,0};\r
+#else\r
+unsigned screenloc[3]= {PAGE1START,PAGE2START,PAGE3START};\r
+#endif\r
+unsigned freelatch = FREESTART;\r
+\r
+long   lasttimecount;\r
+long   frameon;\r
+\r
+unsigned       wallheight[MAXVIEWWIDTH];\r
+\r
+fixed  tileglobal      = TILEGLOBAL;\r
+fixed  mindist         = MINDIST;\r
+\r
+\r
+//\r
+// math tables\r
+//\r
+int                    pixelangle[MAXVIEWWIDTH];\r
+long           far finetangent[FINEANGLES/4];\r
+fixed          far sintable[ANGLES+ANGLES/4],far *costable = sintable+(ANGLES/4);\r
+\r
+//\r
+// refresh variables\r
+//\r
+fixed  viewx,viewy;                    // the focal point\r
+int            viewangle;\r
+fixed  viewsin,viewcos;\r
+\r
+\r
+\r
+fixed  FixedByFrac (fixed a, fixed b);\r
+void   TransformActor (objtype *ob);\r
+void   BuildTables (void);\r
+void   ClearScreen (void);\r
+int            CalcRotate (objtype *ob);\r
+void   DrawScaleds (void);\r
+void   CalcTics (void);\r
+void   FixOfs (void);\r
+void   ThreeDRefresh (void);\r
+\r
+\r
+\r
+//\r
+// wall optimization variables\r
+//\r
+int            lastside;               // true for vertical\r
+long   lastintercept;\r
+int            lasttilehit;\r
+\r
+\r
+//\r
+// ray tracing variables\r
+//\r
+int                    focaltx,focalty,viewtx,viewty;\r
+\r
+int                    midangle,angle;\r
+unsigned       xpartial,ypartial;\r
+unsigned       xpartialup,xpartialdown,ypartialup,ypartialdown;\r
+unsigned       xinttile,yinttile;\r
+\r
+unsigned       tilehit;\r
+unsigned       pixx;\r
+\r
+int            xtile,ytile;\r
+int            xtilestep,ytilestep;\r
+long   xintercept,yintercept;\r
+long   xstep,ystep;\r
+\r
+int            horizwall[MAXWALLTILES],vertwall[MAXWALLTILES];\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+void AsmRefresh (void);                        // in WL_DR_A.ASM\r
+\r
+/*\r
+============================================================================\r
+\r
+                          3 - D  DEFINITIONS\r
+\r
+============================================================================\r
+*/\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+========================\r
+=\r
+= FixedByFrac\r
+=\r
+= multiply a 16/16 bit, 2's complement fixed point number by a 16 bit\r
+= fraction, passed as a signed magnitude 32 bit number\r
+=\r
+========================\r
+*/\r
+\r
+#pragma warn -rvl                      // I stick the return value in with ASMs\r
+\r
+fixed FixedByFrac (fixed a, fixed b)\r
+{\r
+//\r
+// setup\r
+//\r
+asm    mov     si,[WORD PTR b+2]       // sign of result = sign of fraction\r
+\r
+asm    mov     ax,[WORD PTR a]\r
+asm    mov     cx,[WORD PTR a+2]\r
+\r
+asm    or      cx,cx\r
+asm    jns     aok:                            // negative?\r
+asm    neg     cx\r
+asm    neg     ax\r
+asm    sbb     cx,0\r
+asm    xor     si,0x8000                       // toggle sign of result\r
+aok:\r
+\r
+//\r
+// multiply  cx:ax by bx\r
+//\r
+asm    mov     bx,[WORD PTR b]\r
+asm    mul     bx                                      // fraction*fraction\r
+asm    mov     di,dx                           // di is low word of result\r
+asm    mov     ax,cx                           //\r
+asm    mul     bx                                      // units*fraction\r
+asm add        ax,di\r
+asm    adc     dx,0\r
+\r
+//\r
+// put result dx:ax in 2's complement\r
+//\r
+asm    test    si,0x8000               // is the result negative?\r
+asm    jz      ansok:\r
+asm    neg     dx\r
+asm    neg     ax\r
+asm    sbb     dx,0\r
+\r
+ansok:;\r
+\r
+}\r
+\r
+#pragma warn +rvl\r
+\r
+//==========================================================================\r
+\r
+/*\r
+========================\r
+=\r
+= TransformActor\r
+=\r
+= Takes paramaters:\r
+=   gx,gy              : globalx/globaly of point\r
+=\r
+= globals:\r
+=   viewx,viewy                : point of view\r
+=   viewcos,viewsin    : sin/cos of viewangle\r
+=   scale              : conversion from global value to screen value\r
+=\r
+= sets:\r
+=   screenx,transx,transy,screenheight: projected edge location and size\r
+=\r
+========================\r
+*/\r
+\r
+\r
+//\r
+// transform actor\r
+//\r
+void TransformActor (objtype *ob)\r
+{\r
+       int ratio;\r
+       fixed gx,gy,gxt,gyt,nx,ny;\r
+       long    temp;\r
+\r
+//\r
+// translate point to view centered coordinates\r
+//\r
+       gx = ob->x-viewx;\r
+       gy = ob->y-viewy;\r
+\r
+//\r
+// calculate newx\r
+//\r
+       gxt = FixedByFrac(gx,viewcos);\r
+       gyt = FixedByFrac(gy,viewsin);\r
+       nx = gxt-gyt-ACTORSIZE;         // fudge the shape forward a bit, because\r
+                                                               // the midpoint could put parts of the shape\r
+                                                               // into an adjacent wall\r
+\r
+//\r
+// calculate newy\r
+//\r
+       gxt = FixedByFrac(gx,viewsin);\r
+       gyt = FixedByFrac(gy,viewcos);\r
+       ny = gyt+gxt;\r
+\r
+//\r
+// calculate perspective ratio\r
+//\r
+       ob->transx = nx;\r
+       ob->transy = ny;\r
+\r
+       if (nx<mindist)                 // too close, don't overflow the divide\r
+       {\r
+         ob->viewheight = 0;\r
+         return;\r
+       }\r
+\r
+       ob->viewx = centerx + ny*scale/nx;      // DEBUG: use assembly divide\r
+\r
+//\r
+// calculate height (heightnumerator/(nx>>8))\r
+//\r
+       asm     mov     ax,[WORD PTR heightnumerator]\r
+       asm     mov     dx,[WORD PTR heightnumerator+2]\r
+       asm     idiv    [WORD PTR nx+1]                 // nx>>8\r
+       asm     mov     [WORD PTR temp],ax\r
+       asm     mov     [WORD PTR temp+2],dx\r
+\r
+       ob->viewheight = temp;\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+========================\r
+=\r
+= TransformTile\r
+=\r
+= Takes paramaters:\r
+=   tx,ty              : tile the object is centered in\r
+=\r
+= globals:\r
+=   viewx,viewy                : point of view\r
+=   viewcos,viewsin    : sin/cos of viewangle\r
+=   scale              : conversion from global value to screen value\r
+=\r
+= sets:\r
+=   screenx,transx,transy,screenheight: projected edge location and size\r
+=\r
+= Returns true if the tile is withing getting distance\r
+=\r
+========================\r
+*/\r
+\r
+boolean TransformTile (int tx, int ty, int *dispx, int *dispheight)\r
+{\r
+       int ratio;\r
+       fixed gx,gy,gxt,gyt,nx,ny;\r
+       long    temp;\r
+\r
+//\r
+// translate point to view centered coordinates\r
+//\r
+       gx = ((long)tx<<TILESHIFT)+0x8000-viewx;\r
+       gy = ((long)ty<<TILESHIFT)+0x8000-viewy;\r
+\r
+//\r
+// calculate newx\r
+//\r
+       gxt = FixedByFrac(gx,viewcos);\r
+       gyt = FixedByFrac(gy,viewsin);\r
+       nx = gxt-gyt-0x2000;            // 0x2000 is size of object\r
+\r
+//\r
+// calculate newy\r
+//\r
+       gxt = FixedByFrac(gx,viewsin);\r
+       gyt = FixedByFrac(gy,viewcos);\r
+       ny = gyt+gxt;\r
+\r
+\r
+//\r
+// calculate perspective ratio\r
+//\r
+       if (nx<mindist)                 // too close, don't overflow the divide\r
+       {\r
+               *dispheight = 0;\r
+               return false;\r
+       }\r
+\r
+       *dispx = centerx + ny*scale/nx; // DEBUG: use assembly divide\r
+\r
+//\r
+// calculate height (heightnumerator/(nx>>8))\r
+//\r
+       asm     mov     ax,[WORD PTR heightnumerator]\r
+       asm     mov     dx,[WORD PTR heightnumerator+2]\r
+       asm     idiv    [WORD PTR nx+1]                 // nx>>8\r
+       asm     mov     [WORD PTR temp],ax\r
+       asm     mov     [WORD PTR temp+2],dx\r
+\r
+       *dispheight = temp;\r
+\r
+//\r
+// see if it should be grabbed\r
+//\r
+       if (nx<TILEGLOBAL && ny>-TILEGLOBAL/2 && ny<TILEGLOBAL/2)\r
+               return true;\r
+       else\r
+               return false;\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= CalcHeight\r
+=\r
+= Calculates the height of xintercept,yintercept from viewx,viewy\r
+=\r
+====================\r
+*/\r
+\r
+#pragma warn -rvl                      // I stick the return value in with ASMs\r
+\r
+int    CalcHeight (void)\r
+{\r
+       int     transheight;\r
+       int ratio;\r
+       fixed gxt,gyt,nx,ny;\r
+       long    gx,gy;\r
+\r
+       gx = xintercept-viewx;\r
+       gxt = FixedByFrac(gx,viewcos);\r
+\r
+       gy = yintercept-viewy;\r
+       gyt = FixedByFrac(gy,viewsin);\r
+\r
+       nx = gxt-gyt;\r
+\r
+  //\r
+  // calculate perspective ratio (heightnumerator/(nx>>8))\r
+  //\r
+       if (nx<mindist)\r
+               nx=mindist;                     // don't let divide overflow\r
+\r
+       asm     mov     ax,[WORD PTR heightnumerator]\r
+       asm     mov     dx,[WORD PTR heightnumerator+2]\r
+       asm     idiv    [WORD PTR nx+1]                 // nx>>8\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= ScalePost\r
+=\r
+===================\r
+*/\r
+\r
+long           postsource;\r
+unsigned       postx;\r
+unsigned       postwidth;\r
+\r
+void   near ScalePost (void)           // VGA version\r
+{\r
+       asm     mov     ax,SCREENSEG\r
+       asm     mov     es,ax\r
+\r
+       asm     mov     bx,[postx]\r
+       asm     shl     bx,1\r
+       asm     mov     bp,WORD PTR [wallheight+bx]             // fractional height (low 3 bits frac)\r
+       asm     and     bp,0xfff8                               // bp = heightscaler*4\r
+       asm     shr     bp,1\r
+       asm     cmp     bp,[maxscaleshl2]\r
+       asm     jle     heightok\r
+       asm     mov     bp,[maxscaleshl2]\r
+heightok:\r
+       asm     add     bp,OFFSET fullscalefarcall\r
+       //\r
+       // scale a byte wide strip of wall\r
+       //\r
+       asm     mov     bx,[postx]\r
+       asm     mov     di,bx\r
+       asm     shr     di,1                                            // X in bytes\r
+       asm     shr     di,1\r
+       asm     add     di,[bufferofs]\r
+\r
+       asm     and     bx,3\r
+       /* begin 8086 hack\r
+       asm     shl     bx,3\r
+       */\r
+       asm push cx\r
+       asm mov cl,3\r
+       asm shl bx,cl\r
+       asm pop cx\r
+       /* end 8086 hack */\r
+       asm     add     bx,[postwidth]\r
+\r
+       asm     mov     al,BYTE PTR [mapmasks1-1+bx]    // -1 because no widths of 0\r
+       asm     mov     dx,SC_INDEX+1\r
+       asm     out     dx,al                                           // set bit mask register\r
+       asm     lds     si,DWORD PTR [postsource]\r
+       asm     call DWORD PTR [bp]                             // scale the line of pixels\r
+\r
+       asm     mov     al,BYTE PTR [ss:mapmasks2-1+bx]   // -1 because no widths of 0\r
+       asm     or      al,al\r
+       asm     jz      nomore\r
+\r
+       //\r
+       // draw a second byte for vertical strips that cross two bytes\r
+       //\r
+       asm     inc     di\r
+       asm     out     dx,al                                           // set bit mask register\r
+       asm     call DWORD PTR [bp]                             // scale the line of pixels\r
+\r
+       asm     mov     al,BYTE PTR [ss:mapmasks3-1+bx] // -1 because no widths of 0\r
+       asm     or      al,al\r
+       asm     jz      nomore\r
+       //\r
+       // draw a third byte for vertical strips that cross three bytes\r
+       //\r
+       asm     inc     di\r
+       asm     out     dx,al                                           // set bit mask register\r
+       asm     call DWORD PTR [bp]                             // scale the line of pixels\r
+\r
+\r
+nomore:\r
+       asm     mov     ax,ss\r
+       asm     mov     ds,ax\r
+}\r
+\r
+void  FarScalePost (void)                              // just so other files can call\r
+{\r
+       ScalePost ();\r
+}\r
+\r
+\r
+/*\r
+====================\r
+=\r
+= HitVertWall\r
+=\r
+= tilehit bit 7 is 0, because it's not a door tile\r
+= if bit 6 is 1 and the adjacent tile is a door tile, use door side pic\r
+=\r
+====================\r
+*/\r
+\r
+void HitVertWall (void)\r
+{\r
+       int                     wallpic;\r
+       unsigned        texture;\r
+\r
+       texture = (yintercept>>4)&0xfc0;\r
+       if (xtilestep == -1)\r
+       {\r
+               texture = 0xfc0-texture;\r
+               xintercept += TILEGLOBAL;\r
+       }\r
+       wallheight[pixx] = CalcHeight();\r
+\r
+       if (lastside==1 && lastintercept == xtile && lasttilehit == tilehit)\r
+       {\r
+               // in the same wall type as last time, so check for optimized draw\r
+               if (texture == (unsigned)postsource)\r
+               {\r
+               // wide scale\r
+                       postwidth++;\r
+                       wallheight[pixx] = wallheight[pixx-1];\r
+                       return;\r
+               }\r
+               else\r
+               {\r
+                       ScalePost ();\r
+                       (unsigned)postsource = texture;\r
+                       postwidth = 1;\r
+                       postx = pixx;\r
+               }\r
+       }\r
+       else\r
+       {\r
+       // new wall\r
+               if (lastside != -1)                             // if not the first scaled post\r
+                       ScalePost ();\r
+\r
+               lastside = true;\r
+               lastintercept = xtile;\r
+\r
+               lasttilehit = tilehit;\r
+               postx = pixx;\r
+               postwidth = 1;\r
+\r
+               if (tilehit & 0x40)\r
+               {                                                               // check for adjacent doors\r
+                       ytile = yintercept>>TILESHIFT;\r
+                       if ( tilemap[xtile-xtilestep][ytile]&0x80 )\r
+                               wallpic = DOORWALL+3;\r
+                       else\r
+                               wallpic = vertwall[tilehit & ~0x40];\r
+               }\r
+               else\r
+                       wallpic = vertwall[tilehit];\r
+\r
+               *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);\r
+               (unsigned)postsource = texture;\r
+\r
+       }\r
+}\r
+\r
+\r
+/*\r
+====================\r
+=\r
+= HitHorizWall\r
+=\r
+= tilehit bit 7 is 0, because it's not a door tile\r
+= if bit 6 is 1 and the adjacent tile is a door tile, use door side pic\r
+=\r
+====================\r
+*/\r
+\r
+void HitHorizWall (void)\r
+{\r
+       int                     wallpic;\r
+       unsigned        texture;\r
+\r
+       texture = (xintercept>>4)&0xfc0;\r
+       if (ytilestep == -1)\r
+               yintercept += TILEGLOBAL;\r
+       else\r
+               texture = 0xfc0-texture;\r
+       wallheight[pixx] = CalcHeight();\r
+\r
+       if (lastside==0 && lastintercept == ytile && lasttilehit == tilehit)\r
+       {\r
+               // in the same wall type as last time, so check for optimized draw\r
+               if (texture == (unsigned)postsource)\r
+               {\r
+               // wide scale\r
+                       postwidth++;\r
+                       wallheight[pixx] = wallheight[pixx-1];\r
+                       return;\r
+               }\r
+               else\r
+               {\r
+                       ScalePost ();\r
+                       (unsigned)postsource = texture;\r
+                       postwidth = 1;\r
+                       postx = pixx;\r
+               }\r
+       }\r
+       else\r
+       {\r
+       // new wall\r
+               if (lastside != -1)                             // if not the first scaled post\r
+                       ScalePost ();\r
+\r
+               lastside = 0;\r
+               lastintercept = ytile;\r
+\r
+               lasttilehit = tilehit;\r
+               postx = pixx;\r
+               postwidth = 1;\r
+\r
+               if (tilehit & 0x40)\r
+               {                                                               // check for adjacent doors\r
+                       xtile = xintercept>>TILESHIFT;\r
+                       if ( tilemap[xtile][ytile-ytilestep]&0x80 )\r
+                               wallpic = DOORWALL+2;\r
+                       else\r
+                               wallpic = horizwall[tilehit & ~0x40];\r
+               }\r
+               else\r
+                       wallpic = horizwall[tilehit];\r
+\r
+               *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);\r
+               (unsigned)postsource = texture;\r
+       }\r
+\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= HitHorizDoor\r
+=\r
+====================\r
+*/\r
+\r
+void HitHorizDoor (void)\r
+{\r
+       unsigned        texture,doorpage,doornum;\r
+\r
+       doornum = tilehit&0x7f;\r
+       texture = ( (xintercept-doorposition[doornum]) >> 4) &0xfc0;\r
+\r
+       wallheight[pixx] = CalcHeight();\r
+\r
+       if (lasttilehit == tilehit)\r
+       {\r
+       // in the same door as last time, so check for optimized draw\r
+               if (texture == (unsigned)postsource)\r
+               {\r
+               // wide scale\r
+                       postwidth++;\r
+                       wallheight[pixx] = wallheight[pixx-1];\r
+                       return;\r
+               }\r
+               else\r
+               {\r
+                       ScalePost ();\r
+                       (unsigned)postsource = texture;\r
+                       postwidth = 1;\r
+                       postx = pixx;\r
+               }\r
+       }\r
+       else\r
+       {\r
+               if (lastside != -1)                             // if not the first scaled post\r
+                       ScalePost ();                   // draw last post\r
+       // first pixel in this door\r
+               lastside = 2;\r
+               lasttilehit = tilehit;\r
+               postx = pixx;\r
+               postwidth = 1;\r
+\r
+               switch (doorobjlist[doornum].lock)\r
+               {\r
+               case dr_normal:\r
+                       doorpage = DOORWALL;\r
+                       break;\r
+               case dr_lock1:\r
+               case dr_lock2:\r
+               case dr_lock3:\r
+               case dr_lock4:\r
+                       doorpage = DOORWALL+6;\r
+                       break;\r
+               case dr_elevator:\r
+                       doorpage = DOORWALL+4;\r
+                       break;\r
+               }\r
+\r
+               *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(doorpage);\r
+               (unsigned)postsource = texture;\r
+       }\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= HitVertDoor\r
+=\r
+====================\r
+*/\r
+\r
+void HitVertDoor (void)\r
+{\r
+       unsigned        texture,doorpage,doornum;\r
+\r
+       doornum = tilehit&0x7f;\r
+       texture = ( (yintercept-doorposition[doornum]) >> 4) &0xfc0;\r
+\r
+       wallheight[pixx] = CalcHeight();\r
+\r
+       if (lasttilehit == tilehit)\r
+       {\r
+       // in the same door as last time, so check for optimized draw\r
+               if (texture == (unsigned)postsource)\r
+               {\r
+               // wide scale\r
+                       postwidth++;\r
+                       wallheight[pixx] = wallheight[pixx-1];\r
+                       return;\r
+               }\r
+               else\r
+               {\r
+                       ScalePost ();\r
+                       (unsigned)postsource = texture;\r
+                       postwidth = 1;\r
+                       postx = pixx;\r
+               }\r
+       }\r
+       else\r
+       {\r
+               if (lastside != -1)                             // if not the first scaled post\r
+                       ScalePost ();                   // draw last post\r
+       // first pixel in this door\r
+               lastside = 2;\r
+               lasttilehit = tilehit;\r
+               postx = pixx;\r
+               postwidth = 1;\r
+\r
+               switch (doorobjlist[doornum].lock)\r
+               {\r
+               case dr_normal:\r
+                       doorpage = DOORWALL;\r
+                       break;\r
+               case dr_lock1:\r
+               case dr_lock2:\r
+               case dr_lock3:\r
+               case dr_lock4:\r
+                       doorpage = DOORWALL+6;\r
+                       break;\r
+               case dr_elevator:\r
+                       doorpage = DOORWALL+4;\r
+                       break;\r
+               }\r
+\r
+               *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(doorpage+1);\r
+               (unsigned)postsource = texture;\r
+       }\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+====================\r
+=\r
+= HitHorizPWall\r
+=\r
+= A pushable wall in action has been hit\r
+=\r
+====================\r
+*/\r
+\r
+void HitHorizPWall (void)\r
+{\r
+       int                     wallpic;\r
+       unsigned        texture,offset;\r
+\r
+       texture = (xintercept>>4)&0xfc0;\r
+       offset = pwallpos<<10;\r
+       if (ytilestep == -1)\r
+               yintercept += TILEGLOBAL-offset;\r
+       else\r
+       {\r
+               texture = 0xfc0-texture;\r
+               yintercept += offset;\r
+       }\r
+\r
+       wallheight[pixx] = CalcHeight();\r
+\r
+       if (lasttilehit == tilehit)\r
+       {\r
+               // in the same wall type as last time, so check for optimized draw\r
+               if (texture == (unsigned)postsource)\r
+               {\r
+               // wide scale\r
+                       postwidth++;\r
+                       wallheight[pixx] = wallheight[pixx-1];\r
+                       return;\r
+               }\r
+               else\r
+               {\r
+                       ScalePost ();\r
+                       (unsigned)postsource = texture;\r
+                       postwidth = 1;\r
+                       postx = pixx;\r
+               }\r
+       }\r
+       else\r
+       {\r
+       // new wall\r
+               if (lastside != -1)                             // if not the first scaled post\r
+                       ScalePost ();\r
+\r
+               lasttilehit = tilehit;\r
+               postx = pixx;\r
+               postwidth = 1;\r
+\r
+               wallpic = horizwall[tilehit&63];\r
+\r
+               *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);\r
+               (unsigned)postsource = texture;\r
+       }\r
+\r
+}\r
+\r
+\r
+/*\r
+====================\r
+=\r
+= HitVertPWall\r
+=\r
+= A pushable wall in action has been hit\r
+=\r
+====================\r
+*/\r
+\r
+void HitVertPWall (void)\r
+{\r
+       int                     wallpic;\r
+       unsigned        texture,offset;\r
+\r
+       texture = (yintercept>>4)&0xfc0;\r
+       offset = pwallpos<<10;\r
+       if (xtilestep == -1)\r
+       {\r
+               xintercept += TILEGLOBAL-offset;\r
+               texture = 0xfc0-texture;\r
+       }\r
+       else\r
+               xintercept += offset;\r
+\r
+       wallheight[pixx] = CalcHeight();\r
+\r
+       if (lasttilehit == tilehit)\r
+       {\r
+               // in the same wall type as last time, so check for optimized draw\r
+               if (texture == (unsigned)postsource)\r
+               {\r
+               // wide scale\r
+                       postwidth++;\r
+                       wallheight[pixx] = wallheight[pixx-1];\r
+                       return;\r
+               }\r
+               else\r
+               {\r
+                       ScalePost ();\r
+                       (unsigned)postsource = texture;\r
+                       postwidth = 1;\r
+                       postx = pixx;\r
+               }\r
+       }\r
+       else\r
+       {\r
+       // new wall\r
+               if (lastside != -1)                             // if not the first scaled post\r
+                       ScalePost ();\r
+\r
+               lasttilehit = tilehit;\r
+               postx = pixx;\r
+               postwidth = 1;\r
+\r
+               wallpic = vertwall[tilehit&63];\r
+\r
+               *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);\r
+               (unsigned)postsource = texture;\r
+       }\r
+\r
+}\r
+\r
+//==========================================================================\r
+\r
+//==========================================================================\r
+\r
+#if 0\r
+/*\r
+=====================\r
+=\r
+= ClearScreen\r
+=\r
+=====================\r
+*/\r
+\r
+void ClearScreen (void)\r
+{\r
+ unsigned floor=egaFloor[gamestate.episode*10+mapon],\r
+         ceiling=egaCeiling[gamestate.episode*10+mapon];\r
+\r
+  //\r
+  // clear the screen\r
+  //\r
+asm    mov     dx,GC_INDEX\r
+asm    mov     ax,GC_MODE + 256*2              // read mode 0, write mode 2\r
+asm    out     dx,ax\r
+asm    mov     ax,GC_BITMASK + 255*256\r
+asm    out     dx,ax\r
+\r
+asm    mov     dx,40\r
+asm    mov     ax,[viewwidth]\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    sub     dx,ax                                   // dx = 40-viewwidth/8\r
+\r
+asm    mov     bx,[viewwidth]\r
+asm    shr     bx,1                                    // bl = viewwidth/16\r
+asm    shr     bx,1\r
+asm    shr     bx,1\r
+asm    shr     bx,1\r
+asm    mov     bh,BYTE PTR [viewheight]\r
+asm    shr     bh,1                                    // half height\r
+\r
+asm    mov     ax,[ceiling]\r
+asm    mov     es,[screenseg]\r
+asm    mov     di,[bufferofs]\r
+\r
+toploop:\r
+asm    mov     cl,bl\r
+asm    rep     stosw\r
+asm    add     di,dx\r
+asm    dec     bh\r
+asm    jnz     toploop\r
+\r
+asm    mov     bh,BYTE PTR [viewheight]\r
+asm    shr     bh,1                                    // half height\r
+asm    mov     ax,[floor]\r
+\r
+bottomloop:\r
+asm    mov     cl,bl\r
+asm    rep     stosw\r
+asm    add     di,dx\r
+asm    dec     bh\r
+asm    jnz     bottomloop\r
+\r
+\r
+asm    mov     dx,GC_INDEX\r
+asm    mov     ax,GC_MODE + 256*10             // read mode 1, write mode 2\r
+asm    out     dx,ax\r
+asm    mov     al,GC_BITMASK\r
+asm    out     dx,al\r
+\r
+}\r
+#endif\r
+//==========================================================================\r
+\r
+unsigned vgaCeiling[]=\r
+{\r
+#ifndef SPEAR\r
+ 0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xbfbf,\r
+ 0x4e4e,0x4e4e,0x4e4e,0x1d1d,0x8d8d,0x4e4e,0x1d1d,0x2d2d,0x1d1d,0x8d8d,\r
+ 0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x2d2d,0xdddd,0x1d1d,0x1d1d,0x9898,\r
+\r
+ 0x1d1d,0x9d9d,0x2d2d,0xdddd,0xdddd,0x9d9d,0x2d2d,0x4d4d,0x1d1d,0xdddd,\r
+ 0x7d7d,0x1d1d,0x2d2d,0x2d2d,0xdddd,0xd7d7,0x1d1d,0x1d1d,0x1d1d,0x2d2d,\r
+ 0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xdddd,0xdddd,0x7d7d,0xdddd,0xdddd,0xdddd\r
+#else\r
+ 0x6f6f,0x4f4f,0x1d1d,0xdede,0xdfdf,0x2e2e,0x7f7f,0x9e9e,0xaeae,0x7f7f,\r
+ 0x1d1d,0xdede,0xdfdf,0xdede,0xdfdf,0xdede,0xe1e1,0xdcdc,0x2e2e,0x1d1d,0xdcdc\r
+#endif\r
+};\r
+\r
+/*\r
+=====================\r
+=\r
+= VGAClearScreen\r
+=\r
+=====================\r
+*/\r
+\r
+void VGAClearScreen (void)\r
+{\r
+ unsigned ceiling=vgaCeiling[gamestate.episode*10+mapon];\r
+\r
+  //\r
+  // clear the screen\r
+  //\r
+asm    mov     dx,SC_INDEX\r
+asm    mov     ax,SC_MAPMASK+15*256    // write through all planes\r
+asm    out     dx,ax\r
+\r
+asm    mov     dx,80\r
+asm    mov     ax,[viewwidth]\r
+asm    shr     ax,1\r
+asm    shr     ax,1\r
+asm    sub     dx,ax                                   // dx = 40-viewwidth/2\r
+\r
+asm    mov     bx,[viewwidth]\r
+asm    shr     bx,1                                    // bl = viewwidth/8\r
+asm    shr     bx,1\r
+asm    shr     bx,1\r
+asm    mov     bh,BYTE PTR [viewheight]\r
+asm    shr     bh,1                                    // half height\r
+\r
+asm    mov     es,[screenseg]\r
+asm    mov     di,[bufferofs]\r
+asm    mov     ax,[ceiling]\r
+\r
+toploop:\r
+asm    mov     cl,bl\r
+asm    rep     stosw\r
+asm    add     di,dx\r
+asm    dec     bh\r
+asm    jnz     toploop\r
+\r
+asm    mov     bh,BYTE PTR [viewheight]\r
+asm    shr     bh,1                                    // half height\r
+asm    mov     ax,0x1919\r
+\r
+bottomloop:\r
+asm    mov     cl,bl\r
+asm    rep     stosw\r
+asm    add     di,dx\r
+asm    dec     bh\r
+asm    jnz     bottomloop\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= CalcRotate\r
+=\r
+=====================\r
+*/\r
+\r
+int    CalcRotate (objtype *ob)\r
+{\r
+       int     angle,viewangle;\r
+\r
+       // this isn't exactly correct, as it should vary by a trig value,\r
+       // but it is close enough with only eight rotations\r
+\r
+       viewangle = player->angle + (centerx - ob->viewx)/8;\r
+\r
+       if (ob->obclass == rocketobj || ob->obclass == hrocketobj)\r
+               angle =  (viewangle-180)- ob->angle;\r
+       else\r
+               angle =  (viewangle-180)- dirangle[ob->dir];\r
+\r
+       angle+=ANGLES/16;\r
+       while (angle>=ANGLES)\r
+               angle-=ANGLES;\r
+       while (angle<0)\r
+               angle+=ANGLES;\r
+\r
+       if (ob->state->rotate == 2)             // 2 rotation pain frame\r
+               return 4*(angle/(ANGLES/2));        // seperated by 3 (art layout...)\r
+\r
+       return angle/(ANGLES/8);\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= DrawScaleds\r
+=\r
+= Draws all objects that are visable\r
+=\r
+=====================\r
+*/\r
+\r
+#define MAXVISABLE     50\r
+\r
+typedef struct\r
+{\r
+       int     viewx,\r
+               viewheight,\r
+               shapenum;\r
+} visobj_t;\r
+\r
+visobj_t       vislist[MAXVISABLE],*visptr,*visstep,*farthest;\r
+\r
+void DrawScaleds (void)\r
+{\r
+       int             i,j,least,numvisable,height;\r
+       memptr          shape;\r
+       byte            *tilespot,*visspot;\r
+       int                     shapenum;\r
+       unsigned        spotloc;\r
+\r
+       statobj_t       *statptr;\r
+       objtype         *obj;\r
+\r
+       visptr = &vislist[0];\r
+\r
+//\r
+// place static objects\r
+//\r
+       for (statptr = &statobjlist[0] ; statptr !=laststatobj ; statptr++)\r
+       {\r
+               if ((visptr->shapenum = statptr->shapenum) == -1)\r
+                       continue;                                               // object has been deleted\r
+\r
+               if (!*statptr->visspot)\r
+                       continue;                                               // not visable\r
+\r
+               if (TransformTile (statptr->tilex,statptr->tiley\r
+                       ,&visptr->viewx,&visptr->viewheight) && statptr->flags & FL_BONUS)\r
+               {\r
+                       GetBonus (statptr);\r
+                       continue;\r
+               }\r
+\r
+               if (!visptr->viewheight)\r
+                       continue;                                               // to close to the object\r
+\r
+               if (visptr < &vislist[MAXVISABLE-1])    // don't let it overflow\r
+                       visptr++;\r
+       }\r
+\r
+//\r
+// place active objects\r
+//\r
+       for (obj = player->next;obj;obj=obj->next)\r
+       {\r
+               if (!(visptr->shapenum = obj->state->shapenum))\r
+                       continue;                                               // no shape\r
+\r
+               spotloc = (obj->tilex<<6)+obj->tiley;   // optimize: keep in struct?\r
+               visspot = &spotvis[0][0]+spotloc;\r
+               tilespot = &tilemap[0][0]+spotloc;\r
+\r
+               //\r
+               // could be in any of the nine surrounding tiles\r
+               //\r
+               if (*visspot\r
+               || ( *(visspot-1) && !*(tilespot-1) )\r
+               || ( *(visspot+1) && !*(tilespot+1) )\r
+               || ( *(visspot-65) && !*(tilespot-65) )\r
+               || ( *(visspot-64) && !*(tilespot-64) )\r
+               || ( *(visspot-63) && !*(tilespot-63) )\r
+               || ( *(visspot+65) && !*(tilespot+65) )\r
+               || ( *(visspot+64) && !*(tilespot+64) )\r
+               || ( *(visspot+63) && !*(tilespot+63) ) )\r
+               {\r
+                       obj->active = true;\r
+                       TransformActor (obj);\r
+                       if (!obj->viewheight)\r
+                               continue;                                               // too close or far away\r
+\r
+                       visptr->viewx = obj->viewx;\r
+                       visptr->viewheight = obj->viewheight;\r
+                       if (visptr->shapenum == -1)\r
+                               visptr->shapenum = obj->temp1;  // special shape\r
+\r
+                       if (obj->state->rotate)\r
+                               visptr->shapenum += CalcRotate (obj);\r
+\r
+                       if (visptr < &vislist[MAXVISABLE-1])    // don't let it overflow\r
+                               visptr++;\r
+                       obj->flags |= FL_VISABLE;\r
+               }\r
+               else\r
+                       obj->flags &= ~FL_VISABLE;\r
+       }\r
+\r
+//\r
+// draw from back to front\r
+//\r
+       numvisable = visptr-&vislist[0];\r
+\r
+       if (!numvisable)\r
+               return;                                                                 // no visable objects\r
+\r
+       for (i = 0; i<numvisable; i++)\r
+       {\r
+               least = 32000;\r
+               for (visstep=&vislist[0] ; visstep<visptr ; visstep++)\r
+               {\r
+                       height = visstep->viewheight;\r
+                       if (height < least)\r
+                       {\r
+                               least = height;\r
+                               farthest = visstep;\r
+                       }\r
+               }\r
+               //\r
+               // draw farthest\r
+               //\r
+               ScaleShape(farthest->viewx,farthest->shapenum,farthest->viewheight);\r
+\r
+               farthest->viewheight = 32000;\r
+       }\r
+\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==============\r
+=\r
+= DrawPlayerWeapon\r
+=\r
+= Draw the player's hands\r
+=\r
+==============\r
+*/\r
+\r
+int    weaponscale[NUMWEAPONS] = {SPR_KNIFEREADY,SPR_PISTOLREADY\r
+       ,SPR_MACHINEGUNREADY,SPR_CHAINREADY};\r
+\r
+void DrawPlayerWeapon (void)\r
+{\r
+       int     shapenum;\r
+\r
+#ifndef SPEAR\r
+       if (gamestate.victoryflag)\r
+       {\r
+               if (player->state == &s_deathcam && (TimeCount&32) )\r
+                       SimpleScaleShape(viewwidth/2,SPR_DEATHCAM,viewheight+1);\r
+               return;\r
+       }\r
+#endif\r
+\r
+       if (gamestate.weapon != -1)\r
+       {\r
+               shapenum = weaponscale[gamestate.weapon]+gamestate.weaponframe;\r
+               SimpleScaleShape(viewwidth/2,shapenum,viewheight+1);\r
+       }\r
+\r
+       if (demorecord || demoplayback)\r
+               SimpleScaleShape(viewwidth/2,SPR_DEMO,viewheight+1);\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= CalcTics\r
+=\r
+=====================\r
+*/\r
+\r
+void CalcTics (void)\r
+{\r
+       long    newtime,oldtimecount;\r
+\r
+//\r
+// calculate tics since last refresh for adaptive timing\r
+//\r
+       if (lasttimecount > TimeCount)\r
+               TimeCount = lasttimecount;              // if the game was paused a LONG time\r
+\r
+       do\r
+       {\r
+               newtime = TimeCount;\r
+               tics = newtime-lasttimecount;\r
+       } while (!tics);                        // make sure at least one tic passes\r
+\r
+       lasttimecount = newtime;\r
+\r
+#ifdef FILEPROFILE\r
+               strcpy (scratch,"\tTics:");\r
+               itoa (tics,str,10);\r
+               strcat (scratch,str);\r
+               strcat (scratch,"\n");\r
+               write (profilehandle,scratch,strlen(scratch));\r
+#endif\r
+\r
+       if (tics>MAXTICS)\r
+       {\r
+               TimeCount -= (tics-MAXTICS);\r
+               tics = MAXTICS;\r
+       }\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+========================\r
+=\r
+= FixOfs\r
+=\r
+========================\r
+*/\r
+\r
+void   FixOfs (void)\r
+{\r
+       VW_ScreenToScreen (displayofs,bufferofs,viewwidth/8,viewheight);\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+====================\r
+=\r
+= WallRefresh\r
+=\r
+====================\r
+*/\r
+\r
+void WallRefresh (void)\r
+{\r
+//\r
+// set up variables for this view\r
+//\r
+       viewangle = player->angle;\r
+       midangle = viewangle*(FINEANGLES/ANGLES);\r
+       viewsin = sintable[viewangle];\r
+       viewcos = costable[viewangle];\r
+       viewx = player->x - FixedByFrac(focallength,viewcos);\r
+       viewy = player->y + FixedByFrac(focallength,viewsin);\r
+\r
+       focaltx = viewx>>TILESHIFT;\r
+       focalty = viewy>>TILESHIFT;\r
+\r
+       viewtx = player->x >> TILESHIFT;\r
+       viewty = player->y >> TILESHIFT;\r
+\r
+       xpartialdown = viewx&(TILEGLOBAL-1);\r
+       xpartialup = TILEGLOBAL-xpartialdown;\r
+       ypartialdown = viewy&(TILEGLOBAL-1);\r
+       ypartialup = TILEGLOBAL-ypartialdown;\r
+\r
+       lastside = -1;                  // the first pixel is on a new wall\r
+       AsmRefresh ();\r
+       ScalePost ();                   // no more optimization on last post\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+========================\r
+=\r
+= ThreeDRefresh\r
+=\r
+========================\r
+*/\r
+\r
+void   ThreeDRefresh (void)\r
+{\r
+       int tracedir;\r
+\r
+// this wouldn't need to be done except for my debugger/video wierdness\r
+       outportb (SC_INDEX,SC_MAPMASK);\r
+\r
+//\r
+// clear out the traced array\r
+//\r
+asm    mov     ax,ds\r
+asm    mov     es,ax\r
+asm    mov     di,OFFSET spotvis\r
+asm    xor     ax,ax\r
+asm    mov     cx,2048                                                 // 64*64 / 2\r
+asm    rep stosw\r
+\r
+       bufferofs += screenofs;\r
+\r
+//\r
+// follow the walls from there to the right, drawwing as we go\r
+//\r
+       VGAClearScreen ();\r
+\r
+       WallRefresh ();\r
+\r
+//\r
+// draw all the scaled images\r
+//\r
+       DrawScaleds();                  // draw scaled stuff\r
+       DrawPlayerWeapon ();    // draw player's hands\r
+\r
+//\r
+// show screen and time last cycle\r
+//\r
+       if (fizzlein)\r
+       {\r
+               FizzleFade(bufferofs,displayofs+screenofs,viewwidth,viewheight,20,false);\r
+               fizzlein = false;\r
+\r
+               lasttimecount = TimeCount = 0;          // don't make a big tic count\r
+\r
+       }\r
+\r
+       bufferofs -= screenofs;\r
+       displayofs = bufferofs;\r
+\r
+       asm     cli\r
+       asm     mov     cx,[displayofs]\r
+       asm     mov     dx,3d4h         // CRTC address register\r
+       asm     mov     al,0ch          // start address high register\r
+       asm     out     dx,al\r
+       asm     inc     dx\r
+       asm     mov     al,ch\r
+       asm     out     dx,al           // set the high byte\r
+       asm     sti\r
+\r
+       bufferofs += SCREENSIZE;\r
+       if (bufferofs > PAGE3START)\r
+               bufferofs = PAGE1START;\r
+\r
+       frameon++;\r
+       PM_NextFrame();\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
diff --git a/16/wf3d8086/wl_game.c b/16/wf3d8086/wl_game.c
new file mode 100755 (executable)
index 0000000..9f63d9f
--- /dev/null
@@ -0,0 +1,1484 @@
+// WL_GAME.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+#ifdef MYPROFILE\r
+#include <TIME.H>\r
+#endif\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+boolean                ingame,fizzlein;\r
+unsigned       latchpics[NUMLATCHPICS];\r
+gametype       gamestate;\r
+\r
+long           spearx,speary;\r
+unsigned       spearangle;\r
+boolean                spearflag;\r
+\r
+//\r
+// ELEVATOR BACK MAPS - REMEMBER (-1)!!\r
+//\r
+int ElevatorBackTo[]={1,1,7,3,5,3};\r
+\r
+void ScanInfoPlane (void);\r
+void SetupGameLevel (void);\r
+void DrawPlayScreen (void);\r
+void LoadLatchMem (void);\r
+void GameLoop (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+//===========================================================================\r
+//===========================================================================\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= SetSoundLoc - Given the location of an object (in terms of global\r
+=      coordinates, held in globalsoundx and globalsoundy), munges the values\r
+=      for an approximate distance from the left and right ear, and puts\r
+=      those values into leftchannel and rightchannel.\r
+=\r
+= JAB\r
+=\r
+==========================\r
+*/\r
+\r
+       fixed   globalsoundx,globalsoundy;\r
+       int             leftchannel,rightchannel;\r
+#define ATABLEMAX 15\r
+byte righttable[ATABLEMAX][ATABLEMAX * 2] = {\r
+{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 6, 0, 0, 0, 0, 0, 1, 3, 5, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 6, 4, 0, 0, 0, 0, 0, 2, 4, 6, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 4, 1, 0, 0, 0, 1, 2, 4, 6, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 6, 5, 4, 2, 1, 0, 1, 2, 3, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 5, 4, 3, 2, 2, 3, 3, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 4, 4, 4, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 6, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}\r
+};\r
+byte lefttable[ATABLEMAX][ATABLEMAX * 2] = {\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 5, 3, 1, 0, 0, 0, 0, 0, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 2, 0, 0, 0, 0, 0, 4, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 2, 1, 0, 0, 0, 1, 4, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 7, 5, 3, 2, 1, 0, 1, 2, 4, 5, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 5, 3, 3, 2, 2, 3, 4, 5, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 6, 5, 4, 4, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 6, 6, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},\r
+{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}\r
+};\r
+\r
+void\r
+SetSoundLoc(fixed gx,fixed gy)\r
+{\r
+       fixed   xt,yt;\r
+       int             x,y;\r
+\r
+//\r
+// translate point to view centered coordinates\r
+//\r
+       gx -= viewx;\r
+       gy -= viewy;\r
+\r
+//\r
+// calculate newx\r
+//\r
+       xt = FixedByFrac(gx,viewcos);\r
+       yt = FixedByFrac(gy,viewsin);\r
+       x = (xt - yt) >> TILESHIFT;\r
+\r
+//\r
+// calculate newy\r
+//\r
+       xt = FixedByFrac(gx,viewsin);\r
+       yt = FixedByFrac(gy,viewcos);\r
+       y = (yt + xt) >> TILESHIFT;\r
+\r
+       if (y >= ATABLEMAX)\r
+               y = ATABLEMAX - 1;\r
+       else if (y <= -ATABLEMAX)\r
+               y = -ATABLEMAX;\r
+       if (x < 0)\r
+               x = -x;\r
+       if (x >= ATABLEMAX)\r
+               x = ATABLEMAX - 1;\r
+       leftchannel  =  lefttable[x][y + ATABLEMAX];\r
+       rightchannel = righttable[x][y + ATABLEMAX];\r
+\r
+#if 0\r
+       CenterWindow(8,1);\r
+       US_PrintSigned(leftchannel);\r
+       US_Print(",");\r
+       US_PrintSigned(rightchannel);\r
+       VW_UpdateScreen();\r
+#endif\r
+}\r
+\r
+/*\r
+==========================\r
+=\r
+= SetSoundLocGlobal - Sets up globalsoundx & globalsoundy and then calls\r
+=      UpdateSoundLoc() to transform that into relative channel volumes. Those\r
+=      values are then passed to the Sound Manager so that they'll be used for\r
+=      the next sound played (if possible).\r
+=\r
+= JAB\r
+=\r
+==========================\r
+*/\r
+void PlaySoundLocGlobal(word s,fixed gx,fixed gy)\r
+{\r
+       SetSoundLoc(gx,gy);\r
+       SD_PositionSound(leftchannel,rightchannel);\r
+       if (SD_PlaySound(s))\r
+       {\r
+               globalsoundx = gx;\r
+               globalsoundy = gy;\r
+       }\r
+}\r
+\r
+void UpdateSoundLoc(void)\r
+{\r
+       if (SoundPositioned)\r
+       {\r
+               SetSoundLoc(globalsoundx,globalsoundy);\r
+               SD_SetPosition(leftchannel,rightchannel);\r
+       }\r
+}\r
+\r
+/*\r
+**     JAB End\r
+*/\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= ClearMemory\r
+=\r
+==========================\r
+*/\r
+\r
+void ClearMemory (void)\r
+{\r
+       PM_UnlockMainMem();\r
+       SD_StopDigitized();\r
+       MM_SortMem ();\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= ScanInfoPlane\r
+=\r
+= Spawn all actors and mark down special places\r
+=\r
+==========================\r
+*/\r
+\r
+void ScanInfoPlane (void)\r
+{\r
+       unsigned        x,y,i,j;\r
+       int                     tile;\r
+       unsigned        far     *start;\r
+\r
+       start = mapsegs[1];\r
+       for (y=0;y<mapheight;y++)\r
+               for (x=0;x<mapwidth;x++)\r
+               {\r
+                       tile = *start++;\r
+                       if (!tile)\r
+                               continue;\r
+\r
+                       switch (tile)\r
+                       {\r
+                       case 19:\r
+                       case 20:\r
+                       case 21:\r
+                       case 22:\r
+                               SpawnPlayer(x,y,NORTH+tile-19);\r
+                               break;\r
+\r
+                       case 23:\r
+                       case 24:\r
+                       case 25:\r
+                       case 26:\r
+                       case 27:\r
+                       case 28:\r
+                       case 29:\r
+                       case 30:\r
+\r
+                       case 31:\r
+                       case 32:\r
+                       case 33:\r
+                       case 34:\r
+                       case 35:\r
+                       case 36:\r
+                       case 37:\r
+                       case 38:\r
+\r
+                       case 39:\r
+                       case 40:\r
+                       case 41:\r
+                       case 42:\r
+                       case 43:\r
+                       case 44:\r
+                       case 45:\r
+                       case 46:\r
+\r
+                       case 47:\r
+                       case 48:\r
+                       case 49:\r
+                       case 50:\r
+                       case 51:\r
+                       case 52:\r
+                       case 53:\r
+                       case 54:\r
+\r
+                       case 55:\r
+                       case 56:\r
+                       case 57:\r
+                       case 58:\r
+                       case 59:\r
+                       case 60:\r
+                       case 61:\r
+                       case 62:\r
+\r
+                       case 63:\r
+                       case 64:\r
+                       case 65:\r
+                       case 66:\r
+                       case 67:\r
+                       case 68:\r
+                       case 69:\r
+                       case 70:\r
+                       case 71:\r
+                       case 72:\r
+                       case 73:                                                // TRUCK AND SPEAR!\r
+                       case 74:\r
+\r
+                               SpawnStatic(x,y,tile-23);\r
+                               break;\r
+\r
+//\r
+// P wall\r
+//\r
+                       case 98:\r
+                               if (!loadedgame)\r
+                                 gamestate.secrettotal++;\r
+                               break;\r
+\r
+//\r
+// guard\r
+//\r
+                       case 180:\r
+                       case 181:\r
+                       case 182:\r
+                       case 183:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 144:\r
+                       case 145:\r
+                       case 146:\r
+                       case 147:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 108:\r
+                       case 109:\r
+                       case 110:\r
+                       case 111:\r
+                               SpawnStand(en_guard,x,y,tile-108);\r
+                               break;\r
+\r
+\r
+                       case 184:\r
+                       case 185:\r
+                       case 186:\r
+                       case 187:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 148:\r
+                       case 149:\r
+                       case 150:\r
+                       case 151:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 112:\r
+                       case 113:\r
+                       case 114:\r
+                       case 115:\r
+                               SpawnPatrol(en_guard,x,y,tile-112);\r
+                               break;\r
+\r
+                       case 124:\r
+                               SpawnDeadGuard (x,y);\r
+                               break;\r
+//\r
+// officer\r
+//\r
+                       case 188:\r
+                       case 189:\r
+                       case 190:\r
+                       case 191:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 152:\r
+                       case 153:\r
+                       case 154:\r
+                       case 155:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 116:\r
+                       case 117:\r
+                       case 118:\r
+                       case 119:\r
+                               SpawnStand(en_officer,x,y,tile-116);\r
+                               break;\r
+\r
+\r
+                       case 192:\r
+                       case 193:\r
+                       case 194:\r
+                       case 195:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 156:\r
+                       case 157:\r
+                       case 158:\r
+                       case 159:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 120:\r
+                       case 121:\r
+                       case 122:\r
+                       case 123:\r
+                               SpawnPatrol(en_officer,x,y,tile-120);\r
+                               break;\r
+\r
+\r
+//\r
+// ss\r
+//\r
+                       case 198:\r
+                       case 199:\r
+                       case 200:\r
+                       case 201:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 162:\r
+                       case 163:\r
+                       case 164:\r
+                       case 165:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 126:\r
+                       case 127:\r
+                       case 128:\r
+                       case 129:\r
+                               SpawnStand(en_ss,x,y,tile-126);\r
+                               break;\r
+\r
+\r
+                       case 202:\r
+                       case 203:\r
+                       case 204:\r
+                       case 205:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 166:\r
+                       case 167:\r
+                       case 168:\r
+                       case 169:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 130:\r
+                       case 131:\r
+                       case 132:\r
+                       case 133:\r
+                               SpawnPatrol(en_ss,x,y,tile-130);\r
+                               break;\r
+\r
+//\r
+// dogs\r
+//\r
+                       case 206:\r
+                       case 207:\r
+                       case 208:\r
+                       case 209:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 170:\r
+                       case 171:\r
+                       case 172:\r
+                       case 173:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 134:\r
+                       case 135:\r
+                       case 136:\r
+                       case 137:\r
+                               SpawnStand(en_dog,x,y,tile-134);\r
+                               break;\r
+\r
+\r
+                       case 210:\r
+                       case 211:\r
+                       case 212:\r
+                       case 213:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 174:\r
+                       case 175:\r
+                       case 176:\r
+                       case 177:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 36;\r
+                       case 138:\r
+                       case 139:\r
+                       case 140:\r
+                       case 141:\r
+                               SpawnPatrol(en_dog,x,y,tile-138);\r
+                               break;\r
+\r
+//\r
+// boss\r
+//\r
+#ifndef SPEAR\r
+                       case 214:\r
+                               SpawnBoss (x,y);\r
+                               break;\r
+                       case 197:\r
+                               SpawnGretel (x,y);\r
+                               break;\r
+                       case 215:\r
+                               SpawnGift (x,y);\r
+                               break;\r
+                       case 179:\r
+                               SpawnFat (x,y);\r
+                               break;\r
+                       case 196:\r
+                               SpawnSchabbs (x,y);\r
+                               break;\r
+                       case 160:\r
+                               SpawnFakeHitler (x,y);\r
+                               break;\r
+                       case 178:\r
+                               SpawnHitler (x,y);\r
+                               break;\r
+#else\r
+                       case 106:\r
+                               SpawnSpectre (x,y);\r
+                               break;\r
+                       case 107:\r
+                               SpawnAngel (x,y);\r
+                               break;\r
+                       case 125:\r
+                               SpawnTrans (x,y);\r
+                               break;\r
+                       case 142:\r
+                               SpawnUber (x,y);\r
+                               break;\r
+                       case 143:\r
+                               SpawnWill (x,y);\r
+                               break;\r
+                       case 161:\r
+                               SpawnDeath (x,y);\r
+                               break;\r
+\r
+#endif\r
+\r
+//\r
+// mutants\r
+//\r
+                       case 252:\r
+                       case 253:\r
+                       case 254:\r
+                       case 255:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 18;\r
+                       case 234:\r
+                       case 235:\r
+                       case 236:\r
+                       case 237:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 18;\r
+                       case 216:\r
+                       case 217:\r
+                       case 218:\r
+                       case 219:\r
+                               SpawnStand(en_mutant,x,y,tile-216);\r
+                               break;\r
+\r
+                       case 256:\r
+                       case 257:\r
+                       case 258:\r
+                       case 259:\r
+                               if (gamestate.difficulty<gd_hard)\r
+                                       break;\r
+                               tile -= 18;\r
+                       case 238:\r
+                       case 239:\r
+                       case 240:\r
+                       case 241:\r
+                               if (gamestate.difficulty<gd_medium)\r
+                                       break;\r
+                               tile -= 18;\r
+                       case 220:\r
+                       case 221:\r
+                       case 222:\r
+                       case 223:\r
+                               SpawnPatrol(en_mutant,x,y,tile-220);\r
+                               break;\r
+\r
+//\r
+// ghosts\r
+//\r
+#ifndef SPEAR\r
+                       case 224:\r
+                               SpawnGhosts (en_blinky,x,y);\r
+                               break;\r
+                       case 225:\r
+                               SpawnGhosts (en_clyde,x,y);\r
+                               break;\r
+                       case 226:\r
+                               SpawnGhosts (en_pinky,x,y);\r
+                               break;\r
+                       case 227:\r
+                               SpawnGhosts (en_inky,x,y);\r
+                               break;\r
+#endif\r
+                       }\r
+\r
+               }\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= SetupGameLevel\r
+=\r
+==================\r
+*/\r
+\r
+void SetupGameLevel (void)\r
+{\r
+       int     x,y,i;\r
+       unsigned        far *map,tile,spot;\r
+\r
+\r
+       if (!loadedgame)\r
+       {\r
+        gamestate.TimeCount=\r
+        gamestate.secrettotal=\r
+        gamestate.killtotal=\r
+        gamestate.treasuretotal=\r
+        gamestate.secretcount=\r
+        gamestate.killcount=\r
+        gamestate.treasurecount=0;\r
+       }\r
+\r
+       if (demoplayback || demorecord)\r
+               US_InitRndT (false);\r
+       else\r
+               US_InitRndT (true);\r
+\r
+//\r
+// load the level\r
+//\r
+       CA_CacheMap (gamestate.mapon+10*gamestate.episode);\r
+       mapon-=gamestate.episode*10;\r
+\r
+       mapwidth = mapheaderseg[mapon]->width;\r
+       mapheight = mapheaderseg[mapon]->height;\r
+\r
+       if (mapwidth != 64 || mapheight != 64)\r
+               Quit ("Map not 64*64!");\r
+\r
+\r
+//\r
+// copy the wall data to a data segment array\r
+//\r
+       memset (tilemap,0,sizeof(tilemap));\r
+       memset (actorat,0,sizeof(actorat));\r
+       map = mapsegs[0];\r
+       for (y=0;y<mapheight;y++)\r
+               for (x=0;x<mapwidth;x++)\r
+               {\r
+                       tile = *map++;\r
+                       if (tile<AREATILE)\r
+                       {\r
+                       // solid wall\r
+                               tilemap[x][y] = tile;\r
+                               (unsigned)actorat[x][y] = tile;\r
+                       }\r
+                       else\r
+                       {\r
+                       // area floor\r
+                               tilemap[x][y] = 0;\r
+                               (unsigned)actorat[x][y] = 0;\r
+                       }\r
+               }\r
+\r
+//\r
+// spawn doors\r
+//\r
+       InitActorList ();                       // start spawning things with a clean slate\r
+       InitDoorList ();\r
+       InitStaticList ();\r
+\r
+       map = mapsegs[0];\r
+       for (y=0;y<mapheight;y++)\r
+               for (x=0;x<mapwidth;x++)\r
+               {\r
+                       tile = *map++;\r
+                       if (tile >= 90 && tile <= 101)\r
+                       {\r
+                       // door\r
+                               switch (tile)\r
+                               {\r
+                               case 90:\r
+                               case 92:\r
+                               case 94:\r
+                               case 96:\r
+                               case 98:\r
+                               case 100:\r
+                                       SpawnDoor (x,y,1,(tile-90)/2);\r
+                                       break;\r
+                               case 91:\r
+                               case 93:\r
+                               case 95:\r
+                               case 97:\r
+                               case 99:\r
+                               case 101:\r
+                                       SpawnDoor (x,y,0,(tile-91)/2);\r
+                                       break;\r
+                               }\r
+                       }\r
+               }\r
+\r
+//\r
+// spawn actors\r
+//\r
+       ScanInfoPlane ();\r
+\r
+//\r
+// take out the ambush markers\r
+//\r
+       map = mapsegs[0];\r
+       for (y=0;y<mapheight;y++)\r
+               for (x=0;x<mapwidth;x++)\r
+               {\r
+                       tile = *map++;\r
+                       if (tile == AMBUSHTILE)\r
+                       {\r
+                               tilemap[x][y] = 0;\r
+                               if ( (unsigned)actorat[x][y] == AMBUSHTILE)\r
+                                       actorat[x][y] = NULL;\r
+\r
+                               if (*map >= AREATILE)\r
+                                       tile = *map;\r
+                               if (*(map-1-mapwidth) >= AREATILE)\r
+                                       tile = *(map-1-mapwidth);\r
+                               if (*(map-1+mapwidth) >= AREATILE)\r
+                                       tile = *(map-1+mapwidth);\r
+                               if ( *(map-2) >= AREATILE)\r
+                                       tile = *(map-2);\r
+\r
+                               *(map-1) = tile;\r
+                       }\r
+               }\r
+\r
+\r
+\r
+//\r
+// have the caching manager load and purge stuff to make sure all marks\r
+// are in memory\r
+//\r
+       CA_LoadAllSounds ();\r
+\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= DrawPlayBorderSides\r
+=\r
+= To fix window overwrites\r
+=\r
+===================\r
+*/\r
+\r
+void DrawPlayBorderSides (void)\r
+{\r
+       int     xl,yl;\r
+\r
+       xl = 160-viewwidth/2;\r
+       yl = (200-STATUSLINES-viewheight)/2;\r
+\r
+       VWB_Bar (0,0,xl-1,200-STATUSLINES,127);\r
+       VWB_Bar (xl+viewwidth+1,0,xl-2,200-STATUSLINES,127);\r
+\r
+       VWB_Vlin (yl-1,yl+viewheight,xl-1,0);\r
+       VWB_Vlin (yl-1,yl+viewheight,xl+viewwidth,125);\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= DrawAllPlayBorderSides\r
+=\r
+===================\r
+*/\r
+\r
+void DrawAllPlayBorderSides (void)\r
+{\r
+       unsigned        i,temp;\r
+\r
+       temp = bufferofs;\r
+       for (i=0;i<3;i++)\r
+       {\r
+               bufferofs = screenloc[i];\r
+               DrawPlayBorderSides ();\r
+       }\r
+       bufferofs = temp;\r
+}\r
+\r
+/*\r
+===================\r
+=\r
+= DrawPlayBorder\r
+=\r
+===================\r
+*/\r
+void DrawAllPlayBorder (void)\r
+{\r
+       unsigned        i,temp;\r
+\r
+       temp = bufferofs;\r
+       for (i=0;i<3;i++)\r
+       {\r
+               bufferofs = screenloc[i];\r
+               DrawPlayBorder ();\r
+       }\r
+       bufferofs = temp;\r
+}\r
+\r
+/*\r
+===================\r
+=\r
+= DrawPlayBorder\r
+=\r
+===================\r
+*/\r
+\r
+void DrawPlayBorder (void)\r
+{\r
+       int     xl,yl;\r
+\r
+       VWB_Bar (0,0,320,200-STATUSLINES,127);\r
+\r
+       xl = 160-viewwidth/2;\r
+       yl = (200-STATUSLINES-viewheight)/2;\r
+       VWB_Bar (xl,yl,viewwidth,viewheight,0);\r
+\r
+       VWB_Hlin (xl-1,xl+viewwidth,yl-1,0);\r
+       VWB_Hlin (xl-1,xl+viewwidth,yl+viewheight,125);\r
+       VWB_Vlin (yl-1,yl+viewheight,xl-1,0);\r
+       VWB_Vlin (yl-1,yl+viewheight,xl+viewwidth,125);\r
+       VWB_Plot (xl-1,yl+viewheight,124);\r
+}\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= DrawPlayScreen\r
+=\r
+===================\r
+*/\r
+\r
+void DrawPlayScreen (void)\r
+{\r
+       int     i,j,p,m;\r
+       unsigned        temp;\r
+\r
+       VW_FadeOut ();\r
+\r
+       temp = bufferofs;\r
+\r
+       CA_CacheGrChunk (STATUSBARPIC);\r
+\r
+       for (i=0;i<3;i++)\r
+       {\r
+               bufferofs = screenloc[i];\r
+               DrawPlayBorder ();\r
+               VWB_DrawPic (0,200-STATUSLINES,STATUSBARPIC);\r
+       }\r
+\r
+       bufferofs = temp;\r
+\r
+       UNCACHEGRCHUNK (STATUSBARPIC);\r
+\r
+       DrawFace ();\r
+       DrawHealth ();\r
+       DrawLives ();\r
+       DrawLevel ();\r
+       DrawAmmo ();\r
+       DrawKeys ();\r
+       DrawWeapon ();\r
+       DrawScore ();\r
+}\r
+\r
+\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= StartDemoRecord\r
+=\r
+==================\r
+*/\r
+\r
+#define MAXDEMOSIZE    8192\r
+\r
+void StartDemoRecord (int levelnumber)\r
+{\r
+       MM_GetPtr (&demobuffer,MAXDEMOSIZE);\r
+       MM_SetLock (&demobuffer,true);\r
+       demoptr = (char far *)demobuffer;\r
+       lastdemoptr = demoptr+MAXDEMOSIZE;\r
+\r
+       *demoptr = levelnumber;\r
+       demoptr += 4;                           // leave space for length\r
+       demorecord = true;\r
+}\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= FinishDemoRecord\r
+=\r
+==================\r
+*/\r
+\r
+char   demoname[13] = "DEMO?.";\r
+\r
+void FinishDemoRecord (void)\r
+{\r
+       long    length,level;\r
+\r
+       demorecord = false;\r
+\r
+       length = demoptr - (char far *)demobuffer;\r
+\r
+       demoptr = ((char far *)demobuffer)+1;\r
+       *(unsigned far *)demoptr = length;\r
+\r
+       CenterWindow(24,3);\r
+       PrintY+=6;\r
+       US_Print(" Demo number (0-9):");\r
+       VW_UpdateScreen();\r
+\r
+       if (US_LineInput (px,py,str,NULL,true,2,0))\r
+       {\r
+               level = atoi (str);\r
+               if (level>=0 && level<=9)\r
+               {\r
+                       demoname[4] = '0'+level;\r
+                       CA_WriteFile (demoname,(void far *)demobuffer,length);\r
+               }\r
+       }\r
+\r
+\r
+       MM_FreePtr (&demobuffer);\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= RecordDemo\r
+=\r
+= Fades the screen out, then starts a demo.  Exits with the screen faded\r
+=\r
+==================\r
+*/\r
+\r
+void RecordDemo (void)\r
+{\r
+       int level,esc;\r
+\r
+       CenterWindow(26,3);\r
+       PrintY+=6;\r
+       CA_CacheGrChunk(STARTFONT);\r
+       fontnumber=0;\r
+       US_Print("  Demo which level(1-10):");\r
+       VW_UpdateScreen();\r
+       VW_FadeIn ();\r
+       esc = !US_LineInput (px,py,str,NULL,true,2,0);\r
+       if (esc)\r
+               return;\r
+\r
+       level = atoi (str);\r
+       level--;\r
+\r
+       SETFONTCOLOR(0,15);\r
+       VW_FadeOut ();\r
+\r
+#ifndef SPEAR\r
+       NewGame (gd_hard,level/10);\r
+       gamestate.mapon = level%10;\r
+#else\r
+       NewGame (gd_hard,0);\r
+       gamestate.mapon = level;\r
+#endif\r
+\r
+       StartDemoRecord (level);\r
+\r
+       DrawPlayScreen ();\r
+       VW_FadeIn ();\r
+\r
+       startgame = false;\r
+       demorecord = true;\r
+\r
+       SetupGameLevel ();\r
+       StartMusic ();\r
+       PM_CheckMainMem ();\r
+       fizzlein = true;\r
+\r
+       PlayLoop ();\r
+\r
+       demoplayback = false;\r
+\r
+       StopMusic ();\r
+       VW_FadeOut ();\r
+       ClearMemory ();\r
+\r
+       FinishDemoRecord ();\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= PlayDemo\r
+=\r
+= Fades the screen out, then starts a demo.  Exits with the screen faded\r
+=\r
+==================\r
+*/\r
+\r
+void PlayDemo (int demonumber)\r
+{\r
+       int length;\r
+\r
+#ifdef DEMOSEXTERN\r
+// debug: load chunk\r
+#ifndef SPEARDEMO\r
+       int dems[4]={T_DEMO0,T_DEMO1,T_DEMO2,T_DEMO3};\r
+#else\r
+       int dems[1]={T_DEMO0};\r
+#endif\r
+\r
+       CA_CacheGrChunk(dems[demonumber]);\r
+       demoptr = grsegs[dems[demonumber]];\r
+       MM_SetLock (&grsegs[dems[demonumber]],true);\r
+#else\r
+       demoname[4] = '0'+demonumber;\r
+       CA_LoadFile (demoname,&demobuffer);\r
+       MM_SetLock (&demobuffer,true);\r
+       demoptr = (char far *)demobuffer;\r
+#endif\r
+\r
+       NewGame (1,0);\r
+       gamestate.mapon = *demoptr++;\r
+       gamestate.difficulty = gd_hard;\r
+       length = *((unsigned far *)demoptr)++;\r
+       demoptr++;\r
+       lastdemoptr = demoptr-4+length;\r
+\r
+       VW_FadeOut ();\r
+\r
+       SETFONTCOLOR(0,15);\r
+       DrawPlayScreen ();\r
+       VW_FadeIn ();\r
+\r
+       startgame = false;\r
+       demoplayback = true;\r
+\r
+       SetupGameLevel ();\r
+       StartMusic ();\r
+       PM_CheckMainMem ();\r
+       fizzlein = true;\r
+\r
+       PlayLoop ();\r
+\r
+#ifdef DEMOSEXTERN\r
+       UNCACHEGRCHUNK(dems[demonumber]);\r
+#else\r
+       MM_FreePtr (&demobuffer);\r
+#endif\r
+\r
+       demoplayback = false;\r
+\r
+       StopMusic ();\r
+       VW_FadeOut ();\r
+       ClearMemory ();\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= Died\r
+=\r
+==================\r
+*/\r
+\r
+#define DEATHROTATE 2\r
+\r
+void Died (void)\r
+{\r
+       float   fangle;\r
+       long    dx,dy;\r
+       int             iangle,curangle,clockwise,counter,change;\r
+\r
+       gamestate.weapon = -1;                  // take away weapon\r
+       SD_PlaySound (PLAYERDEATHSND);\r
+//\r
+// swing around to face attacker\r
+//\r
+       dx = killerobj->x - player->x;\r
+       dy = player->y - killerobj->y;\r
+\r
+       fangle = atan2(dy,dx);                  // returns -pi to pi\r
+       if (fangle<0)\r
+               fangle = M_PI*2+fangle;\r
+\r
+       iangle = fangle/(M_PI*2)*ANGLES;\r
+\r
+       if (player->angle > iangle)\r
+       {\r
+               counter = player->angle - iangle;\r
+               clockwise = ANGLES-player->angle + iangle;\r
+       }\r
+       else\r
+       {\r
+               clockwise = iangle - player->angle;\r
+               counter = player->angle + ANGLES-iangle;\r
+       }\r
+\r
+       curangle = player->angle;\r
+\r
+       if (clockwise<counter)\r
+       {\r
+       //\r
+       // rotate clockwise\r
+       //\r
+               if (curangle>iangle)\r
+                       curangle -= ANGLES;\r
+               do\r
+               {\r
+                       change = tics*DEATHROTATE;\r
+                       if (curangle + change > iangle)\r
+                               change = iangle-curangle;\r
+\r
+                       curangle += change;\r
+                       player->angle += change;\r
+                       if (player->angle >= ANGLES)\r
+                               player->angle -= ANGLES;\r
+\r
+                       ThreeDRefresh ();\r
+                       CalcTics ();\r
+               } while (curangle != iangle);\r
+       }\r
+       else\r
+       {\r
+       //\r
+       // rotate counterclockwise\r
+       //\r
+               if (curangle<iangle)\r
+                       curangle += ANGLES;\r
+               do\r
+               {\r
+                       change = -tics*DEATHROTATE;\r
+                       if (curangle + change < iangle)\r
+                               change = iangle-curangle;\r
+\r
+                       curangle += change;\r
+                       player->angle += change;\r
+                       if (player->angle < 0)\r
+                               player->angle += ANGLES;\r
+\r
+                       ThreeDRefresh ();\r
+                       CalcTics ();\r
+               } while (curangle != iangle);\r
+       }\r
+\r
+//\r
+// fade to red\r
+//\r
+       FinishPaletteShifts ();\r
+\r
+       bufferofs += screenofs;\r
+       VW_Bar (0,0,viewwidth,viewheight,4);\r
+       IN_ClearKeysDown ();\r
+       FizzleFade(bufferofs,displayofs+screenofs,viewwidth,viewheight,70,false);\r
+       bufferofs -= screenofs;\r
+       IN_UserInput(100);\r
+       SD_WaitSoundDone ();\r
+\r
+       if (tedlevel == false)  // SO'S YA DON'T GET KILLED WHILE LAUNCHING!\r
+         gamestate.lives--;\r
+\r
+       if (gamestate.lives > -1)\r
+       {\r
+               gamestate.health = 100;\r
+               gamestate.weapon = gamestate.bestweapon\r
+                       = gamestate.chosenweapon = wp_pistol;\r
+               gamestate.ammo = STARTAMMO;\r
+               gamestate.keys = 0;\r
+               gamestate.attackframe = gamestate.attackcount =\r
+               gamestate.weaponframe = 0;\r
+\r
+               DrawKeys ();\r
+               DrawWeapon ();\r
+               DrawAmmo ();\r
+               DrawHealth ();\r
+               DrawFace ();\r
+               DrawLives ();\r
+       }\r
+\r
+}\r
+\r
+//==========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= GameLoop\r
+=\r
+===================\r
+*/\r
+\r
+void GameLoop (void)\r
+{\r
+       int i,xl,yl,xh,yh;\r
+       char num[20];\r
+       boolean died;\r
+#ifdef MYPROFILE\r
+       clock_t start,end;\r
+#endif\r
+\r
+restartgame:\r
+       ClearMemory ();\r
+       SETFONTCOLOR(0,15);\r
+       DrawPlayScreen ();\r
+       died = false;\r
+restart:\r
+       do\r
+       {\r
+               if (!loadedgame)\r
+                 gamestate.score = gamestate.oldscore;\r
+               DrawScore();\r
+\r
+               startgame = false;\r
+               if (loadedgame)\r
+                       loadedgame = false;\r
+               else\r
+                       SetupGameLevel ();\r
+\r
+#ifdef SPEAR\r
+               if (gamestate.mapon == 20)      // give them the key allways\r
+               {\r
+                       gamestate.keys |= 1;\r
+                       DrawKeys ();\r
+               }\r
+#endif\r
+\r
+               ingame = true;\r
+               StartMusic ();\r
+               PM_CheckMainMem ();\r
+               if (!died)\r
+                       PreloadGraphics ();\r
+               else\r
+                       died = false;\r
+\r
+               fizzlein = true;\r
+               DrawLevel ();\r
+\r
+startplayloop:\r
+               PlayLoop ();\r
+\r
+#ifdef SPEAR\r
+               if (spearflag)\r
+               {\r
+                       SD_StopSound();\r
+                       SD_PlaySound(GETSPEARSND);\r
+                       if (DigiMode != sds_Off)\r
+                       {\r
+                               long lasttimecount = TimeCount;\r
+\r
+                               while(TimeCount < lasttimecount+150)\r
+                               //while(DigiPlaying!=false)\r
+                                       SD_Poll();\r
+                       }\r
+                       else\r
+                               SD_WaitSoundDone();\r
+\r
+                       ClearMemory ();\r
+                       gamestate.oldscore = gamestate.score;\r
+                       gamestate.mapon = 20;\r
+                       SetupGameLevel ();\r
+                       StartMusic ();\r
+                       PM_CheckMainMem ();\r
+                       player->x = spearx;\r
+                       player->y = speary;\r
+                       player->angle = spearangle;\r
+                       spearflag = false;\r
+                       Thrust (0,0);\r
+                       goto startplayloop;\r
+               }\r
+#endif\r
+\r
+               StopMusic ();\r
+               ingame = false;\r
+\r
+               if (demorecord && playstate != ex_warped)\r
+                       FinishDemoRecord ();\r
+\r
+               if (startgame || loadedgame)\r
+                       goto restartgame;\r
+\r
+               switch (playstate)\r
+               {\r
+               case ex_completed:\r
+               case ex_secretlevel:\r
+                       gamestate.keys = 0;\r
+                       DrawKeys ();\r
+                       VW_FadeOut ();\r
+\r
+                       ClearMemory ();\r
+\r
+                       LevelCompleted ();              // do the intermission\r
+#ifdef SPEARDEMO\r
+                       if (gamestate.mapon == 1)\r
+                       {\r
+                               died = true;                    // don't "get psyched!"\r
+\r
+                               VW_FadeOut ();\r
+\r
+                               ClearMemory ();\r
+\r
+                               CheckHighScore (gamestate.score,gamestate.mapon+1);\r
+\r
+                               #pragma warn -sus\r
+                               #ifndef JAPAN\r
+                               _fstrcpy(MainMenu[viewscores].string,STR_VS);\r
+                               #endif\r
+                               MainMenu[viewscores].routine = CP_ViewScores;\r
+                               #pragma warn +sus\r
+\r
+                               return;\r
+                       }\r
+#endif\r
+\r
+#ifdef JAPDEMO\r
+                       if (gamestate.mapon == 3)\r
+                       {\r
+                               died = true;                    // don't "get psyched!"\r
+\r
+                               VW_FadeOut ();\r
+\r
+                               ClearMemory ();\r
+\r
+                               CheckHighScore (gamestate.score,gamestate.mapon+1);\r
+\r
+                               #pragma warn -sus\r
+                               #ifndef JAPAN\r
+                               _fstrcpy(MainMenu[viewscores].string,STR_VS);\r
+                               #endif\r
+                               MainMenu[viewscores].routine = CP_ViewScores;\r
+                               #pragma warn +sus\r
+\r
+                               return;\r
+                       }\r
+#endif\r
+\r
+                       gamestate.oldscore = gamestate.score;\r
+\r
+#ifndef SPEAR\r
+                       //\r
+                       // COMING BACK FROM SECRET LEVEL\r
+                       //\r
+                       if (gamestate.mapon == 9)\r
+                               gamestate.mapon = ElevatorBackTo[gamestate.episode];    // back from secret\r
+                       else\r
+                       //\r
+                       // GOING TO SECRET LEVEL\r
+                       //\r
+                       if (playstate == ex_secretlevel)\r
+                               gamestate.mapon = 9;\r
+#else\r
+\r
+#define FROMSECRET1            3\r
+#define FROMSECRET2            11\r
+\r
+                       //\r
+                       // GOING TO SECRET LEVEL\r
+                       //\r
+                       if (playstate == ex_secretlevel)\r
+                               switch(gamestate.mapon)\r
+                               {\r
+                                case FROMSECRET1: gamestate.mapon = 18; break;\r
+                                case FROMSECRET2: gamestate.mapon = 19; break;\r
+                               }\r
+                       else\r
+                       //\r
+                       // COMING BACK FROM SECRET LEVEL\r
+                       //\r
+                       if (gamestate.mapon == 18 || gamestate.mapon == 19)\r
+                               switch(gamestate.mapon)\r
+                               {\r
+                                case 18: gamestate.mapon = FROMSECRET1+1; break;\r
+                                case 19: gamestate.mapon = FROMSECRET2+1; break;\r
+                               }\r
+#endif\r
+                       else\r
+                       //\r
+                       // GOING TO NEXT LEVEL\r
+                       //\r
+                               gamestate.mapon++;\r
+\r
+\r
+                       break;\r
+\r
+               case ex_died:\r
+                       Died ();\r
+                       died = true;                    // don't "get psyched!"\r
+\r
+                       if (gamestate.lives > -1)\r
+                               break;                          // more lives left\r
+\r
+                       VW_FadeOut ();\r
+\r
+                       ClearMemory ();\r
+\r
+                       CheckHighScore (gamestate.score,gamestate.mapon+1);\r
+\r
+                       #pragma warn -sus\r
+                       #ifndef JAPAN\r
+                       _fstrcpy(MainMenu[viewscores].string,STR_VS);\r
+                       #endif\r
+                       MainMenu[viewscores].routine = CP_ViewScores;\r
+                       #pragma warn +sus\r
+\r
+                       return;\r
+\r
+               case ex_victorious:\r
+\r
+#ifndef SPEAR\r
+                       VW_FadeOut ();\r
+#else\r
+                       VL_FadeOut (0,255,0,17,17,300);\r
+#endif\r
+                       ClearMemory ();\r
+\r
+                       Victory ();\r
+\r
+                       ClearMemory ();\r
+\r
+                       CheckHighScore (gamestate.score,gamestate.mapon+1);\r
+\r
+                       #pragma warn -sus\r
+                       #ifndef JAPAN\r
+                       _fstrcpy(MainMenu[viewscores].string,STR_VS);\r
+                       #endif\r
+                       MainMenu[viewscores].routine = CP_ViewScores;\r
+                       #pragma warn +sus\r
+\r
+                       return;\r
+\r
+               default:\r
+                       ClearMemory ();\r
+                       break;\r
+               }\r
+\r
+       } while (1);\r
+\r
+}\r
+\r
diff --git a/16/wf3d8086/wl_inter.c b/16/wf3d8086/wl_inter.c
new file mode 100755 (executable)
index 0000000..c74cc9e
--- /dev/null
@@ -0,0 +1,1718 @@
+// WL_INTER.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= CLearSplitVWB\r
+=\r
+==================\r
+*/\r
+\r
+void ClearSplitVWB (void)\r
+{\r
+       memset (update,0,sizeof(update));\r
+       WindowX = 0;\r
+       WindowY = 0;\r
+       WindowW = 320;\r
+       WindowH = 160;\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+#ifdef SPEAR\r
+#ifndef SPEARDEMO\r
+////////////////////////////////////////////////////////\r
+//\r
+// End of Spear of Destiny\r
+//\r
+////////////////////////////////////////////////////////\r
+\r
+void EndScreen (int palette, int screen)\r
+{\r
+       CA_CacheScreen (screen);\r
+       VW_UpdateScreen ();\r
+       CA_CacheGrChunk (palette);\r
+       VL_FadeIn(0,255,grsegs[palette],30);\r
+       UNCACHEGRCHUNK (palette);\r
+       IN_ClearKeysDown ();\r
+       IN_Ack ();\r
+       VW_FadeOut ();\r
+}\r
+\r
+\r
+void EndSpear(void)\r
+{\r
+       EndScreen (END1PALETTE, ENDSCREEN11PIC);\r
+\r
+       CA_CacheScreen (ENDSCREEN3PIC);\r
+       VW_UpdateScreen ();\r
+       CA_CacheGrChunk (END3PALETTE);\r
+       VL_FadeIn(0,255,grsegs[END3PALETTE],30);\r
+       UNCACHEGRCHUNK (END3PALETTE);\r
+       fontnumber = 0;\r
+       fontcolor = 0xd0;\r
+       WindowX = 0;\r
+       WindowW = 320;\r
+       PrintX = 0;\r
+       PrintY = 180;\r
+       US_CPrint (STR_ENDGAME1"\n");\r
+       US_CPrint (STR_ENDGAME2);\r
+       VW_UpdateScreen ();\r
+       IN_StartAck ();\r
+       TimeCount = 0;\r
+       while (!IN_CheckAck () && TimeCount < 700);\r
+\r
+       PrintX = 0;\r
+       PrintY = 180;\r
+       VWB_Bar(0,180,320,20,0);\r
+       US_CPrint (STR_ENDGAME3"\n");\r
+       US_CPrint (STR_ENDGAME4);\r
+       VW_UpdateScreen ();\r
+       IN_StartAck ();\r
+       TimeCount = 0;\r
+       while (!IN_CheckAck () && TimeCount < 700);\r
+\r
+       VW_FadeOut ();\r
+\r
+       EndScreen (END4PALETTE, ENDSCREEN4PIC);\r
+       EndScreen (END5PALETTE, ENDSCREEN5PIC);\r
+       EndScreen (END6PALETTE, ENDSCREEN6PIC);\r
+       EndScreen (END7PALETTE, ENDSCREEN7PIC);\r
+       EndScreen (END8PALETTE, ENDSCREEN8PIC);\r
+       EndScreen (END9PALETTE, ENDSCREEN9PIC);\r
+\r
+       EndScreen (END2PALETTE, ENDSCREEN12PIC);\r
+\r
+       MainMenu[savegame].active = 0;\r
+}\r
+#endif\r
+#endif\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= Victory\r
+=\r
+==================\r
+*/\r
+\r
+void Victory (void)\r
+{\r
+#ifndef SPEARDEMO\r
+       long    sec;\r
+       int i,min,kr,sr,tr,x;\r
+       char tempstr[8];\r
+\r
+#define RATIOX 6\r
+#define RATIOY 14\r
+#define TIMEX  14\r
+#define TIMEY  8\r
+\r
+\r
+#ifdef SPEAR\r
+       StartCPMusic (XTHEEND_MUS);\r
+\r
+       CA_CacheGrChunk(BJCOLLAPSE1PIC);\r
+       CA_CacheGrChunk(BJCOLLAPSE2PIC);\r
+       CA_CacheGrChunk(BJCOLLAPSE3PIC);\r
+       CA_CacheGrChunk(BJCOLLAPSE4PIC);\r
+\r
+       VWB_Bar(0,0,320,200,VIEWCOLOR);\r
+       VWB_DrawPic (124,44,BJCOLLAPSE1PIC);\r
+       VW_UpdateScreen ();\r
+       VW_FadeIn ();\r
+       VW_WaitVBL(2*70);\r
+       VWB_DrawPic (124,44,BJCOLLAPSE2PIC);\r
+       VW_UpdateScreen ();\r
+       VW_WaitVBL(105);\r
+       VWB_DrawPic (124,44,BJCOLLAPSE3PIC);\r
+       VW_UpdateScreen ();\r
+       VW_WaitVBL(105);\r
+       VWB_DrawPic (124,44,BJCOLLAPSE4PIC);\r
+       VW_UpdateScreen ();\r
+       VW_WaitVBL(3*70);\r
+\r
+       UNCACHEGRCHUNK(BJCOLLAPSE1PIC);\r
+       UNCACHEGRCHUNK(BJCOLLAPSE2PIC);\r
+       UNCACHEGRCHUNK(BJCOLLAPSE3PIC);\r
+       UNCACHEGRCHUNK(BJCOLLAPSE4PIC);\r
+       VL_FadeOut (0,255,0,17,17,5);\r
+#endif\r
+\r
+       StartCPMusic (URAHERO_MUS);\r
+       ClearSplitVWB ();\r
+       CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END);\r
+       CA_CacheGrChunk(STARTFONT);\r
+\r
+#ifndef SPEAR\r
+       CA_CacheGrChunk(C_TIMECODEPIC);\r
+#endif\r
+\r
+\r
+       VWB_Bar (0,0,320,200-STATUSLINES,127);\r
+#ifdef JAPAN\r
+#ifndef JAPDEMO\r
+       CA_CacheGrChunk(C_ENDRATIOSPIC);\r
+       VWB_DrawPic(0,0,C_ENDRATIOSPIC);\r
+       UNCACHEGRCHUNK(C_ENDRATIOSPIC);\r
+#endif\r
+#else\r
+       Write(18,2,STR_YOUWIN);\r
+\r
+       Write(TIMEX,TIMEY-2,STR_TOTALTIME);\r
+\r
+       Write(12,RATIOY-2,"averages");\r
+\r
+       #ifdef SPANISH\r
+       Write(RATIOX+2,  RATIOY,      STR_RATKILL);\r
+       Write(RATIOX+2,  RATIOY+2,  STR_RATSECRET);\r
+       Write(RATIOX+2,  RATIOY+4,STR_RATTREASURE);\r
+       #else\r
+       Write(RATIOX+8,RATIOY,      STR_RATKILL);\r
+       Write(RATIOX+4,RATIOY+2,  STR_RATSECRET);\r
+       Write(RATIOX,  RATIOY+4,STR_RATTREASURE);\r
+       #endif\r
+\r
+#endif\r
+\r
+#ifndef JAPDEMO\r
+       VWB_DrawPic (8,4,L_BJWINSPIC);\r
+#endif\r
+\r
+\r
+#ifndef SPEAR\r
+       for (kr = sr = tr = sec = i = 0;i < 8;i++)\r
+#else\r
+       for (kr = sr = tr = sec = i = 0;i < 20;i++)\r
+#endif\r
+       {\r
+               sec += LevelRatios[i].time;\r
+               kr += LevelRatios[i].kill;\r
+               sr += LevelRatios[i].secret;\r
+               tr += LevelRatios[i].treasure;\r
+       }\r
+\r
+#ifndef SPEAR\r
+       kr /= 8;\r
+       sr /= 8;\r
+       tr /= 8;\r
+#else\r
+       kr /= 14;\r
+       sr /= 14;\r
+       tr /= 14;\r
+#endif\r
+\r
+       min = sec/60;\r
+       sec %= 60;\r
+\r
+       if (min > 99)\r
+               min = sec = 99;\r
+\r
+       i = TIMEX*8+1;\r
+       VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(min/10));\r
+       i += 2*8;\r
+       VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(min%10));\r
+       i += 2*8;\r
+       Write(i/8,TIMEY,":");\r
+       i += 1*8;\r
+       VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(sec/10));\r
+       i += 2*8;\r
+       VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(sec%10));\r
+       VW_UpdateScreen ();\r
+\r
+       itoa(kr,tempstr,10);\r
+       x=RATIOX+24-strlen(tempstr)*2;\r
+       Write(x,RATIOY,tempstr);\r
+\r
+       itoa(sr,tempstr,10);\r
+       x=RATIOX+24-strlen(tempstr)*2;\r
+       Write(x,RATIOY+2,tempstr);\r
+\r
+       itoa(tr,tempstr,10);\r
+       x=RATIOX+24-strlen(tempstr)*2;\r
+       Write(x,RATIOY+4,tempstr);\r
+\r
+\r
+#ifndef SPANISH\r
+#ifndef UPLOAD\r
+#ifndef SPEAR\r
+       //\r
+       // TOTAL TIME VERIFICATION CODE\r
+       //\r
+       if (gamestate.difficulty>=gd_medium)\r
+       {\r
+               VWB_DrawPic (30*8,TIMEY*8,C_TIMECODEPIC);\r
+               fontnumber = 0;\r
+               fontcolor = READHCOLOR;\r
+               PrintX = 30*8-3;\r
+               PrintY = TIMEY*8+8;\r
+               PrintX+=4;\r
+               tempstr[0] = (((min/10)^(min%10))^0xa)+'A';\r
+               tempstr[1] = (((sec/10)^(sec%10))^0xa)+'A';\r
+               tempstr[2] = (tempstr[0]^tempstr[1])+'A';\r
+               tempstr[3] = 0;\r
+               US_Print(tempstr);\r
+       }\r
+#endif\r
+#endif\r
+#endif\r
+\r
+\r
+       fontnumber = 1;\r
+\r
+       VW_UpdateScreen ();\r
+       VW_FadeIn ();\r
+\r
+       IN_Ack();\r
+\r
+       #ifndef SPEAR\r
+       if (Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+               PicturePause();\r
+       #endif\r
+\r
+       VW_FadeOut ();\r
+\r
+#ifndef SPEAR\r
+       UNCACHEGRCHUNK(C_TIMECODEPIC);\r
+#endif\r
+       UnCacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END);\r
+\r
+#ifndef SPEAR\r
+       EndText();\r
+#else\r
+       EndSpear();\r
+#endif\r
+\r
+#endif // SPEARDEMO\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+#ifndef JAPAN\r
+/*\r
+==================\r
+=\r
+= PG13\r
+=\r
+==================\r
+*/\r
+\r
+void PG13 (void)\r
+{\r
+       VW_FadeOut();\r
+       VWB_Bar(0,0,320,200,0x82);                      // background\r
+\r
+       CA_CacheGrChunk (PG13PIC);\r
+       VWB_DrawPic (216,110,PG13PIC);\r
+       VW_UpdateScreen ();\r
+\r
+       UNCACHEGRCHUNK (PG13PIC);\r
+\r
+       VW_FadeIn();\r
+       IN_UserInput(TickBase*7);\r
+\r
+       VW_FadeOut ();\r
+}\r
+#endif\r
+\r
+\r
+//==========================================================================\r
+\r
+void Write(int x,int y,char *string)\r
+{\r
+ int alpha[]={L_NUM0PIC,L_NUM1PIC,L_NUM2PIC,L_NUM3PIC,L_NUM4PIC,L_NUM5PIC,\r
+       L_NUM6PIC,L_NUM7PIC,L_NUM8PIC,L_NUM9PIC,L_COLONPIC,0,0,0,0,0,0,L_APIC,L_BPIC,\r
+       L_CPIC,L_DPIC,L_EPIC,L_FPIC,L_GPIC,L_HPIC,L_IPIC,L_JPIC,L_KPIC,\r
+       L_LPIC,L_MPIC,L_NPIC,L_OPIC,L_PPIC,L_QPIC,L_RPIC,L_SPIC,L_TPIC,\r
+       L_UPIC,L_VPIC,L_WPIC,L_XPIC,L_YPIC,L_ZPIC};\r
+\r
+ int i,ox,nx,ny;\r
+ char ch;\r
+\r
+\r
+ ox=nx=x*8;\r
+ ny=y*8;\r
+ for (i=0;i<strlen(string);i++)\r
+   if (string[i]=='\n')\r
+   {\r
+       nx=ox;\r
+       ny+=16;\r
+   }\r
+   else\r
+   {\r
+       ch=string[i];\r
+       if (ch>='a')\r
+         ch-=('a'-'A');\r
+       ch-='0';\r
+\r
+       switch(string[i])\r
+       {\r
+        case '!':\r
+          VWB_DrawPic(nx,ny,L_EXPOINTPIC);\r
+          nx+=8;\r
+          continue;\r
+\r
+        case '\'':\r
+          VWB_DrawPic(nx,ny,L_APOSTROPHEPIC);\r
+          nx+=8;\r
+          continue;\r
+\r
+        case ' ': break;\r
+        case 0x3a:     // ':'\r
+\r
+          VWB_DrawPic(nx,ny,L_COLONPIC);\r
+          nx+=8;\r
+          continue;\r
+\r
+        case '%':\r
+          VWB_DrawPic(nx,ny,L_PERCENTPIC);\r
+          break;\r
+\r
+        default:\r
+          VWB_DrawPic(nx,ny,alpha[ch]);\r
+       }\r
+       nx+=16;\r
+   }\r
+}\r
+\r
+\r
+//\r
+// Breathe Mr. BJ!!!\r
+//\r
+void BJ_Breathe(void)\r
+{\r
+       static int which=0,max=10;\r
+       int pics[2]={L_GUYPIC,L_GUY2PIC};\r
+\r
+\r
+       if (TimeCount>max)\r
+       {\r
+               which^=1;\r
+               VWB_DrawPic(0,16,pics[which]);\r
+               VW_UpdateScreen();\r
+               TimeCount=0;\r
+               max=35;\r
+       }\r
+}\r
+\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= LevelCompleted\r
+=\r
+= Entered with the screen faded out\r
+= Still in split screen mode with the status bar\r
+=\r
+= Exit with the screen faded out\r
+=\r
+==================\r
+*/\r
+\r
+#ifndef SPEAR\r
+LRstruct LevelRatios[8];\r
+#else\r
+LRstruct LevelRatios[20];\r
+#endif\r
+\r
+void LevelCompleted (void)\r
+{\r
+       #define VBLWAIT 30\r
+       #define PAR_AMOUNT      500\r
+       #define PERCENT100AMT   10000\r
+       typedef struct {\r
+                       float time;\r
+                       char timestr[6];\r
+                       } times;\r
+\r
+       int     x,i,min,sec,ratio,kr,sr,tr;\r
+       unsigned        temp;\r
+       char tempstr[10];\r
+       long bonus,timeleft=0;\r
+       times parTimes[]=\r
+       {\r
+#ifndef SPEAR\r
+        //\r
+        // Episode One Par Times\r
+        //\r
+        {1.5,  "01:30"},\r
+        {2,    "02:00"},\r
+        {2,    "02:00"},\r
+        {3.5,  "03:30"},\r
+        {3,    "03:00"},\r
+        {3,    "03:00"},\r
+        {2.5,  "02:30"},\r
+        {2.5,  "02:30"},\r
+        {0,    "??:??"},       // Boss level\r
+        {0,    "??:??"},       // Secret level\r
+\r
+        //\r
+        // Episode Two Par Times\r
+        //\r
+        {1.5,  "01:30"},\r
+        {3.5,  "03:30"},\r
+        {3,    "03:00"},\r
+        {2,    "02:00"},\r
+        {4,    "04:00"},\r
+        {6,    "06:00"},\r
+        {1,    "01:00"},\r
+        {3,    "03:00"},\r
+        {0,    "??:??"},\r
+        {0,    "??:??"},\r
+\r
+        //\r
+        // Episode Three Par Times\r
+        //\r
+        {1.5,  "01:30"},\r
+        {1.5,  "01:30"},\r
+        {2.5,  "02:30"},\r
+        {2.5,  "02:30"},\r
+        {3.5,  "03:30"},\r
+        {2.5,  "02:30"},\r
+        {2,    "02:00"},\r
+        {6,    "06:00"},\r
+        {0,    "??:??"},\r
+        {0,    "??:??"},\r
+\r
+        //\r
+        // Episode Four Par Times\r
+        //\r
+        {2,    "02:00"},\r
+        {2,    "02:00"},\r
+        {1.5,  "01:30"},\r
+        {1,    "01:00"},\r
+        {4.5,  "04:30"},\r
+        {3.5,  "03:30"},\r
+        {2,    "02:00"},\r
+        {4.5,  "04:30"},\r
+        {0,    "??:??"},\r
+        {0,    "??:??"},\r
+\r
+        //\r
+        // Episode Five Par Times\r
+        //\r
+        {2.5,  "02:30"},\r
+        {1.5,  "01:30"},\r
+        {2.5,  "02:30"},\r
+        {2.5,  "02:30"},\r
+        {4,    "04:00"},\r
+        {3,    "03:00"},\r
+        {4.5,  "04:30"},\r
+        {3.5,  "03:30"},\r
+        {0,    "??:??"},\r
+        {0,    "??:??"},\r
+\r
+        //\r
+        // Episode Six Par Times\r
+        //\r
+        {6.5,  "06:30"},\r
+        {4,    "04:00"},\r
+        {4.5,  "04:30"},\r
+        {6,    "06:00"},\r
+        {5,    "05:00"},\r
+        {5.5,  "05:30"},\r
+        {5.5,  "05:30"},\r
+        {8.5,  "08:30"},\r
+        {0,    "??:??"},\r
+        {0,    "??:??"}\r
+#else\r
+        //\r
+        // SPEAR OF DESTINY TIMES\r
+        //\r
+        {1.5,  "01:30"},\r
+        {3.5,  "03:30"},\r
+        {2.75, "02:45"},\r
+        {3.5,  "03:30"},\r
+        {0,    "??:??"},       // Boss 1\r
+        {4.5,  "04:30"},\r
+        {3.25, "03:15"},\r
+        {2.75, "02:45"},\r
+        {4.75, "04:45"},\r
+        {0,    "??:??"},       // Boss 2\r
+        {6.5,  "06:30"},\r
+        {4.5,  "04:30"},\r
+        {2.75, "02:45"},\r
+        {4.5,  "04:30"},\r
+        {6,    "06:00"},\r
+        {0,    "??:??"},       // Boss 3\r
+        {6,    "06:00"},\r
+        {0,    "??:??"},       // Boss 4\r
+        {0,    "??:??"},       // Secret level 1\r
+        {0,    "??:??"},       // Secret level 2\r
+#endif\r
+       };\r
+\r
+\r
+\r
+       CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END);\r
+       ClearSplitVWB ();                       // set up for double buffering in split screen\r
+       VWB_Bar (0,0,320,200-STATUSLINES,127);\r
+       StartCPMusic(ENDLEVEL_MUS);\r
+\r
+//\r
+// do the intermission\r
+//\r
+       IN_ClearKeysDown();\r
+       IN_StartAck();\r
+\r
+#ifdef JAPAN\r
+       CA_CacheGrChunk(C_INTERMISSIONPIC);\r
+       VWB_DrawPic(0,0,C_INTERMISSIONPIC);\r
+       UNCACHEGRCHUNK(C_INTERMISSIONPIC);\r
+#endif\r
+       VWB_DrawPic(0,16,L_GUYPIC);\r
+\r
+#ifndef SPEAR\r
+       if (mapon<8)\r
+#else\r
+       if (mapon != 4 &&\r
+               mapon != 9 &&\r
+               mapon != 15 &&\r
+               mapon < 17)\r
+#endif\r
+       {\r
+#ifndef JAPAN\r
+        #ifdef SPANISH\r
+        Write(14,2,"piso\ncompletado");\r
+        #else\r
+        Write(14,2,"floor\ncompleted");\r
+        #endif\r
+\r
+        Write(14,7,STR_BONUS"     0");\r
+        Write(16,10,STR_TIME);\r
+        Write(16,12,STR_PAR);\r
+\r
+        #ifdef SPANISH\r
+        Write(11,14,    STR_RAT2KILL);\r
+        Write(11,16,  STR_RAT2SECRET);\r
+        Write(11,18,STR_RAT2TREASURE);\r
+        #else\r
+        Write(9,14,    STR_RAT2KILL);\r
+        Write(5,16,  STR_RAT2SECRET);\r
+        Write(1,18,STR_RAT2TREASURE);\r
+        #endif\r
+\r
+        Write(26,2,itoa(gamestate.mapon+1,tempstr,10));\r
+#endif\r
+\r
+        #ifdef SPANISH\r
+        Write(30,12,parTimes[gamestate.episode*10+mapon].timestr);\r
+        #else\r
+        Write(26,12,parTimes[gamestate.episode*10+mapon].timestr);\r
+        #endif\r
+\r
+        //\r
+        // PRINT TIME\r
+        //\r
+        sec=gamestate.TimeCount/70;\r
+\r
+        if (sec > 99*60)               // 99 minutes max\r
+          sec = 99*60;\r
+\r
+        if (gamestate.TimeCount<parTimes[gamestate.episode*10+mapon].time*4200)\r
+               timeleft=(parTimes[gamestate.episode*10+mapon].time*4200)/70-sec;\r
+\r
+        min=sec/60;\r
+        sec%=60;\r
+\r
+        #ifdef SPANISH\r
+        i=30*8;\r
+        #else\r
+        i=26*8;\r
+        #endif\r
+        VWB_DrawPic(i,10*8,L_NUM0PIC+(min/10));\r
+        i+=2*8;\r
+        VWB_DrawPic(i,10*8,L_NUM0PIC+(min%10));\r
+        i+=2*8;\r
+        Write(i/8,10,":");\r
+        i+=1*8;\r
+        VWB_DrawPic(i,10*8,L_NUM0PIC+(sec/10));\r
+        i+=2*8;\r
+        VWB_DrawPic(i,10*8,L_NUM0PIC+(sec%10));\r
+\r
+        VW_UpdateScreen ();\r
+        VW_FadeIn ();\r
+\r
+\r
+        //\r
+        // FIGURE RATIOS OUT BEFOREHAND\r
+        //\r
+        kr = sr = tr = 0;\r
+        if (gamestate.killtotal)\r
+               kr=(gamestate.killcount*100)/gamestate.killtotal;\r
+        if (gamestate.secrettotal)\r
+               sr=(gamestate.secretcount*100)/gamestate.secrettotal;\r
+        if (gamestate.treasuretotal)\r
+               tr=(gamestate.treasurecount*100)/gamestate.treasuretotal;\r
+\r
+\r
+        //\r
+        // PRINT TIME BONUS\r
+        //\r
+        bonus=timeleft*PAR_AMOUNT;\r
+        if (bonus)\r
+        {\r
+         for (i=0;i<=timeleft;i++)\r
+         {\r
+          ltoa((long)i*PAR_AMOUNT,tempstr,10);\r
+          x=36-strlen(tempstr)*2;\r
+          Write(x,7,tempstr);\r
+          if (!(i%(PAR_AMOUNT/10)))\r
+                SD_PlaySound(ENDBONUS1SND);\r
+          VW_UpdateScreen();\r
+          while(SD_SoundPlaying())\r
+                BJ_Breathe();\r
+          if (IN_CheckAck())\r
+                goto done;\r
+         }\r
+\r
+         VW_UpdateScreen();\r
+         SD_PlaySound(ENDBONUS2SND);\r
+         while(SD_SoundPlaying())\r
+               BJ_Breathe();\r
+        }\r
+\r
+\r
+        #ifdef SPANISH\r
+        #define RATIOXX                33\r
+        #else\r
+        #define RATIOXX                37\r
+        #endif\r
+        //\r
+        // KILL RATIO\r
+        //\r
+        ratio=kr;\r
+        for (i=0;i<=ratio;i++)\r
+        {\r
+         itoa(i,tempstr,10);\r
+         x=RATIOXX-strlen(tempstr)*2;\r
+         Write(x,14,tempstr);\r
+         if (!(i%10))\r
+               SD_PlaySound(ENDBONUS1SND);\r
+         VW_UpdateScreen ();\r
+         while(SD_SoundPlaying())\r
+               BJ_Breathe();\r
+\r
+         if (IN_CheckAck())\r
+               goto done;\r
+        }\r
+        if (ratio==100)\r
+        {\r
+          VW_WaitVBL(VBLWAIT);\r
+          SD_StopSound();\r
+          bonus+=PERCENT100AMT;\r
+          ltoa(bonus,tempstr,10);\r
+          x=(RATIOXX-1)-strlen(tempstr)*2;\r
+          Write(x,7,tempstr);\r
+          VW_UpdateScreen();\r
+          SD_PlaySound(PERCENT100SND);\r
+        }\r
+        else\r
+        if (!ratio)\r
+        {\r
+          VW_WaitVBL(VBLWAIT);\r
+          SD_StopSound();\r
+          SD_PlaySound(NOBONUSSND);\r
+        }\r
+        else\r
+        SD_PlaySound(ENDBONUS2SND);\r
+\r
+        VW_UpdateScreen();\r
+        while(SD_SoundPlaying())\r
+          BJ_Breathe();\r
+\r
+\r
+        //\r
+        // SECRET RATIO\r
+        //\r
+        ratio=sr;\r
+        for (i=0;i<=ratio;i++)\r
+        {\r
+         itoa(i,tempstr,10);\r
+         x=RATIOXX-strlen(tempstr)*2;\r
+         Write(x,16,tempstr);\r
+         if (!(i%10))\r
+               SD_PlaySound(ENDBONUS1SND);\r
+         VW_UpdateScreen ();\r
+         while(SD_SoundPlaying())\r
+               BJ_Breathe();\r
+         BJ_Breathe();\r
+\r
+         if (IN_CheckAck())\r
+               goto done;\r
+        }\r
+        if (ratio==100)\r
+        {\r
+          VW_WaitVBL(VBLWAIT);\r
+          SD_StopSound();\r
+          bonus+=PERCENT100AMT;\r
+          ltoa(bonus,tempstr,10);\r
+          x=(RATIOXX-1)-strlen(tempstr)*2;\r
+          Write(x,7,tempstr);\r
+          VW_UpdateScreen();\r
+          SD_PlaySound(PERCENT100SND);\r
+        }\r
+        else\r
+        if (!ratio)\r
+        {\r
+          VW_WaitVBL(VBLWAIT);\r
+          SD_StopSound();\r
+          SD_PlaySound(NOBONUSSND);\r
+        }\r
+        else\r
+          SD_PlaySound(ENDBONUS2SND);\r
+        VW_UpdateScreen();\r
+        while(SD_SoundPlaying())\r
+          BJ_Breathe();\r
+\r
+\r
+        //\r
+        // TREASURE RATIO\r
+        //\r
+        ratio=tr;\r
+        for (i=0;i<=ratio;i++)\r
+        {\r
+         itoa(i,tempstr,10);\r
+         x=RATIOXX-strlen(tempstr)*2;\r
+         Write(x,18,tempstr);\r
+         if (!(i%10))\r
+               SD_PlaySound(ENDBONUS1SND);\r
+         VW_UpdateScreen ();\r
+         while(SD_SoundPlaying())\r
+               BJ_Breathe();\r
+         if (IN_CheckAck())\r
+               goto done;\r
+        }\r
+        if (ratio==100)\r
+        {\r
+          VW_WaitVBL(VBLWAIT);\r
+          SD_StopSound();\r
+          bonus+=PERCENT100AMT;\r
+          ltoa(bonus,tempstr,10);\r
+          x=(RATIOXX-1)-strlen(tempstr)*2;\r
+          Write(x,7,tempstr);\r
+          VW_UpdateScreen();\r
+          SD_PlaySound(PERCENT100SND);\r
+        }\r
+        else\r
+        if (!ratio)\r
+        {\r
+          VW_WaitVBL(VBLWAIT);\r
+          SD_StopSound();\r
+          SD_PlaySound(NOBONUSSND);\r
+        }\r
+        else\r
+        SD_PlaySound(ENDBONUS2SND);\r
+        VW_UpdateScreen();\r
+        while(SD_SoundPlaying())\r
+          BJ_Breathe();\r
+\r
+\r
+        //\r
+        // JUMP STRAIGHT HERE IF KEY PRESSED\r
+        //\r
+        done:\r
+\r
+        itoa(kr,tempstr,10);\r
+        x=RATIOXX-strlen(tempstr)*2;\r
+        Write(x,14,tempstr);\r
+\r
+        itoa(sr,tempstr,10);\r
+        x=RATIOXX-strlen(tempstr)*2;\r
+        Write(x,16,tempstr);\r
+\r
+        itoa(tr,tempstr,10);\r
+        x=RATIOXX-strlen(tempstr)*2;\r
+        Write(x,18,tempstr);\r
+\r
+        bonus=(long)timeleft*PAR_AMOUNT+\r
+                  (PERCENT100AMT*(kr==100))+\r
+                  (PERCENT100AMT*(sr==100))+\r
+                  (PERCENT100AMT*(tr==100));\r
+\r
+        GivePoints(bonus);\r
+        ltoa(bonus,tempstr,10);\r
+        x=36-strlen(tempstr)*2;\r
+        Write(x,7,tempstr);\r
+\r
+        //\r
+        // SAVE RATIO INFORMATION FOR ENDGAME\r
+        //\r
+        LevelRatios[mapon].kill=kr;\r
+        LevelRatios[mapon].secret=sr;\r
+        LevelRatios[mapon].treasure=tr;\r
+        LevelRatios[mapon].time=min*60+sec;\r
+       }\r
+       else\r
+       {\r
+#ifdef SPEAR\r
+#ifndef SPEARDEMO\r
+         switch(mapon)\r
+         {\r
+          case 4: Write(14,4," trans\n"\r
+                                                 " grosse\n"\r
+                                                 STR_DEFEATED); break;\r
+          case 9: Write(14,4,"barnacle\n"\r
+                                                 "wilhelm\n"\r
+                                                 STR_DEFEATED); break;\r
+          case 15: Write(14,4,"ubermutant\n"\r
+                                                  STR_DEFEATED); break;\r
+          case 17: Write(14,4," death\n"\r
+                                                  " knight\n"\r
+                                                  STR_DEFEATED); break;\r
+          case 18: Write(13,4,"secret tunnel\n"\r
+                                                  "    area\n"\r
+                                                  "  completed!"); break;\r
+          case 19: Write(13,4,"secret castle\n"\r
+                                                  "    area\n"\r
+                                                  "  completed!"); break;\r
+         }\r
+#endif\r
+#else\r
+         Write(14,4,"secret floor\n completed!");\r
+#endif\r
+\r
+         Write(10,16,"15000 bonus!");\r
+\r
+         VW_UpdateScreen();\r
+         VW_FadeIn();\r
+\r
+         GivePoints(15000);\r
+       }\r
+\r
+\r
+       DrawScore();\r
+       VW_UpdateScreen();\r
+\r
+       TimeCount=0;\r
+       IN_StartAck();\r
+       while(!IN_CheckAck())\r
+         BJ_Breathe();\r
+\r
+//\r
+// done\r
+//\r
+#ifdef SPEARDEMO\r
+       if (gamestate.mapon == 1)\r
+       {\r
+               SD_PlaySound (BONUS1UPSND);\r
+\r
+               CA_CacheGrChunk (STARTFONT+1);\r
+               Message ("This concludes your demo\n"\r
+                                "of Spear of Destiny! Now,\n"\r
+                                "go to your local software\n"\r
+                                "store and buy it!");\r
+               UNCACHEGRCHUNK (STARTFONT+1);\r
+\r
+               IN_ClearKeysDown();\r
+               IN_Ack();\r
+       }\r
+#endif\r
+\r
+#ifdef JAPDEMO\r
+       if (gamestate.mapon == 3)\r
+       {\r
+               SD_PlaySound (BONUS1UPSND);\r
+\r
+               CA_CacheGrChunk (STARTFONT+1);\r
+               Message ("This concludes your demo\n"\r
+                                "of Wolfenstein 3-D! Now,\n"\r
+                                "go to your local software\n"\r
+                                "store and buy it!");\r
+               UNCACHEGRCHUNK (STARTFONT+1);\r
+\r
+               IN_ClearKeysDown();\r
+               IN_Ack();\r
+       }\r
+#endif\r
+\r
+       #ifndef SPEAR\r
+       if (Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+               PicturePause();\r
+       #endif\r
+\r
+       VW_FadeOut ();\r
+       temp = bufferofs;\r
+       for (i=0;i<3;i++)\r
+       {\r
+               bufferofs = screenloc[i];\r
+               DrawPlayBorder ();\r
+       }\r
+       bufferofs = temp;\r
+\r
+       UnCacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END);\r
+}\r
+\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= PreloadGraphics\r
+=\r
+= Fill the cache up\r
+=\r
+=================\r
+*/\r
+\r
+boolean PreloadUpdate(unsigned current, unsigned total)\r
+{\r
+       unsigned w = WindowW - 10;\r
+\r
+\r
+       VWB_Bar(WindowX + 5,WindowY + WindowH - 3,w,2,BLACK);\r
+       w = ((long)w * current) / total;\r
+       if (w)\r
+       {\r
+        VWB_Bar(WindowX + 5,WindowY + WindowH - 3,w,2,0x37); //SECONDCOLOR);\r
+        VWB_Bar(WindowX + 5,WindowY + WindowH - 3,w-1,1,0x32);\r
+\r
+       }\r
+       VW_UpdateScreen();\r
+//     if (LastScan == sc_Escape)\r
+//     {\r
+//             IN_ClearKeysDown();\r
+//             return(true);\r
+//     }\r
+//     else\r
+               return(false);\r
+}\r
+\r
+void PreloadGraphics(void)\r
+{\r
+       DrawLevel ();\r
+       ClearSplitVWB ();                       // set up for double buffering in split screen\r
+\r
+       VWB_Bar (0,0,320,200-STATUSLINES,127);\r
+\r
+       LatchDrawPic (20-14,80-3*8,GETPSYCHEDPIC);\r
+\r
+       WindowX = 160-14*8;\r
+       WindowY = 80-3*8;\r
+       WindowW = 28*8;\r
+       WindowH = 48;\r
+       VW_UpdateScreen();\r
+       VW_FadeIn ();\r
+\r
+       PM_Preload (PreloadUpdate);\r
+       IN_UserInput (70);\r
+       VW_FadeOut ();\r
+\r
+       DrawPlayBorder ();\r
+       VW_UpdateScreen ();\r
+}\r
+\r
+\r
+//==========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= DrawHighScores\r
+=\r
+==================\r
+*/\r
+\r
+void   DrawHighScores(void)\r
+{\r
+       char            buffer[16],*str,buffer1[5];\r
+       byte            temp,temp1,temp2,temp3;\r
+       word            i,j,\r
+                               w,h,\r
+                               x,y;\r
+       HighScore       *s;\r
+\r
+\r
+       MM_SortMem ();\r
+\r
+#ifndef SPEAR\r
+//     CA_CacheGrChunk (C_CODEPIC);\r
+       CA_CacheGrChunk (HIGHSCORESPIC);\r
+       CA_CacheGrChunk (STARTFONT);\r
+       CA_CacheGrChunk (C_LEVELPIC);\r
+       CA_CacheGrChunk (C_SCOREPIC);\r
+       CA_CacheGrChunk (C_NAMEPIC);\r
+\r
+       ClearMScreen();\r
+       DrawStripes(10);\r
+\r
+       VWB_DrawPic(48,0,HIGHSCORESPIC);\r
+       UNCACHEGRCHUNK (HIGHSCORESPIC);\r
+\r
+       VWB_DrawPic(4*8,68,C_NAMEPIC);\r
+       VWB_DrawPic(20*8,68,C_LEVELPIC);\r
+       VWB_DrawPic(28*8,68,C_SCOREPIC);\r
+#ifndef UPLOAD\r
+//     VWB_DrawPic(35*8,68,C_CODEPIC);\r
+#endif\r
+       fontnumber=0;\r
+\r
+#else\r
+       CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+       ClearMScreen();\r
+       DrawStripes(10);\r
+       UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+\r
+       CacheLump (HIGHSCORES_LUMP_START,HIGHSCORES_LUMP_END);\r
+       CA_CacheGrChunk (STARTFONT+1);\r
+       VWB_DrawPic (0,0,HIGHSCORESPIC);\r
+\r
+       fontnumber = 1;\r
+#endif\r
+\r
+\r
+#ifndef SPEAR\r
+       SETFONTCOLOR(15,0x29);\r
+#else\r
+       SETFONTCOLOR(HIGHLIGHT,0x29);\r
+#endif\r
+\r
+       for (i = 0,s = Scores;i < MaxScores;i++,s++)\r
+       {\r
+               PrintY = 76 + (16 * i);\r
+\r
+               //\r
+               // name\r
+               //\r
+#ifndef SPEAR\r
+               PrintX = 4*8;\r
+#else\r
+               PrintX = 16;\r
+#endif\r
+               US_Print(s->name);\r
+\r
+               //\r
+               // level\r
+               //\r
+               ultoa(s->completed,buffer,10);\r
+#ifndef SPEAR\r
+               for (str = buffer;*str;str++)\r
+                       *str = *str + (129 - '0');      // Used fixed-width numbers (129...)\r
+               USL_MeasureString(buffer,&w,&h);\r
+               PrintX = (22 * 8)-w;\r
+#else\r
+               USL_MeasureString(buffer,&w,&h);\r
+               PrintX = 194 - w;\r
+#endif\r
+\r
+#ifndef UPLOAD\r
+#ifndef SPEAR\r
+               PrintX -= 6;\r
+               itoa(s->episode+1,buffer1,10);\r
+               US_Print("E");\r
+               US_Print(buffer1);\r
+               US_Print("/L");\r
+#endif\r
+#endif\r
+\r
+#ifdef SPEAR\r
+               if (s->completed == 21)\r
+                       VWB_DrawPic (PrintX+8,PrintY-1,C_WONSPEARPIC);\r
+               else\r
+#endif\r
+               US_Print(buffer);\r
+\r
+               //\r
+               // score\r
+               //\r
+               ultoa(s->score,buffer,10);\r
+#ifndef SPEAR\r
+               for (str = buffer;*str;str++)\r
+                       *str = *str + (129 - '0');      // Used fixed-width numbers (129...)\r
+               USL_MeasureString(buffer,&w,&h);\r
+               PrintX = (34 * 8) - 8 - w;\r
+#else\r
+               USL_MeasureString(buffer,&w,&h);\r
+               PrintX = 292 - w;\r
+#endif\r
+               US_Print(buffer);\r
+\r
+               #if 0\r
+#ifndef UPLOAD\r
+#ifndef SPEAR\r
+               //\r
+               // verification #\r
+               //\r
+               if (!i)\r
+               {\r
+                temp=(((s->score >> 28)& 0xf)^\r
+                         ((s->score >> 24)& 0xf))+'A';\r
+                temp1=(((s->score >> 20)& 0xf)^\r
+                          ((s->score >> 16)& 0xf))+'A';\r
+                temp2=(((s->score >> 12)& 0xf)^\r
+                          ((s->score >> 8)& 0xf))+'A';\r
+                temp3=(((s->score >> 4)& 0xf)^\r
+                          ((s->score >> 0)& 0xf))+'A';\r
+\r
+                SETFONTCOLOR(0x49,0x29);\r
+                PrintX = 35*8;\r
+                buffer[0]=temp;\r
+                buffer[1]=temp1;\r
+                buffer[2]=temp2;\r
+                buffer[3]=temp3;\r
+                buffer[4]=0;\r
+                US_Print(buffer);\r
+                SETFONTCOLOR(15,0x29);\r
+               }\r
+#endif\r
+#endif\r
+               #endif\r
+       }\r
+\r
+       VW_UpdateScreen ();\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (HIGHSCORES_LUMP_START,HIGHSCORES_LUMP_END);\r
+       fontnumber = 0;\r
+#endif\r
+}\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= CheckHighScore\r
+=\r
+=======================\r
+*/\r
+\r
+void   CheckHighScore (long score,word other)\r
+{\r
+       word            i,j;\r
+       int                     n;\r
+       HighScore       myscore;\r
+\r
+       strcpy(myscore.name,"");\r
+       myscore.score = score;\r
+       myscore.episode = gamestate.episode;\r
+       myscore.completed = other;\r
+\r
+       for (i = 0,n = -1;i < MaxScores;i++)\r
+       {\r
+               if\r
+               (\r
+                       (myscore.score > Scores[i].score)\r
+               ||      (\r
+                               (myscore.score == Scores[i].score)\r
+                       &&      (myscore.completed > Scores[i].completed)\r
+                       )\r
+               )\r
+               {\r
+                       for (j = MaxScores;--j > i;)\r
+                               Scores[j] = Scores[j - 1];\r
+                       Scores[i] = myscore;\r
+                       n = i;\r
+                       break;\r
+               }\r
+       }\r
+\r
+#ifdef SPEAR\r
+       StartCPMusic (XAWARD_MUS);\r
+#else\r
+       StartCPMusic (ROSTER_MUS);\r
+#endif\r
+       DrawHighScores ();\r
+\r
+       VW_FadeIn ();\r
+\r
+       if (n != -1)\r
+       {\r
+       //\r
+       // got a high score\r
+       //\r
+               PrintY = 76 + (16 * n);\r
+#ifndef SPEAR\r
+               PrintX = 4*8;\r
+               backcolor = BORDCOLOR;\r
+               fontcolor = 15;\r
+               US_LineInput(PrintX,PrintY,Scores[n].name,nil,true,MaxHighName,100);\r
+#else\r
+               PrintX = 16;\r
+               fontnumber = 1;\r
+               VWB_Bar (PrintX-2,PrintY-2,145,15,0x9c);\r
+               VW_UpdateScreen ();\r
+               backcolor = 0x9c;\r
+               fontcolor = 15;\r
+               US_LineInput(PrintX,PrintY,Scores[n].name,nil,true,MaxHighName,130);\r
+#endif\r
+       }\r
+       else\r
+       {\r
+               IN_ClearKeysDown ();\r
+               IN_UserInput(500);\r
+       }\r
+\r
+}\r
+\r
+\r
+#ifndef UPLOAD\r
+#ifndef SPEAR\r
+#ifndef JAPAN\r
+////////////////////////////////////////////////////////\r
+//\r
+// NON-SHAREWARE NOTICE\r
+//\r
+////////////////////////////////////////////////////////\r
+void NonShareware(void)\r
+{\r
+       VW_FadeOut();\r
+\r
+       ClearMScreen();\r
+       DrawStripes(10);\r
+\r
+       CA_CacheGrChunk(STARTFONT+1);\r
+       fontnumber = 1;\r
+\r
+       SETFONTCOLOR(READHCOLOR,BKGDCOLOR);\r
+       PrintX=110;\r
+       PrintY=15;\r
+\r
+       #ifdef SPANISH\r
+       US_Print("Atencion");\r
+       #else\r
+       US_Print("Attention");\r
+       #endif\r
+\r
+       SETFONTCOLOR(HIGHLIGHT,BKGDCOLOR);\r
+       WindowX=PrintX=40;\r
+       PrintY=60;\r
+       #ifdef SPANISH\r
+       US_Print("Este juego NO es gratis y\n");\r
+       US_Print("NO es Shareware; favor de\n");\r
+       US_Print("no distribuirlo.\n\n");\r
+       #else\r
+       US_Print("This game is NOT shareware.\n");\r
+       US_Print("Please do not distribute it.\n");\r
+       US_Print("Thanks.\n\n");\r
+       #endif\r
+       US_Print("        Id Software\n");\r
+\r
+       VW_UpdateScreen ();\r
+       VW_FadeIn();\r
+       IN_Ack();\r
+}\r
+#endif\r
+#endif\r
+#endif\r
+\r
+#ifdef SPEAR\r
+#ifndef SPEARDEMO\r
+////////////////////////////////////////////////////////\r
+//\r
+// COPY PROTECTION FOR FormGen\r
+//\r
+////////////////////////////////////////////////////////\r
+char   far CopyProFailedStrs[][100] = {\r
+                       STR_COPY1,\r
+                       STR_COPY2,\r
+\r
+                       STR_COPY3,\r
+                       STR_COPY4,\r
+\r
+                       STR_COPY5,\r
+                       STR_COPY6,\r
+\r
+                       STR_COPY7,\r
+                       STR_COPY8,\r
+\r
+                       STR_COPY9,\r
+                       "",\r
+\r
+                       STR_COPY10,\r
+                       STR_COPY11,\r
+\r
+                       STR_COPY12,\r
+                       "",\r
+\r
+                       STR_COPY13,\r
+                       "",\r
+\r
+                       STR_COPY14,\r
+                       ""\r
+                       },\r
+\r
+               far BackDoorStrs[5][16] = {\r
+                       "a spoon?",\r
+                       "bite me!",\r
+                       "joshua",\r
+                       "pelt",\r
+#ifdef BETA\r
+                       "beta"\r
+#else\r
+                       "snoops"\r
+#endif\r
+                       },\r
+\r
+               far GoodBoyStrs[10][40] = {\r
+                       "...is the CORRECT ANSWER!",\r
+                       "",\r
+\r
+                       "Consider yourself bitten, sir.",\r
+                       "",\r
+\r
+                       "Greetings Professor Falken, would you",\r
+                       "like to play Spear of Destiny?",\r
+\r
+                       "Do you have any gold spray paint?",\r
+                       "",\r
+\r
+#ifdef BETA\r
+                       "Beta testing approved.",\r
+#else\r
+                       "I wish I had a 21\" monitor...",\r
+#endif\r
+                       ""\r
+                       },\r
+\r
+               far bossstrs[4][24] = {\r
+                       "DEATH KNIGHT",\r
+                       "BARNACLE WILHELM",\r
+                       "UBERMUTANTUBER MUTANT",\r
+                       "TRANS GROSSE"\r
+                       },\r
+\r
+               far WordStr[5][20] = {\r
+                       "New Game",\r
+                       "Sound...F4",\r
+                       "Control...F6",\r
+                       "Change View...F5",\r
+                       "Quit...F10"},\r
+\r
+               far     WordCorrect[5][2] = {"3","4","4","5","5"},\r
+\r
+               far MemberStr[10][40] = {\r
+                       STR_COPY15,\r
+                       "",\r
+\r
+                       STR_COPY16,\r
+                       "",\r
+\r
+                       STR_COPY17,\r
+                       STR_COPY18,\r
+\r
+                       STR_COPY19,\r
+                       STR_COPY20,\r
+\r
+                       STR_COPY21,\r
+                       STR_COPY22},\r
+\r
+               far MemberCorrect[5][24] = {\r
+                       "adrian carmack",\r
+                       "john carmackjohn romero",\r
+                       "tom hall",\r
+                       "jay wilbur",\r
+                       "kevin cloud"},\r
+\r
+               far DosMessages[9][80] = {\r
+                       STR_NOPE1,\r
+                       STR_NOPE2,\r
+                       STR_NOPE3,\r
+                       STR_NOPE4,\r
+                       STR_NOPE5,\r
+                       STR_NOPE6,\r
+                       STR_NOPE7,\r
+                       STR_NOPE8,\r
+                       STR_NOPE9},\r
+\r
+               far MiscTitle[4][20] = {\r
+                       "BLOOD TEST",\r
+                       "STRAIGHT-LACED",\r
+                       "QUITE SHAPELY",\r
+                       "I AM WHAT I AMMO"\r
+                       },\r
+\r
+               far MiscStr[12][40] = {\r
+                       STR_MISC1,\r
+                       STR_MISC2,\r
+                       "",\r
+\r
+                       STR_MISC3,\r
+                       STR_MISC4,\r
+                       "",\r
+\r
+                       STR_MISC5,\r
+                       STR_MISC6,\r
+                       "",\r
+\r
+                       STR_MISC7,\r
+                       STR_MISC8,\r
+                       STR_MISC9\r
+                       },\r
+\r
+               far MiscCorrect[4][5] = {"ss","8",STR_STAR,"45"};\r
+\r
+\r
+int  BackDoor(char *s)\r
+{\r
+       int i;\r
+\r
+\r
+       strlwr(s);\r
+\r
+       for (i=0;i<5;i++)\r
+               if (!_fstrcmp(s,BackDoorStrs[i]))\r
+               {\r
+                       SETFONTCOLOR(14,15);\r
+                       fontnumber = 0;\r
+                       PrintY = 175;\r
+                       VWB_DrawPic (0,20*8,COPYPROTBOXPIC);\r
+                       US_CPrint(GoodBoyStrs[i*2]);\r
+                       US_CPrint(GoodBoyStrs[i*2+1]);\r
+                       VW_UpdateScreen();\r
+                       return 1;\r
+               }\r
+\r
+       return 0;\r
+}\r
+\r
+\r
+void CopyProtection(void)\r
+{\r
+#define TYPEBOX_Y              177\r
+#define TYPEBOX_BKGD   0x9c\r
+#define PRINTCOLOR             HIGHLIGHT\r
+\r
+       int     i,match,whichboss,bossnum,try,whichline,enemypicked[4]={0,0,0,0},\r
+               bosses[4] = { BOSSPIC1PIC,BOSSPIC2PIC,BOSSPIC3PIC,BOSSPIC4PIC },\r
+               whichone,whichpicked[4]={0,0,0,0},quiztype,whichmem,\r
+               memberpicked[5]={0,0,0,0,0},wordpicked[5]={0,0,0,0,0},whichword;\r
+\r
+       char    inputbuffer[20],\r
+                       message[80];\r
+\r
+       enum\r
+       {\r
+               debriefing,\r
+               checkmanual,\r
+               staffquiz,\r
+               miscquiz,\r
+\r
+               totaltypes\r
+       };\r
+\r
+\r
+\r
+       try = 0;\r
+       VW_FadeOut();\r
+       CA_CacheGrChunk(C_BACKDROPPIC);\r
+       CacheLump(COPYPROT_LUMP_START,COPYPROT_LUMP_END);\r
+       CA_CacheGrChunk(STARTFONT+1);\r
+       CA_LoadAllSounds();\r
+       StartCPMusic(COPYPRO_MUS);\r
+       US_InitRndT(true);\r
+\r
+       while (try<3)\r
+       {\r
+               fontnumber = 1;\r
+               SETFONTCOLOR(PRINTCOLOR-2,15);\r
+               VWB_DrawPic (0,0,C_BACKDROPPIC);\r
+               VWB_DrawPic (0,0,COPYPROTTOPPIC);\r
+               VWB_DrawPic (0,20*8,COPYPROTBOXPIC);\r
+               WindowX = WindowY = 0;\r
+               WindowW = 320;\r
+               WindowH = 200;\r
+               PrintY = 65;\r
+\r
+               quiztype = US_RndT()%totaltypes;\r
+               switch(quiztype)\r
+               {\r
+                       //\r
+                       // BOSSES QUIZ\r
+                       //\r
+                       case debriefing:\r
+                               PrintX = 0;\r
+                               US_Print(STR_DEBRIEF);\r
+                               SETFONTCOLOR(PRINTCOLOR,15);\r
+\r
+                               while (enemypicked[whichboss = US_RndT()&3]);\r
+                               enemypicked[whichboss] = 1;\r
+                               bossnum = bosses[whichboss];\r
+                               VWB_DrawPic(128,60,bossnum);\r
+                               fontnumber = 0;\r
+                               PrintY = 130;\r
+                               US_CPrint(STR_ENEMY1"\n");\r
+                               US_CPrint(STR_ENEMY2"\n\n");\r
+\r
+                               VW_UpdateScreen();\r
+                               VW_FadeIn();\r
+\r
+                               PrintX = 100;\r
+                               fontcolor = 15;\r
+                               backcolor = TYPEBOX_BKGD;\r
+                               inputbuffer[0] = 0;\r
+                               PrintY = TYPEBOX_Y;\r
+                               fontnumber = 1;\r
+                               US_LineInput(PrintX,PrintY,inputbuffer,nil,true,20,100);\r
+\r
+                               match = 0;\r
+                               for (i=0;i<_fstrlen(bossstrs[whichboss]);i++)\r
+                                       if (!_fstrnicmp(inputbuffer,bossstrs[whichboss]+i,strlen(inputbuffer)) &&\r
+                                               strlen(inputbuffer)>3)\r
+                                               match = 1;\r
+\r
+                               match += BackDoor(inputbuffer);\r
+                               break;\r
+\r
+                       //\r
+                       // MANUAL CHECK\r
+                       //\r
+                       case checkmanual:\r
+                               while (wordpicked[whichword = US_RndT()%5]);\r
+                               wordpicked[whichword] = 1;\r
+                               US_CPrint(STR_CHECKMAN);\r
+                               SETFONTCOLOR(PRINTCOLOR,15);\r
+                               PrintY += 25;\r
+                               US_CPrint(STR_MAN1);\r
+                               US_CPrint(STR_MAN2);\r
+                               _fstrcpy(message,STR_MAN3" \"");\r
+                               _fstrcat(message,WordStr[whichword]);\r
+                               _fstrcat(message,"\" "STR_MAN4);\r
+                               US_CPrint(message);\r
+                               VW_UpdateScreen();\r
+                               VW_FadeIn();\r
+\r
+                               PrintX = 146;\r
+                               fontcolor = 15;\r
+                               backcolor = TYPEBOX_BKGD;\r
+                               inputbuffer[0] = 0;\r
+                               PrintY = TYPEBOX_Y;\r
+                               US_LineInput(PrintX,PrintY,inputbuffer,nil,true,6,100);\r
+\r
+                               strlwr(inputbuffer);\r
+                               match = 1-(_fstrcmp(inputbuffer,WordCorrect[whichword])!=0);\r
+                               match += BackDoor(inputbuffer);\r
+                               break;\r
+\r
+                       //\r
+                       // STAFF QUIZ\r
+                       //\r
+                       case staffquiz:\r
+                               while (memberpicked[whichmem = US_RndT()%5]);\r
+                               memberpicked[whichmem] = 1;\r
+                               US_CPrint(STR_ID1);\r
+                               SETFONTCOLOR(PRINTCOLOR,15);\r
+                               PrintY += 25;\r
+                               US_CPrint(MemberStr[whichmem*2]);\r
+                               US_CPrint(MemberStr[whichmem*2+1]);\r
+                               VW_UpdateScreen();\r
+                               VW_FadeIn();\r
+\r
+                               PrintX = 100;\r
+                               fontcolor = 15;\r
+                               backcolor = TYPEBOX_BKGD;\r
+                               inputbuffer[0] = 0;\r
+                               PrintY = TYPEBOX_Y;\r
+                               US_LineInput(PrintX,PrintY,inputbuffer,nil,true,20,120);\r
+\r
+                               strlwr(inputbuffer);\r
+                               match = 0;\r
+                               for (i=0;i<_fstrlen(MemberCorrect[whichmem]);i++)\r
+                                       if (!_fstrnicmp(inputbuffer,MemberCorrect[whichmem]+i,strlen(inputbuffer)) &&\r
+                                               strlen(inputbuffer)>2)\r
+                                                       match = 1;\r
+                               match += BackDoor(inputbuffer);\r
+                               break;\r
+\r
+                       //\r
+                       // MISCELLANEOUS QUESTIONS\r
+                       //\r
+                       case miscquiz:\r
+                               while (whichpicked[whichone = US_RndT()&3]);\r
+                               whichpicked[whichone] = 1;\r
+                               US_CPrint(MiscTitle[whichone]);\r
+                               SETFONTCOLOR(PRINTCOLOR,15);\r
+                               PrintY += 25;\r
+                               US_CPrint(MiscStr[whichone*3]);\r
+                               US_CPrint(MiscStr[whichone*3+1]);\r
+                               US_CPrint(MiscStr[whichone*3+2]);\r
+                               VW_UpdateScreen();\r
+                               VW_FadeIn();\r
+\r
+                               PrintX = 146;\r
+                               fontcolor = 15;\r
+                               backcolor = TYPEBOX_BKGD;\r
+                               inputbuffer[0] = 0;\r
+                               PrintY = TYPEBOX_Y;\r
+                               US_LineInput(PrintX,PrintY,inputbuffer,nil,true,6,100);\r
+\r
+                               strlwr(inputbuffer);\r
+                               match = 1-(_fstrcmp(inputbuffer,MiscCorrect[whichone])!=0);\r
+                               match += BackDoor(inputbuffer);\r
+                               break;\r
+                       }\r
+\r
+               //\r
+               // IF NO MATCH, WE'VE GOT A (MINOR) PROBLEM!\r
+               //\r
+\r
+               if (!match)\r
+               {\r
+                       whichline = 2*(US_RndT()%9);\r
+                       SETFONTCOLOR(14,15);\r
+                       fontnumber = 0;\r
+                       PrintY = 175;\r
+                       VWB_DrawPic (0,20*8,COPYPROTBOXPIC);\r
+                       US_CPrint(CopyProFailedStrs[whichline]);\r
+                       US_CPrint(CopyProFailedStrs[whichline+1]);\r
+\r
+                       VW_UpdateScreen();\r
+                       SD_PlaySound(NOWAYSND);\r
+                       IN_UserInput(TickBase*3);\r
+                       VW_FadeOut();\r
+                       try++;\r
+               }\r
+               else\r
+               {\r
+                       int start;\r
+\r
+\r
+                       SD_PlaySound(BONUS1UPSND);\r
+                       SD_WaitSoundDone();\r
+                       UNCACHEGRCHUNK (STARTFONT+1);\r
+                       UNCACHEGRCHUNK (C_BACKDROPPIC);\r
+                       UnCacheLump (COPYPROT_LUMP_START,COPYPROT_LUMP_END);\r
+\r
+                       switch(SoundMode)\r
+                       {\r
+                               case sdm_Off: return;\r
+                               case sdm_PC: start = STARTPCSOUNDS; break;\r
+                               case sdm_AdLib: start = STARTADLIBSOUNDS;\r
+                       }\r
+\r
+                       for (i=0;i<NUMSOUNDS;i++,start++)\r
+                               MM_FreePtr ((memptr *)&audiosegs[start]);\r
+                       return;\r
+               }\r
+       }\r
+\r
+       ClearMemory();\r
+       ShutdownId();\r
+\r
+       _fstrcpy(message,DosMessages[US_RndT()%9]);\r
+\r
+       _AX = 3;\r
+       geninterrupt(0x10);\r
+\r
+       printf("%s\n",message);\r
+       exit(1);\r
+}\r
+\r
+#endif // SPEARDEMO\r
+#endif // SPEAR\r
+//===========================================================================\r
diff --git a/16/wf3d8086/wl_main.c b/16/wf3d8086/wl_main.c
new file mode 100755 (executable)
index 0000000..7fec729
--- /dev/null
@@ -0,0 +1,1616 @@
+// WL_MAIN.C\r
+\r
+#include <conio.h>\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                  WOLFENSTEIN 3-D\r
+\r
+                                         An Id Software production\r
+\r
+                                                  by John Carmack\r
+\r
+=============================================================================\r
+*/\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+#define FOCALLENGTH     (0x5700l)               // in global coordinates\r
+#define VIEWGLOBAL      0x10000                 // globals visable flush to wall\r
+\r
+#define VIEWWIDTH       256                     // size of view window\r
+#define VIEWHEIGHT      144\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+char            str[80],str2[20];\r
+int                            tedlevelnum;\r
+boolean         tedlevel;\r
+boolean         nospr;\r
+boolean         IsA386;\r
+int                     dirangle[9] = {0,ANGLES/8,2*ANGLES/8,3*ANGLES/8,4*ANGLES/8,\r
+       5*ANGLES/8,6*ANGLES/8,7*ANGLES/8,ANGLES};\r
+\r
+//\r
+// proejection variables\r
+//\r
+fixed           focallength;\r
+unsigned        screenofs;\r
+int             viewwidth;\r
+int             viewheight;\r
+int             centerx;\r
+int             shootdelta;                     // pixels away from centerx a target can be\r
+fixed           scale,maxslope;\r
+long            heightnumerator;\r
+int                     minheightdiv;\r
+\r
+\r
+void            Quit (char *error);\r
+\r
+boolean         startgame,loadedgame,virtualreality;\r
+int             mouseadjustment;\r
+\r
+char   configname[13]="CONFIG.";\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+====================\r
+=\r
+= ReadConfig\r
+=\r
+====================\r
+*/\r
+\r
+void ReadConfig(void)\r
+{\r
+       int                     file;\r
+       SDMode          sd;\r
+       SMMode          sm;\r
+       SDSMode         sds;\r
+\r
+\r
+       if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1)\r
+       {\r
+       //\r
+       // valid config file\r
+       //\r
+               read(file,Scores,sizeof(HighScore) * MaxScores);\r
+\r
+               read(file,&sd,sizeof(sd));\r
+               read(file,&sm,sizeof(sm));\r
+               read(file,&sds,sizeof(sds));\r
+\r
+               read(file,&mouseenabled,sizeof(mouseenabled));\r
+               read(file,&joystickenabled,sizeof(joystickenabled));\r
+               read(file,&joypadenabled,sizeof(joypadenabled));\r
+               read(file,&joystickprogressive,sizeof(joystickprogressive));\r
+               read(file,&joystickport,sizeof(joystickport));\r
+\r
+               read(file,&dirscan,sizeof(dirscan));\r
+               read(file,&buttonscan,sizeof(buttonscan));\r
+               read(file,&buttonmouse,sizeof(buttonmouse));\r
+               read(file,&buttonjoy,sizeof(buttonjoy));\r
+\r
+               read(file,&viewsize,sizeof(viewsize));\r
+               read(file,&mouseadjustment,sizeof(mouseadjustment));\r
+\r
+               close(file);\r
+\r
+               if (sd == sdm_AdLib && !AdLibPresent && !SoundBlasterPresent)\r
+               {\r
+                       sd = sdm_PC;\r
+                       sd = smm_Off;\r
+               }\r
+\r
+               if ((sds == sds_SoundBlaster && !SoundBlasterPresent) ||\r
+                       (sds == sds_SoundSource && !SoundSourcePresent))\r
+                       sds = sds_Off;\r
+\r
+               if (!MousePresent)\r
+                       mouseenabled = false;\r
+               if (!JoysPresent[joystickport])\r
+                       joystickenabled = false;\r
+\r
+               MainMenu[6].active=1;\r
+               MainItems.curpos=0;\r
+       }\r
+       else\r
+       {\r
+       //\r
+       // no config file, so select by hardware\r
+       //\r
+               if (SoundBlasterPresent || AdLibPresent)\r
+               {\r
+                       sd = sdm_AdLib;\r
+                       sm = smm_AdLib;\r
+               }\r
+               else\r
+               {\r
+                       sd = sdm_PC;\r
+                       sm = smm_Off;\r
+               }\r
+\r
+               if (SoundBlasterPresent)\r
+                       sds = sds_SoundBlaster;\r
+               else if (SoundSourcePresent)\r
+                       sds = sds_SoundSource;\r
+               else\r
+                       sds = sds_Off;\r
+\r
+               if (MousePresent)\r
+                       mouseenabled = true;\r
+\r
+               joystickenabled = false;\r
+               joypadenabled = false;\r
+               joystickport = 0;\r
+               joystickprogressive = false;\r
+\r
+               viewsize = 15;\r
+               mouseadjustment=5;\r
+       }\r
+\r
+       SD_SetMusicMode (sm);\r
+       SD_SetSoundMode (sd);\r
+       SD_SetDigiDevice (sds);\r
+\r
+}\r
+\r
+\r
+/*\r
+====================\r
+=\r
+= WriteConfig\r
+=\r
+====================\r
+*/\r
+\r
+void WriteConfig(void)\r
+{\r
+       int                     file;\r
+\r
+       file = open(configname,O_CREAT | O_BINARY | O_WRONLY,\r
+                               S_IREAD | S_IWRITE | S_IFREG);\r
+\r
+       if (file != -1)\r
+       {\r
+               write(file,Scores,sizeof(HighScore) * MaxScores);\r
+\r
+               write(file,&SoundMode,sizeof(SoundMode));\r
+               write(file,&MusicMode,sizeof(MusicMode));\r
+               write(file,&DigiMode,sizeof(DigiMode));\r
+\r
+               write(file,&mouseenabled,sizeof(mouseenabled));\r
+               write(file,&joystickenabled,sizeof(joystickenabled));\r
+               write(file,&joypadenabled,sizeof(joypadenabled));\r
+               write(file,&joystickprogressive,sizeof(joystickprogressive));\r
+               write(file,&joystickport,sizeof(joystickport));\r
+\r
+               write(file,&dirscan,sizeof(dirscan));\r
+               write(file,&buttonscan,sizeof(buttonscan));\r
+               write(file,&buttonmouse,sizeof(buttonmouse));\r
+               write(file,&buttonjoy,sizeof(buttonjoy));\r
+\r
+               write(file,&viewsize,sizeof(viewsize));\r
+               write(file,&mouseadjustment,sizeof(mouseadjustment));\r
+\r
+               close(file);\r
+       }\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+========================\r
+=\r
+= Patch386\r
+=\r
+= Patch ldiv to use 32 bit instructions\r
+=\r
+========================\r
+*/\r
+\r
+char    *JHParmStrings[] = {"no386",nil};\r
+void Patch386 (void)\r
+{\r
+extern void far jabhack2(void);\r
+extern int far  CheckIs386(void);\r
+\r
+       int     i;\r
+\r
+       for (i = 1;i < _argc;i++)\r
+               if (US_CheckParm(_argv[i],JHParmStrings) == 0)\r
+               {\r
+                       IsA386 = false;\r
+                       return;\r
+               }\r
+\r
+       if (CheckIs386())\r
+       {\r
+               IsA386 = true;\r
+               jabhack2();\r
+       }\r
+       else\r
+               IsA386 = false;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= NewGame\r
+=\r
+= Set up new game to start from the beginning\r
+=\r
+=====================\r
+*/\r
+\r
+void NewGame (int difficulty,int episode)\r
+{\r
+       memset (&gamestate,0,sizeof(gamestate));\r
+       gamestate.difficulty = difficulty;\r
+       gamestate.weapon = gamestate.bestweapon\r
+               = gamestate.chosenweapon = wp_pistol;\r
+       gamestate.health = 100;\r
+       gamestate.ammo = STARTAMMO;\r
+       gamestate.lives = 3;\r
+       gamestate.nextextra = EXTRAPOINTS;\r
+       gamestate.episode=episode;\r
+\r
+       startgame = true;\r
+}\r
+\r
+//===========================================================================\r
+\r
+void DiskFlopAnim(int x,int y)\r
+{\r
+ static char which=0;\r
+ if (!x && !y)\r
+   return;\r
+ VWB_DrawPic(x,y,C_DISKLOADING1PIC+which);\r
+ VW_UpdateScreen();\r
+ which^=1;\r
+}\r
+\r
+\r
+long DoChecksum(byte far *source,unsigned size,long checksum)\r
+{\r
+ unsigned i;\r
+\r
+ for (i=0;i<size-1;i++)\r
+   checksum += source[i]^source[i+1];\r
+\r
+ return checksum;\r
+}\r
+\r
+\r
+/*\r
+==================\r
+=\r
+= SaveTheGame\r
+=\r
+==================\r
+*/\r
+\r
+boolean SaveTheGame(int file,int x,int y)\r
+{\r
+       struct diskfree_t dfree;\r
+       long avail,size,checksum;\r
+       objtype *ob,nullobj;\r
+\r
+\r
+       if (_dos_getdiskfree(0,&dfree))\r
+         Quit("Error in _dos_getdiskfree call");\r
+\r
+       avail = (long)dfree.avail_clusters *\r
+                       dfree.bytes_per_sector *\r
+                       dfree.sectors_per_cluster;\r
+\r
+       size = 0;\r
+       for (ob = player; ob ; ob=ob->next)\r
+         size += sizeof(*ob);\r
+       size += sizeof(nullobj);\r
+\r
+       size += sizeof(gamestate) +\r
+                       sizeof(LRstruct)*8 +\r
+                       sizeof(tilemap) +\r
+                       sizeof(actorat) +\r
+                       sizeof(laststatobj) +\r
+                       sizeof(statobjlist) +\r
+                       sizeof(doorposition) +\r
+                       sizeof(pwallstate) +\r
+                       sizeof(pwallx) +\r
+                       sizeof(pwally) +\r
+                       sizeof(pwalldir) +\r
+                       sizeof(pwallpos);\r
+\r
+       if (avail < size)\r
+       {\r
+        Message(STR_NOSPACE1"\n"\r
+                        STR_NOSPACE2);\r
+        return false;\r
+       }\r
+\r
+       checksum = 0;\r
+\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)&gamestate,sizeof(gamestate));\r
+       checksum = DoChecksum((byte far *)&gamestate,sizeof(gamestate),checksum);\r
+\r
+       DiskFlopAnim(x,y);\r
+#ifdef SPEAR\r
+       CA_FarWrite (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*20);\r
+       checksum = DoChecksum((byte far *)&LevelRatios[0],sizeof(LRstruct)*20,checksum);\r
+#else\r
+       CA_FarWrite (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*8);\r
+       checksum = DoChecksum((byte far *)&LevelRatios[0],sizeof(LRstruct)*8,checksum);\r
+#endif\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)tilemap,sizeof(tilemap));\r
+       checksum = DoChecksum((byte far *)tilemap,sizeof(tilemap),checksum);\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)actorat,sizeof(actorat));\r
+       checksum = DoChecksum((byte far *)actorat,sizeof(actorat),checksum);\r
+\r
+       CA_FarWrite (file,(void far *)areaconnect,sizeof(areaconnect));\r
+       CA_FarWrite (file,(void far *)areabyplayer,sizeof(areabyplayer));\r
+\r
+       for (ob = player ; ob ; ob=ob->next)\r
+       {\r
+        DiskFlopAnim(x,y);\r
+        CA_FarWrite (file,(void far *)ob,sizeof(*ob));\r
+       }\r
+       nullobj.active = ac_badobject;          // end of file marker\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)&nullobj,sizeof(nullobj));\r
+\r
+\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)&laststatobj,sizeof(laststatobj));\r
+       checksum = DoChecksum((byte far *)&laststatobj,sizeof(laststatobj),checksum);\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)statobjlist,sizeof(statobjlist));\r
+       checksum = DoChecksum((byte far *)statobjlist,sizeof(statobjlist),checksum);\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)doorposition,sizeof(doorposition));\r
+       checksum = DoChecksum((byte far *)doorposition,sizeof(doorposition),checksum);\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)doorobjlist,sizeof(doorobjlist));\r
+       checksum = DoChecksum((byte far *)doorobjlist,sizeof(doorobjlist),checksum);\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarWrite (file,(void far *)&pwallstate,sizeof(pwallstate));\r
+       checksum = DoChecksum((byte far *)&pwallstate,sizeof(pwallstate),checksum);\r
+       CA_FarWrite (file,(void far *)&pwallx,sizeof(pwallx));\r
+       checksum = DoChecksum((byte far *)&pwallx,sizeof(pwallx),checksum);\r
+       CA_FarWrite (file,(void far *)&pwally,sizeof(pwally));\r
+       checksum = DoChecksum((byte far *)&pwally,sizeof(pwally),checksum);\r
+       CA_FarWrite (file,(void far *)&pwalldir,sizeof(pwalldir));\r
+       checksum = DoChecksum((byte far *)&pwalldir,sizeof(pwalldir),checksum);\r
+       CA_FarWrite (file,(void far *)&pwallpos,sizeof(pwallpos));\r
+       checksum = DoChecksum((byte far *)&pwallpos,sizeof(pwallpos),checksum);\r
+\r
+       //\r
+       // WRITE OUT CHECKSUM\r
+       //\r
+       CA_FarWrite (file,(void far *)&checksum,sizeof(checksum));\r
+\r
+       return(true);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= LoadTheGame\r
+=\r
+==================\r
+*/\r
+\r
+boolean LoadTheGame(int file,int x,int y)\r
+{\r
+       long checksum,oldchecksum;\r
+       objtype *ob,nullobj;\r
+\r
+\r
+       checksum = 0;\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)&gamestate,sizeof(gamestate));\r
+       checksum = DoChecksum((byte far *)&gamestate,sizeof(gamestate),checksum);\r
+\r
+       DiskFlopAnim(x,y);\r
+#ifdef SPEAR\r
+       CA_FarRead (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*20);\r
+       checksum = DoChecksum((byte far *)&LevelRatios[0],sizeof(LRstruct)*20,checksum);\r
+#else\r
+       CA_FarRead (file,(void far *)&LevelRatios[0],sizeof(LRstruct)*8);\r
+       checksum = DoChecksum((byte far *)&LevelRatios[0],sizeof(LRstruct)*8,checksum);\r
+#endif\r
+\r
+       DiskFlopAnim(x,y);\r
+       SetupGameLevel ();\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)tilemap,sizeof(tilemap));\r
+       checksum = DoChecksum((byte far *)tilemap,sizeof(tilemap),checksum);\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)actorat,sizeof(actorat));\r
+       checksum = DoChecksum((byte far *)actorat,sizeof(actorat),checksum);\r
+\r
+       CA_FarRead (file,(void far *)areaconnect,sizeof(areaconnect));\r
+       CA_FarRead (file,(void far *)areabyplayer,sizeof(areabyplayer));\r
+\r
+\r
+\r
+       InitActorList ();\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)player,sizeof(*player));\r
+\r
+       while (1)\r
+       {\r
+        DiskFlopAnim(x,y);\r
+               CA_FarRead (file,(void far *)&nullobj,sizeof(nullobj));\r
+               if (nullobj.active == ac_badobject)\r
+                       break;\r
+               GetNewActor ();\r
+        // don't copy over the links\r
+               memcpy (new,&nullobj,sizeof(nullobj)-4);\r
+       }\r
+\r
+\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)&laststatobj,sizeof(laststatobj));\r
+       checksum = DoChecksum((byte far *)&laststatobj,sizeof(laststatobj),checksum);\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)statobjlist,sizeof(statobjlist));\r
+       checksum = DoChecksum((byte far *)statobjlist,sizeof(statobjlist),checksum);\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)doorposition,sizeof(doorposition));\r
+       checksum = DoChecksum((byte far *)doorposition,sizeof(doorposition),checksum);\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)doorobjlist,sizeof(doorobjlist));\r
+       checksum = DoChecksum((byte far *)doorobjlist,sizeof(doorobjlist),checksum);\r
+\r
+       DiskFlopAnim(x,y);\r
+       CA_FarRead (file,(void far *)&pwallstate,sizeof(pwallstate));\r
+       checksum = DoChecksum((byte far *)&pwallstate,sizeof(pwallstate),checksum);\r
+       CA_FarRead (file,(void far *)&pwallx,sizeof(pwallx));\r
+       checksum = DoChecksum((byte far *)&pwallx,sizeof(pwallx),checksum);\r
+       CA_FarRead (file,(void far *)&pwally,sizeof(pwally));\r
+       checksum = DoChecksum((byte far *)&pwally,sizeof(pwally),checksum);\r
+       CA_FarRead (file,(void far *)&pwalldir,sizeof(pwalldir));\r
+       checksum = DoChecksum((byte far *)&pwalldir,sizeof(pwalldir),checksum);\r
+       CA_FarRead (file,(void far *)&pwallpos,sizeof(pwallpos));\r
+       checksum = DoChecksum((byte far *)&pwallpos,sizeof(pwallpos),checksum);\r
+\r
+       CA_FarRead (file,(void far *)&oldchecksum,sizeof(oldchecksum));\r
+\r
+       if (oldchecksum != checksum)\r
+       {\r
+        Message(STR_SAVECHT1"\n"\r
+                        STR_SAVECHT2"\n"\r
+                        STR_SAVECHT3"\n"\r
+                        STR_SAVECHT4);\r
+\r
+        IN_ClearKeysDown();\r
+        IN_Ack();\r
+\r
+        gamestate.score = 0;\r
+        gamestate.lives = 1;\r
+        gamestate.weapon =\r
+          gamestate.chosenweapon =\r
+          gamestate.bestweapon = wp_pistol;\r
+        gamestate.ammo = 8;\r
+       }\r
+\r
+       return true;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==========================\r
+=\r
+= ShutdownId\r
+=\r
+= Shuts down all ID_?? managers\r
+=\r
+==========================\r
+*/\r
+\r
+void ShutdownId (void)\r
+{\r
+       US_Shutdown ();\r
+       SD_Shutdown ();\r
+       PM_Shutdown ();\r
+       IN_Shutdown ();\r
+       VW_Shutdown ();\r
+       CA_Shutdown ();\r
+       MM_Shutdown ();\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==================\r
+=\r
+= BuildTables\r
+=\r
+= Calculates:\r
+=\r
+= scale                 projection constant\r
+= sintable/costable     overlapping fractional tables\r
+=\r
+==================\r
+*/\r
+\r
+const   float   radtoint = (float)FINEANGLES/2/PI;\r
+\r
+void BuildTables (void)\r
+{\r
+  int           i;\r
+  float         angle,anglestep;\r
+  double        tang;\r
+  fixed         value;\r
+\r
+\r
+//\r
+// calculate fine tangents\r
+//\r
+\r
+       for (i=0;i<FINEANGLES/8;i++)\r
+       {\r
+               tang = tan( (i+0.5)/radtoint);\r
+               finetangent[i] = tang*TILEGLOBAL;\r
+               finetangent[FINEANGLES/4-1-i] = 1/tang*TILEGLOBAL;\r
+       }\r
+\r
+//\r
+// costable overlays sintable with a quarter phase shift\r
+// ANGLES is assumed to be divisable by four\r
+//\r
+// The low word of the value is the fraction, the high bit is the sign bit,\r
+// bits 16-30 should be 0\r
+//\r
+\r
+  angle = 0;\r
+  anglestep = PI/2/ANGLEQUAD;\r
+  for (i=0;i<=ANGLEQUAD;i++)\r
+  {\r
+       value=GLOBAL1*sin(angle);\r
+       sintable[i]=\r
+         sintable[i+ANGLES]=\r
+         sintable[ANGLES/2-i] = value;\r
+       sintable[ANGLES-i]=\r
+         sintable[ANGLES/2+i] = value | 0x80000000l;\r
+       angle += anglestep;\r
+  }\r
+\r
+}\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+====================\r
+=\r
+= CalcProjection\r
+=\r
+= Uses focallength\r
+=\r
+====================\r
+*/\r
+\r
+void CalcProjection (long focal)\r
+{\r
+       int             i;\r
+       long            intang;\r
+       float   angle;\r
+       double  tang;\r
+       double  planedist;\r
+       double  globinhalf;\r
+       int             halfview;\r
+       double  halfangle,facedist;\r
+\r
+\r
+       focallength = focal;\r
+       facedist = focal+MINDIST;\r
+       halfview = viewwidth/2;                                 // half view in pixels\r
+\r
+//\r
+// calculate scale value for vertical height calculations\r
+// and sprite x calculations\r
+//\r
+       scale = halfview*facedist/(VIEWGLOBAL/2);\r
+\r
+//\r
+// divide heightnumerator by a posts distance to get the posts height for\r
+// the heightbuffer.  The pixel height is height>>2\r
+//\r
+       heightnumerator = (TILEGLOBAL*scale)>>6;\r
+       minheightdiv = heightnumerator/0x7fff +1;\r
+\r
+//\r
+// calculate the angle offset from view angle of each pixel's ray\r
+//\r
+\r
+       for (i=0;i<halfview;i++)\r
+       {\r
+       // start 1/2 pixel over, so viewangle bisects two middle pixels\r
+               tang = (long)i*VIEWGLOBAL/viewwidth/facedist;\r
+               angle = atan(tang);\r
+               intang = angle*radtoint;\r
+               pixelangle[halfview-1-i] = intang;\r
+               pixelangle[halfview+i] = -intang;\r
+       }\r
+\r
+//\r
+// if a point's abs(y/x) is greater than maxslope, the point is outside\r
+// the view area\r
+//\r
+       maxslope = finetangent[pixelangle[0]];\r
+       maxslope >>= 8;\r
+}\r
+\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= SetupWalls\r
+=\r
+= Map tile values to scaled pics\r
+=\r
+===================\r
+*/\r
+\r
+void SetupWalls (void)\r
+{\r
+       int     i;\r
+\r
+       for (i=1;i<MAXWALLTILES;i++)\r
+       {\r
+               horizwall[i]=(i-1)*2;\r
+               vertwall[i]=(i-1)*2+1;\r
+       }\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==========================\r
+=\r
+= SignonScreen\r
+=\r
+==========================\r
+*/\r
+\r
+void SignonScreen (void)                        // VGA version\r
+{\r
+       unsigned        segstart,seglength;\r
+\r
+       VL_SetVGAPlaneMode ();\r
+       VL_TestPaletteSet ();\r
+       VL_SetPalette (&gamepal);\r
+\r
+       if (!virtualreality)\r
+       {\r
+               VW_SetScreen(0x8000,0);\r
+               VL_MungePic (&introscn,320,200);\r
+               VL_MemToScreen (&introscn,320,200,0,0);\r
+               VW_SetScreen(0,0);\r
+       }\r
+\r
+//\r
+// reclaim the memory from the linked in signon screen\r
+//\r
+       segstart = FP_SEG(&introscn);\r
+       seglength = 64000/16;\r
+       if (FP_OFF(&introscn))\r
+       {\r
+               segstart++;\r
+               seglength--;\r
+       }\r
+       MML_UseSpace (segstart,seglength);\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= FinishSignon\r
+=\r
+==========================\r
+*/\r
+\r
+void FinishSignon (void)\r
+{\r
+\r
+#ifndef SPEAR\r
+       VW_Bar (0,189,300,11,peekb(0xa000,0));\r
+       WindowX = 0;\r
+       WindowW = 320;\r
+       PrintY = 190;\r
+\r
+       #ifndef JAPAN\r
+       SETFONTCOLOR(14,4);\r
+\r
+       #ifdef SPANISH\r
+       US_CPrint ("Oprima una tecla");\r
+       #else\r
+       US_CPrint ("Press a key");\r
+       #endif\r
+\r
+       #endif\r
+\r
+       if (!NoWait)\r
+               IN_Ack ();\r
+\r
+       #ifndef JAPAN\r
+       VW_Bar (0,189,300,11,peekb(0xa000,0));\r
+\r
+       PrintY = 190;\r
+       SETFONTCOLOR(10,4);\r
+\r
+       #ifdef SPANISH\r
+       US_CPrint ("pensando...");\r
+       #else\r
+       US_CPrint ("Working...");\r
+       #endif\r
+\r
+       #endif\r
+\r
+       SETFONTCOLOR(0,15);\r
+#else\r
+       if (!NoWait)\r
+               VW_WaitVBL(3*70);\r
+#endif\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= MS_CheckParm\r
+=\r
+=================\r
+*/\r
+\r
+boolean MS_CheckParm (char far *check)\r
+{\r
+       int             i;\r
+       char    *parm;\r
+\r
+       for (i = 1;i<_argc;i++)\r
+       {\r
+               parm = _argv[i];\r
+\r
+               while ( !isalpha(*parm) )       // skip - / \ etc.. in front of parm\r
+                       if (!*parm++)\r
+                               break;                          // hit end of string without an alphanum\r
+\r
+               if ( !_fstricmp(check,parm) )\r
+                       return true;\r
+       }\r
+\r
+       return false;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= InitDigiMap\r
+=\r
+=====================\r
+*/\r
+\r
+static  int     wolfdigimap[] =\r
+               {\r
+                       // These first sounds are in the upload version\r
+#ifndef SPEAR\r
+                       HALTSND,                0,\r
+                       DOGBARKSND,             1,\r
+                       CLOSEDOORSND,           2,\r
+                       OPENDOORSND,            3,\r
+                       ATKMACHINEGUNSND,       4,\r
+                       ATKPISTOLSND,           5,\r
+                       ATKGATLINGSND,          6,\r
+                       SCHUTZADSND,            7,\r
+                       GUTENTAGSND,            8,\r
+                       MUTTISND,               9,\r
+                       BOSSFIRESND,            10,\r
+                       SSFIRESND,              11,\r
+                       DEATHSCREAM1SND,        12,\r
+                       DEATHSCREAM2SND,        13,\r
+                       DEATHSCREAM3SND,        13,\r
+                       TAKEDAMAGESND,          14,\r
+                       PUSHWALLSND,            15,\r
+\r
+                       LEBENSND,               20,\r
+                       NAZIFIRESND,            21,\r
+                       SLURPIESND,             22,\r
+\r
+                       YEAHSND,                                32,\r
+\r
+#ifndef UPLOAD\r
+                       // These are in all other episodes\r
+                       DOGDEATHSND,            16,\r
+                       AHHHGSND,               17,\r
+                       DIESND,                 18,\r
+                       EVASND,                 19,\r
+\r
+                       TOT_HUNDSND,            23,\r
+                       MEINGOTTSND,            24,\r
+                       SCHABBSHASND,           25,\r
+                       HITLERHASND,            26,\r
+                       SPIONSND,               27,\r
+                       NEINSOVASSND,           28,\r
+                       DOGATTACKSND,           29,\r
+                       LEVELDONESND,           30,\r
+                       MECHSTEPSND,                    31,\r
+\r
+                       SCHEISTSND,                             33,\r
+                       DEATHSCREAM4SND,                34,             // AIIEEE\r
+                       DEATHSCREAM5SND,                35,             // DEE-DEE\r
+                       DONNERSND,                              36,             // EPISODE 4 BOSS DIE\r
+                       EINESND,                                37,             // EPISODE 4 BOSS SIGHTING\r
+                       ERLAUBENSND,                    38,             // EPISODE 6 BOSS SIGHTING\r
+                       DEATHSCREAM6SND,                39,             // FART\r
+                       DEATHSCREAM7SND,                40,             // GASP\r
+                       DEATHSCREAM8SND,                41,             // GUH-BOY!\r
+                       DEATHSCREAM9SND,                42,             // AH GEEZ!\r
+                       KEINSND,                                43,             // EPISODE 5 BOSS SIGHTING\r
+                       MEINSND,                                44,             // EPISODE 6 BOSS DIE\r
+                       ROSESND,                                45,             // EPISODE 5 BOSS DIE\r
+\r
+#endif\r
+#else\r
+//\r
+// SPEAR OF DESTINY DIGISOUNDS\r
+//\r
+                       HALTSND,                0,\r
+                       CLOSEDOORSND,           2,\r
+                       OPENDOORSND,            3,\r
+                       ATKMACHINEGUNSND,       4,\r
+                       ATKPISTOLSND,           5,\r
+                       ATKGATLINGSND,          6,\r
+                       SCHUTZADSND,            7,\r
+                       BOSSFIRESND,            8,\r
+                       SSFIRESND,              9,\r
+                       DEATHSCREAM1SND,        10,\r
+                       DEATHSCREAM2SND,        11,\r
+                       TAKEDAMAGESND,          12,\r
+                       PUSHWALLSND,            13,\r
+                       AHHHGSND,               15,\r
+                       LEBENSND,               16,\r
+                       NAZIFIRESND,            17,\r
+                       SLURPIESND,             18,\r
+                       LEVELDONESND,           22,\r
+                       DEATHSCREAM4SND,                23,             // AIIEEE\r
+                       DEATHSCREAM3SND,        23,             // DOUBLY-MAPPED!!!\r
+                       DEATHSCREAM5SND,                24,             // DEE-DEE\r
+                       DEATHSCREAM6SND,                25,             // FART\r
+                       DEATHSCREAM7SND,                26,             // GASP\r
+                       DEATHSCREAM8SND,                27,             // GUH-BOY!\r
+                       DEATHSCREAM9SND,                28,             // AH GEEZ!\r
+                       GETGATLINGSND,                  38,             // Got Gat replacement\r
+\r
+#ifndef SPEARDEMO\r
+                       DOGBARKSND,             1,\r
+                       DOGDEATHSND,            14,\r
+                       SPIONSND,               19,\r
+                       NEINSOVASSND,           20,\r
+                       DOGATTACKSND,           21,\r
+                       TRANSSIGHTSND,                  29,             // Trans Sight\r
+                       TRANSDEATHSND,                  30,             // Trans Death\r
+                       WILHELMSIGHTSND,                31,             // Wilhelm Sight\r
+                       WILHELMDEATHSND,                32,             // Wilhelm Death\r
+                       UBERDEATHSND,                   33,             // Uber Death\r
+                       KNIGHTSIGHTSND,                 34,             // Death Knight Sight\r
+                       KNIGHTDEATHSND,                 35,             // Death Knight Death\r
+                       ANGELSIGHTSND,                  36,             // Angel Sight\r
+                       ANGELDEATHSND,                  37,             // Angel Death\r
+                       GETSPEARSND,                    39,             // Got Spear replacement\r
+#endif\r
+#endif\r
+                       LASTSOUND\r
+               };\r
+\r
+\r
+void InitDigiMap (void)\r
+{\r
+       int                     *map;\r
+\r
+       for (map = wolfdigimap;*map != LASTSOUND;map += 2)\r
+               DigiMap[map[0]] = map[1];\r
+\r
+\r
+}\r
+\r
+\r
+#ifndef SPEAR\r
+CP_iteminfo    MusicItems={CTL_X,CTL_Y,6,0,32};\r
+CP_itemtype far MusicMenu[]=\r
+       {\r
+               {1,"Get Them!",0},\r
+               {1,"Searching",0},\r
+               {1,"P.O.W.",0},\r
+               {1,"Suspense",0},\r
+               {1,"War March",0},\r
+               {1,"Around The Corner!",0},\r
+\r
+               {1,"Nazi Anthem",0},\r
+               {1,"Lurking...",0},\r
+               {1,"Going After Hitler",0},\r
+               {1,"Pounding Headache",0},\r
+               {1,"Into the Dungeons",0},\r
+               {1,"Ultimate Conquest",0},\r
+\r
+               {1,"Kill the S.O.B.",0},\r
+               {1,"The Nazi Rap",0},\r
+               {1,"Twelfth Hour",0},\r
+               {1,"Zero Hour",0},\r
+               {1,"Ultimate Conquest",0},\r
+               {1,"Wolfpack",0}\r
+       };\r
+#else\r
+CP_iteminfo MusicItems={CTL_X,CTL_Y-20,9,0,32};\r
+CP_itemtype far MusicMenu[]=\r
+   {\r
+               {1,"Funky Colonel Bill",0},\r
+               {1,"Death To The Nazis",0},\r
+               {1,"Tiptoeing Around",0},\r
+               {1,"Is This THE END?",0},\r
+               {1,"Evil Incarnate",0},\r
+               {1,"Jazzin' Them Nazis",0},\r
+               {1,"Puttin' It To The Enemy",0},\r
+               {1,"The SS Gonna Get You",0},\r
+               {1,"Towering Above",0}\r
+       };\r
+#endif\r
+\r
+#ifndef SPEARDEMO\r
+void DoJukebox(void)\r
+{\r
+       int which,lastsong=-1;\r
+       unsigned start,songs[]=\r
+               {\r
+#ifndef SPEAR\r
+                       GETTHEM_MUS,\r
+                       SEARCHN_MUS,\r
+                       POW_MUS,\r
+                       SUSPENSE_MUS,\r
+                       WARMARCH_MUS,\r
+                       CORNER_MUS,\r
+\r
+                       NAZI_OMI_MUS,\r
+                       PREGNANT_MUS,\r
+                       GOINGAFT_MUS,\r
+                       HEADACHE_MUS,\r
+                       DUNGEON_MUS,\r
+                       ULTIMATE_MUS,\r
+\r
+                       INTROCW3_MUS,\r
+                       NAZI_RAP_MUS,\r
+                       TWELFTH_MUS,\r
+                       ZEROHOUR_MUS,\r
+                       ULTIMATE_MUS,\r
+                       PACMAN_MUS\r
+#else\r
+                       XFUNKIE_MUS,             // 0\r
+                       XDEATH_MUS,              // 2\r
+                       XTIPTOE_MUS,             // 4\r
+                       XTHEEND_MUS,             // 7\r
+                       XEVIL_MUS,               // 17\r
+                       XJAZNAZI_MUS,            // 18\r
+                       XPUTIT_MUS,              // 21\r
+                       XGETYOU_MUS,             // 22\r
+                       XTOWER2_MUS              // 23\r
+#endif\r
+               };\r
+       struct dostime_t time;\r
+\r
+\r
+\r
+       IN_ClearKeysDown();\r
+       if (!AdLibPresent && !SoundBlasterPresent)\r
+               return;\r
+\r
+\r
+       MenuFadeOut();\r
+\r
+#ifndef SPEAR\r
+#ifndef UPLOAD\r
+       _dos_gettime(&time);\r
+       start = (time.hsecond%3)*6;\r
+#else\r
+       start = 0;\r
+#endif\r
+#else\r
+       start = 0;\r
+#endif\r
+\r
+\r
+       CA_CacheGrChunk (STARTFONT+1);\r
+#ifdef SPEAR\r
+       CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+#else\r
+       CacheLump (CONTROLS_LUMP_START,CONTROLS_LUMP_END);\r
+#endif\r
+       CA_LoadAllSounds ();\r
+\r
+       fontnumber=1;\r
+       ClearMScreen ();\r
+       VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+       DrawStripes (10);\r
+       SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR);\r
+\r
+#ifndef SPEAR\r
+       DrawWindow (CTL_X-2,CTL_Y-6,280,13*7,BKGDCOLOR);\r
+#else\r
+       DrawWindow (CTL_X-2,CTL_Y-26,280,13*10,BKGDCOLOR);\r
+#endif\r
+\r
+       DrawMenu (&MusicItems,&MusicMenu[start]);\r
+\r
+       SETFONTCOLOR (READHCOLOR,BKGDCOLOR);\r
+       PrintY=15;\r
+       WindowX = 0;\r
+       WindowY = 320;\r
+       US_CPrint ("Robert's Jukebox");\r
+\r
+       SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR);\r
+       VW_UpdateScreen();\r
+       MenuFadeIn();\r
+\r
+       do\r
+       {\r
+               which = HandleMenu(&MusicItems,&MusicMenu[start],NULL);\r
+               if (which>=0)\r
+               {\r
+                       if (lastsong >= 0)\r
+                               MusicMenu[start+lastsong].active = 1;\r
+\r
+                       StartCPMusic(songs[start + which]);\r
+                       MusicMenu[start+which].active = 2;\r
+                       DrawMenu (&MusicItems,&MusicMenu[start]);\r
+                       VW_UpdateScreen();\r
+                       lastsong = which;\r
+               }\r
+       } while(which>=0);\r
+\r
+       MenuFadeOut();\r
+       IN_ClearKeysDown();\r
+#ifdef SPEAR\r
+       UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+#else\r
+       UnCacheLump (CONTROLS_LUMP_START,CONTROLS_LUMP_END);\r
+#endif\r
+}\r
+#endif\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= InitGame\r
+=\r
+= Load a few things right away\r
+=\r
+==========================\r
+*/\r
+\r
+void InitGame (void)\r
+{\r
+       int                     i,x,y;\r
+       unsigned        *blockstart;\r
+\r
+       if (MS_CheckParm ("virtual"))\r
+               virtualreality = true;\r
+       else\r
+               virtualreality = false;\r
+\r
+       MM_Startup ();                  // so the signon screen can be freed\r
+\r
+       SignonScreen ();\r
+\r
+       VW_Startup ();\r
+       IN_Startup ();\r
+       PM_Startup ();\r
+       PM_UnlockMainMem ();\r
+       SD_Startup ();\r
+       CA_Startup ();\r
+       US_Startup ();\r
+\r
+\r
+#ifndef SPEAR\r
+       if (mminfo.mainmem < 235000L)\r
+#else\r
+       if (mminfo.mainmem < 257000L && !MS_CheckParm("debugmode"))\r
+#endif\r
+       {\r
+               memptr screen;\r
+\r
+               CA_CacheGrChunk (ERRORSCREEN);\r
+               screen = grsegs[ERRORSCREEN];\r
+               ShutdownId();\r
+               movedata ((unsigned)screen,7+7*160,0xb800,0,17*160);\r
+               gotoxy (1,23);\r
+               exit(1);\r
+       }\r
+\r
+\r
+//\r
+// build some tables\r
+//\r
+       InitDigiMap ();\r
+\r
+       for (i=0;i<MAPSIZE;i++)\r
+       {\r
+               nearmapylookup[i] = &tilemap[0][0]+MAPSIZE*i;\r
+               farmapylookup[i] = i*64;\r
+       }\r
+\r
+       for (i=0;i<PORTTILESHIGH;i++)\r
+               uwidthtable[i] = UPDATEWIDE*i;\r
+\r
+       blockstart = &blockstarts[0];\r
+       for (y=0;y<UPDATEHIGH;y++)\r
+               for (x=0;x<UPDATEWIDE;x++)\r
+                       *blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;\r
+\r
+       updateptr = &update[0];\r
+\r
+       bufferofs = 0;\r
+       displayofs = 0;\r
+       ReadConfig ();\r
+\r
+\r
+//\r
+// HOLDING DOWN 'M' KEY?\r
+//\r
+#ifndef SPEARDEMO\r
+       if (Keyboard[sc_M])\r
+         DoJukebox();\r
+       else\r
+#endif\r
+//\r
+// draw intro screen stuff\r
+//\r
+       if (!virtualreality)\r
+               IntroScreen ();\r
+\r
+//\r
+// load in and lock down some basic chunks\r
+//\r
+\r
+       CA_CacheGrChunk(STARTFONT);\r
+       MM_SetLock (&grsegs[STARTFONT],true);\r
+\r
+       LoadLatchMem ();\r
+       BuildTables ();          // trig tables\r
+       SetupWalls ();\r
+\r
+#if 0\r
+{\r
+int temp,i;\r
+temp = viewsize;\r
+       profilehandle = open("SCALERS.TXT", O_CREAT | O_WRONLY | O_TEXT);\r
+for (i=1;i<20;i++)\r
+       NewViewSize(i);\r
+viewsize = temp;\r
+close(profilehandle);\r
+}\r
+#endif\r
+\r
+       NewViewSize (viewsize);\r
+\r
+\r
+//\r
+// initialize variables\r
+//\r
+       InitRedShifts ();\r
+       if (!virtualreality)\r
+               FinishSignon();\r
+\r
+       displayofs = PAGE1START;\r
+       bufferofs = PAGE2START;\r
+\r
+       if (virtualreality)\r
+       {\r
+               NoWait = true;\r
+               geninterrupt(0x60);\r
+       }\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==========================\r
+=\r
+= SetViewSize\r
+=\r
+==========================\r
+*/\r
+\r
+boolean SetViewSize (unsigned width, unsigned height)\r
+{\r
+       viewwidth = width&~15;                  // must be divisable by 16\r
+       viewheight = height&~1;                 // must be even\r
+       centerx = viewwidth/2-1;\r
+       shootdelta = viewwidth/10;\r
+       screenofs = ((200-STATUSLINES-viewheight)/2*SCREENWIDTH+(320-viewwidth)/8);\r
+\r
+//\r
+// calculate trace angles and projection constants\r
+//\r
+       CalcProjection (FOCALLENGTH);\r
+\r
+//\r
+// build all needed compiled scalers\r
+//\r
+//     MM_BombOnError (false);\r
+       SetupScaling (viewwidth*1.5);\r
+#if 0\r
+       MM_BombOnError (true);\r
+       if (mmerror)\r
+       {\r
+               Quit ("Can't build scalers!");\r
+               mmerror = false;\r
+               return false;\r
+       }\r
+#endif\r
+       return true;\r
+}\r
+\r
+\r
+void ShowViewSize (int width)\r
+{\r
+       int     oldwidth,oldheight;\r
+\r
+       oldwidth = viewwidth;\r
+       oldheight = viewheight;\r
+\r
+       viewwidth = width*16;\r
+       viewheight = width*16*HEIGHTRATIO;\r
+       DrawPlayBorder ();\r
+\r
+       viewheight = oldheight;\r
+       viewwidth = oldwidth;\r
+}\r
+\r
+\r
+void NewViewSize (int width)\r
+{\r
+       CA_UpLevel ();\r
+       MM_SortMem ();\r
+       viewsize = width;\r
+       SetViewSize (width*16,width*16*HEIGHTRATIO);\r
+       CA_DownLevel ();\r
+}\r
+\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==========================\r
+=\r
+= Quit\r
+=\r
+==========================\r
+*/\r
+\r
+void Quit (char *error)\r
+{\r
+       unsigned        finscreen;\r
+       memptr  screen;\r
+\r
+       if (virtualreality)\r
+               geninterrupt(0x61);\r
+\r
+       ClearMemory ();\r
+       if (!*error)\r
+       {\r
+        #ifndef JAPAN\r
+        CA_CacheGrChunk (ORDERSCREEN);\r
+        screen = grsegs[ORDERSCREEN];\r
+        #endif\r
+        WriteConfig ();\r
+       }\r
+       else\r
+       {\r
+        CA_CacheGrChunk (ERRORSCREEN);\r
+        screen = grsegs[ERRORSCREEN];\r
+       }\r
+\r
+       ShutdownId ();\r
+\r
+       if (error && *error)\r
+       {\r
+         movedata ((unsigned)screen,7,0xb800,0,7*160);\r
+         gotoxy (10,4);\r
+         puts(error);\r
+         gotoxy (1,8);\r
+         exit(1);\r
+       }\r
+       else\r
+       if (!error || !(*error))\r
+       {\r
+               clrscr();\r
+               #ifndef JAPAN\r
+               movedata ((unsigned)screen,7,0xb800,0,4000);\r
+               gotoxy(1,24);\r
+               #endif\r
+//asm  mov     bh,0\r
+//asm  mov     dh,23   // row\r
+//asm  mov     dl,0    // collumn\r
+//asm  mov ah,2\r
+//asm  int     0x10\r
+       }\r
+\r
+       exit(0);\r
+}\r
+\r
+//===========================================================================\r
+\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= DemoLoop\r
+=\r
+=====================\r
+*/\r
+\r
+static  char *ParmStrings[] = {"baby","easy","normal","hard",""};\r
+\r
+void    DemoLoop (void)\r
+{\r
+       static int LastDemo;\r
+       int     i,level;\r
+       long nsize;\r
+       memptr  nullblock;\r
+\r
+//\r
+// check for launch from ted\r
+//\r
+       if (tedlevel)\r
+       {\r
+               NoWait = true;\r
+               NewGame(1,0);\r
+\r
+               for (i = 1;i < _argc;i++)\r
+               {\r
+                       if ( (level = US_CheckParm(_argv[i],ParmStrings)) != -1)\r
+                       {\r
+                        gamestate.difficulty=level;\r
+                        break;\r
+                       }\r
+               }\r
+\r
+#ifndef SPEAR\r
+               gamestate.episode = tedlevelnum/10;\r
+               gamestate.mapon = tedlevelnum%10;\r
+#else\r
+               gamestate.episode = 0;\r
+               gamestate.mapon = tedlevelnum;\r
+#endif\r
+               GameLoop();\r
+               Quit (NULL);\r
+       }\r
+\r
+\r
+//\r
+// main game cycle\r
+//\r
+\r
+\r
+//     nsize = (long)40*1024;\r
+//     MM_GetPtr(&nullblock,nsize);\r
+\r
+#ifndef DEMOTEST\r
+\r
+       #ifndef UPLOAD\r
+\r
+               #ifndef GOODTIMES\r
+               #ifndef SPEAR\r
+               #ifndef JAPAN\r
+               if (!NoWait)\r
+                       NonShareware();\r
+               #endif\r
+               #else\r
+\r
+                       #ifndef GOODTIMES\r
+                       #ifndef SPEARDEMO\r
+                       CopyProtection();\r
+                       #endif\r
+                       #endif\r
+\r
+               #endif\r
+               #endif\r
+       #endif\r
+\r
+       StartCPMusic(INTROSONG);\r
+\r
+#ifndef JAPAN\r
+       if (!NoWait)\r
+               PG13 ();\r
+#endif\r
+\r
+#endif\r
+\r
+       while (1)\r
+       {\r
+               while (!NoWait)\r
+               {\r
+//\r
+// title page\r
+//\r
+                       MM_SortMem ();\r
+#ifndef DEMOTEST\r
+\r
+#ifdef SPEAR\r
+                       CA_CacheGrChunk (TITLEPALETTE);\r
+\r
+                       CA_CacheGrChunk (TITLE1PIC);\r
+                       VWB_DrawPic (0,0,TITLE1PIC);\r
+                       UNCACHEGRCHUNK (TITLE1PIC);\r
+\r
+                       CA_CacheGrChunk (TITLE2PIC);\r
+                       VWB_DrawPic (0,80,TITLE2PIC);\r
+                       UNCACHEGRCHUNK (TITLE2PIC);\r
+                       VW_UpdateScreen ();\r
+                       VL_FadeIn(0,255,grsegs[TITLEPALETTE],30);\r
+\r
+                       UNCACHEGRCHUNK (TITLEPALETTE);\r
+#else\r
+                       CA_CacheScreen (TITLEPIC);\r
+                       VW_UpdateScreen ();\r
+                       VW_FadeIn();\r
+#endif\r
+                       if (IN_UserInput(TickBase*15))\r
+                               break;\r
+                       VW_FadeOut();\r
+//\r
+// credits page\r
+//\r
+                       CA_CacheScreen (CREDITSPIC);\r
+                       VW_UpdateScreen();\r
+                       VW_FadeIn ();\r
+                       if (IN_UserInput(TickBase*10))\r
+                               break;\r
+                       VW_FadeOut ();\r
+//\r
+// high scores\r
+//\r
+                       DrawHighScores ();\r
+                       VW_UpdateScreen ();\r
+                       VW_FadeIn ();\r
+\r
+                       if (IN_UserInput(TickBase*10))\r
+                               break;\r
+#endif\r
+//\r
+// demo\r
+//\r
+\r
+                       #ifndef SPEARDEMO\r
+                       PlayDemo (LastDemo++%4);\r
+                       #else\r
+                       PlayDemo (0);\r
+                       #endif\r
+\r
+                       if (playstate == ex_abort)\r
+                               break;\r
+                       StartCPMusic(INTROSONG);\r
+               }\r
+\r
+               VW_FadeOut ();\r
+\r
+#ifndef SPEAR\r
+               if (Keyboard[sc_Tab] && MS_CheckParm("goobers"))\r
+#else\r
+               if (Keyboard[sc_Tab] && MS_CheckParm("debugmode"))\r
+#endif\r
+                       RecordDemo ();\r
+               else\r
+                       US_ControlPanel (0);\r
+\r
+               if (startgame || loadedgame)\r
+               {\r
+                       GameLoop ();\r
+                       VW_FadeOut();\r
+                       StartCPMusic(INTROSONG);\r
+               }\r
+       }\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= main\r
+=\r
+==========================\r
+*/\r
+\r
+char    *nosprtxt[] = {"nospr",nil};\r
+\r
+void main (void)\r
+{\r
+       int     i;\r
+\r
+\r
+#ifdef BETA\r
+       //\r
+       // THIS IS FOR BETA ONLY!\r
+       //\r
+       struct dosdate_t d;\r
+\r
+       _dos_getdate(&d);\r
+       if (d.year > YEAR ||\r
+               (d.month >= MONTH && d.day >= DAY))\r
+       {\r
+        printf("Sorry, BETA-TESTING is over. Thanks for you help.\n");\r
+        exit(1);\r
+       }\r
+#endif\r
+\r
+       CheckForEpisodes();\r
+\r
+       Patch386 ();\r
+\r
+       InitGame ();\r
+\r
+       DemoLoop();\r
+\r
+       Quit("Demo loop exited???");\r
+}\r
+\r
diff --git a/16/wf3d8086/wl_menu.c b/16/wf3d8086/wl_menu.c
new file mode 100755 (executable)
index 0000000..7d1521c
--- /dev/null
@@ -0,0 +1,3986 @@
+////////////////////////////////////////////////////////////////////\r
+//\r
+// WL_MENU.C\r
+// by John Romero (C) 1992 Id Software, Inc.\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+#include "wl_def.h"\r
+#pragma hdrstop\r
+\r
+//\r
+// PRIVATE PROTOTYPES\r
+//\r
+void CP_ReadThis(void);\r
+\r
+#ifdef SPEAR\r
+#define STARTITEM      newgame\r
+\r
+#else\r
+#ifdef GOODTIMES\r
+#define STARTITEM      newgame\r
+\r
+#else\r
+#define STARTITEM      readthis\r
+#endif\r
+#endif\r
+\r
+char far endStrings[9][80]=\r
+{\r
+#ifndef SPEAR\r
+       {"Dost thou wish to\nleave with such hasty\nabandon?"},\r
+       {"Chickening out...\nalready?"},\r
+       {"Press N for more carnage.\nPress Y to be a weenie."},\r
+       {"So, you think you can\nquit this easily, huh?"},\r
+       {"Press N to save the world.\nPress Y to abandon it in\nits hour of need."},\r
+       {"Press N if you are brave.\nPress Y to cower in shame."},\r
+       {"Heroes, press N.\nWimps, press Y."},\r
+       {"You are at an intersection.\nA sign says, 'Press Y to quit.'\n>"},\r
+       {"For guns and glory, press N.\nFor work and worry, press Y."}\r
+#else\r
+       ENDSTR1,\r
+       ENDSTR2,\r
+       ENDSTR3,\r
+       ENDSTR4,\r
+       ENDSTR5,\r
+       ENDSTR6,\r
+       ENDSTR7,\r
+       ENDSTR8,\r
+       ENDSTR9\r
+#endif\r
+};\r
+\r
+CP_iteminfo\r
+       MainItems={MENU_X,MENU_Y,10,STARTITEM,24},\r
+       SndItems={SM_X,SM_Y1,12,0,52},\r
+       LSItems={LSM_X,LSM_Y,10,0,24},\r
+       CtlItems={CTL_X,CTL_Y,6,-1,56},\r
+       CusItems={8,CST_Y+13*2,9,-1,0},\r
+       NewEitems={NE_X,NE_Y,11,0,88},\r
+       NewItems={NM_X,NM_Y,4,2,24};\r
+\r
+#pragma warn -sus\r
+CP_itemtype far\r
+MainMenu[]=\r
+{\r
+#ifdef JAPAN\r
+       {1,"",CP_NewGame},\r
+       {1,"",CP_Sound},\r
+       {1,"",CP_Control},\r
+       {1,"",CP_LoadGame},\r
+       {0,"",CP_SaveGame},\r
+       {1,"",CP_ChangeView},\r
+       {2,"",CP_ReadThis},\r
+       {1,"",CP_ViewScores},\r
+       {1,"",0},\r
+       {1,"",0}\r
+#else\r
+\r
+       {1,STR_NG,CP_NewGame},\r
+       {1,STR_SD,CP_Sound},\r
+       {1,STR_CL,CP_Control},\r
+       {1,STR_LG,CP_LoadGame},\r
+       {0,STR_SG,CP_SaveGame},\r
+       {1,STR_CV,CP_ChangeView},\r
+\r
+#ifndef GOODTIMES\r
+#ifndef SPEAR\r
+\r
+       #ifdef SPANISH\r
+       {2,"Ve esto!",CP_ReadThis},\r
+       #else\r
+       {2,"Read This!",CP_ReadThis},\r
+       #endif\r
+\r
+#endif\r
+#endif\r
+\r
+       {1,STR_VS,CP_ViewScores},\r
+       {1,STR_BD,0},\r
+       {1,STR_QT,0}\r
+#endif\r
+},\r
+\r
+far SndMenu[]=\r
+{\r
+#ifdef JAPAN\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+#else\r
+       {1,STR_NONE,0},\r
+       {1,STR_PC,0},\r
+       {1,STR_ALSB,0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {1,STR_NONE,0},\r
+       {1,STR_DISNEY,0},\r
+       {1,STR_SB,0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {1,STR_NONE,0},\r
+       {1,STR_ALSB,0}\r
+#endif\r
+},\r
+\r
+far CtlMenu[]=\r
+{\r
+#ifdef JAPAN\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",MouseSensitivity},\r
+       {1,"",CustomControls}\r
+#else\r
+       {0,STR_MOUSEEN,0},\r
+       {0,STR_JOYEN,0},\r
+       {0,STR_PORT2,0},\r
+       {0,STR_GAMEPAD,0},\r
+       {0,STR_SENS,MouseSensitivity},\r
+       {1,STR_CUSTOM,CustomControls}\r
+#endif\r
+},\r
+\r
+#pragma warn +sus\r
+\r
+#ifndef SPEAR\r
+far NewEmenu[]=\r
+{\r
+#ifdef JAPAN\r
+#ifdef JAPDEMO\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+#else\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {0,"",0}\r
+#endif\r
+#else\r
+       #ifdef SPANISH\r
+       {1,"Episodio 1\n"\r
+          "Fuga desde Wolfenstein",0},\r
+       {0,"",0},\r
+       {3,"Episodio 2\n"\r
+                  "Operacion Eisenfaust",0},\r
+       {0,"",0},\r
+       {3,"Episodio 3\n"\r
+                  "Muere, Fuhrer, Muere!",0},\r
+       {0,"",0},\r
+       {3,"Episodio 4\n"\r
+                 "Un Negro Secreto",0},\r
+       {0,"",0},\r
+       {3,"Episodio 5\n"\r
+                 "Huellas del Loco",0},\r
+       {0,"",0},\r
+       {3,"Episodio 6\n"\r
+                 "Confrontacion",0}\r
+       #else\r
+       {1,"Episode 1\n"\r
+          "Escape from Wolfenstein",0},\r
+       {0,"",0},\r
+       {3,"Episode 2\n"\r
+                  "Operation: Eisenfaust",0},\r
+       {0,"",0},\r
+       {3,"Episode 3\n"\r
+                  "Die, Fuhrer, Die!",0},\r
+       {0,"",0},\r
+       {3,"Episode 4\n"\r
+                 "A Dark Secret",0},\r
+       {0,"",0},\r
+       {3,"Episode 5\n"\r
+                 "Trail of the Madman",0},\r
+       {0,"",0},\r
+       {3,"Episode 6\n"\r
+                 "Confrontation",0}\r
+       #endif\r
+#endif\r
+},\r
+#endif\r
+\r
+\r
+far NewMenu[]=\r
+{\r
+#ifdef JAPAN\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0}\r
+#else\r
+       {1,STR_DADDY,0},\r
+       {1,STR_HURTME,0},\r
+       {1,STR_BRINGEM,0},\r
+       {1,STR_DEATH,0}\r
+#endif\r
+},\r
+\r
+far LSMenu[]=\r
+{\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0},\r
+       {1,"",0}\r
+},\r
+\r
+far CusMenu[]=\r
+{\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {0,"",0},\r
+       {1,"",0},\r
+       {0,"",0},\r
+       {1,"",0}\r
+}\r
+;\r
+\r
+\r
+int color_hlite[]={\r
+   DEACTIVE,\r
+   HIGHLIGHT,\r
+   READHCOLOR,\r
+   0x67\r
+   },\r
+\r
+   color_norml[]={\r
+   DEACTIVE,\r
+   TEXTCOLOR,\r
+   READCOLOR,\r
+   0x6b\r
+   };\r
+\r
+int EpisodeSelect[6]={1};\r
+\r
+\r
+int SaveGamesAvail[10],StartGame,SoundStatus=1,pickquick;\r
+char SaveGameNames[10][32],SaveName[13]="SAVEGAM?.";\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// INPUT MANAGER SCANCODE TABLES\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+static byte\r
+                                       *ScanNames[] =          // Scan code names with single chars\r
+                                       {\r
+       "?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?",\r
+       "Q","W","E","R","T","Y","U","I","O","P","[","]","|","?","A","S",\r
+       "D","F","G","H","J","K","L",";","\"","?","?","?","Z","X","C","V",\r
+       "B","N","M",",",".","/","?","?","?","?","?","?","?","?","?","?",\r
+       "?","?","?","?","?","?","?","?","\xf","?","-","\x15","5","\x11","+","?",\r
+       "\x13","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",\r
+       "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",\r
+       "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?"\r
+                                       },      // DEBUG - consolidate these\r
+                                       far ExtScanCodes[] =    // Scan codes with >1 char names\r
+                                       {\r
+       1,0xe,0xf,0x1d,0x2a,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,\r
+       0x3f,0x40,0x41,0x42,0x43,0x44,0x57,0x59,0x46,0x1c,0x36,\r
+       0x37,0x38,0x47,0x49,0x4f,0x51,0x52,0x53,0x45,0x48,\r
+       0x50,0x4b,0x4d,0x00\r
+                                       },\r
+                                       *ExtScanNames[] =       // Names corresponding to ExtScanCodes\r
+                                       {\r
+       "Esc","BkSp","Tab","Ctrl","LShft","Space","CapsLk","F1","F2","F3","F4",\r
+       "F5","F6","F7","F8","F9","F10","F11","F12","ScrlLk","Enter","RShft",\r
+       "PrtSc","Alt","Home","PgUp","End","PgDn","Ins","Del","NumLk","Up",\r
+       "Down","Left","Right",""\r
+                                       };\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// Wolfenstein Control Panel!  Ta Da!\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void US_ControlPanel(byte scancode)\r
+{\r
+       int which,i,start;\r
+\r
+\r
+       if (ingame)\r
+               if (CP_CheckQuick(scancode))\r
+                       return;\r
+\r
+       StartCPMusic(MENUSONG);\r
+       SetupControlPanel();\r
+\r
+       //\r
+       // F-KEYS FROM WITHIN GAME\r
+       //\r
+       switch(scancode)\r
+       {\r
+               case sc_F1:\r
+                       #ifdef SPEAR\r
+                       BossKey();\r
+                       #else\r
+                       #ifdef GOODTIMES\r
+                       BossKey();\r
+                       #else\r
+                       HelpScreens();\r
+                       #endif\r
+                       #endif\r
+                       goto finishup;\r
+\r
+               case sc_F2:\r
+                       CP_SaveGame(0);\r
+                       goto finishup;\r
+\r
+               case sc_F3:\r
+                       CP_LoadGame(0);\r
+                       goto finishup;\r
+\r
+               case sc_F4:\r
+                       CP_Sound();\r
+                       goto finishup;\r
+\r
+               case sc_F5:\r
+                       CP_ChangeView();\r
+                       goto finishup;\r
+\r
+               case sc_F6:\r
+                       CP_Control();\r
+                       goto finishup;\r
+\r
+               finishup:\r
+                       CleanupControlPanel();\r
+                       #ifdef SPEAR\r
+                       UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+                       #endif\r
+                       return;\r
+       }\r
+\r
+#ifdef SPEAR\r
+       CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+#endif\r
+\r
+       DrawMainMenu();\r
+       MenuFadeIn();\r
+       StartGame=0;\r
+\r
+       //\r
+       // MAIN MENU LOOP\r
+       //\r
+       do\r
+       {\r
+               which=HandleMenu(&MainItems,&MainMenu[0],NULL);\r
+\r
+               #ifdef SPEAR\r
+               #ifndef SPEARDEMO\r
+               //\r
+               // EASTER EGG FOR SPEAR OF DESTINY!\r
+               //\r
+               if (Keyboard[sc_I] && Keyboard[sc_D])\r
+               {\r
+                       VW_FadeOut();\r
+                       StartCPMusic (XJAZNAZI_MUS);\r
+                       UnCacheLump(OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+                       UnCacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+                       MM_SortMem ();\r
+                       ClearMemory ();\r
+\r
+\r
+                       CA_CacheGrChunk (IDGUYS1PIC);\r
+                       VWB_DrawPic(0,0,IDGUYS1PIC);\r
+                       UNCACHEGRCHUNK(IDGUYS1PIC);\r
+\r
+                       CA_CacheGrChunk (IDGUYS2PIC);\r
+                       VWB_DrawPic(0,80,IDGUYS2PIC);\r
+                       UNCACHEGRCHUNK(IDGUYS2PIC);\r
+\r
+                       VW_UpdateScreen();\r
+\r
+                       CA_CacheGrChunk (IDGUYSPALETTE);\r
+                       VL_FadeIn(0,255,grsegs[IDGUYSPALETTE],30);\r
+                       UNCACHEGRCHUNK(IDGUYSPALETTE);\r
+\r
+                       while (Keyboard[sc_I] || Keyboard[sc_D]);\r
+                       IN_ClearKeysDown();\r
+                       IN_Ack();\r
+\r
+                       VW_FadeOut();\r
+\r
+                       CacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+                       CacheLump(OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+                       DrawMainMenu();\r
+                       StartCPMusic (MENUSONG);\r
+                       MenuFadeIn();\r
+               }\r
+               #endif\r
+               #endif\r
+\r
+               switch(which)\r
+               {\r
+                       case viewscores:\r
+                               if (MainMenu[viewscores].routine == NULL)\r
+                                       if (CP_EndGame())\r
+                                               StartGame=1;\r
+\r
+                               DrawMainMenu();\r
+                               MenuFadeIn();\r
+                               break;\r
+\r
+                       case backtodemo:\r
+                               #ifdef SPEAR\r
+                               if (!ingame)\r
+                               {\r
+                                       //\r
+                                       // DEALLOCATE ALL SOUNDS!\r
+                                       //\r
+                                       switch (SoundMode)\r
+                                       {\r
+                                               case sdm_PC:\r
+                                                       start = STARTPCSOUNDS;\r
+                                                       break;\r
+                                               case sdm_AdLib:\r
+                                                       start = STARTADLIBSOUNDS;\r
+                                                       break;\r
+                                       }\r
+\r
+                                       if (SoundMode != sdm_Off)\r
+                                               for (i=0;i<NUMSOUNDS;i++,start++)\r
+                                                       if (audiosegs[start])\r
+                                                               MM_SetPurge (&(memptr)audiosegs[start],3);              // make purgable\r
+                               }\r
+                               #endif\r
+\r
+                               MM_SortMem();\r
+                               StartGame=1;\r
+                               if (!ingame)\r
+                                       StartCPMusic(INTROSONG);\r
+                               VL_FadeOut(0,255,0,0,0,10);\r
+                               break;\r
+\r
+                       case -1:\r
+                       case quit:\r
+                               CP_Quit();\r
+                               break;\r
+\r
+                       default:\r
+                               if (!StartGame)\r
+                               {\r
+                                       DrawMainMenu();\r
+                                       MenuFadeIn();\r
+                               }\r
+               }\r
+\r
+       //\r
+       // "EXIT OPTIONS" OR "NEW GAME" EXITS\r
+       //\r
+       } while(!StartGame);\r
+\r
+       //\r
+       // DEALLOCATE EVERYTHING\r
+       //\r
+       CleanupControlPanel();\r
+\r
+       //\r
+       // CHANGE MAINMENU ITEM\r
+       //\r
+       if (startgame || loadedgame)\r
+       {\r
+               #pragma warn -sus\r
+               MainMenu[viewscores].routine = NULL;\r
+               #ifndef JAPAN\r
+               _fstrcpy(MainMenu[viewscores].string,STR_EG);\r
+               #endif\r
+               #pragma warn +sus\r
+       }\r
+\r
+       // RETURN/START GAME EXECUTION\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+       MM_SortMem ();\r
+#endif\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// DRAW MAIN MENU SCREEN\r
+//\r
+void DrawMainMenu(void)\r
+{\r
+#ifdef JAPAN\r
+       CA_CacheScreen(S_OPTIONSPIC);\r
+#else\r
+       ClearMScreen();\r
+\r
+       VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+       DrawStripes(10);\r
+       VWB_DrawPic(84,0,C_OPTIONSPIC);\r
+\r
+       #ifdef SPANISH\r
+       DrawWindow(MENU_X-8,MENU_Y-3,MENU_W+8,MENU_H,BKGDCOLOR);\r
+       #else\r
+       DrawWindow(MENU_X-8,MENU_Y-3,MENU_W,MENU_H,BKGDCOLOR);\r
+       #endif\r
+#endif\r
+\r
+       //\r
+       // CHANGE "GAME" AND "DEMO"\r
+       //\r
+       if (ingame)\r
+       {\r
+               #ifndef JAPAN\r
+\r
+               #ifdef SPANISH\r
+               _fstrcpy(&MainMenu[backtodemo].string,STR_GAME);\r
+               #else\r
+               _fstrcpy(&MainMenu[backtodemo].string[8],STR_GAME);\r
+               #endif\r
+\r
+               #else\r
+               CA_CacheGrChunk(C_MRETGAMEPIC);\r
+               VWB_DrawPic(12*8,20*8,C_MRETGAMEPIC);\r
+               UNCACHEGRCHUNK(C_MRETGAMEPIC);\r
+               CA_CacheGrChunk(C_MENDGAMEPIC);\r
+               VWB_DrawPic(12*8,18*8,C_MENDGAMEPIC);\r
+               UNCACHEGRCHUNK(C_MENDGAMEPIC);\r
+               #endif\r
+               MainMenu[backtodemo].active=2;\r
+       }\r
+       else\r
+       {\r
+               #ifndef JAPAN\r
+               #ifdef SPANISH\r
+               _fstrcpy(&MainMenu[backtodemo].string,STR_BD);\r
+               #else\r
+               _fstrcpy(&MainMenu[backtodemo].string[8],STR_DEMO);\r
+               #endif\r
+               #else\r
+               CA_CacheGrChunk(C_MRETDEMOPIC);\r
+               VWB_DrawPic(12*8,20*8,C_MRETDEMOPIC);\r
+               UNCACHEGRCHUNK(C_MRETDEMOPIC);\r
+               CA_CacheGrChunk(C_MSCORESPIC);\r
+               VWB_DrawPic(12*8,18*8,C_MSCORESPIC);\r
+               UNCACHEGRCHUNK(C_MSCORESPIC);\r
+               #endif\r
+               MainMenu[backtodemo].active=1;\r
+       }\r
+\r
+       DrawMenu(&MainItems,&MainMenu[0]);\r
+       VW_UpdateScreen();\r
+}\r
+\r
+#ifndef GOODTIMES\r
+#ifndef SPEAR\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// READ THIS!\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CP_ReadThis(void)\r
+{\r
+       StartCPMusic(CORNER_MUS);\r
+       HelpScreens();\r
+       StartCPMusic(MENUSONG);\r
+}\r
+#endif\r
+#endif\r
+\r
+#ifndef SPEAR\r
+#ifndef GOODTIMES\r
+#else\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// BOSS KEY\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void BossKey(void)\r
+{\r
+       SD_MusicOff();\r
+       _AX = 3;\r
+       geninterrupt(0x10);\r
+       printf("C>");\r
+       while (!Keyboard[sc_Escape])\r
+       IN_ClearKeysDown();\r
+\r
+       SD_MusicOn();\r
+       VL_SetVGAPlaneMode ();\r
+       VL_TestPaletteSet ();\r
+       VL_SetPalette (&gamepal);\r
+       LoadLatchMem();\r
+}\r
+#endif\r
+#endif\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// CHECK QUICK-KEYS & QUIT (WHILE IN A GAME)\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+int CP_CheckQuick(unsigned scancode)\r
+{\r
+       switch(scancode)\r
+       {\r
+               //\r
+               // END GAME\r
+               //\r
+               case sc_F7:\r
+                       CA_CacheGrChunk(STARTFONT+1);\r
+\r
+                       WindowH=160;\r
+                       #ifdef JAPAN\r
+                       if (GetYorN(7,8,C_JAPQUITPIC))\r
+                       #else\r
+                       if (Confirm(ENDGAMESTR))\r
+                       #endif\r
+                       {\r
+                               playstate = ex_died;\r
+                               pickquick = gamestate.lives = 0;\r
+                       }\r
+\r
+                       DrawAllPlayBorder();\r
+                       WindowH=200;\r
+                       fontnumber=0;\r
+                       MainMenu[savegame].active = 0;\r
+                       return 1;\r
+\r
+               //\r
+               // QUICKSAVE\r
+               //\r
+               case sc_F8:\r
+                       if (SaveGamesAvail[LSItems.curpos] && pickquick)\r
+                       {\r
+                               CA_CacheGrChunk(STARTFONT+1);\r
+                               fontnumber = 1;\r
+                               Message(STR_SAVING"...");\r
+                               CP_SaveGame(1);\r
+                               fontnumber=0;\r
+                       }\r
+                       else\r
+                       {\r
+                               #ifndef SPEAR\r
+                               CA_CacheGrChunk(STARTFONT+1);\r
+                               CA_CacheGrChunk(C_CURSOR1PIC);\r
+                               CA_CacheGrChunk(C_CURSOR2PIC);\r
+                               CA_CacheGrChunk(C_DISKLOADING1PIC);\r
+                               CA_CacheGrChunk(C_DISKLOADING2PIC);\r
+                               CA_CacheGrChunk(C_SAVEGAMEPIC);\r
+                               CA_CacheGrChunk(C_MOUSELBACKPIC);\r
+                               #else\r
+                               CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+                               CA_CacheGrChunk(C_CURSOR1PIC);\r
+                               #endif\r
+\r
+                               VW_FadeOut ();\r
+\r
+                               StartCPMusic(MENUSONG);\r
+                               pickquick=CP_SaveGame(0);\r
+\r
+                               SETFONTCOLOR(0,15);\r
+                               IN_ClearKeysDown();\r
+                               DrawPlayScreen ();\r
+\r
+                               if (!startgame && !loadedgame)\r
+                               {\r
+                                       VW_FadeIn ();\r
+                                       StartMusic ();\r
+                               }\r
+\r
+                               if (loadedgame)\r
+                                       playstate = ex_abort;\r
+                               lasttimecount = TimeCount;\r
+\r
+                               if (MousePresent)\r
+                                       Mouse(MDelta);  // Clear accumulated mouse movement\r
+\r
+                               PM_CheckMainMem ();\r
+\r
+                               #ifndef SPEAR\r
+                               UNCACHEGRCHUNK(C_CURSOR1PIC);\r
+                               UNCACHEGRCHUNK(C_CURSOR2PIC);\r
+                               UNCACHEGRCHUNK(C_DISKLOADING1PIC);\r
+                               UNCACHEGRCHUNK(C_DISKLOADING2PIC);\r
+                               UNCACHEGRCHUNK(C_SAVEGAMEPIC);\r
+                               UNCACHEGRCHUNK(C_MOUSELBACKPIC);\r
+                               #else\r
+                               UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+                               #endif\r
+                       }\r
+                       return 1;\r
+\r
+               //\r
+               // QUICKLOAD\r
+               //\r
+               case sc_F9:\r
+                       if (SaveGamesAvail[LSItems.curpos] && pickquick)\r
+                       {\r
+                               char string[100]=STR_LGC;\r
+\r
+\r
+                               CA_CacheGrChunk(STARTFONT+1);\r
+                               fontnumber = 1;\r
+\r
+                               strcat(string,SaveGameNames[LSItems.curpos]);\r
+                               strcat(string,"\"?");\r
+\r
+                               if (Confirm(string))\r
+                                       CP_LoadGame(1);\r
+\r
+                               DrawAllPlayBorder();\r
+                               fontnumber=0;\r
+                       }\r
+                       else\r
+                       {\r
+                               #ifndef SPEAR\r
+                               CA_CacheGrChunk(STARTFONT+1);\r
+                               CA_CacheGrChunk(C_CURSOR1PIC);\r
+                               CA_CacheGrChunk(C_CURSOR2PIC);\r
+                               CA_CacheGrChunk(C_DISKLOADING1PIC);\r
+                               CA_CacheGrChunk(C_DISKLOADING2PIC);\r
+                               CA_CacheGrChunk(C_LOADGAMEPIC);\r
+                               CA_CacheGrChunk(C_MOUSELBACKPIC);\r
+                               #else\r
+                               CA_CacheGrChunk(C_CURSOR1PIC);\r
+                               CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+                               #endif\r
+\r
+                               VW_FadeOut ();\r
+\r
+                               StartCPMusic(MENUSONG);\r
+                               pickquick=CP_LoadGame(0);\r
+\r
+                               SETFONTCOLOR(0,15);\r
+                               IN_ClearKeysDown();\r
+                               DrawPlayScreen ();\r
+\r
+                               if (!startgame && !loadedgame)\r
+                               {\r
+                                       VW_FadeIn ();\r
+                                       StartMusic ();\r
+                               }\r
+\r
+                               if (loadedgame)\r
+                                       playstate = ex_abort;\r
+\r
+                               lasttimecount = TimeCount;\r
+\r
+                               if (MousePresent)\r
+                                       Mouse(MDelta);  // Clear accumulated mouse movement\r
+                               PM_CheckMainMem ();\r
+\r
+                               #ifndef SPEAR\r
+                               UNCACHEGRCHUNK(C_CURSOR1PIC);\r
+                               UNCACHEGRCHUNK(C_CURSOR2PIC);\r
+                               UNCACHEGRCHUNK(C_DISKLOADING1PIC);\r
+                               UNCACHEGRCHUNK(C_DISKLOADING2PIC);\r
+                               UNCACHEGRCHUNK(C_LOADGAMEPIC);\r
+                               UNCACHEGRCHUNK(C_MOUSELBACKPIC);\r
+                               #else\r
+                               UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+                               #endif\r
+                       }\r
+                       return 1;\r
+\r
+               //\r
+               // QUIT\r
+               //\r
+               case sc_F10:\r
+                       CA_CacheGrChunk(STARTFONT+1);\r
+\r
+                       WindowX=WindowY=0;\r
+                       WindowW=320;\r
+                       WindowH=160;\r
+                       #ifdef JAPAN\r
+                       if (GetYorN(7,8,C_QUITMSGPIC))\r
+                       #else\r
+                               #ifdef SPANISH\r
+                       if (Confirm(ENDGAMESTR))\r
+                               #else\r
+                       if (Confirm(endStrings[US_RndT()&0x7+(US_RndT()&1)]))\r
+                               #endif\r
+                       #endif\r
+                       {\r
+                               int i;\r
+\r
+\r
+                               VW_UpdateScreen();\r
+                               SD_MusicOff();\r
+                               SD_StopSound();\r
+                               MenuFadeOut();\r
+\r
+                               //\r
+                               // SHUT-UP THE ADLIB\r
+                               //\r
+                               for (i=1;i<=0xf5;i++)\r
+                                       alOut(i,0);\r
+                               Quit(NULL);\r
+                       }\r
+\r
+                       DrawAllPlayBorder();\r
+                       WindowH=200;\r
+                       fontnumber=0;\r
+                       return 1;\r
+               }\r
+\r
+       return 0;\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// END THE CURRENT GAME\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+int CP_EndGame(void)\r
+{\r
+#ifdef JAPAN\r
+       if (!GetYorN(7,8,C_JAPQUITPIC))\r
+#else\r
+       if (!Confirm(ENDGAMESTR))\r
+#endif\r
+               return 0;\r
+\r
+       pickquick = gamestate.lives = 0;\r
+       playstate = ex_died;\r
+\r
+       #pragma warn -sus\r
+       MainMenu[savegame].active = 0;\r
+       MainMenu[viewscores].routine=CP_ViewScores;\r
+       #ifndef JAPAN\r
+       _fstrcpy(MainMenu[viewscores].string,STR_VS);\r
+       #endif\r
+       #pragma warn +sus\r
+\r
+       return 1;\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// VIEW THE HIGH SCORES\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CP_ViewScores(void)\r
+{\r
+       fontnumber=0;\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+       StartCPMusic (XAWARD_MUS);\r
+#else\r
+       StartCPMusic (ROSTER_MUS);\r
+#endif\r
+\r
+       DrawHighScores ();\r
+       VW_UpdateScreen ();\r
+       MenuFadeIn();\r
+       fontnumber=1;\r
+\r
+       IN_Ack();\r
+\r
+       StartCPMusic(MENUSONG);\r
+       MenuFadeOut();\r
+\r
+#ifdef SPEAR\r
+       CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+       CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+#endif\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// START A NEW GAME\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CP_NewGame(void)\r
+{\r
+       int which,episode;\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+#endif\r
+\r
+\r
+#ifndef SPEAR\r
+firstpart:\r
+\r
+       DrawNewEpisode();\r
+       do\r
+       {\r
+               which=HandleMenu(&NewEitems,&NewEmenu[0],NULL);\r
+               switch(which)\r
+               {\r
+                       case -1:\r
+                               MenuFadeOut();\r
+                               return;\r
+\r
+                       default:\r
+                               if (!EpisodeSelect[which/2])\r
+                               {\r
+                                       SD_PlaySound (NOWAYSND);\r
+                                       Message("Please select \"Read This!\"\n"\r
+                                                       "from the Options menu to\n"\r
+                                                       "find out how to order this\n"\r
+                                                       "episode from Apogee.");\r
+                                       IN_ClearKeysDown();\r
+                                       IN_Ack();\r
+                                       DrawNewEpisode();\r
+                                       which = 0;\r
+                               }\r
+                               else\r
+                               {\r
+                                       episode = which/2;\r
+                                       which = 1;\r
+                               }\r
+                               break;\r
+               }\r
+\r
+       } while (!which);\r
+\r
+       ShootSnd();\r
+\r
+       //\r
+       // ALREADY IN A GAME?\r
+       //\r
+       if (ingame)\r
+               #ifdef JAPAN\r
+               if (!GetYorN(7,8,C_JAPNEWGAMEPIC))\r
+               #else\r
+               if (!Confirm(CURGAME))\r
+               #endif\r
+               {\r
+                       MenuFadeOut();\r
+                       return;\r
+               }\r
+\r
+       MenuFadeOut();\r
+\r
+#else\r
+       episode = 0;\r
+\r
+       //\r
+       // ALREADY IN A GAME?\r
+       //\r
+       CacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);\r
+       DrawNewGame();\r
+       if (ingame)\r
+               if (!Confirm(CURGAME))\r
+               {\r
+                       MenuFadeOut();\r
+                       UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);\r
+                       CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+                       return;\r
+               }\r
+\r
+#endif\r
+\r
+       DrawNewGame();\r
+       which=HandleMenu(&NewItems,&NewMenu[0],DrawNewGameDiff);\r
+       if (which<0)\r
+       {\r
+               MenuFadeOut();\r
+               #ifndef SPEAR\r
+               goto firstpart;\r
+               #else\r
+               UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);\r
+               CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+               return;\r
+               #endif\r
+       }\r
+\r
+       ShootSnd();\r
+       NewGame(which,episode);\r
+       StartGame=1;\r
+       MenuFadeOut();\r
+\r
+       //\r
+       // CHANGE "READ THIS!" TO NORMAL COLOR\r
+       //\r
+       #ifndef SPEAR\r
+       #ifndef GOODTIMES\r
+       MainMenu[readthis].active=1;\r
+       #endif\r
+       #endif\r
+\r
+       pickquick = 0;\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);\r
+       CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+#endif\r
+}\r
+\r
+\r
+#ifndef SPEAR\r
+/////////////////////\r
+//\r
+// DRAW NEW EPISODE MENU\r
+//\r
+void DrawNewEpisode(void)\r
+{\r
+       int i;\r
+\r
+#ifdef JAPAN\r
+       CA_CacheScreen(S_EPISODEPIC);\r
+#else\r
+       ClearMScreen();\r
+       VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+\r
+       DrawWindow(NE_X-4,NE_Y-4,NE_W+8,NE_H+8,BKGDCOLOR);\r
+       SETFONTCOLOR(READHCOLOR,BKGDCOLOR);\r
+       PrintY=2;\r
+       WindowX=0;\r
+       #ifdef SPANISH\r
+       US_CPrint("Cual episodio jugar?");\r
+       #else\r
+       US_CPrint("Which episode to play?");\r
+       #endif\r
+#endif\r
+\r
+       SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+       DrawMenu(&NewEitems,&NewEmenu[0]);\r
+\r
+       for (i=0;i<6;i++)\r
+               VWB_DrawPic(NE_X+32,NE_Y+i*26,C_EPISODE1PIC+i);\r
+\r
+       VW_UpdateScreen();\r
+       MenuFadeIn();\r
+       WaitKeyUp();\r
+}\r
+#endif\r
+\r
+/////////////////////\r
+//\r
+// DRAW NEW GAME MENU\r
+//\r
+void DrawNewGame(void)\r
+{\r
+#ifdef JAPAN\r
+       CA_CacheScreen(S_SKILLPIC);\r
+#else\r
+       ClearMScreen();\r
+       VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+\r
+       SETFONTCOLOR(READHCOLOR,BKGDCOLOR);\r
+       PrintX=NM_X+20;\r
+       PrintY=NM_Y-32;\r
+\r
+#ifndef SPEAR\r
+       #ifdef SPANISH\r
+       US_Print("Eres macho?");\r
+       #else\r
+       US_Print("How tough are you?");\r
+       #endif\r
+#else\r
+       VWB_DrawPic (PrintX,PrintY,C_HOWTOUGHPIC);\r
+#endif\r
+\r
+       DrawWindow(NM_X-5,NM_Y-10,NM_W,NM_H,BKGDCOLOR);\r
+#endif\r
+\r
+       DrawMenu(&NewItems,&NewMenu[0]);\r
+       DrawNewGameDiff(NewItems.curpos);\r
+       VW_UpdateScreen();\r
+       MenuFadeIn();\r
+       WaitKeyUp();\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// DRAW NEW GAME GRAPHIC\r
+//\r
+void DrawNewGameDiff(int w)\r
+{\r
+       VWB_DrawPic(NM_X+185,NM_Y+7,w+C_BABYMODEPIC);\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// HANDLE SOUND MENU\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CP_Sound(void)\r
+{\r
+       int which,i;\r
+\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+       CacheLump (SOUND_LUMP_START,SOUND_LUMP_END);\r
+#endif\r
+\r
+       DrawSoundMenu();\r
+       MenuFadeIn();\r
+       WaitKeyUp();\r
+\r
+       do\r
+       {\r
+               which=HandleMenu(&SndItems,&SndMenu[0],NULL);\r
+               //\r
+               // HANDLE MENU CHOICES\r
+               //\r
+               switch(which)\r
+               {\r
+                       //\r
+                       // SOUND EFFECTS\r
+                       //\r
+                       case 0:\r
+                               if (SoundMode!=sdm_Off)\r
+                               {\r
+                                       SD_WaitSoundDone();\r
+                                       SD_SetSoundMode(sdm_Off);\r
+                                       DrawSoundMenu();\r
+                               }\r
+                               break;\r
+                       case 1:\r
+                               if (SoundMode!=sdm_PC)\r
+                               {\r
+                                       SD_WaitSoundDone();\r
+                                       SD_SetSoundMode(sdm_PC);\r
+                                       CA_LoadAllSounds();\r
+                                       DrawSoundMenu();\r
+                                       ShootSnd();\r
+                               }\r
+                               break;\r
+                       case 2:\r
+                               if (SoundMode!=sdm_AdLib)\r
+                               {\r
+                                       SD_WaitSoundDone();\r
+                                       SD_SetSoundMode(sdm_AdLib);\r
+                                       CA_LoadAllSounds();\r
+                                       DrawSoundMenu();\r
+                                       ShootSnd();\r
+                               }\r
+                               break;\r
+\r
+                       //\r
+                       // DIGITIZED SOUND\r
+                       //\r
+                       case 5:\r
+                               if (DigiMode!=sds_Off)\r
+                               {\r
+                                       SD_SetDigiDevice(sds_Off);\r
+                                       DrawSoundMenu();\r
+                               }\r
+                               break;\r
+                       case 6:\r
+                               if (DigiMode!=sds_SoundSource)\r
+                               {\r
+                                       SD_SetDigiDevice(sds_SoundSource);\r
+                                       DrawSoundMenu();\r
+                                       ShootSnd();\r
+                               }\r
+                               break;\r
+                       case 7:\r
+                               if (DigiMode!=sds_SoundBlaster)\r
+                               {\r
+                                       SD_SetDigiDevice(sds_SoundBlaster);\r
+                                       DrawSoundMenu();\r
+                                       ShootSnd();\r
+                               }\r
+                               break;\r
+\r
+                       //\r
+                       // MUSIC\r
+                       //\r
+                       case 10:\r
+                               if (MusicMode!=smm_Off)\r
+                               {\r
+                                       SD_SetMusicMode(smm_Off);\r
+                                       DrawSoundMenu();\r
+                                       ShootSnd();\r
+                               }\r
+                               break;\r
+                       case 11:\r
+                               if (MusicMode!=smm_AdLib)\r
+                               {\r
+                                       SD_SetMusicMode(smm_AdLib);\r
+                                       DrawSoundMenu();\r
+                                       ShootSnd();\r
+                                       StartCPMusic(MENUSONG);\r
+                               }\r
+                               break;\r
+               }\r
+       } while(which>=0);\r
+\r
+       MenuFadeOut();\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (SOUND_LUMP_START,SOUND_LUMP_END);\r
+       CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+#endif\r
+}\r
+\r
+\r
+//////////////////////\r
+//\r
+// DRAW THE SOUND MENU\r
+//\r
+void DrawSoundMenu(void)\r
+{\r
+       int i,on;\r
+\r
+\r
+#ifdef JAPAN\r
+       CA_CacheScreen(S_SOUNDPIC);\r
+#else\r
+       //\r
+       // DRAW SOUND MENU\r
+       //\r
+       ClearMScreen();\r
+       VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+\r
+       DrawWindow(SM_X-8,SM_Y1-3,SM_W,SM_H1,BKGDCOLOR);\r
+       DrawWindow(SM_X-8,SM_Y2-3,SM_W,SM_H2,BKGDCOLOR);\r
+       DrawWindow(SM_X-8,SM_Y3-3,SM_W,SM_H3,BKGDCOLOR);\r
+#endif\r
+\r
+       //\r
+       // IF NO ADLIB, NON-CHOOSENESS!\r
+       //\r
+       if (!AdLibPresent && !SoundBlasterPresent)\r
+       {\r
+               SndMenu[2].active=SndMenu[10].active=SndMenu[11].active=0;\r
+       }\r
+\r
+       if (!SoundSourcePresent)\r
+               SndMenu[6].active=0;\r
+\r
+       if (!SoundBlasterPresent)\r
+               SndMenu[7].active=0;\r
+\r
+       if (!SoundSourcePresent && !SoundBlasterPresent)\r
+               SndMenu[5].active=0;\r
+\r
+       DrawMenu(&SndItems,&SndMenu[0]);\r
+#ifndef JAPAN\r
+       VWB_DrawPic(100,SM_Y1-20,C_FXTITLEPIC);\r
+       VWB_DrawPic(100,SM_Y2-20,C_DIGITITLEPIC);\r
+       VWB_DrawPic(100,SM_Y3-20,C_MUSICTITLEPIC);\r
+#endif\r
+\r
+       for (i=0;i<SndItems.amount;i++)\r
+#ifdef JAPAN\r
+               if (i!=3 && i!=4 && i!=8 && i!=9)\r
+#else\r
+               if (SndMenu[i].string[0])\r
+#endif\r
+               {\r
+                       //\r
+                       // DRAW SELECTED/NOT SELECTED GRAPHIC BUTTONS\r
+                       //\r
+                       on=0;\r
+                       switch(i)\r
+                       {\r
+                               //\r
+                               // SOUND EFFECTS\r
+                               //\r
+                               case 0: if (SoundMode==sdm_Off) on=1; break;\r
+                               case 1: if (SoundMode==sdm_PC) on=1; break;\r
+                               case 2: if (SoundMode==sdm_AdLib) on=1; break;\r
+\r
+                               //\r
+                               // DIGITIZED SOUND\r
+                               //\r
+                               case 5: if (DigiMode==sds_Off) on=1; break;\r
+                               case 6: if (DigiMode==sds_SoundSource) on=1; break;\r
+                               case 7: if (DigiMode==sds_SoundBlaster) on=1; break;\r
+\r
+                               //\r
+                               // MUSIC\r
+                               //\r
+                               case 10: if (MusicMode==smm_Off) on=1; break;\r
+                               case 11: if (MusicMode==smm_AdLib) on=1; break;\r
+                       }\r
+\r
+                       if (on)\r
+                               VWB_DrawPic(SM_X+24,SM_Y1+i*13+2,C_SELECTEDPIC);\r
+                       else\r
+                               VWB_DrawPic(SM_X+24,SM_Y1+i*13+2,C_NOTSELECTEDPIC);\r
+               }\r
+\r
+       DrawMenuGun(&SndItems);\r
+       VW_UpdateScreen();\r
+}\r
+\r
+\r
+//\r
+// DRAW LOAD/SAVE IN PROGRESS\r
+//\r
+void DrawLSAction(int which)\r
+{\r
+       #define LSA_X   96\r
+       #define LSA_Y   80\r
+       #define LSA_W   130\r
+       #define LSA_H   42\r
+\r
+       DrawWindow(LSA_X,LSA_Y,LSA_W,LSA_H,TEXTCOLOR);\r
+       DrawOutline(LSA_X,LSA_Y,LSA_W,LSA_H,0,HIGHLIGHT);\r
+       VWB_DrawPic(LSA_X+8,LSA_Y+5,C_DISKLOADING1PIC);\r
+\r
+       fontnumber=1;\r
+       SETFONTCOLOR(0,TEXTCOLOR);\r
+       PrintX=LSA_X+46;\r
+       PrintY=LSA_Y+13;\r
+\r
+       if (!which)\r
+               US_Print(STR_LOADING"...");\r
+       else\r
+               US_Print(STR_SAVING"...");\r
+\r
+       VW_UpdateScreen();\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// LOAD SAVED GAMES\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+int CP_LoadGame(int quick)\r
+{\r
+       int handle,which,exit=0;\r
+       char name[13];\r
+\r
+\r
+       strcpy(name,SaveName);\r
+\r
+       //\r
+       // QUICKLOAD?\r
+       //\r
+       if (quick)\r
+       {\r
+               which=LSItems.curpos;\r
+\r
+               if (SaveGamesAvail[which])\r
+               {\r
+                       name[7]=which+'0';\r
+                       handle=open(name,O_BINARY);\r
+                       lseek(handle,32,SEEK_SET);\r
+                       loadedgame=true;\r
+                       LoadTheGame(handle,0,0);\r
+                       loadedgame=false;\r
+                       close(handle);\r
+\r
+                       DrawFace ();\r
+                       DrawHealth ();\r
+                       DrawLives ();\r
+                       DrawLevel ();\r
+                       DrawAmmo ();\r
+                       DrawKeys ();\r
+                       DrawWeapon ();\r
+                       DrawScore ();\r
+                       return 1;\r
+               }\r
+       }\r
+\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+       CacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);\r
+#endif\r
+\r
+       DrawLoadSaveScreen(0);\r
+\r
+       do\r
+       {\r
+               which=HandleMenu(&LSItems,&LSMenu[0],TrackWhichGame);\r
+               if (which>=0 && SaveGamesAvail[which])\r
+               {\r
+                       ShootSnd();\r
+                       name[7]=which+'0';\r
+\r
+                       handle=open(name,O_BINARY);\r
+                       lseek(handle,32,SEEK_SET);\r
+\r
+                       DrawLSAction(0);\r
+                       loadedgame=true;\r
+\r
+                       LoadTheGame(handle,LSA_X+8,LSA_Y+5);\r
+                       close(handle);\r
+\r
+                       StartGame=1;\r
+                       ShootSnd();\r
+                       //\r
+                       // CHANGE "READ THIS!" TO NORMAL COLOR\r
+                       //\r
+\r
+                       #ifndef SPEAR\r
+                       #ifndef GOODTIMES\r
+                       MainMenu[readthis].active=1;\r
+                       #endif\r
+                       #endif\r
+\r
+                       exit=1;\r
+                       break;\r
+               }\r
+\r
+       } while(which>=0);\r
+\r
+       MenuFadeOut();\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);\r
+       CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+#endif\r
+\r
+       return exit;\r
+}\r
+\r
+\r
+///////////////////////////////////\r
+//\r
+// HIGHLIGHT CURRENT SELECTED ENTRY\r
+//\r
+void TrackWhichGame(int w)\r
+{\r
+       static int lastgameon=0;\r
+\r
+       PrintLSEntry(lastgameon,TEXTCOLOR);\r
+       PrintLSEntry(w,HIGHLIGHT);\r
+\r
+       lastgameon=w;\r
+}\r
+\r
+\r
+////////////////////////////\r
+//\r
+// DRAW THE LOAD/SAVE SCREEN\r
+//\r
+void DrawLoadSaveScreen(int loadsave)\r
+{\r
+       #define DISKX   100\r
+       #define DISKY   0\r
+\r
+       int i;\r
+\r
+\r
+       ClearMScreen();\r
+       fontnumber=1;\r
+       VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+       DrawWindow(LSM_X-10,LSM_Y-5,LSM_W,LSM_H,BKGDCOLOR);\r
+       DrawStripes(10);\r
+\r
+       if (!loadsave)\r
+               VWB_DrawPic(60,0,C_LOADGAMEPIC);\r
+       else\r
+               VWB_DrawPic(60,0,C_SAVEGAMEPIC);\r
+\r
+       for (i=0;i<10;i++)\r
+               PrintLSEntry(i,TEXTCOLOR);\r
+\r
+       DrawMenu(&LSItems,&LSMenu[0]);\r
+       VW_UpdateScreen();\r
+       MenuFadeIn();\r
+       WaitKeyUp();\r
+}\r
+\r
+\r
+///////////////////////////////////////////\r
+//\r
+// PRINT LOAD/SAVE GAME ENTRY W/BOX OUTLINE\r
+//\r
+void PrintLSEntry(int w,int color)\r
+{\r
+       SETFONTCOLOR(color,BKGDCOLOR);\r
+       DrawOutline(LSM_X+LSItems.indent,LSM_Y+w*13,LSM_W-LSItems.indent-15,11,color,color);\r
+       PrintX=LSM_X+LSItems.indent+2;\r
+       PrintY=LSM_Y+w*13+1;\r
+       fontnumber=0;\r
+\r
+       if (SaveGamesAvail[w])\r
+               US_Print(SaveGameNames[w]);\r
+       else\r
+               US_Print("      - "STR_EMPTY" -");\r
+\r
+       fontnumber=1;\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// SAVE CURRENT GAME\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+int CP_SaveGame(int quick)\r
+{\r
+       int handle,which,exit=0;\r
+       unsigned nwritten;\r
+       char name[13],input[32];\r
+\r
+\r
+       strcpy(name,SaveName);\r
+\r
+       //\r
+       // QUICKSAVE?\r
+       //\r
+       if (quick)\r
+       {\r
+               which=LSItems.curpos;\r
+\r
+               if (SaveGamesAvail[which])\r
+               {\r
+                       name[7]=which+'0';\r
+                       unlink(name);\r
+                       handle=creat(name,S_IREAD|S_IWRITE);\r
+\r
+                       strcpy(input,&SaveGameNames[which][0]);\r
+\r
+                       _dos_write(handle,(void far *)input,32,&nwritten);\r
+                       lseek(handle,32,SEEK_SET);\r
+                       SaveTheGame(handle,0,0);\r
+                       close(handle);\r
+\r
+                       return 1;\r
+               }\r
+       }\r
+\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+       CacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);\r
+#endif\r
+\r
+       DrawLoadSaveScreen(1);\r
+\r
+       do\r
+       {\r
+               which=HandleMenu(&LSItems,&LSMenu[0],TrackWhichGame);\r
+               if (which>=0)\r
+               {\r
+                       //\r
+                       // OVERWRITE EXISTING SAVEGAME?\r
+                       //\r
+                       if (SaveGamesAvail[which])\r
+                               #ifdef JAPAN\r
+                               if (!GetYorN(7,8,C_JAPSAVEOVERPIC))\r
+                               #else\r
+                               if (!Confirm(GAMESVD))\r
+                               #endif\r
+                               {\r
+                                       DrawLoadSaveScreen(1);\r
+                                       continue;\r
+                               }\r
+                               else\r
+                               {\r
+                                       DrawLoadSaveScreen(1);\r
+                                       PrintLSEntry(which,HIGHLIGHT);\r
+                                       VW_UpdateScreen();\r
+                               }\r
+\r
+                       ShootSnd();\r
+\r
+                       strcpy(input,&SaveGameNames[which][0]);\r
+                       name[7]=which+'0';\r
+\r
+                       fontnumber=0;\r
+                       if (!SaveGamesAvail[which])\r
+                               VWB_Bar(LSM_X+LSItems.indent+1,LSM_Y+which*13+1,LSM_W-LSItems.indent-16,10,BKGDCOLOR);\r
+                       VW_UpdateScreen();\r
+\r
+                       if (US_LineInput(LSM_X+LSItems.indent+2,LSM_Y+which*13+1,input,input,true,31,LSM_W-LSItems.indent-30))\r
+                       {\r
+                               SaveGamesAvail[which]=1;\r
+                               strcpy(&SaveGameNames[which][0],input);\r
+\r
+                               unlink(name);\r
+                               handle=creat(name,S_IREAD|S_IWRITE);\r
+                               _dos_write(handle,(void far *)input,32,&nwritten);\r
+                               lseek(handle,32,SEEK_SET);\r
+\r
+                               DrawLSAction(1);\r
+                               SaveTheGame(handle,LSA_X+8,LSA_Y+5);\r
+\r
+                               close(handle);\r
+\r
+                               ShootSnd();\r
+                               exit=1;\r
+                       }\r
+                       else\r
+                       {\r
+                               VWB_Bar(LSM_X+LSItems.indent+1,LSM_Y+which*13+1,LSM_W-LSItems.indent-16,10,BKGDCOLOR);\r
+                               PrintLSEntry(which,HIGHLIGHT);\r
+                               VW_UpdateScreen();\r
+                               SD_PlaySound(ESCPRESSEDSND);\r
+                               continue;\r
+                       }\r
+\r
+                       fontnumber=1;\r
+                       break;\r
+               }\r
+\r
+       } while(which>=0);\r
+\r
+       MenuFadeOut();\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);\r
+       CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+#endif\r
+\r
+       return exit;\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// CALIBRATE JOYSTICK\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+int CalibrateJoystick(void)\r
+{\r
+       #define CALX    85\r
+       #define CALY    40\r
+       #define CALW    158\r
+       #define CALH    140\r
+\r
+       unsigned xmin,ymin,xmax,ymax,jb;\r
+\r
+\r
+\r
+       #ifdef JAPAN\r
+       VWB_DrawPic(CALX,CALY,C_JOY0PIC);\r
+       #else\r
+       DrawWindow(CALX-5,CALY-5,CALW,CALH,TEXTCOLOR);\r
+       DrawOutline(CALX-5,CALY-5,CALW,CALH,0,HIGHLIGHT);\r
+       SETFONTCOLOR(0,TEXTCOLOR);\r
+\r
+       WindowX = PrintX = CALX;\r
+       WindowW = CALW;\r
+       WindowH = CALH;\r
+       WindowY = PrintY = CALY;\r
+       US_Print("    "STR_CALIB"\n    "STR_JOYST"\n");\r
+       VWB_DrawPic(CALX+40,CALY+30,C_JOY1PIC);\r
+       PrintY = CALY+80;\r
+       US_Print(STR_MOVEJOY);\r
+       SETFONTCOLOR(BKGDCOLOR,TEXTCOLOR);\r
+       US_Print("   "STR_ESCEXIT);\r
+       #endif\r
+       VW_UpdateScreen();\r
+\r
+       do\r
+       {\r
+               jb=IN_JoyButtons();\r
+               if (Keyboard[sc_Escape])\r
+                       return 0;\r
+               #ifndef SPEAR\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+                       PicturePause();\r
+               #endif\r
+\r
+       } while(!(jb&1));\r
+\r
+       SD_PlaySound(SHOOTSND);\r
+       IN_GetJoyAbs(joystickport,&xmin,&ymin);\r
+\r
+\r
+       #ifdef JAPAN\r
+       VWB_DrawPic(CALX,CALY,C_JOY1PIC);\r
+       #else\r
+       DrawWindow(CALX-5,CALY-5,CALW,CALH,TEXTCOLOR);\r
+       DrawOutline(CALX-5,CALY-5,CALW,CALH,0,HIGHLIGHT);\r
+       SETFONTCOLOR(0,TEXTCOLOR);\r
+\r
+       PrintX = CALX;\r
+       PrintY = CALY;\r
+       US_Print("    "STR_CALIB"\n    "STR_JOYST"\n");\r
+       VWB_DrawPic(CALX+40,CALY+30,C_JOY2PIC);\r
+       PrintY = CALY+80;\r
+       US_Print(STR_MOVEJOY2);\r
+       SETFONTCOLOR(BKGDCOLOR,TEXTCOLOR);\r
+       US_Print("   "STR_ESCEXIT);\r
+       #endif\r
+       VW_UpdateScreen();\r
+\r
+       do\r
+       {\r
+               jb=IN_JoyButtons();\r
+               if (Keyboard[sc_Escape])\r
+                       return 0;\r
+               #ifndef SPEAR\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+                       PicturePause();\r
+               #endif\r
+       } while(!(jb&2));\r
+\r
+       IN_GetJoyAbs(joystickport,&xmax,&ymax);\r
+       SD_PlaySound(SHOOTSND);\r
+\r
+       while (IN_JoyButtons());\r
+\r
+       //\r
+       // ASSIGN ACTUAL VALUES HERE\r
+       //\r
+       if ((xmin != xmax) && (ymin != ymax))\r
+               IN_SetupJoy(joystickport,xmin,xmax,ymin,ymax);\r
+       else\r
+               return 0;\r
+\r
+       return 1;\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// DEFINE CONTROLS\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CP_Control(void)\r
+{\r
+       #define CTL_SPC 70\r
+       enum {MOUSEENABLE,JOYENABLE,USEPORT2,PADENABLE,MOUSESENS,CUSTOMIZE};\r
+       int i,which;\r
+\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+       CacheLump (CONTROL_LUMP_START,CONTROL_LUMP_END);\r
+#endif\r
+\r
+       DrawCtlScreen();\r
+       MenuFadeIn();\r
+       WaitKeyUp();\r
+\r
+       do\r
+       {\r
+               which=HandleMenu(&CtlItems,&CtlMenu[0],NULL);\r
+               switch(which)\r
+               {\r
+                       case MOUSEENABLE:\r
+                               mouseenabled^=1;\r
+                               _CX=_DX=CENTER;\r
+                               Mouse(4);\r
+                               DrawCtlScreen();\r
+                               CusItems.curpos=-1;\r
+                               ShootSnd();\r
+                               break;\r
+\r
+                       case JOYENABLE:\r
+                               joystickenabled^=1;\r
+                               if (joystickenabled)\r
+                                       if (!CalibrateJoystick())\r
+                                               joystickenabled = 0;\r
+                               DrawCtlScreen();\r
+                               CusItems.curpos=-1;\r
+                               ShootSnd();\r
+                               break;\r
+\r
+                       case USEPORT2:\r
+                               joystickport^=1;\r
+                               DrawCtlScreen();\r
+                               ShootSnd();\r
+                               break;\r
+\r
+                       case PADENABLE:\r
+                               joypadenabled^=1;\r
+                               DrawCtlScreen();\r
+                               ShootSnd();\r
+                               break;\r
+\r
+                       case MOUSESENS:\r
+                       case CUSTOMIZE:\r
+                               DrawCtlScreen();\r
+                               MenuFadeIn();\r
+                               WaitKeyUp();\r
+                               break;\r
+               }\r
+       } while(which>=0);\r
+\r
+       MenuFadeOut();\r
+\r
+#ifdef SPEAR\r
+       UnCacheLump (CONTROL_LUMP_START,CONTROL_LUMP_END);\r
+       CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);\r
+#endif\r
+}\r
+\r
+\r
+////////////////////////////////\r
+//\r
+// DRAW MOUSE SENSITIVITY SCREEN\r
+//\r
+void DrawMouseSens(void)\r
+{\r
+#ifdef JAPAN\r
+       CA_CacheScreen(S_MOUSESENSPIC);\r
+#else\r
+       ClearMScreen();\r
+       VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+       #ifdef SPANISH\r
+       DrawWindow(10,80,300,43,BKGDCOLOR);\r
+       #else\r
+       DrawWindow(10,80,300,30,BKGDCOLOR);\r
+       #endif\r
+\r
+       WindowX=0;\r
+       WindowW=320;\r
+       PrintY=82;\r
+       SETFONTCOLOR(READCOLOR,BKGDCOLOR);\r
+       US_CPrint(STR_MOUSEADJ);\r
+\r
+       SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+       #ifdef SPANISH\r
+       PrintX=14;\r
+       PrintY=95+13;\r
+       US_Print(STR_SLOW);\r
+       PrintX=252;\r
+       US_Print(STR_FAST);\r
+       #else\r
+       PrintX=14;\r
+       PrintY=95;\r
+       US_Print(STR_SLOW);\r
+       PrintX=269;\r
+       US_Print(STR_FAST);\r
+       #endif\r
+#endif\r
+\r
+       VWB_Bar(60,97,200,10,TEXTCOLOR);\r
+       DrawOutline(60,97,200,10,0,HIGHLIGHT);\r
+       DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);\r
+       VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);\r
+\r
+       VW_UpdateScreen();\r
+       MenuFadeIn();\r
+}\r
+\r
+\r
+///////////////////////////\r
+//\r
+// ADJUST MOUSE SENSITIVITY\r
+//\r
+void MouseSensitivity(void)\r
+{\r
+       ControlInfo ci;\r
+       int exit=0,oldMA;\r
+\r
+\r
+       oldMA=mouseadjustment;\r
+       DrawMouseSens();\r
+       do\r
+       {\r
+               ReadAnyControl(&ci);\r
+               switch(ci.dir)\r
+               {\r
+                       case dir_North:\r
+                       case dir_West:\r
+                               if (mouseadjustment)\r
+                               {\r
+                                       mouseadjustment--;\r
+                                       VWB_Bar(60,97,200,10,TEXTCOLOR);\r
+                                       DrawOutline(60,97,200,10,0,HIGHLIGHT);\r
+                                       DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);\r
+                                       VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);\r
+                                       VW_UpdateScreen();\r
+                                       SD_PlaySound(MOVEGUN1SND);\r
+                                       while(Keyboard[sc_LeftArrow]);\r
+                                       WaitKeyUp();\r
+                               }\r
+                               break;\r
+\r
+                       case dir_South:\r
+                       case dir_East:\r
+                               if (mouseadjustment<9)\r
+                               {\r
+                                       mouseadjustment++;\r
+                                       VWB_Bar(60,97,200,10,TEXTCOLOR);\r
+                                       DrawOutline(60,97,200,10,0,HIGHLIGHT);\r
+                                       DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);\r
+                                       VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);\r
+                                       VW_UpdateScreen();\r
+                                       SD_PlaySound(MOVEGUN1SND);\r
+                                       while(Keyboard[sc_RightArrow]);\r
+                                       WaitKeyUp();\r
+                               }\r
+                               break;\r
+               }\r
+\r
+               #ifndef SPEAR\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+               #else\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))\r
+               #endif\r
+                       PicturePause();\r
+\r
+               if (ci.button0 || Keyboard[sc_Space] || Keyboard[sc_Enter])\r
+                       exit=1;\r
+               else\r
+               if (ci.button1 || Keyboard[sc_Escape])\r
+                       exit=2;\r
+\r
+       } while(!exit);\r
+\r
+       if (exit==2)\r
+       {\r
+               mouseadjustment=oldMA;\r
+               SD_PlaySound(ESCPRESSEDSND);\r
+       }\r
+       else\r
+               SD_PlaySound(SHOOTSND);\r
+\r
+       WaitKeyUp();\r
+       MenuFadeOut();\r
+}\r
+\r
+\r
+///////////////////////////\r
+//\r
+// DRAW CONTROL MENU SCREEN\r
+//\r
+void DrawCtlScreen(void)\r
+{\r
+ int i,x,y;\r
+\r
+\r
+#ifdef JAPAN\r
+       CA_CacheScreen(S_CONTROLPIC);\r
+#else\r
+ ClearMScreen();\r
+ DrawStripes(10);\r
+ VWB_DrawPic(80,0,C_CONTROLPIC);\r
+ VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+ DrawWindow(CTL_X-8,CTL_Y-5,CTL_W,CTL_H,BKGDCOLOR);\r
+#endif\r
+ WindowX=0;\r
+ WindowW=320;\r
+ SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+\r
+ if (JoysPresent[0])\r
+   CtlMenu[1].active=\r
+   CtlMenu[2].active=\r
+   CtlMenu[3].active=1;\r
+\r
+ CtlMenu[2].active=CtlMenu[3].active=joystickenabled;\r
+\r
+ if (MousePresent)\r
+ {\r
+  CtlMenu[4].active=\r
+  CtlMenu[0].active=1;\r
+ }\r
+\r
+ CtlMenu[4].active=mouseenabled;\r
+\r
+\r
+ DrawMenu(&CtlItems,&CtlMenu[0]);\r
+\r
+\r
+ x=CTL_X+CtlItems.indent-24;\r
+ y=CTL_Y+3;\r
+ if (mouseenabled)\r
+   VWB_DrawPic(x,y,C_SELECTEDPIC);\r
+ else\r
+   VWB_DrawPic(x,y,C_NOTSELECTEDPIC);\r
+\r
+ y=CTL_Y+16;\r
+ if (joystickenabled)\r
+   VWB_DrawPic(x,y,C_SELECTEDPIC);\r
+ else\r
+   VWB_DrawPic(x,y,C_NOTSELECTEDPIC);\r
+\r
+ y=CTL_Y+29;\r
+ if (joystickport)\r
+   VWB_DrawPic(x,y,C_SELECTEDPIC);\r
+ else\r
+   VWB_DrawPic(x,y,C_NOTSELECTEDPIC);\r
+\r
+ y=CTL_Y+42;\r
+ if (joypadenabled)\r
+   VWB_DrawPic(x,y,C_SELECTEDPIC);\r
+ else\r
+   VWB_DrawPic(x,y,C_NOTSELECTEDPIC);\r
+\r
+ //\r
+ // PICK FIRST AVAILABLE SPOT\r
+ //\r
+ if (CtlItems.curpos<0 || !CtlMenu[CtlItems.curpos].active)\r
+   for (i=0;i<6;i++)\r
+        if (CtlMenu[i].active)\r
+        {\r
+         CtlItems.curpos=i;\r
+         break;\r
+        }\r
+\r
+ DrawMenuGun(&CtlItems);\r
+ VW_UpdateScreen();\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// CUSTOMIZE CONTROLS\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+enum {FIRE,STRAFE,RUN,OPEN};\r
+char mbarray[4][3]={"b0","b1","b2","b3"},\r
+          order[4]={RUN,OPEN,FIRE,STRAFE};\r
+\r
+\r
+void CustomControls(void)\r
+{\r
+ int which;\r
+\r
+\r
+ DrawCustomScreen();\r
+ do\r
+ {\r
+  which=HandleMenu(&CusItems,&CusMenu[0],FixupCustom);\r
+  switch(which)\r
+  {\r
+   case 0:\r
+        DefineMouseBtns();\r
+        DrawCustMouse(1);\r
+        break;\r
+   case 3:\r
+        DefineJoyBtns();\r
+        DrawCustJoy(0);\r
+        break;\r
+   case 6:\r
+        DefineKeyBtns();\r
+        DrawCustKeybd(0);\r
+        break;\r
+   case 8:\r
+        DefineKeyMove();\r
+        DrawCustKeys(0);\r
+  }\r
+ } while(which>=0);\r
+\r
+\r
+\r
+ MenuFadeOut();\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// DEFINE THE MOUSE BUTTONS\r
+//\r
+void DefineMouseBtns(void)\r
+{\r
+ CustomCtrls mouseallowed={0,1,1,1};\r
+ EnterCtrlData(2,&mouseallowed,DrawCustMouse,PrintCustMouse,MOUSE);\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// DEFINE THE JOYSTICK BUTTONS\r
+//\r
+void DefineJoyBtns(void)\r
+{\r
+ CustomCtrls joyallowed={1,1,1,1};\r
+ EnterCtrlData(5,&joyallowed,DrawCustJoy,PrintCustJoy,JOYSTICK);\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// DEFINE THE KEYBOARD BUTTONS\r
+//\r
+void DefineKeyBtns(void)\r
+{\r
+ CustomCtrls keyallowed={1,1,1,1};\r
+ EnterCtrlData(8,&keyallowed,DrawCustKeybd,PrintCustKeybd,KEYBOARDBTNS);\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// DEFINE THE KEYBOARD BUTTONS\r
+//\r
+void DefineKeyMove(void)\r
+{\r
+       CustomCtrls keyallowed={1,1,1,1};\r
+       EnterCtrlData(10,&keyallowed,DrawCustKeys,PrintCustKeys,KEYBOARDMOVE);\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// ENTER CONTROL DATA FOR ANY TYPE OF CONTROL\r
+//\r
+enum {FWRD,RIGHT,BKWD,LEFT};\r
+int moveorder[4]={LEFT,RIGHT,FWRD,BKWD};\r
+\r
+void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*PrintRtn)(int),int type)\r
+{\r
+ int j,exit,tick,redraw,which,x,picked;\r
+ ControlInfo ci;\r
+\r
+\r
+ ShootSnd();\r
+ PrintY=CST_Y+13*index;\r
+ IN_ClearKeysDown();\r
+ exit=0;\r
+ redraw=1;\r
+ //\r
+ // FIND FIRST SPOT IN ALLOWED ARRAY\r
+ //\r
+ for (j=0;j<4;j++)\r
+   if (cust->allowed[j])\r
+   {\r
+       which=j;\r
+       break;\r
+   }\r
+\r
+ do\r
+ {\r
+  if (redraw)\r
+  {\r
+   x=CST_START+CST_SPC*which;\r
+   DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);\r
+\r
+   DrawRtn(1);\r
+   DrawWindow(x-2,PrintY,CST_SPC,11,TEXTCOLOR);\r
+   DrawOutline(x-2,PrintY,CST_SPC,11,0,HIGHLIGHT);\r
+   SETFONTCOLOR(0,TEXTCOLOR);\r
+   PrintRtn(which);\r
+   PrintX=x;\r
+   SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+   VW_UpdateScreen();\r
+   WaitKeyUp();\r
+   redraw=0;\r
+  }\r
+\r
+  ReadAnyControl(&ci);\r
+\r
+  if (type==MOUSE || type==JOYSTICK)\r
+       if (IN_KeyDown(sc_Enter)||IN_KeyDown(sc_Control)||IN_KeyDown(sc_Alt))\r
+       {\r
+        IN_ClearKeysDown();\r
+        ci.button0=ci.button1=false;\r
+       }\r
+\r
+  //\r
+  // CHANGE BUTTON VALUE?\r
+  //\r
+  if ((ci.button0|ci.button1|ci.button2|ci.button3)||\r
+         ((type==KEYBOARDBTNS||type==KEYBOARDMOVE) && LastScan==sc_Enter))\r
+  {\r
+   tick=TimeCount=picked=0;\r
+   SETFONTCOLOR(0,TEXTCOLOR);\r
+\r
+   do\r
+   {\r
+       int button,result=0;\r
+\r
+\r
+       if (type==KEYBOARDBTNS||type==KEYBOARDMOVE)\r
+         IN_ClearKeysDown();\r
+\r
+       //\r
+       // FLASH CURSOR\r
+       //\r
+       if (TimeCount>10)\r
+       {\r
+        switch(tick)\r
+        {\r
+         case 0:\r
+       VWB_Bar(x,PrintY+1,CST_SPC-2,10,TEXTCOLOR);\r
+       break;\r
+         case 1:\r
+       PrintX=x;\r
+       US_Print("?");\r
+       SD_PlaySound(HITWALLSND);\r
+        }\r
+        tick^=1;\r
+        TimeCount=0;\r
+        VW_UpdateScreen();\r
+       }\r
+\r
+       //\r
+       // WHICH TYPE OF INPUT DO WE PROCESS?\r
+       //\r
+       switch(type)\r
+       {\r
+        case MOUSE:\r
+          Mouse(3);\r
+          button=_BX;\r
+          switch(button)\r
+          {\r
+       case 1: result=1; break;\r
+       case 2: result=2; break;\r
+       case 4: result=3; break;\r
+          }\r
+\r
+          if (result)\r
+          {\r
+       int z;\r
+\r
+\r
+       for (z=0;z<4;z++)\r
+         if (order[which]==buttonmouse[z])\r
+         {\r
+          buttonmouse[z]=bt_nobutton;\r
+          break;\r
+         }\r
+\r
+       buttonmouse[result-1]=order[which];\r
+       picked=1;\r
+       SD_PlaySound(SHOOTDOORSND);\r
+          }\r
+          break;\r
+\r
+        case JOYSTICK:\r
+          if (ci.button0) result=1;\r
+          else\r
+          if (ci.button1) result=2;\r
+          else\r
+          if (ci.button2) result=3;\r
+          else\r
+          if (ci.button3) result=4;\r
+\r
+          if (result)\r
+          {\r
+       int z;\r
+\r
+\r
+       for (z=0;z<4;z++)\r
+         if (order[which]==buttonjoy[z])\r
+         {\r
+          buttonjoy[z]=bt_nobutton;\r
+          break;\r
+         }\r
+\r
+       buttonjoy[result-1]=order[which];\r
+       picked=1;\r
+       SD_PlaySound(SHOOTDOORSND);\r
+          }\r
+          break;\r
+\r
+        case KEYBOARDBTNS:\r
+          if (LastScan)\r
+          {\r
+       buttonscan[order[which]]=LastScan;\r
+       picked=1;\r
+       ShootSnd();\r
+       IN_ClearKeysDown();\r
+          }\r
+          break;\r
+\r
+        case KEYBOARDMOVE:\r
+          if (LastScan)\r
+          {\r
+       dirscan[moveorder[which]]=LastScan;\r
+       picked=1;\r
+       ShootSnd();\r
+       IN_ClearKeysDown();\r
+          }\r
+          break;\r
+       }\r
+\r
+       //\r
+       // EXIT INPUT?\r
+       //\r
+       if (IN_KeyDown(sc_Escape))\r
+       {\r
+        picked=1;\r
+        continue;\r
+       }\r
+\r
+   } while(!picked);\r
+\r
+   SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+   redraw=1;\r
+   WaitKeyUp();\r
+   continue;\r
+  }\r
+\r
+  if (ci.button1 || IN_KeyDown(sc_Escape))\r
+       exit=1;\r
+\r
+  //\r
+  // MOVE TO ANOTHER SPOT?\r
+  //\r
+  switch(ci.dir)\r
+  {\r
+   case dir_West:\r
+        do\r
+        {\r
+         which--;\r
+         if (which<0)\r
+       which=3;\r
+        } while(!cust->allowed[which]);\r
+        redraw=1;\r
+        SD_PlaySound(MOVEGUN1SND);\r
+        while(ReadAnyControl(&ci),ci.dir!=dir_None);\r
+        IN_ClearKeysDown();\r
+        break;\r
+\r
+   case dir_East:\r
+        do\r
+        {\r
+         which++;\r
+         if (which>3)\r
+       which=0;\r
+        } while(!cust->allowed[which]);\r
+        redraw=1;\r
+        SD_PlaySound(MOVEGUN1SND);\r
+        while(ReadAnyControl(&ci),ci.dir!=dir_None);\r
+        IN_ClearKeysDown();\r
+        break;\r
+   case dir_North:\r
+   case dir_South:\r
+        exit=1;\r
+  }\r
+ } while(!exit);\r
+\r
+ SD_PlaySound(ESCPRESSEDSND);\r
+ WaitKeyUp();\r
+ DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// FIXUP GUN CURSOR OVERDRAW SHIT\r
+//\r
+void FixupCustom(int w)\r
+{\r
+       static int lastwhich=-1;\r
+       int y=CST_Y+26+w*13;\r
+\r
+\r
+       VWB_Hlin(7,32,y-1,DEACTIVE);\r
+       VWB_Hlin(7,32,y+12,BORD2COLOR);\r
+#ifndef SPEAR\r
+       VWB_Hlin(7,32,y-2,BORDCOLOR);\r
+       VWB_Hlin(7,32,y+13,BORDCOLOR);\r
+#else\r
+       VWB_Hlin(7,32,y-2,BORD2COLOR);\r
+       VWB_Hlin(7,32,y+13,BORD2COLOR);\r
+#endif\r
+\r
+       switch(w)\r
+       {\r
+               case 0: DrawCustMouse(1); break;\r
+               case 3: DrawCustJoy(1); break;\r
+               case 6: DrawCustKeybd(1); break;\r
+               case 8: DrawCustKeys(1);\r
+       }\r
+\r
+\r
+       if (lastwhich>=0)\r
+       {\r
+               y=CST_Y+26+lastwhich*13;\r
+               VWB_Hlin(7,32,y-1,DEACTIVE);\r
+               VWB_Hlin(7,32,y+12,BORD2COLOR);\r
+#ifndef SPEAR\r
+               VWB_Hlin(7,32,y-2,BORDCOLOR);\r
+               VWB_Hlin(7,32,y+13,BORDCOLOR);\r
+#else\r
+               VWB_Hlin(7,32,y-2,BORD2COLOR);\r
+               VWB_Hlin(7,32,y+13,BORD2COLOR);\r
+#endif\r
+\r
+               if (lastwhich!=w)\r
+                       switch(lastwhich)\r
+                       {\r
+                               case 0: DrawCustMouse(0); break;\r
+                               case 3: DrawCustJoy(0); break;\r
+                               case 6: DrawCustKeybd(0); break;\r
+                               case 8: DrawCustKeys(0);\r
+                       }\r
+       }\r
+\r
+       lastwhich=w;\r
+}\r
+\r
+\r
+////////////////////////\r
+//\r
+// DRAW CUSTOMIZE SCREEN\r
+//\r
+void DrawCustomScreen(void)\r
+{\r
+       int i;\r
+\r
+\r
+#ifdef JAPAN\r
+       CA_CacheScreen(S_CUSTOMPIC);\r
+       fontnumber=1;\r
+\r
+       PrintX=CST_START;\r
+       PrintY = CST_Y+26;\r
+       DrawCustMouse(0);\r
+\r
+       PrintX=CST_START;\r
+       US_Print("\n\n\n");\r
+       DrawCustJoy(0);\r
+\r
+       PrintX=CST_START;\r
+       US_Print("\n\n\n");\r
+       DrawCustKeybd(0);\r
+\r
+       PrintX=CST_START;\r
+       US_Print("\n\n\n");\r
+       DrawCustKeys(0);\r
+#else\r
+       ClearMScreen();\r
+       WindowX=0;\r
+       WindowW=320;\r
+       VWB_DrawPic(112,184,C_MOUSELBACKPIC);\r
+       DrawStripes(10);\r
+       VWB_DrawPic(80,0,C_CUSTOMIZEPIC);\r
+\r
+       //\r
+       // MOUSE\r
+       //\r
+       SETFONTCOLOR(READCOLOR,BKGDCOLOR);\r
+       WindowX=0;\r
+       WindowW=320;\r
+\r
+#ifndef SPEAR\r
+       PrintY=CST_Y;\r
+       US_CPrint("Mouse\n");\r
+#else\r
+       PrintY = CST_Y+13;\r
+       VWB_DrawPic (128,48,C_MOUSEPIC);\r
+#endif\r
+\r
+       SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+       #ifdef SPANISH\r
+       PrintX=CST_START-16;\r
+       US_Print(STR_CRUN);\r
+       PrintX=CST_START-16+CST_SPC*1;\r
+       US_Print(STR_COPEN);\r
+       PrintX=CST_START-16+CST_SPC*2;\r
+       US_Print(STR_CFIRE);\r
+       PrintX=CST_START-16+CST_SPC*3;\r
+       US_Print(STR_CSTRAFE"\n");\r
+       #else\r
+       PrintX=CST_START;\r
+       US_Print(STR_CRUN);\r
+       PrintX=CST_START+CST_SPC*1;\r
+       US_Print(STR_COPEN);\r
+       PrintX=CST_START+CST_SPC*2;\r
+       US_Print(STR_CFIRE);\r
+       PrintX=CST_START+CST_SPC*3;\r
+       US_Print(STR_CSTRAFE"\n");\r
+       #endif\r
+\r
+       DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);\r
+       DrawCustMouse(0);\r
+       US_Print("\n");\r
+\r
+\r
+       //\r
+       // JOYSTICK/PAD\r
+       //\r
+#ifndef SPEAR\r
+       SETFONTCOLOR(READCOLOR,BKGDCOLOR);\r
+       US_CPrint("Joystick/Gravis GamePad\n");\r
+#else\r
+       PrintY += 13;\r
+       VWB_DrawPic (40,88,C_JOYSTICKPIC);\r
+#endif\r
+\r
+#ifdef SPEAR\r
+       VWB_DrawPic (112,120,C_KEYBOARDPIC);\r
+#endif\r
+\r
+       SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+       #ifdef SPANISH\r
+       PrintX=CST_START-16;\r
+       US_Print(STR_CRUN);\r
+       PrintX=CST_START-16+CST_SPC*1;\r
+       US_Print(STR_COPEN);\r
+       PrintX=CST_START-16+CST_SPC*2;\r
+       US_Print(STR_CFIRE);\r
+       PrintX=CST_START-16+CST_SPC*3;\r
+       US_Print(STR_CSTRAFE"\n");\r
+       #else\r
+       PrintX=CST_START;\r
+       US_Print(STR_CRUN);\r
+       PrintX=CST_START+CST_SPC*1;\r
+       US_Print(STR_COPEN);\r
+       PrintX=CST_START+CST_SPC*2;\r
+       US_Print(STR_CFIRE);\r
+       PrintX=CST_START+CST_SPC*3;\r
+       US_Print(STR_CSTRAFE"\n");\r
+       #endif\r
+       DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);\r
+       DrawCustJoy(0);\r
+       US_Print("\n");\r
+\r
+\r
+       //\r
+       // KEYBOARD\r
+       //\r
+#ifndef SPEAR\r
+       SETFONTCOLOR(READCOLOR,BKGDCOLOR);\r
+       US_CPrint("Keyboard\n");\r
+#else\r
+       PrintY += 13;\r
+#endif\r
+       SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+       #ifdef SPANISH\r
+       PrintX=CST_START-16;\r
+       US_Print(STR_CRUN);\r
+       PrintX=CST_START-16+CST_SPC*1;\r
+       US_Print(STR_COPEN);\r
+       PrintX=CST_START-16+CST_SPC*2;\r
+       US_Print(STR_CFIRE);\r
+       PrintX=CST_START-16+CST_SPC*3;\r
+       US_Print(STR_CSTRAFE"\n");\r
+       #else\r
+       PrintX=CST_START;\r
+       US_Print(STR_CRUN);\r
+       PrintX=CST_START+CST_SPC*1;\r
+       US_Print(STR_COPEN);\r
+       PrintX=CST_START+CST_SPC*2;\r
+       US_Print(STR_CFIRE);\r
+       PrintX=CST_START+CST_SPC*3;\r
+       US_Print(STR_CSTRAFE"\n");\r
+       #endif\r
+       DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);\r
+       DrawCustKeybd(0);\r
+       US_Print("\n");\r
+\r
+\r
+       //\r
+       // KEYBOARD MOVE KEYS\r
+       //\r
+       SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+       #ifdef SPANISH\r
+       PrintX=4;\r
+       US_Print(STR_LEFT);\r
+       US_Print("/");\r
+       US_Print(STR_RIGHT);\r
+       US_Print("/");\r
+       US_Print(STR_FRWD);\r
+       US_Print("/");\r
+       US_Print(STR_BKWD"\n");\r
+       #else\r
+       PrintX=CST_START;\r
+       US_Print(STR_LEFT);\r
+       PrintX=CST_START+CST_SPC*1;\r
+       US_Print(STR_RIGHT);\r
+       PrintX=CST_START+CST_SPC*2;\r
+       US_Print(STR_FRWD);\r
+       PrintX=CST_START+CST_SPC*3;\r
+       US_Print(STR_BKWD"\n");\r
+       #endif\r
+       DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);\r
+       DrawCustKeys(0);\r
+#endif\r
+       //\r
+       // PICK STARTING POINT IN MENU\r
+       //\r
+       if (CusItems.curpos<0)\r
+               for (i=0;i<CusItems.amount;i++)\r
+                       if (CusMenu[i].active)\r
+                       {\r
+                               CusItems.curpos=i;\r
+                               break;\r
+                       }\r
+\r
+\r
+       VW_UpdateScreen();\r
+       MenuFadeIn();\r
+}\r
+\r
+\r
+void PrintCustMouse(int i)\r
+{\r
+       int j;\r
+\r
+       for (j=0;j<4;j++)\r
+               if (order[i]==buttonmouse[j])\r
+               {\r
+                       PrintX=CST_START+CST_SPC*i;\r
+                       US_Print(mbarray[j]);\r
+                       break;\r
+               }\r
+}\r
+\r
+void DrawCustMouse(int hilight)\r
+{\r
+       int i,color;\r
+\r
+\r
+       color=TEXTCOLOR;\r
+       if (hilight)\r
+               color=HIGHLIGHT;\r
+       SETFONTCOLOR(color,BKGDCOLOR);\r
+\r
+       if (!mouseenabled)\r
+       {\r
+               SETFONTCOLOR(DEACTIVE,BKGDCOLOR);\r
+               CusMenu[0].active=0;\r
+       }\r
+       else\r
+               CusMenu[0].active=1;\r
+\r
+       PrintY=CST_Y+13*2;\r
+       for (i=0;i<4;i++)\r
+               PrintCustMouse(i);\r
+}\r
+\r
+void PrintCustJoy(int i)\r
+{\r
+       int j;\r
+\r
+       for (j=0;j<4;j++)\r
+               if (order[i]==buttonjoy[j])\r
+               {\r
+                       PrintX=CST_START+CST_SPC*i;\r
+                       US_Print(mbarray[j]);\r
+                       break;\r
+               }\r
+}\r
+\r
+void DrawCustJoy(int hilight)\r
+{\r
+       int i,color;\r
+\r
+\r
+       color=TEXTCOLOR;\r
+       if (hilight)\r
+               color=HIGHLIGHT;\r
+       SETFONTCOLOR(color,BKGDCOLOR);\r
+\r
+       if (!joystickenabled)\r
+       {\r
+               SETFONTCOLOR(DEACTIVE,BKGDCOLOR);\r
+               CusMenu[3].active=0;\r
+       }\r
+       else\r
+               CusMenu[3].active=1;\r
+\r
+       PrintY=CST_Y+13*5;\r
+       for (i=0;i<4;i++)\r
+               PrintCustJoy(i);\r
+}\r
+\r
+\r
+void PrintCustKeybd(int i)\r
+{\r
+       PrintX=CST_START+CST_SPC*i;\r
+       US_Print(IN_GetScanName(buttonscan[order[i]]));\r
+}\r
+\r
+void DrawCustKeybd(int hilight)\r
+{\r
+       int i,color;\r
+\r
+\r
+       color=TEXTCOLOR;\r
+       if (hilight)\r
+               color=HIGHLIGHT;\r
+       SETFONTCOLOR(color,BKGDCOLOR);\r
+\r
+       PrintY=CST_Y+13*8;\r
+       for (i=0;i<4;i++)\r
+               PrintCustKeybd(i);\r
+}\r
+\r
+void PrintCustKeys(int i)\r
+{\r
+       PrintX=CST_START+CST_SPC*i;\r
+       US_Print(IN_GetScanName(dirscan[moveorder[i]]));\r
+}\r
+\r
+void DrawCustKeys(int hilight)\r
+{\r
+       int i,color;\r
+\r
+\r
+       color=TEXTCOLOR;\r
+       if (hilight)\r
+               color=HIGHLIGHT;\r
+       SETFONTCOLOR(color,BKGDCOLOR);\r
+\r
+       PrintY=CST_Y+13*10;\r
+       for (i=0;i<4;i++)\r
+               PrintCustKeys(i);\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// CHANGE SCREEN VIEWING SIZE\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CP_ChangeView(void)\r
+{\r
+       int exit=0,oldview,newview;\r
+       ControlInfo ci;\r
+\r
+\r
+       WindowX=WindowY=0;\r
+       WindowW=320;\r
+       WindowH=200;\r
+       newview=oldview=viewwidth/16;\r
+       DrawChangeView(oldview);\r
+\r
+       do\r
+       {\r
+               CheckPause();\r
+               ReadAnyControl(&ci);\r
+               switch(ci.dir)\r
+               {\r
+               case dir_South:\r
+               case dir_West:\r
+                       newview--;\r
+                       if (newview<4)\r
+                               newview=4;\r
+                       ShowViewSize(newview);\r
+                       VW_UpdateScreen();\r
+                       SD_PlaySound(HITWALLSND);\r
+                       TicDelay(10);\r
+                       break;\r
+\r
+               case dir_North:\r
+               case dir_East:\r
+                       newview++;\r
+                       if (newview>19)\r
+                               newview=19;\r
+                       ShowViewSize(newview);\r
+                       VW_UpdateScreen();\r
+                       SD_PlaySound(HITWALLSND);\r
+                       TicDelay(10);\r
+                       break;\r
+               }\r
+\r
+               #ifndef SPEAR\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+               #else\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))\r
+               #endif\r
+                       PicturePause();\r
+\r
+               if (ci.button0 || Keyboard[sc_Enter])\r
+                       exit=1;\r
+               else\r
+               if (ci.button1 || Keyboard[sc_Escape])\r
+               {\r
+                       viewwidth=oldview*16;\r
+                       SD_PlaySound(ESCPRESSEDSND);\r
+                       MenuFadeOut();\r
+                       return;\r
+               }\r
+\r
+       } while(!exit);\r
+\r
+\r
+       if (oldview!=newview)\r
+       {\r
+               SD_PlaySound (SHOOTSND);\r
+               Message(STR_THINK"...");\r
+               NewViewSize(newview);\r
+       }\r
+\r
+       ShootSnd();\r
+       MenuFadeOut();\r
+}\r
+\r
+\r
+/////////////////////////////\r
+//\r
+// DRAW THE CHANGEVIEW SCREEN\r
+//\r
+void DrawChangeView(int view)\r
+{\r
+#ifdef JAPAN\r
+       CA_CacheScreen(S_CHANGEPIC);\r
+\r
+       ShowViewSize(view);\r
+#else\r
+       VWB_Bar(0,160,320,40,VIEWCOLOR);\r
+       ShowViewSize(view);\r
+\r
+       PrintY=161;\r
+       WindowX=0;\r
+       WindowY=320;\r
+       SETFONTCOLOR(HIGHLIGHT,BKGDCOLOR);\r
+\r
+       US_CPrint(STR_SIZE1"\n");\r
+       US_CPrint(STR_SIZE2"\n");\r
+       US_CPrint(STR_SIZE3);\r
+#endif\r
+       VW_UpdateScreen();\r
+\r
+       MenuFadeIn();\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// QUIT THIS INFERNAL GAME!\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CP_Quit(void)\r
+{\r
+       int i;\r
+\r
+\r
+       #ifdef JAPAN\r
+       if (GetYorN(7,11,C_QUITMSGPIC))\r
+       #else\r
+\r
+       #ifdef SPANISH\r
+       if (Confirm(ENDGAMESTR))\r
+       #else\r
+       if (Confirm(endStrings[US_RndT()&0x7+(US_RndT()&1)]))\r
+       #endif\r
+\r
+       #endif\r
+       {\r
+               VW_UpdateScreen();\r
+               SD_MusicOff();\r
+               SD_StopSound();\r
+               MenuFadeOut();\r
+               //\r
+               // SHUT-UP THE ADLIB\r
+               //\r
+               for (i=1;i<=0xf5;i++)\r
+                       alOut(i,0);\r
+               Quit(NULL);\r
+       }\r
+\r
+       DrawMainMenu();\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// HANDLE INTRO SCREEN (SYSTEM CONFIG)\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void IntroScreen(void)\r
+{\r
+#ifdef SPEAR\r
+\r
+#define MAINCOLOR      0x4f\r
+#define EMSCOLOR       0x4f\r
+#define XMSCOLOR       0x4f\r
+\r
+#else\r
+\r
+#define MAINCOLOR      0x6c\r
+#define EMSCOLOR       0x6c\r
+#define XMSCOLOR       0x6c\r
+\r
+#endif\r
+#define FILLCOLOR      14\r
+\r
+       long memory,emshere,xmshere;\r
+       int i,num,ems[10]={100,200,300,400,500,600,700,800,900,1000},\r
+               xms[10]={100,200,300,400,500,600,700,800,900,1000},\r
+               main[10]={32,64,96,128,160,192,224,256,288,320};\r
+\r
+\r
+       //\r
+       // DRAW MAIN MEMORY\r
+       //\r
+       memory=(1023l+mminfo.nearheap+mminfo.farheap)/1024l;\r
+       for (i=0;i<10;i++)\r
+               if (memory>=main[i])\r
+                       VWB_Bar(49,163-8*i,6,5,MAINCOLOR-i);\r
+\r
+\r
+       //\r
+       // DRAW EMS MEMORY\r
+       //\r
+       if (EMSPresent)\r
+       {\r
+               emshere=4l*EMSPagesAvail;\r
+               for (i=0;i<10;i++)\r
+                       if (emshere>=ems[i])\r
+                               VWB_Bar(89,163-8*i,6,5,EMSCOLOR-i);\r
+       }\r
+\r
+       //\r
+       // DRAW XMS MEMORY\r
+       //\r
+       if (XMSPresent)\r
+       {\r
+               xmshere=4l*XMSPagesAvail;\r
+               for (i=0;i<10;i++)\r
+                       if (xmshere>=xms[i])\r
+                               VWB_Bar(129,163-8*i,6,5,XMSCOLOR-i);\r
+       }\r
+\r
+       //\r
+       // FILL BOXES\r
+       //\r
+       if (MousePresent)\r
+               VWB_Bar(164,82,12,2,FILLCOLOR);\r
+\r
+       if (JoysPresent[0] || JoysPresent[1])\r
+               VWB_Bar(164,105,12,2,FILLCOLOR);\r
+\r
+       if (AdLibPresent && !SoundBlasterPresent)\r
+               VWB_Bar(164,128,12,2,FILLCOLOR);\r
+\r
+       if (SoundBlasterPresent)\r
+               VWB_Bar(164,151,12,2,FILLCOLOR);\r
+\r
+       if (SoundSourcePresent)\r
+               VWB_Bar(164,174,12,2,FILLCOLOR);\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// SUPPORT ROUTINES\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+////////////////////////////////////////////////////////////////////\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// Clear Menu screens to dark red\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void ClearMScreen(void)\r
+{\r
+#ifndef SPEAR\r
+       VWB_Bar(0,0,320,200,BORDCOLOR);\r
+#else\r
+       VWB_DrawPic(0,0,C_BACKDROPPIC);\r
+#endif\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// Un/Cache a LUMP of graphics\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CacheLump(int lumpstart,int lumpend)\r
+{\r
+ int i;\r
+\r
+ for (i=lumpstart;i<=lumpend;i++)\r
+   CA_CacheGrChunk(i);\r
+}\r
+\r
+\r
+void UnCacheLump(int lumpstart,int lumpend)\r
+{\r
+ int i;\r
+\r
+ for (i=lumpstart;i<=lumpend;i++)\r
+       if (grsegs[i])\r
+               UNCACHEGRCHUNK(i);\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// Draw a window for a menu\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void DrawWindow(int x,int y,int w,int h,int wcolor)\r
+{\r
+       VWB_Bar(x,y,w,h,wcolor);\r
+       DrawOutline(x,y,w,h,BORD2COLOR,DEACTIVE);\r
+}\r
+\r
+\r
+void DrawOutline(int x,int y,int w,int h,int color1,int color2)\r
+{\r
+       VWB_Hlin(x,x+w,y,color2);\r
+       VWB_Vlin(y,y+h,x,color2);\r
+       VWB_Hlin(x,x+w,y+h,color1);\r
+       VWB_Vlin(y,y+h,x+w,color1);\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// Setup Control Panel stuff - graphics, etc.\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void SetupControlPanel(void)\r
+{\r
+       struct ffblk f;\r
+       char name[13];\r
+       int which,i;\r
+\r
+\r
+       //\r
+       // CACHE GRAPHICS & SOUNDS\r
+       //\r
+       CA_CacheGrChunk(STARTFONT+1);\r
+#ifndef SPEAR\r
+       CacheLump(CONTROLS_LUMP_START,CONTROLS_LUMP_END);\r
+#else\r
+       CacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+#endif\r
+\r
+       SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+       fontnumber=1;\r
+       WindowH=200;\r
+\r
+       if (!ingame)\r
+               CA_LoadAllSounds();\r
+       else\r
+               MainMenu[savegame].active=1;\r
+\r
+       //\r
+       // SEE WHICH SAVE GAME FILES ARE AVAILABLE & READ STRING IN\r
+       //\r
+       strcpy(name,SaveName);\r
+       if (!findfirst(name,&f,0))\r
+               do\r
+               {\r
+                       which=f.ff_name[7]-'0';\r
+                       if (which<10)\r
+                       {\r
+                               int handle;\r
+                               char temp[32];\r
+\r
+                               SaveGamesAvail[which]=1;\r
+                               handle=open(f.ff_name,O_BINARY);\r
+                               read(handle,temp,32);\r
+                               close(handle);\r
+                               strcpy(&SaveGameNames[which][0],temp);\r
+                       }\r
+               } while(!findnext(&f));\r
+\r
+       //\r
+       // CENTER MOUSE\r
+       //\r
+       _CX=_DX=CENTER;\r
+       Mouse(4);\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// Clean up all the Control Panel stuff\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void CleanupControlPanel(void)\r
+{\r
+#ifndef SPEAR\r
+       UnCacheLump(CONTROLS_LUMP_START,CONTROLS_LUMP_END);\r
+#else\r
+       UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);\r
+#endif\r
+\r
+       fontnumber = 0;\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// Handle moving gun around a menu\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+int HandleMenu(CP_iteminfo *item_i,CP_itemtype far *items,void (*routine)(int w))\r
+{\r
+       char key;\r
+       static int redrawitem=1,lastitem=-1;\r
+       int i,x,y,basey,exit,which,shape,timer;\r
+       ControlInfo ci;\r
+\r
+\r
+       which=item_i->curpos;\r
+       x=item_i->x&-8;\r
+       basey=item_i->y-2;\r
+       y=basey+which*13;\r
+\r
+       VWB_DrawPic(x,y,C_CURSOR1PIC);\r
+       SetTextColor(items+which,1);\r
+       if (redrawitem)\r
+       {\r
+               PrintX=item_i->x+item_i->indent;\r
+               PrintY=item_i->y+which*13;\r
+               US_Print((items+which)->string);\r
+       }\r
+       //\r
+       // CALL CUSTOM ROUTINE IF IT IS NEEDED\r
+       //\r
+       if (routine)\r
+               routine(which);\r
+       VW_UpdateScreen();\r
+\r
+       shape=C_CURSOR1PIC;\r
+       timer=8;\r
+       exit=0;\r
+       TimeCount=0;\r
+       IN_ClearKeysDown();\r
+\r
+\r
+       do\r
+       {\r
+               //\r
+               // CHANGE GUN SHAPE\r
+               //\r
+               if (TimeCount>timer)\r
+               {\r
+                       TimeCount=0;\r
+                       if (shape==C_CURSOR1PIC)\r
+                       {\r
+                               shape=C_CURSOR2PIC;\r
+                               timer=8;\r
+                       }\r
+                       else\r
+                       {\r
+                               shape=C_CURSOR1PIC;\r
+                               timer=70;\r
+                       }\r
+                       VWB_DrawPic(x,y,shape);\r
+                       if (routine)\r
+                               routine(which);\r
+                       VW_UpdateScreen();\r
+               }\r
+\r
+               CheckPause();\r
+\r
+               //\r
+               // SEE IF ANY KEYS ARE PRESSED FOR INITIAL CHAR FINDING\r
+               //\r
+               key=LastASCII;\r
+               if (key)\r
+               {\r
+                       int ok=0;\r
+\r
+                       //\r
+                       // CHECK FOR SCREEN CAPTURE\r
+                       //\r
+                       #ifndef SPEAR\r
+                       if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+                       #else\r
+                       if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))\r
+                       #endif\r
+                               PicturePause();\r
+\r
+\r
+                       if (key>='a')\r
+                               key-='a'-'A';\r
+\r
+                       for (i=which+1;i<item_i->amount;i++)\r
+                               if ((items+i)->active && (items+i)->string[0]==key)\r
+                               {\r
+                                       EraseGun(item_i,items,x,y,which);\r
+                                       which=i;\r
+                                       DrawGun(item_i,items,x,&y,which,basey,routine);\r
+                                       ok=1;\r
+                                       IN_ClearKeysDown();\r
+                                       break;\r
+                               }\r
+\r
+                       //\r
+                       // DIDN'T FIND A MATCH FIRST TIME THRU. CHECK AGAIN.\r
+                       //\r
+                       if (!ok)\r
+                       {\r
+                               for (i=0;i<which;i++)\r
+                                       if ((items+i)->active && (items+i)->string[0]==key)\r
+                                       {\r
+                                               EraseGun(item_i,items,x,y,which);\r
+                                               which=i;\r
+                                               DrawGun(item_i,items,x,&y,which,basey,routine);\r
+                                               IN_ClearKeysDown();\r
+                                               break;\r
+                                       }\r
+                       }\r
+               }\r
+\r
+               //\r
+               // GET INPUT\r
+               //\r
+               ReadAnyControl(&ci);\r
+               switch(ci.dir)\r
+               {\r
+                       ////////////////////////////////////////////////\r
+                       //\r
+                       // MOVE UP\r
+                       //\r
+                       case dir_North:\r
+\r
+                       EraseGun(item_i,items,x,y,which);\r
+\r
+                       //\r
+                       // ANIMATE HALF-STEP\r
+                       //\r
+                       if (which && (items+which-1)->active)\r
+                       {\r
+                               y-=6;\r
+                               DrawHalfStep(x,y);\r
+                       }\r
+\r
+                       //\r
+                       // MOVE TO NEXT AVAILABLE SPOT\r
+                       //\r
+                       do\r
+                       {\r
+                               if (!which)\r
+                                       which=item_i->amount-1;\r
+                               else\r
+                                       which--;\r
+                       } while(!(items+which)->active);\r
+\r
+                       DrawGun(item_i,items,x,&y,which,basey,routine);\r
+                       //\r
+                       // WAIT FOR BUTTON-UP OR DELAY NEXT MOVE\r
+                       //\r
+                       TicDelay(20);\r
+                       break;\r
+\r
+                       ////////////////////////////////////////////////\r
+                       //\r
+                       // MOVE DOWN\r
+                       //\r
+                       case dir_South:\r
+\r
+                       EraseGun(item_i,items,x,y,which);\r
+                       //\r
+                       // ANIMATE HALF-STEP\r
+                       //\r
+                       if (which!=item_i->amount-1 && (items+which+1)->active)\r
+                       {\r
+                               y+=6;\r
+                               DrawHalfStep(x,y);\r
+                       }\r
+\r
+                       do\r
+                       {\r
+                               if (which==item_i->amount-1)\r
+                                       which=0;\r
+                               else\r
+                                       which++;\r
+                       } while(!(items+which)->active);\r
+\r
+                       DrawGun(item_i,items,x,&y,which,basey,routine);\r
+\r
+                       //\r
+                       // WAIT FOR BUTTON-UP OR DELAY NEXT MOVE\r
+                       //\r
+                       TicDelay(20);\r
+                       break;\r
+               }\r
+\r
+               if (ci.button0 ||\r
+                       Keyboard[sc_Space] ||\r
+                       Keyboard[sc_Enter])\r
+                               exit=1;\r
+\r
+               if (ci.button1 ||\r
+                       Keyboard[sc_Escape])\r
+                               exit=2;\r
+\r
+       } while(!exit);\r
+\r
+\r
+       IN_ClearKeysDown();\r
+\r
+       //\r
+       // ERASE EVERYTHING\r
+       //\r
+       if (lastitem!=which)\r
+       {\r
+               VWB_Bar(x-1,y,25,16,BKGDCOLOR);\r
+               PrintX=item_i->x+item_i->indent;\r
+               PrintY=item_i->y+which*13;\r
+               US_Print((items+which)->string);\r
+               redrawitem=1;\r
+       }\r
+       else\r
+               redrawitem=0;\r
+\r
+       if (routine)\r
+               routine(which);\r
+       VW_UpdateScreen();\r
+\r
+       item_i->curpos=which;\r
+\r
+       lastitem=which;\r
+       switch(exit)\r
+       {\r
+               case 1:\r
+                       //\r
+                       // CALL THE ROUTINE\r
+                       //\r
+                       if ((items+which)->routine!=NULL)\r
+                       {\r
+                               ShootSnd();\r
+                               MenuFadeOut();\r
+                               (items+which)->routine(0);\r
+                       }\r
+                       return which;\r
+\r
+               case 2:\r
+                       SD_PlaySound(ESCPRESSEDSND);\r
+                       return -1;\r
+       }\r
+\r
+       return 0; // JUST TO SHUT UP THE ERROR MESSAGES!\r
+}\r
+\r
+\r
+//\r
+// ERASE GUN & DE-HIGHLIGHT STRING\r
+//\r
+void EraseGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int y,int which)\r
+{\r
+       VWB_Bar(x-1,y,25,16,BKGDCOLOR);\r
+       SetTextColor(items+which,0);\r
+\r
+       PrintX=item_i->x+item_i->indent;\r
+       PrintY=item_i->y+which*13;\r
+       US_Print((items+which)->string);\r
+       VW_UpdateScreen();\r
+}\r
+\r
+\r
+//\r
+// DRAW HALF STEP OF GUN TO NEXT POSITION\r
+//\r
+void DrawHalfStep(int x,int y)\r
+{\r
+       VWB_DrawPic(x,y,C_CURSOR1PIC);\r
+       VW_UpdateScreen();\r
+       SD_PlaySound(MOVEGUN1SND);\r
+       TimeCount=0;\r
+       while(TimeCount<8);\r
+}\r
+\r
+\r
+//\r
+// DRAW GUN AT NEW POSITION\r
+//\r
+void DrawGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int *y,int which,int basey,void (*routine)(int w))\r
+{\r
+       VWB_Bar(x-1,*y,25,16,BKGDCOLOR);\r
+       *y=basey+which*13;\r
+       VWB_DrawPic(x,*y,C_CURSOR1PIC);\r
+       SetTextColor(items+which,1);\r
+\r
+       PrintX=item_i->x+item_i->indent;\r
+       PrintY=item_i->y+which*13;\r
+       US_Print((items+which)->string);\r
+\r
+       //\r
+       // CALL CUSTOM ROUTINE IF IT IS NEEDED\r
+       //\r
+       if (routine)\r
+               routine(which);\r
+       VW_UpdateScreen();\r
+       SD_PlaySound(MOVEGUN2SND);\r
+}\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// DELAY FOR AN AMOUNT OF TICS OR UNTIL CONTROLS ARE INACTIVE\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void TicDelay(int count)\r
+{\r
+       ControlInfo ci;\r
+\r
+\r
+       TimeCount=0;\r
+       do\r
+       {\r
+               ReadAnyControl(&ci);\r
+       } while(TimeCount<count && ci.dir!=dir_None);\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// Draw a menu\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void DrawMenu(CP_iteminfo *item_i,CP_itemtype far *items)\r
+{\r
+       int i,which=item_i->curpos;\r
+\r
+\r
+       WindowX=PrintX=item_i->x+item_i->indent;\r
+       WindowY=PrintY=item_i->y;\r
+       WindowW=320;\r
+       WindowH=200;\r
+\r
+       for (i=0;i<item_i->amount;i++)\r
+       {\r
+               SetTextColor(items+i,which==i);\r
+\r
+               PrintY=item_i->y+i*13;\r
+               if ((items+i)->active)\r
+                       US_Print((items+i)->string);\r
+               else\r
+               {\r
+                       SETFONTCOLOR(DEACTIVE,BKGDCOLOR);\r
+                       US_Print((items+i)->string);\r
+                       SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);\r
+               }\r
+\r
+               US_Print("\n");\r
+       }\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// SET TEXT COLOR (HIGHLIGHT OR NO)\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void SetTextColor(CP_itemtype far *items,int hlight)\r
+{\r
+       if (hlight)\r
+               {SETFONTCOLOR(color_hlite[items->active],BKGDCOLOR);}\r
+       else\r
+               {SETFONTCOLOR(color_norml[items->active],BKGDCOLOR);}\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// WAIT FOR CTRLKEY-UP OR BUTTON-UP\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void WaitKeyUp(void)\r
+{\r
+       ControlInfo ci;\r
+       while(ReadAnyControl(&ci),      ci.button0|\r
+                                                               ci.button1|\r
+                                                               ci.button2|\r
+                                                               ci.button3|\r
+                                                               Keyboard[sc_Space]|\r
+                                                               Keyboard[sc_Enter]|\r
+                                                               Keyboard[sc_Escape]);\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// READ KEYBOARD, JOYSTICK AND MOUSE FOR INPUT\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void ReadAnyControl(ControlInfo *ci)\r
+{\r
+       int mouseactive=0;\r
+\r
+\r
+       IN_ReadControl(0,ci);\r
+\r
+       if (mouseenabled)\r
+       {\r
+               int mousey,mousex;\r
+\r
+\r
+               // READ MOUSE MOTION COUNTERS\r
+               // RETURN DIRECTION\r
+               // HOME MOUSE\r
+               // CHECK MOUSE BUTTONS\r
+\r
+               Mouse(3);\r
+               mousex=_CX;\r
+               mousey=_DX;\r
+\r
+               if (mousey<CENTER-SENSITIVE)\r
+               {\r
+                       ci->dir=dir_North;\r
+                       _CX=_DX=CENTER;\r
+                       Mouse(4);\r
+                       mouseactive=1;\r
+               }\r
+               else\r
+               if (mousey>CENTER+SENSITIVE)\r
+               {\r
+                       ci->dir=dir_South;\r
+                       _CX=_DX=CENTER;\r
+                       Mouse(4);\r
+                       mouseactive=1;\r
+               }\r
+\r
+               if (mousex<CENTER-SENSITIVE)\r
+               {\r
+                       ci->dir=dir_West;\r
+                       _CX=_DX=CENTER;\r
+                       Mouse(4);\r
+                       mouseactive=1;\r
+               }\r
+               else\r
+               if (mousex>CENTER+SENSITIVE)\r
+               {\r
+                       ci->dir=dir_East;\r
+                       _CX=_DX=CENTER;\r
+                       Mouse(4);\r
+                       mouseactive=1;\r
+               }\r
+\r
+               if (IN_MouseButtons())\r
+               {\r
+                       ci->button0=IN_MouseButtons()&1;\r
+                       ci->button1=IN_MouseButtons()&2;\r
+                       ci->button2=IN_MouseButtons()&4;\r
+                       ci->button3=false;\r
+                       mouseactive=1;\r
+               }\r
+       }\r
+\r
+       if (joystickenabled && !mouseactive)\r
+       {\r
+               int jx,jy,jb;\r
+\r
+\r
+               INL_GetJoyDelta(joystickport,&jx,&jy);\r
+               if (jy<-SENSITIVE)\r
+                       ci->dir=dir_North;\r
+               else\r
+               if (jy>SENSITIVE)\r
+                       ci->dir=dir_South;\r
+\r
+               if (jx<-SENSITIVE)\r
+                       ci->dir=dir_West;\r
+               else\r
+               if (jx>SENSITIVE)\r
+                       ci->dir=dir_East;\r
+\r
+               jb=IN_JoyButtons();\r
+               if (jb)\r
+               {\r
+                       ci->button0=jb&1;\r
+                       ci->button1=jb&2;\r
+                       if (joypadenabled)\r
+                       {\r
+                               ci->button2=jb&4;\r
+                               ci->button3=jb&8;\r
+                       }\r
+                       else\r
+                               ci->button2=ci->button3=false;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// DRAW DIALOG AND CONFIRM YES OR NO TO QUESTION\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+int Confirm(char far *string)\r
+{\r
+       int xit=0,i,x,y,tick=0,time,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};\r
+\r
+\r
+       Message(string);\r
+       IN_ClearKeysDown();\r
+\r
+       //\r
+       // BLINK CURSOR\r
+       //\r
+       x=PrintX;\r
+       y=PrintY;\r
+       TimeCount=0;\r
+\r
+       do\r
+       {\r
+               if (TimeCount>=10)\r
+               {\r
+                       switch(tick)\r
+                       {\r
+                               case 0:\r
+                                       VWB_Bar(x,y,8,13,TEXTCOLOR);\r
+                                       break;\r
+                               case 1:\r
+                                       PrintX=x;\r
+                                       PrintY=y;\r
+                                       US_Print("_");\r
+                       }\r
+                       VW_UpdateScreen();\r
+                       tick^=1;\r
+                       TimeCount=0;\r
+               }\r
+\r
+               #ifndef SPEAR\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+                       PicturePause();\r
+               #endif\r
+\r
+       #ifdef SPANISH\r
+       } while(!Keyboard[sc_S] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);\r
+       #else\r
+       } while(!Keyboard[sc_Y] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);\r
+       #endif\r
+\r
+       #ifdef SPANISH\r
+       if (Keyboard[sc_S])\r
+       {\r
+               xit=1;\r
+               ShootSnd();\r
+       }\r
+\r
+       while(Keyboard[sc_S] || Keyboard[sc_N] || Keyboard[sc_Escape]);\r
+\r
+       #else\r
+\r
+       if (Keyboard[sc_Y])\r
+       {\r
+               xit=1;\r
+               ShootSnd();\r
+       }\r
+\r
+       while(Keyboard[sc_Y] || Keyboard[sc_N] || Keyboard[sc_Escape]);\r
+       #endif\r
+\r
+       IN_ClearKeysDown();\r
+       SD_PlaySound(whichsnd[xit]);\r
+       return xit;\r
+}\r
+\r
+#ifdef JAPAN\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// DRAW MESSAGE & GET Y OR N\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+int GetYorN(int x,int y,int pic)\r
+{\r
+       int xit=0,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};\r
+\r
+\r
+       CA_CacheGrChunk(pic);\r
+       VWB_DrawPic(x * 8,y * 8,pic);\r
+       UNCACHEGRCHUNK(pic);\r
+       VW_UpdateScreen();\r
+       IN_ClearKeysDown();\r
+\r
+       do\r
+       {\r
+               #ifndef SPEAR\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+                       PicturePause();\r
+               #endif\r
+\r
+       #ifdef SPANISH\r
+       } while(!Keyboard[sc_S] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);\r
+       #else\r
+       } while(!Keyboard[sc_Y] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);\r
+       #endif\r
+\r
+       #ifdef SPANISH\r
+       if (Keyboard[sc_S])\r
+       {\r
+               xit=1;\r
+               ShootSnd();\r
+       }\r
+\r
+       while(Keyboard[sc_S] || Keyboard[sc_N] || Keyboard[sc_Escape]);\r
+\r
+       #else\r
+\r
+       if (Keyboard[sc_Y])\r
+       {\r
+               xit=1;\r
+               ShootSnd();\r
+       }\r
+\r
+       while(Keyboard[sc_Y] || Keyboard[sc_N] || Keyboard[sc_Escape]);\r
+       #endif\r
+\r
+       IN_ClearKeysDown();\r
+       SD_PlaySound(whichsnd[xit]);\r
+       return xit;\r
+}\r
+#endif\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// PRINT A MESSAGE IN A WINDOW\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+void Message(char far *string)\r
+{\r
+       int h=0,w=0,mw=0,i,x,y,time;\r
+       fontstruct _seg *font;\r
+\r
+\r
+       CA_CacheGrChunk (STARTFONT+1);\r
+       fontnumber=1;\r
+       font=grsegs[STARTFONT+fontnumber];\r
+       h=font->height;\r
+       for (i=0;i<_fstrlen(string);i++)\r
+               if (string[i]=='\n')\r
+               {\r
+                       if (w>mw)\r
+                               mw=w;\r
+                       w=0;\r
+                       h+=font->height;\r
+               }\r
+               else\r
+                       w+=font->width[string[i]];\r
+\r
+       if (w+10>mw)\r
+               mw=w+10;\r
+\r
+       PrintY=(WindowH/2)-h/2;\r
+       PrintX=WindowX=160-mw/2;\r
+\r
+       DrawWindow(WindowX-5,PrintY-5,mw+10,h+10,TEXTCOLOR);\r
+       DrawOutline(WindowX-5,PrintY-5,mw+10,h+10,0,HIGHLIGHT);\r
+       SETFONTCOLOR(0,TEXTCOLOR);\r
+       US_Print(string);\r
+       VW_UpdateScreen();\r
+}\r
+\r
+\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// THIS MAY BE FIXED A LITTLE LATER...\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+static int     lastmusic;\r
+\r
+void StartCPMusic(int song)\r
+{\r
+       musicnames      chunk;\r
+\r
+       if (audiosegs[STARTMUSIC + lastmusic])  // JDC\r
+               MM_FreePtr ((memptr *)&audiosegs[STARTMUSIC + lastmusic]);\r
+       lastmusic = song;\r
+\r
+       SD_MusicOff();\r
+       chunk = song;\r
+\r
+       MM_BombOnError (false);\r
+       CA_CacheAudioChunk(STARTMUSIC + chunk);\r
+       MM_BombOnError (true);\r
+       if (mmerror)\r
+               mmerror = false;\r
+       else\r
+       {\r
+               MM_SetLock(&((memptr)audiosegs[STARTMUSIC + chunk]),true);\r
+               SD_StartMusic((MusicGroup far *)audiosegs[STARTMUSIC + chunk]);\r
+       }\r
+}\r
+\r
+void FreeMusic (void)\r
+{\r
+       if (audiosegs[STARTMUSIC + lastmusic])  // JDC\r
+               MM_FreePtr ((memptr *)&audiosegs[STARTMUSIC + lastmusic]);\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_GetScanName() - Returns a string containing the name of the\r
+//             specified scan code\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+byte *\r
+IN_GetScanName(ScanCode scan)\r
+{\r
+       byte            **p;\r
+       ScanCode        far *s;\r
+\r
+       for (s = ExtScanCodes,p = ExtScanNames;*s;p++,s++)\r
+               if (*s == scan)\r
+                       return(*p);\r
+\r
+       return(ScanNames[scan]);\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+// CHECK FOR PAUSE KEY (FOR MUSIC ONLY)\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void CheckPause(void)\r
+{\r
+       if (Paused)\r
+       {\r
+               switch(SoundStatus)\r
+               {\r
+                       case 0: SD_MusicOn(); break;\r
+                       case 1: SD_MusicOff(); break;\r
+               }\r
+\r
+               SoundStatus^=1;\r
+               VW_WaitVBL(3);\r
+               IN_ClearKeysDown();\r
+               Paused=false;\r
+ }\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+// DRAW GUN CURSOR AT CORRECT POSITION IN MENU\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void DrawMenuGun(CP_iteminfo *iteminfo)\r
+{\r
+       int x,y;\r
+\r
+\r
+       x=iteminfo->x;\r
+       y=iteminfo->y+iteminfo->curpos*13-2;\r
+       VWB_DrawPic(x,y,C_CURSOR1PIC);\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+// DRAW SCREEN TITLE STRIPES\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void DrawStripes(int y)\r
+{\r
+#ifndef SPEAR\r
+       VWB_Bar(0,y,320,24,0);\r
+       VWB_Hlin(0,319,y+22,STRIPE);\r
+#else\r
+       VWB_Bar(0,y,320,22,0);\r
+       VWB_Hlin(0,319,y+23,0);\r
+#endif\r
+}\r
+\r
+void ShootSnd(void)\r
+{\r
+       SD_PlaySound(SHOOTSND);\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+// CHECK FOR EPISODES\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void CheckForEpisodes(void)\r
+{\r
+       struct ffblk f;\r
+\r
+//\r
+// JAPANESE VERSION\r
+//\r
+#ifdef JAPAN\r
+#ifdef JAPDEMO\r
+       if (!findfirst("*.WJ1",&f,FA_ARCH))\r
+       {\r
+               strcpy(extension,"WJ1");\r
+#else\r
+       if (!findfirst("*.WJ6",&f,FA_ARCH))\r
+       {\r
+               strcpy(extension,"WJ6");\r
+#endif\r
+               strcat(configname,extension);\r
+               strcat(SaveName,extension);\r
+               strcat(PageFileName,extension);\r
+               strcat(audioname,extension);\r
+               strcat(demoname,extension);\r
+               EpisodeSelect[1] =\r
+               EpisodeSelect[2] =\r
+               EpisodeSelect[3] =\r
+               EpisodeSelect[4] =\r
+               EpisodeSelect[5] = 1;\r
+       }\r
+       else\r
+               Quit("NO JAPANESE WOLFENSTEIN 3-D DATA FILES to be found!");\r
+#else\r
+\r
+//\r
+// ENGLISH\r
+//\r
+#ifndef UPLOAD\r
+#ifndef SPEAR\r
+       if (!findfirst("*.WL6",&f,FA_ARCH))\r
+       {\r
+               strcpy(extension,"WL6");\r
+               NewEmenu[2].active =\r
+               NewEmenu[4].active =\r
+               NewEmenu[6].active =\r
+               NewEmenu[8].active =\r
+               NewEmenu[10].active =\r
+               EpisodeSelect[1] =\r
+               EpisodeSelect[2] =\r
+               EpisodeSelect[3] =\r
+               EpisodeSelect[4] =\r
+               EpisodeSelect[5] = 1;\r
+       }\r
+       else\r
+       if (!findfirst("*.WL3",&f,FA_ARCH))\r
+       {\r
+               strcpy(extension,"WL3");\r
+               NewEmenu[2].active =\r
+               NewEmenu[4].active =\r
+               EpisodeSelect[1] =\r
+               EpisodeSelect[2] = 1;\r
+       }\r
+       else\r
+#endif\r
+#endif\r
+\r
+\r
+\r
+#ifdef SPEAR\r
+#ifndef SPEARDEMO\r
+       if (!findfirst("*.SOD",&f,FA_ARCH))\r
+       {\r
+               strcpy(extension,"SOD");\r
+       }\r
+       else\r
+               Quit("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");\r
+#else\r
+       if (!findfirst("*.SDM",&f,FA_ARCH))\r
+       {\r
+               strcpy(extension,"SDM");\r
+       }\r
+       else\r
+               Quit("NO SPEAR OF DESTINY DEMO DATA FILES TO BE FOUND!");\r
+#endif\r
+\r
+#else\r
+       if (!findfirst("*.WL1",&f,FA_ARCH))\r
+       {\r
+               strcpy(extension,"WL1");\r
+       }\r
+       else\r
+               Quit("NO WOLFENSTEIN 3-D DATA FILES to be found!");\r
+#endif\r
+\r
+       strcat(configname,extension);\r
+       strcat(SaveName,extension);\r
+       strcat(PageFileName,extension);\r
+       strcat(audioname,extension);\r
+       strcat(demoname,extension);\r
+#ifndef SPEAR\r
+#ifndef GOODTIMES\r
+       strcat(helpfilename,extension);\r
+#endif\r
+       strcat(endfilename,extension);\r
+#endif\r
+#endif\r
+}\r
diff --git a/16/wf3d8086/wl_menu.h b/16/wf3d8086/wl_menu.h
new file mode 100755 (executable)
index 0000000..dc03400
--- /dev/null
@@ -0,0 +1,234 @@
+//\r
+// WL_MENU.H\r
+//\r
+#ifdef SPEAR\r
+\r
+#define BORDCOLOR      0x99\r
+#define BORD2COLOR     0x93\r
+#define DEACTIVE       0x9b\r
+#define BKGDCOLOR      0x9d\r
+//#define STRIPE               0x9c\r
+\r
+#define MenuFadeOut()  VL_FadeOut(0,255,0,0,51,10)\r
+\r
+#else\r
+\r
+#define BORDCOLOR      0x29\r
+#define BORD2COLOR     0x23\r
+#define DEACTIVE       0x2b\r
+#define BKGDCOLOR      0x2d\r
+#define STRIPE         0x2c\r
+\r
+#define MenuFadeOut()  VL_FadeOut(0,255,43,0,0,10)\r
+\r
+#endif\r
+\r
+#define READCOLOR      0x4a\r
+#define READHCOLOR     0x47\r
+#define VIEWCOLOR      0x7f\r
+#define TEXTCOLOR      0x17\r
+#define HIGHLIGHT      0x13\r
+#define MenuFadeIn()   VL_FadeIn(0,255,&gamepal,10)\r
+\r
+\r
+#define MENUSONG       WONDERIN_MUS\r
+\r
+#ifndef SPEAR\r
+#define INTROSONG      NAZI_NOR_MUS\r
+#else\r
+#define INTROSONG      XTOWER2_MUS\r
+#endif\r
+\r
+#define SENSITIVE      60\r
+#define CENTER         SENSITIVE*2\r
+\r
+#define MENU_X 76\r
+#define MENU_Y 55\r
+#define MENU_W 178\r
+#ifndef SPEAR\r
+#define MENU_H 13*10+6\r
+#else\r
+#define MENU_H 13*9+6\r
+#endif\r
+\r
+#define SM_X   48\r
+#define SM_W   250\r
+\r
+#define SM_Y1  20\r
+#define SM_H1  4*13-7\r
+#define SM_Y2  SM_Y1+5*13\r
+#define SM_H2  4*13-7\r
+#define SM_Y3  SM_Y2+5*13\r
+#define SM_H3  3*13-7\r
+\r
+#define CTL_X  24\r
+#define CTL_Y  70\r
+#define CTL_W  284\r
+#define CTL_H  13*7-7\r
+\r
+#define LSM_X  85\r
+#define LSM_Y  55\r
+#define LSM_W  175\r
+#define LSM_H  10*13+10\r
+\r
+#define NM_X   50\r
+#define NM_Y   100\r
+#define NM_W   225\r
+#define NM_H   13*4+15\r
+\r
+#define NE_X   10\r
+#define NE_Y   23\r
+#define NE_W   320-NE_X*2\r
+#define NE_H   200-NE_Y*2\r
+\r
+#define CST_X          20\r
+#define CST_Y          48\r
+#define CST_START      60\r
+#define CST_SPC        60\r
+\r
+\r
+//\r
+// TYPEDEFS\r
+//\r
+typedef struct {\r
+               int x,y,amount,curpos,indent;\r
+               } CP_iteminfo;\r
+\r
+typedef struct {\r
+               int active;\r
+               char string[36];\r
+               void (* routine)(int temp1);\r
+               } CP_itemtype;\r
+\r
+typedef struct {\r
+               int allowed[4];\r
+               } CustomCtrls;\r
+\r
+extern CP_itemtype far MainMenu[],far NewEMenu[];\r
+extern CP_iteminfo MainItems;\r
+\r
+//\r
+// FUNCTION PROTOTYPES\r
+//\r
+void SetupControlPanel(void);\r
+void CleanupControlPanel(void);\r
+\r
+void DrawMenu(CP_iteminfo *item_i,CP_itemtype far *items);\r
+int  HandleMenu(CP_iteminfo *item_i,\r
+               CP_itemtype far *items,\r
+               void (*routine)(int w));\r
+void ClearMScreen(void);\r
+void DrawWindow(int x,int y,int w,int h,int wcolor);\r
+void DrawOutline(int x,int y,int w,int h,int color1,int color2);\r
+void WaitKeyUp(void);\r
+void ReadAnyControl(ControlInfo *ci);\r
+void TicDelay(int count);\r
+void CacheLump(int lumpstart,int lumpend);\r
+void UnCacheLump(int lumpstart,int lumpend);\r
+void StartCPMusic(int song);\r
+int  Confirm(char far *string);\r
+void Message(char far *string);\r
+void CheckPause(void);\r
+void ShootSnd(void);\r
+void CheckSecretMissions(void);\r
+void BossKey(void);\r
+\r
+void DrawGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int *y,int which,int basey,void (*routine)(int w));\r
+void DrawHalfStep(int x,int y);\r
+void EraseGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int y,int which);\r
+void SetTextColor(CP_itemtype far *items,int hlight);\r
+void DrawMenuGun(CP_iteminfo *iteminfo);\r
+void DrawStripes(int y);\r
+\r
+void DefineMouseBtns(void);\r
+void DefineJoyBtns(void);\r
+void DefineKeyBtns(void);\r
+void DefineKeyMove(void);\r
+void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*PrintRtn)(int),int type);\r
+\r
+void DrawMainMenu(void);\r
+void DrawSoundMenu(void);\r
+void DrawLoadSaveScreen(int loadsave);\r
+void DrawNewEpisode(void);\r
+void DrawNewGame(void);\r
+void DrawChangeView(int view);\r
+void DrawMouseSens(void);\r
+void DrawCtlScreen(void);\r
+void DrawCustomScreen(void);\r
+void DrawLSAction(int which);\r
+void DrawCustMouse(int hilight);\r
+void DrawCustJoy(int hilight);\r
+void DrawCustKeybd(int hilight);\r
+void DrawCustKeys(int hilight);\r
+void PrintCustMouse(int i);\r
+void PrintCustJoy(int i);\r
+void PrintCustKeybd(int i);\r
+void PrintCustKeys(int i);\r
+\r
+void PrintLSEntry(int w,int color);\r
+void TrackWhichGame(int w);\r
+void DrawNewGameDiff(int w);\r
+void FixupCustom(int w);\r
+\r
+void CP_NewGame(void);\r
+void CP_Sound(void);\r
+int  CP_LoadGame(int quick);\r
+int  CP_SaveGame(int quick);\r
+void CP_Control(void);\r
+void CP_ChangeView(void);\r
+void CP_ExitOptions(void);\r
+void CP_Quit(void);\r
+void CP_ViewScores(void);\r
+int  CP_EndGame(void);\r
+int  CP_CheckQuick(unsigned scancode);\r
+void CustomControls(void);\r
+void MouseSensitivity(void);\r
+\r
+void CheckForEpisodes(void);\r
+\r
+//\r
+// VARIABLES\r
+//\r
+extern int SaveGamesAvail[10],StartGame,SoundStatus;\r
+extern char SaveGameNames[10][32],SaveName[13];\r
+\r
+enum {MOUSE,JOYSTICK,KEYBOARDBTNS,KEYBOARDMOVE};       // FOR INPUT TYPES\r
+\r
+#ifndef USO_FIX1\r
+extern\r
+#endif\r
+enum\r
+{\r
+       newgame,\r
+       soundmenu,\r
+       control,\r
+       loadgame,\r
+       savegame,\r
+       changeview,\r
+\r
+#ifndef GOODTIMES\r
+#ifndef SPEAR\r
+       readthis,\r
+#endif\r
+#endif\r
+\r
+       viewscores,\r
+       backtodemo,\r
+       quit\r
+} menuitems;\r
+\r
+//\r
+// WL_INTER\r
+//\r
+typedef struct {\r
+               int kill,secret,treasure;\r
+               long time;\r
+               } LRstruct;\r
+\r
+extern LRstruct LevelRatios[];\r
+\r
+void Write (int x,int y,char *string);\r
+void NonShareware(void);\r
+int GetYorN(int x,int y,int pic);\r
+\r
+\r
diff --git a/16/wf3d8086/wl_play.c b/16/wf3d8086/wl_play.c
new file mode 100755 (executable)
index 0000000..447c893
--- /dev/null
@@ -0,0 +1,1473 @@
+// WL_PLAY.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define sc_Question    0x35\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+boolean                madenoise;                                      // true when shooting or screaming\r
+\r
+exit_t         playstate;\r
+\r
+int                    DebugOk;\r
+\r
+objtype        objlist[MAXACTORS],*new,*obj,*player,*lastobj,\r
+                       *objfreelist,*killerobj;\r
+\r
+unsigned       farmapylookup[MAPSIZE];\r
+byte           *nearmapylookup[MAPSIZE];\r
+\r
+boolean                singlestep,godmode,noclip;\r
+int                    extravbls;\r
+\r
+byte           tilemap[MAPSIZE][MAPSIZE];      // wall values only\r
+byte           spotvis[MAPSIZE][MAPSIZE];\r
+objtype                *actorat[MAPSIZE][MAPSIZE];\r
+\r
+//\r
+// replacing refresh manager\r
+//\r
+unsigned       mapwidth,mapheight,tics;\r
+boolean                compatability;\r
+byte           *updateptr;\r
+unsigned       mapwidthtable[64];\r
+unsigned       uwidthtable[UPDATEHIGH];\r
+unsigned       blockstarts[UPDATEWIDE*UPDATEHIGH];\r
+//uso: replace: byte            update[UPDATESIZE];\r
+//uso: is needed? byte    update[UPDATEHIGH][UPDATEWIDE];\r
+\r
+//\r
+// control info\r
+//\r
+boolean                mouseenabled,joystickenabled,joypadenabled,joystickprogressive;\r
+int                    joystickport;\r
+int                    dirscan[4] = {sc_UpArrow,sc_RightArrow,sc_DownArrow,sc_LeftArrow};\r
+int                    buttonscan[NUMBUTTONS] =\r
+                       {sc_Control,sc_Alt,sc_RShift,sc_Space,sc_1,sc_2,sc_3,sc_4};\r
+int                    buttonmouse[4]={bt_attack,bt_strafe,bt_use,bt_nobutton};\r
+int                    buttonjoy[4]={bt_attack,bt_strafe,bt_use,bt_run};\r
+\r
+int                    viewsize;\r
+\r
+boolean                buttonheld[NUMBUTTONS];\r
+\r
+boolean                demorecord,demoplayback;\r
+char           far *demoptr, far *lastdemoptr;\r
+memptr         demobuffer;\r
+\r
+//\r
+// curent user input\r
+//\r
+int                    controlx,controly;              // range from -100 to 100 per tic\r
+boolean                buttonstate[NUMBUTTONS];\r
+\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+void   CenterWindow(word w,word h);\r
+void   InitObjList (void);\r
+void   RemoveObj (objtype *gone);\r
+void   PollControls (void);\r
+void   StopMusic(void);\r
+void   StartMusic(void);\r
+void   PlayLoop (void);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+objtype dummyobj;\r
+\r
+//\r
+// LIST OF SONGS FOR EACH VERSION\r
+//\r
+int songs[]=\r
+{\r
+#ifndef SPEAR\r
+ //\r
+ // Episode One\r
+ //\r
+ GETTHEM_MUS,\r
+ SEARCHN_MUS,\r
+ POW_MUS,\r
+ SUSPENSE_MUS,\r
+ GETTHEM_MUS,\r
+ SEARCHN_MUS,\r
+ POW_MUS,\r
+ SUSPENSE_MUS,\r
+\r
+ WARMARCH_MUS, // Boss level\r
+ CORNER_MUS,   // Secret level\r
+\r
+ //\r
+ // Episode Two\r
+ //\r
+ NAZI_OMI_MUS,\r
+ PREGNANT_MUS,\r
+ GOINGAFT_MUS,\r
+ HEADACHE_MUS,\r
+ NAZI_OMI_MUS,\r
+ PREGNANT_MUS,\r
+ HEADACHE_MUS,\r
+ GOINGAFT_MUS,\r
+\r
+ WARMARCH_MUS, // Boss level\r
+ DUNGEON_MUS,  // Secret level\r
+\r
+ //\r
+ // Episode Three\r
+ //\r
+ INTROCW3_MUS,\r
+ NAZI_RAP_MUS,\r
+ TWELFTH_MUS,\r
+ ZEROHOUR_MUS,\r
+ INTROCW3_MUS,\r
+ NAZI_RAP_MUS,\r
+ TWELFTH_MUS,\r
+ ZEROHOUR_MUS,\r
+\r
+ ULTIMATE_MUS, // Boss level\r
+ PACMAN_MUS,   // Secret level\r
+\r
+ //\r
+ // Episode Four\r
+ //\r
+ GETTHEM_MUS,\r
+ SEARCHN_MUS,\r
+ POW_MUS,\r
+ SUSPENSE_MUS,\r
+ GETTHEM_MUS,\r
+ SEARCHN_MUS,\r
+ POW_MUS,\r
+ SUSPENSE_MUS,\r
+\r
+ WARMARCH_MUS, // Boss level\r
+ CORNER_MUS,   // Secret level\r
+\r
+ //\r
+ // Episode Five\r
+ //\r
+ NAZI_OMI_MUS,\r
+ PREGNANT_MUS,\r
+ GOINGAFT_MUS,\r
+ HEADACHE_MUS,\r
+ NAZI_OMI_MUS,\r
+ PREGNANT_MUS,\r
+ HEADACHE_MUS,\r
+ GOINGAFT_MUS,\r
+\r
+ WARMARCH_MUS, // Boss level\r
+ DUNGEON_MUS,  // Secret level\r
+\r
+ //\r
+ // Episode Six\r
+ //\r
+ INTROCW3_MUS,\r
+ NAZI_RAP_MUS,\r
+ TWELFTH_MUS,\r
+ ZEROHOUR_MUS,\r
+ INTROCW3_MUS,\r
+ NAZI_RAP_MUS,\r
+ TWELFTH_MUS,\r
+ ZEROHOUR_MUS,\r
+\r
+ ULTIMATE_MUS, // Boss level\r
+ FUNKYOU_MUS           // Secret level\r
+#else\r
+\r
+ //////////////////////////////////////////////////////////////\r
+ //\r
+ // SPEAR OF DESTINY TRACKS\r
+ //\r
+ //////////////////////////////////////////////////////////////\r
+ XTIPTOE_MUS,\r
+ XFUNKIE_MUS,\r
+ XDEATH_MUS,\r
+ XGETYOU_MUS,          // DON'T KNOW\r
+ ULTIMATE_MUS, // Trans Gr\94sse\r
+\r
+ DUNGEON_MUS,\r
+ GOINGAFT_MUS,\r
+ POW_MUS,\r
+ TWELFTH_MUS,\r
+ ULTIMATE_MUS, // Barnacle Wilhelm BOSS\r
+\r
+ NAZI_OMI_MUS,\r
+ GETTHEM_MUS,\r
+ SUSPENSE_MUS,\r
+ SEARCHN_MUS,\r
+ ZEROHOUR_MUS,\r
+ ULTIMATE_MUS, // Super Mutant BOSS\r
+\r
+ XPUTIT_MUS,\r
+ ULTIMATE_MUS, // Death Knight BOSS\r
+\r
+ XJAZNAZI_MUS, // Secret level\r
+ XFUNKIE_MUS,  // Secret level (DON'T KNOW)\r
+\r
+ XEVIL_MUS             // Angel of Death BOSS\r
+\r
+#endif\r
+};\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                 USER CONTROL\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+#define BASEMOVE               35\r
+#define RUNMOVE                        70\r
+#define BASETURN               35\r
+#define RUNTURN                        70\r
+\r
+#define JOYSCALE               2\r
+\r
+/*\r
+===================\r
+=\r
+= PollKeyboardButtons\r
+=\r
+===================\r
+*/\r
+\r
+void PollKeyboardButtons (void)\r
+{\r
+       int             i;\r
+\r
+       for (i=0;i<NUMBUTTONS;i++)\r
+               if (Keyboard[buttonscan[i]])\r
+                       buttonstate[i] = true;\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= PollMouseButtons\r
+=\r
+===================\r
+*/\r
+\r
+void PollMouseButtons (void)\r
+{\r
+       int     buttons;\r
+\r
+       buttons = IN_MouseButtons ();\r
+\r
+       if (buttons&1)\r
+               buttonstate[buttonmouse[0]] = true;\r
+       if (buttons&2)\r
+               buttonstate[buttonmouse[1]] = true;\r
+       if (buttons&4)\r
+               buttonstate[buttonmouse[2]] = true;\r
+}\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= PollJoystickButtons\r
+=\r
+===================\r
+*/\r
+\r
+void PollJoystickButtons (void)\r
+{\r
+       int     buttons;\r
+\r
+       buttons = IN_JoyButtons ();\r
+\r
+       if (joystickport && !joypadenabled)\r
+       {\r
+               if (buttons&4)\r
+                       buttonstate[buttonjoy[0]] = true;\r
+               if (buttons&8)\r
+                       buttonstate[buttonjoy[1]] = true;\r
+       }\r
+       else\r
+       {\r
+               if (buttons&1)\r
+                       buttonstate[buttonjoy[0]] = true;\r
+               if (buttons&2)\r
+                       buttonstate[buttonjoy[1]] = true;\r
+               if (joypadenabled)\r
+               {\r
+                       if (buttons&4)\r
+                               buttonstate[buttonjoy[2]] = true;\r
+                       if (buttons&8)\r
+                               buttonstate[buttonjoy[3]] = true;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= PollKeyboardMove\r
+=\r
+===================\r
+*/\r
+\r
+void PollKeyboardMove (void)\r
+{\r
+       if (buttonstate[bt_run])\r
+       {\r
+               if (Keyboard[dirscan[di_north]])\r
+                       controly -= RUNMOVE*tics;\r
+               if (Keyboard[dirscan[di_south]])\r
+                       controly += RUNMOVE*tics;\r
+               if (Keyboard[dirscan[di_west]])\r
+                       controlx -= RUNMOVE*tics;\r
+               if (Keyboard[dirscan[di_east]])\r
+                       controlx += RUNMOVE*tics;\r
+       }\r
+       else\r
+       {\r
+               if (Keyboard[dirscan[di_north]])\r
+                       controly -= BASEMOVE*tics;\r
+               if (Keyboard[dirscan[di_south]])\r
+                       controly += BASEMOVE*tics;\r
+               if (Keyboard[dirscan[di_west]])\r
+                       controlx -= BASEMOVE*tics;\r
+               if (Keyboard[dirscan[di_east]])\r
+                       controlx += BASEMOVE*tics;\r
+       }\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= PollMouseMove\r
+=\r
+===================\r
+*/\r
+\r
+void PollMouseMove (void)\r
+{\r
+       int     mousexmove,mouseymove;\r
+\r
+       Mouse(MDelta);\r
+       mousexmove = _CX;\r
+       mouseymove = _DX;\r
+\r
+       controlx += mousexmove*10/(13-mouseadjustment);\r
+       controly += mouseymove*20/(13-mouseadjustment);\r
+}\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= PollJoystickMove\r
+=\r
+===================\r
+*/\r
+\r
+void PollJoystickMove (void)\r
+{\r
+       int     joyx,joyy;\r
+\r
+       INL_GetJoyDelta(joystickport,&joyx,&joyy);\r
+\r
+       if (joystickprogressive)\r
+       {\r
+               if (joyx > 64)\r
+                       controlx += (joyx-64)*JOYSCALE*tics;\r
+               else if (joyx < -64)\r
+                       controlx -= (-joyx-64)*JOYSCALE*tics;\r
+               if (joyy > 64)\r
+                       controlx += (joyy-64)*JOYSCALE*tics;\r
+               else if (joyy < -64)\r
+                       controly -= (-joyy-64)*JOYSCALE*tics;\r
+       }\r
+       else if (buttonstate[bt_run])\r
+       {\r
+               if (joyx > 64)\r
+                       controlx += RUNMOVE*tics;\r
+               else if (joyx < -64)\r
+                       controlx -= RUNMOVE*tics;\r
+               if (joyy > 64)\r
+                       controly += RUNMOVE*tics;\r
+               else if (joyy < -64)\r
+                       controly -= RUNMOVE*tics;\r
+       }\r
+       else\r
+       {\r
+               if (joyx > 64)\r
+                       controlx += BASEMOVE*tics;\r
+               else if (joyx < -64)\r
+                       controlx -= BASEMOVE*tics;\r
+               if (joyy > 64)\r
+                       controly += BASEMOVE*tics;\r
+               else if (joyy < -64)\r
+                       controly -= BASEMOVE*tics;\r
+       }\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= PollControls\r
+=\r
+= Gets user or demo input, call once each frame\r
+=\r
+= controlx             set between -100 and 100 per tic\r
+= controly\r
+= buttonheld[] the state of the buttons LAST frame\r
+= buttonstate[]        the state of the buttons THIS frame\r
+=\r
+===================\r
+*/\r
+\r
+void PollControls (void)\r
+{\r
+       int             max,min,i;\r
+       byte    buttonbits;\r
+\r
+//\r
+// get timing info for last frame\r
+//\r
+       if (demoplayback)\r
+       {\r
+               while (TimeCount<lasttimecount+DEMOTICS)\r
+               ;\r
+               TimeCount = lasttimecount + DEMOTICS;\r
+               lasttimecount += DEMOTICS;\r
+               tics = DEMOTICS;\r
+       }\r
+       else if (demorecord)                    // demo recording and playback needs\r
+       {                                                               // to be constant\r
+//\r
+// take DEMOTICS or more tics, and modify Timecount to reflect time taken\r
+//\r
+               while (TimeCount<lasttimecount+DEMOTICS)\r
+               ;\r
+               TimeCount = lasttimecount + DEMOTICS;\r
+               lasttimecount += DEMOTICS;\r
+               tics = DEMOTICS;\r
+       }\r
+       else\r
+               CalcTics ();\r
+\r
+       controlx = 0;\r
+       controly = 0;\r
+       memcpy (buttonheld,buttonstate,sizeof(buttonstate));\r
+       memset (buttonstate,0,sizeof(buttonstate));\r
+\r
+       if (demoplayback)\r
+       {\r
+       //\r
+       // read commands from demo buffer\r
+       //\r
+               buttonbits = *demoptr++;\r
+               for (i=0;i<NUMBUTTONS;i++)\r
+               {\r
+                       buttonstate[i] = buttonbits&1;\r
+                       buttonbits >>= 1;\r
+               }\r
+\r
+               controlx = *demoptr++;\r
+               controly = *demoptr++;\r
+\r
+               if (demoptr == lastdemoptr)\r
+                       playstate = ex_completed;               // demo is done\r
+\r
+               controlx *= (int)tics;\r
+               controly *= (int)tics;\r
+\r
+               return;\r
+       }\r
+\r
+\r
+//\r
+// get button states\r
+//\r
+       PollKeyboardButtons ();\r
+\r
+       if (mouseenabled)\r
+               PollMouseButtons ();\r
+\r
+       if (joystickenabled)\r
+               PollJoystickButtons ();\r
+\r
+//\r
+// get movements\r
+//\r
+       PollKeyboardMove ();\r
+\r
+       if (mouseenabled)\r
+               PollMouseMove ();\r
+\r
+       if (joystickenabled)\r
+               PollJoystickMove ();\r
+\r
+//\r
+// bound movement to a maximum\r
+//\r
+       max = 100*tics;\r
+       min = -max;\r
+       if (controlx > max)\r
+               controlx = max;\r
+       else if (controlx < min)\r
+               controlx = min;\r
+\r
+       if (controly > max)\r
+               controly = max;\r
+       else if (controly < min)\r
+               controly = min;\r
+\r
+       if (demorecord)\r
+       {\r
+       //\r
+       // save info out to demo buffer\r
+       //\r
+               controlx /= (int)tics;\r
+               controly /= (int)tics;\r
+\r
+               buttonbits = 0;\r
+\r
+               for (i=NUMBUTTONS-1;i>=0;i--)\r
+               {\r
+                       buttonbits <<= 1;\r
+                       if (buttonstate[i])\r
+                               buttonbits |= 1;\r
+               }\r
+\r
+               *demoptr++ = buttonbits;\r
+               *demoptr++ = controlx;\r
+               *demoptr++ = controly;\r
+\r
+               if (demoptr >= lastdemoptr)\r
+                       Quit ("Demo buffer overflowed!");\r
+\r
+               controlx *= (int)tics;\r
+               controly *= (int)tics;\r
+       }\r
+}\r
+\r
+\r
+\r
+//==========================================================================\r
+\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     CenterWindow() - Generates a window of a given width & height in the\r
+//             middle of the screen\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+\r
+#define MAXX   320\r
+#define MAXY   160\r
+\r
+void   CenterWindow(word w,word h)\r
+{\r
+       FixOfs ();\r
+       US_DrawWindow(((MAXX / 8) - w) / 2,((MAXY / 8) - h) / 2,w,h);\r
+}\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= CheckKeys\r
+=\r
+=====================\r
+*/\r
+\r
+void CheckKeys (void)\r
+{\r
+       int             i;\r
+       byte    scan;\r
+       unsigned        temp;\r
+\r
+\r
+       if (screenfaded || demoplayback)        // don't do anything with a faded screen\r
+               return;\r
+\r
+       scan = LastScan;\r
+\r
+\r
+       #ifdef SPEAR\r
+       //\r
+       // SECRET CHEAT CODE: TAB-G-F10\r
+       //\r
+       if (Keyboard[sc_Tab] &&\r
+               Keyboard[sc_G] &&\r
+               Keyboard[sc_F10])\r
+       {\r
+               WindowH = 160;\r
+               if (godmode)\r
+               {\r
+                       Message ("God mode OFF");\r
+                       SD_PlaySound (NOBONUSSND);\r
+               }\r
+               else\r
+               {\r
+                       Message ("God mode ON");\r
+                       SD_PlaySound (ENDBONUS2SND);\r
+               }\r
+\r
+               IN_Ack();\r
+               godmode ^= 1;\r
+               DrawAllPlayBorderSides ();\r
+               IN_ClearKeysDown();\r
+               return;\r
+       }\r
+       #endif\r
+\r
+\r
+       //\r
+       // SECRET CHEAT CODE: 'MLI'\r
+       //\r
+       if (Keyboard[sc_M] &&\r
+               Keyboard[sc_L] &&\r
+               Keyboard[sc_I])\r
+       {\r
+               gamestate.health = 100;\r
+               gamestate.ammo = 99;\r
+               gamestate.keys = 3;\r
+               gamestate.score = 0;\r
+               gamestate.TimeCount += 42000L;\r
+               GiveWeapon (wp_chaingun);\r
+\r
+               DrawWeapon();\r
+               DrawHealth();\r
+               DrawKeys();\r
+               DrawAmmo();\r
+               DrawScore();\r
+\r
+               ClearMemory ();\r
+               CA_CacheGrChunk (STARTFONT+1);\r
+               ClearSplitVWB ();\r
+               VW_ScreenToScreen (displayofs,bufferofs,80,160);\r
+\r
+               Message(STR_CHEATER1"\n"\r
+                               STR_CHEATER2"\n\n"\r
+                               STR_CHEATER3"\n"\r
+                               STR_CHEATER4"\n"\r
+                               STR_CHEATER5);\r
+\r
+               UNCACHEGRCHUNK(STARTFONT+1);\r
+               PM_CheckMainMem ();\r
+               IN_ClearKeysDown();\r
+               IN_Ack();\r
+\r
+               DrawAllPlayBorder ();\r
+       }\r
+\r
+       //\r
+       // OPEN UP DEBUG KEYS\r
+       //\r
+#ifndef SPEAR\r
+       if (Keyboard[sc_BackSpace] &&\r
+               Keyboard[sc_LShift] &&\r
+               Keyboard[sc_Alt] &&\r
+               MS_CheckParm("goobers"))\r
+#else\r
+       if (Keyboard[sc_BackSpace] &&\r
+               Keyboard[sc_LShift] &&\r
+               Keyboard[sc_Alt] &&\r
+               MS_CheckParm("debugmode"))\r
+#endif\r
+       {\r
+        ClearMemory ();\r
+        CA_CacheGrChunk (STARTFONT+1);\r
+        ClearSplitVWB ();\r
+        VW_ScreenToScreen (displayofs,bufferofs,80,160);\r
+\r
+        Message("Debugging keys are\nnow available!");\r
+        UNCACHEGRCHUNK(STARTFONT+1);\r
+        PM_CheckMainMem ();\r
+        IN_ClearKeysDown();\r
+        IN_Ack();\r
+\r
+        DrawAllPlayBorderSides ();\r
+        DebugOk=1;\r
+       }\r
+\r
+       //\r
+       // TRYING THE KEEN CHEAT CODE!\r
+       //\r
+       if (Keyboard[sc_B] &&\r
+               Keyboard[sc_A] &&\r
+               Keyboard[sc_T])\r
+       {\r
+        ClearMemory ();\r
+        CA_CacheGrChunk (STARTFONT+1);\r
+        ClearSplitVWB ();\r
+        VW_ScreenToScreen (displayofs,bufferofs,80,160);\r
+\r
+        Message("Commander Keen is also\n"\r
+                        "available from Apogee, but\n"\r
+                        "then, you already know\n"\r
+                        "that - right, Cheatmeister?!");\r
+\r
+        UNCACHEGRCHUNK(STARTFONT+1);\r
+        PM_CheckMainMem ();\r
+        IN_ClearKeysDown();\r
+        IN_Ack();\r
+\r
+        DrawAllPlayBorder ();\r
+       }\r
+\r
+//\r
+// pause key weirdness can't be checked as a scan code\r
+//\r
+       if (Paused)\r
+       {\r
+               bufferofs = displayofs;\r
+               LatchDrawPic (20-4,80-2*8,PAUSEDPIC);\r
+               SD_MusicOff();\r
+               IN_Ack();\r
+               IN_ClearKeysDown ();\r
+               SD_MusicOn();\r
+               Paused = false;\r
+               if (MousePresent)\r
+                       Mouse(MDelta);  // Clear accumulated mouse movement\r
+               return;\r
+       }\r
+\r
+\r
+//\r
+// F1-F7/ESC to enter control panel\r
+//\r
+       if (\r
+#ifndef DEBCHECK\r
+               scan == sc_F10 ||\r
+#endif\r
+               scan == sc_F9 ||\r
+               scan == sc_F7 ||\r
+               scan == sc_F8)                  // pop up quit dialog\r
+       {\r
+               ClearMemory ();\r
+               ClearSplitVWB ();\r
+               VW_ScreenToScreen (displayofs,bufferofs,80,160);\r
+               US_ControlPanel(scan);\r
+\r
+                DrawAllPlayBorderSides ();\r
+\r
+               if (scan == sc_F9)\r
+                 StartMusic ();\r
+\r
+               PM_CheckMainMem ();\r
+               SETFONTCOLOR(0,15);\r
+               IN_ClearKeysDown();\r
+               return;\r
+       }\r
+\r
+       if ( (scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape)\r
+       {\r
+               StopMusic ();\r
+               ClearMemory ();\r
+               VW_FadeOut ();\r
+\r
+               US_ControlPanel(scan);\r
+\r
+               SETFONTCOLOR(0,15);\r
+               IN_ClearKeysDown();\r
+               DrawPlayScreen ();\r
+               if (!startgame && !loadedgame)\r
+               {\r
+                       VW_FadeIn ();\r
+                       StartMusic ();\r
+               }\r
+               if (loadedgame)\r
+                       playstate = ex_abort;\r
+               lasttimecount = TimeCount;\r
+               if (MousePresent)\r
+                       Mouse(MDelta);  // Clear accumulated mouse movement\r
+               PM_CheckMainMem ();\r
+               return;\r
+       }\r
+\r
+//\r
+// TAB-? debug keys\r
+//\r
+       if (Keyboard[sc_Tab] && DebugOk)\r
+       {\r
+               CA_CacheGrChunk (STARTFONT);\r
+               fontnumber=0;\r
+               SETFONTCOLOR(0,15);\r
+               DebugKeys();\r
+               if (MousePresent)\r
+                       Mouse(MDelta);  // Clear accumulated mouse movement\r
+               lasttimecount = TimeCount;\r
+               return;\r
+       }\r
+\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+/*\r
+#############################################################################\r
+\r
+                                 The objlist data structure\r
+\r
+#############################################################################\r
+\r
+objlist containt structures for every actor currently playing.  The structure\r
+is accessed as a linked list starting at *player, ending when ob->next ==\r
+NULL.  GetNewObj inserts a new object at the end of the list, meaning that\r
+if an actor spawn another actor, the new one WILL get to think and react the\r
+same frame.  RemoveObj unlinks the given object and returns it to the free\r
+list, but does not damage the objects ->next pointer, so if the current object\r
+removes itself, a linked list following loop can still safely get to the\r
+next element.\r
+\r
+<backwardly linked free list>\r
+\r
+#############################################################################\r
+*/\r
+\r
+\r
+/*\r
+=========================\r
+=\r
+= InitActorList\r
+=\r
+= Call to clear out the actor object lists returning them all to the free\r
+= list.  Allocates a special spot for the player.\r
+=\r
+=========================\r
+*/\r
+\r
+int    objcount;\r
+\r
+void InitActorList (void)\r
+{\r
+       int     i;\r
+\r
+//\r
+// init the actor lists\r
+//\r
+       for (i=0;i<MAXACTORS;i++)\r
+       {\r
+               objlist[i].prev = &objlist[i+1];\r
+               objlist[i].next = NULL;\r
+       }\r
+\r
+       objlist[MAXACTORS-1].prev = NULL;\r
+\r
+       objfreelist = &objlist[0];\r
+       lastobj = NULL;\r
+\r
+       objcount = 0;\r
+\r
+//\r
+// give the player the first free spots\r
+//\r
+       GetNewActor ();\r
+       player = new;\r
+\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=========================\r
+=\r
+= GetNewActor\r
+=\r
+= Sets the global variable new to point to a free spot in objlist.\r
+= The free spot is inserted at the end of the liked list\r
+=\r
+= When the object list is full, the caller can either have it bomb out ot\r
+= return a dummy object pointer that will never get used\r
+=\r
+=========================\r
+*/\r
+\r
+void GetNewActor (void)\r
+{\r
+       if (!objfreelist)\r
+               Quit ("GetNewActor: No free spots in objlist!");\r
+\r
+       new = objfreelist;\r
+       objfreelist = new->prev;\r
+       memset (new,0,sizeof(*new));\r
+\r
+       if (lastobj)\r
+               lastobj->next = new;\r
+       new->prev = lastobj;    // new->next is allready NULL from memset\r
+\r
+       new->active = false;\r
+       lastobj = new;\r
+\r
+       objcount++;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=========================\r
+=\r
+= RemoveObj\r
+=\r
+= Add the given object back into the free list, and unlink it from it's\r
+= neighbors\r
+=\r
+=========================\r
+*/\r
+\r
+void RemoveObj (objtype *gone)\r
+{\r
+       objtype **spotat;\r
+\r
+       if (gone == player)\r
+               Quit ("RemoveObj: Tried to remove the player!");\r
+\r
+       gone->state = NULL;\r
+\r
+//\r
+// fix the next object's back link\r
+//\r
+       if (gone == lastobj)\r
+               lastobj = (objtype *)gone->prev;\r
+       else\r
+               gone->next->prev = gone->prev;\r
+\r
+//\r
+// fix the previous object's forward link\r
+//\r
+       gone->prev->next = gone->next;\r
+\r
+//\r
+// add it back in to the free list\r
+//\r
+       gone->prev = objfreelist;\r
+       objfreelist = gone;\r
+\r
+       objcount--;\r
+}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               MUSIC STUFF\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= StopMusic\r
+=\r
+=================\r
+*/\r
+\r
+void StopMusic(void)\r
+{\r
+       int     i;\r
+\r
+       SD_MusicOff();\r
+       for (i = 0;i < LASTMUSIC;i++)\r
+               if (audiosegs[STARTMUSIC + i])\r
+               {\r
+                       MM_SetPurge(&((memptr)audiosegs[STARTMUSIC + i]),3);\r
+                       MM_SetLock(&((memptr)audiosegs[STARTMUSIC + i]),false);\r
+               }\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= StartMusic\r
+=\r
+=================\r
+*/\r
+\r
+void StartMusic(void)\r
+{\r
+       musicnames      chunk;\r
+\r
+       SD_MusicOff();\r
+       chunk = songs[gamestate.mapon+gamestate.episode*10];\r
+\r
+//     if ((chunk == -1) || (MusicMode != smm_AdLib))\r
+//DEBUG control panel          return;\r
+\r
+       MM_BombOnError (false);\r
+       CA_CacheAudioChunk(STARTMUSIC + chunk);\r
+       MM_BombOnError (true);\r
+       if (mmerror)\r
+               mmerror = false;\r
+       else\r
+       {\r
+               MM_SetLock(&((memptr)audiosegs[STARTMUSIC + chunk]),true);\r
+               SD_StartMusic((MusicGroup far *)audiosegs[STARTMUSIC + chunk]);\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       PALETTE SHIFTING STUFF\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define NUMREDSHIFTS   6\r
+#define REDSTEPS               8\r
+\r
+#define NUMWHITESHIFTS 3\r
+#define WHITESTEPS             20\r
+#define WHITETICS              6\r
+\r
+\r
+byte   far redshifts[NUMREDSHIFTS][768];\r
+byte   far whiteshifts[NUMREDSHIFTS][768];\r
+\r
+int            damagecount,bonuscount;\r
+boolean        palshifted;\r
+\r
+extern         byte    far     gamepal;\r
+\r
+/*\r
+=====================\r
+=\r
+= InitRedShifts\r
+=\r
+=====================\r
+*/\r
+\r
+void InitRedShifts (void)\r
+{\r
+       byte    far *workptr, far *baseptr;\r
+       int             i,j,delta;\r
+\r
+\r
+//\r
+// fade through intermediate frames\r
+//\r
+       for (i=1;i<=NUMREDSHIFTS;i++)\r
+       {\r
+               workptr = (byte far *)&redshifts[i-1][0];\r
+               baseptr = &gamepal;\r
+\r
+               for (j=0;j<=255;j++)\r
+               {\r
+                       delta = 64-*baseptr;\r
+                       *workptr++ = *baseptr++ + delta * i / REDSTEPS;\r
+                       delta = -*baseptr;\r
+                       *workptr++ = *baseptr++ + delta * i / REDSTEPS;\r
+                       delta = -*baseptr;\r
+                       *workptr++ = *baseptr++ + delta * i / REDSTEPS;\r
+               }\r
+       }\r
+\r
+       for (i=1;i<=NUMWHITESHIFTS;i++)\r
+       {\r
+               workptr = (byte far *)&whiteshifts[i-1][0];\r
+               baseptr = &gamepal;\r
+\r
+               for (j=0;j<=255;j++)\r
+               {\r
+                       delta = 64-*baseptr;\r
+                       *workptr++ = *baseptr++ + delta * i / WHITESTEPS;\r
+                       delta = 62-*baseptr;\r
+                       *workptr++ = *baseptr++ + delta * i / WHITESTEPS;\r
+                       delta = 0-*baseptr;\r
+                       *workptr++ = *baseptr++ + delta * i / WHITESTEPS;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= ClearPaletteShifts\r
+=\r
+=====================\r
+*/\r
+\r
+void ClearPaletteShifts (void)\r
+{\r
+       bonuscount = damagecount = 0;\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= StartBonusFlash\r
+=\r
+=====================\r
+*/\r
+\r
+void StartBonusFlash (void)\r
+{\r
+       bonuscount = NUMWHITESHIFTS*WHITETICS;          // white shift palette\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= StartDamageFlash\r
+=\r
+=====================\r
+*/\r
+\r
+void StartDamageFlash (int damage)\r
+{\r
+       damagecount += damage;\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= UpdatePaletteShifts\r
+=\r
+=====================\r
+*/\r
+\r
+void UpdatePaletteShifts (void)\r
+{\r
+       int     red,white;\r
+\r
+       if (bonuscount)\r
+       {\r
+               white = bonuscount/WHITETICS +1;\r
+               if (white>NUMWHITESHIFTS)\r
+                       white = NUMWHITESHIFTS;\r
+               bonuscount -= tics;\r
+               if (bonuscount < 0)\r
+                       bonuscount = 0;\r
+       }\r
+       else\r
+               white = 0;\r
+\r
+\r
+       if (damagecount)\r
+       {\r
+               red = damagecount/10 +1;\r
+               if (red>NUMREDSHIFTS)\r
+                       red = NUMREDSHIFTS;\r
+\r
+               damagecount -= tics;\r
+               if (damagecount < 0)\r
+                       damagecount = 0;\r
+       }\r
+       else\r
+               red = 0;\r
+\r
+       if (red)\r
+       {\r
+               VW_WaitVBL(1);\r
+               VL_SetPalette (redshifts[red-1]);\r
+               palshifted = true;\r
+       }\r
+       else if (white)\r
+       {\r
+               VW_WaitVBL(1);\r
+               VL_SetPalette (whiteshifts[white-1]);\r
+               palshifted = true;\r
+       }\r
+       else if (palshifted)\r
+       {\r
+               VW_WaitVBL(1);\r
+               VL_SetPalette (&gamepal);               // back to normal\r
+               palshifted = false;\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= FinishPaletteShifts\r
+=\r
+= Resets palette to normal if needed\r
+=\r
+=====================\r
+*/\r
+\r
+void FinishPaletteShifts (void)\r
+{\r
+       if (palshifted)\r
+       {\r
+               palshifted = 0;\r
+               VW_WaitVBL(1);\r
+               VL_SetPalette (&gamepal);\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               CORE PLAYLOOP\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= DoActor\r
+=\r
+=====================\r
+*/\r
+\r
+void DoActor (objtype *ob)\r
+{\r
+       void (*think)(objtype *);\r
+\r
+       if (!ob->active && !areabyplayer[ob->areanumber])\r
+               return;\r
+\r
+       if (!(ob->flags&(FL_NONMARK|FL_NEVERMARK)) )\r
+               actorat[ob->tilex][ob->tiley] = NULL;\r
+\r
+//\r
+// non transitional object\r
+//\r
+\r
+       if (!ob->ticcount)\r
+       {\r
+               think = ob->state->think;\r
+               if (think)\r
+               {\r
+                       think (ob);\r
+                       if (!ob->state)\r
+                       {\r
+                               RemoveObj (ob);\r
+                               return;\r
+                       }\r
+               }\r
+\r
+               if (ob->flags&FL_NEVERMARK)\r
+                       return;\r
+\r
+               if ( (ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley])\r
+                       return;\r
+\r
+               actorat[ob->tilex][ob->tiley] = ob;\r
+               return;\r
+       }\r
+\r
+//\r
+// transitional object\r
+//\r
+       ob->ticcount-=tics;\r
+       while ( ob->ticcount <= 0)\r
+       {\r
+               think = ob->state->action;                      // end of state action\r
+               if (think)\r
+               {\r
+                       think (ob);\r
+                       if (!ob->state)\r
+                       {\r
+                               RemoveObj (ob);\r
+                               return;\r
+                       }\r
+               }\r
+\r
+               ob->state = ob->state->next;\r
+\r
+               if (!ob->state)\r
+               {\r
+                       RemoveObj (ob);\r
+                       return;\r
+               }\r
+\r
+               if (!ob->state->tictime)\r
+               {\r
+                       ob->ticcount = 0;\r
+                       goto think;\r
+               }\r
+\r
+               ob->ticcount += ob->state->tictime;\r
+       }\r
+\r
+think:\r
+       //\r
+       // think\r
+       //\r
+       think = ob->state->think;\r
+       if (think)\r
+       {\r
+               think (ob);\r
+               if (!ob->state)\r
+               {\r
+                       RemoveObj (ob);\r
+                       return;\r
+               }\r
+       }\r
+\r
+       if (ob->flags&FL_NEVERMARK)\r
+               return;\r
+\r
+       if ( (ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley])\r
+               return;\r
+\r
+       actorat[ob->tilex][ob->tiley] = ob;\r
+}\r
+\r
+//==========================================================================\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= PlayLoop\r
+=\r
+===================\r
+*/\r
+long funnyticount;\r
+\r
+\r
+void PlayLoop (void)\r
+{\r
+       int             give;\r
+       int     helmetangle;\r
+\r
+       playstate = TimeCount = lasttimecount = 0;\r
+       frameon = 0;\r
+       running = false;\r
+       anglefrac = 0;\r
+       facecount = 0;\r
+       funnyticount = 0;\r
+       memset (buttonstate,0,sizeof(buttonstate));\r
+       ClearPaletteShifts ();\r
+\r
+       if (MousePresent)\r
+               Mouse(MDelta);  // Clear accumulated mouse movement\r
+\r
+       if (demoplayback)\r
+               IN_StartAck ();\r
+\r
+       do\r
+       {\r
+               if (virtualreality)\r
+               {\r
+                       helmetangle = peek (0x40,0xf0);\r
+                       player->angle += helmetangle;\r
+                       if (player->angle >= ANGLES)\r
+                               player->angle -= ANGLES;\r
+               }\r
+\r
+\r
+               PollControls();\r
+\r
+//\r
+// actor thinking\r
+//\r
+               madenoise = false;\r
+\r
+               MoveDoors ();\r
+               MovePWalls ();\r
+\r
+               for (obj = player;obj;obj = obj->next)\r
+                       DoActor (obj);\r
+\r
+               UpdatePaletteShifts ();\r
+\r
+               ThreeDRefresh ();\r
+\r
+               //\r
+               // MAKE FUNNY FACE IF BJ DOESN'T MOVE FOR AWHILE\r
+               //\r
+               #ifdef SPEAR\r
+               funnyticount += tics;\r
+               if (funnyticount > 30l*70)\r
+               {\r
+                       funnyticount = 0;\r
+                       StatusDrawPic (17,4,BJWAITING1PIC+(US_RndT()&1));\r
+                       facecount = 0;\r
+               }\r
+               #endif\r
+\r
+               gamestate.TimeCount+=tics;\r
+\r
+               SD_Poll ();\r
+               UpdateSoundLoc();       // JAB\r
+\r
+               if (screenfaded)\r
+                       VW_FadeIn ();\r
+\r
+               CheckKeys();\r
+\r
+//\r
+// debug aids\r
+//\r
+               if (singlestep)\r
+               {\r
+                       VW_WaitVBL(14);\r
+                       lasttimecount = TimeCount;\r
+               }\r
+               if (extravbls)\r
+                       VW_WaitVBL(extravbls);\r
+\r
+               if (demoplayback)\r
+               {\r
+                       if (IN_CheckAck ())\r
+                       {\r
+                               IN_ClearKeysDown ();\r
+                               playstate = ex_abort;\r
+                       }\r
+               }\r
+\r
+\r
+               if (virtualreality)\r
+               {\r
+                       player->angle -= helmetangle;\r
+                       if (player->angle < 0)\r
+                               player->angle += ANGLES;\r
+               }\r
+\r
+       }while (!playstate && !startgame);\r
+\r
+       if (playstate != ex_died)\r
+               FinishPaletteShifts ();\r
+}\r
+\r
diff --git a/16/wf3d8086/wl_scale.c b/16/wf3d8086/wl_scale.c
new file mode 100755 (executable)
index 0000000..9c1e102
--- /dev/null
@@ -0,0 +1,741 @@
+// WL_SCALE.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+#define OP_RETF        0xcb\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                 GLOBALS\r
+\r
+=============================================================================\r
+*/\r
+\r
+t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1];\r
+long                   fullscalefarcall[MAXSCALEHEIGHT+1];\r
+\r
+int                    maxscale,maxscaleshl2;\r
+\r
+boolean        insetupscaling;\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                 LOCALS\r
+\r
+=============================================================================\r
+*/\r
+\r
+t_compscale    _seg *work;\r
+unsigned BuildCompScale (int height, memptr *finalspot);\r
+\r
+int                    stepbytwo;\r
+\r
+//===========================================================================\r
+\r
+/*\r
+==============\r
+=\r
+= BadScale\r
+=\r
+==============\r
+*/\r
+\r
+void far BadScale (void)\r
+{\r
+       Quit ("BadScale called!");\r
+}\r
+\r
+\r
+/*\r
+==========================\r
+=\r
+= SetupScaling\r
+=\r
+==========================\r
+*/\r
+\r
+void SetupScaling (int maxscaleheight)\r
+{\r
+       int             i,x,y;\r
+       byte    far *dest;\r
+\r
+       insetupscaling = true;\r
+\r
+       maxscaleheight/=2;                      // one scaler every two pixels\r
+\r
+       maxscale = maxscaleheight-1;\r
+       maxscaleshl2 = maxscale<<2;\r
+\r
+//\r
+// free up old scalers\r
+//\r
+       for (i=1;i<MAXSCALEHEIGHT;i++)\r
+       {\r
+               if (scaledirectory[i])\r
+                       MM_FreePtr (&(memptr)scaledirectory[i]);\r
+               if (i>=stepbytwo)\r
+                       i += 2;\r
+       }\r
+       memset (scaledirectory,0,sizeof(scaledirectory));\r
+\r
+       MM_SortMem ();\r
+\r
+//\r
+// build the compiled scalers\r
+//\r
+       stepbytwo = viewheight/2;       // save space by double stepping\r
+       MM_GetPtr (&(memptr)work,20000);\r
+\r
+       for (i=1;i<=maxscaleheight;i++)\r
+       {\r
+               BuildCompScale (i*2,&(memptr)scaledirectory[i]);\r
+               if (i>=stepbytwo)\r
+                       i+= 2;\r
+       }\r
+       MM_FreePtr (&(memptr)work);\r
+\r
+//\r
+// compact memory and lock down scalers\r
+//\r
+       MM_SortMem ();\r
+       for (i=1;i<=maxscaleheight;i++)\r
+       {\r
+               MM_SetLock (&(memptr)scaledirectory[i],true);\r
+               fullscalefarcall[i] = (unsigned)scaledirectory[i];\r
+               fullscalefarcall[i] <<=16;\r
+               fullscalefarcall[i] += scaledirectory[i]->codeofs[0];\r
+               if (i>=stepbytwo)\r
+               {\r
+                       scaledirectory[i+1] = scaledirectory[i];\r
+                       fullscalefarcall[i+1] = fullscalefarcall[i];\r
+                       scaledirectory[i+2] = scaledirectory[i];\r
+                       fullscalefarcall[i+2] = fullscalefarcall[i];\r
+                       i+=2;\r
+               }\r
+       }\r
+       scaledirectory[0] = scaledirectory[1];\r
+       fullscalefarcall[0] = fullscalefarcall[1];\r
+\r
+//\r
+// check for oversize wall drawing\r
+//\r
+       for (i=maxscaleheight;i<MAXSCALEHEIGHT;i++)\r
+               fullscalefarcall[i] = (long)BadScale;\r
+\r
+       insetupscaling = false;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+========================\r
+=\r
+= BuildCompScale\r
+=\r
+= Builds a compiled scaler object that will scale a 64 tall object to\r
+= the given height (centered vertically on the screen)\r
+=\r
+= height should be even\r
+=\r
+= Call with\r
+= ---------\r
+= DS:SI                Source for scale\r
+= ES:DI                Dest for scale\r
+=\r
+= Calling the compiled scaler only destroys AL\r
+=\r
+========================\r
+*/\r
+\r
+unsigned BuildCompScale (int height, memptr *finalspot)\r
+{\r
+       byte            far *code;\r
+\r
+       int                     i;\r
+       long            fix,step;\r
+       unsigned        src,totalscaled,totalsize;\r
+       int                     startpix,endpix,toppix;\r
+\r
+\r
+       step = ((long)height<<16) / 64;\r
+       code = &work->code[0];\r
+       toppix = (viewheight-height)/2;\r
+       fix = 0;\r
+\r
+       for (src=0;src<=64;src++)\r
+       {\r
+               startpix = fix>>16;\r
+               fix += step;\r
+               endpix = fix>>16;\r
+\r
+               if (endpix>startpix)\r
+                       work->width[src] = endpix-startpix;\r
+               else\r
+                       work->width[src] = 0;\r
+\r
+//\r
+// mark the start of the code\r
+//\r
+               work->codeofs[src] = FP_OFF(code);\r
+\r
+//\r
+// compile some code if the source pixel generates any screen pixels\r
+//\r
+               startpix+=toppix;\r
+               endpix+=toppix;\r
+\r
+               if (startpix == endpix || endpix < 0 || startpix >= viewheight || src == 64)\r
+                       continue;\r
+\r
+       //\r
+       // mov al,[si+src]\r
+       //\r
+               *code++ = 0x8a;\r
+               *code++ = 0x44;\r
+               *code++ = src;\r
+\r
+               for (;startpix<endpix;startpix++)\r
+               {\r
+                       if (startpix >= viewheight)\r
+                               break;                                          // off the bottom of the view area\r
+                       if (startpix < 0)\r
+                               continue;                                       // not into the view area\r
+\r
+               //\r
+               // mov [es:di+heightofs],al\r
+               //\r
+                       *code++ = 0x26;\r
+                       *code++ = 0x88;\r
+                       *code++ = 0x85;\r
+                       *((unsigned far *)code)++ = startpix*SCREENBWIDE;\r
+               }\r
+\r
+       }\r
+\r
+//\r
+// retf\r
+//\r
+       *code++ = 0xcb;\r
+\r
+       totalsize = FP_OFF(code);\r
+       MM_GetPtr (finalspot,totalsize);\r
+       _fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize);\r
+\r
+       return totalsize;\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= ScaleLine\r
+=\r
+= linescale should have the high word set to the segment of the scaler\r
+=\r
+=======================\r
+*/\r
+\r
+extern int                     slinex,slinewidth;\r
+extern unsigned        far *linecmds;\r
+extern long            linescale;\r
+extern unsigned        maskword;\r
+\r
+byte   mask1,mask2,mask3;\r
+\r
+\r
+void near ScaleLine (void)\r
+{\r
+asm    mov     cx,WORD PTR [linescale+2]\r
+asm    mov     es,cx                                           // segment of scaler\r
+\r
+asm    mov bp,WORD PTR [linecmds]\r
+asm    mov     dx,SC_INDEX+1                           // to set SC_MAPMASK\r
+\r
+asm    mov     bx,[slinex]\r
+asm    mov     di,bx\r
+asm    shr     di,1                                            // X in bytes\r
+asm    shr     di,1\r
+asm    add     di,[bufferofs]\r
+asm    and     bx,3\r
+/* begin 8086 hack\r
+asm    shl     bx,3\r
+*/\r
+asm push cx\r
+asm mov cl,3\r
+asm shl bx,cl\r
+asm pop cx\r
+/* end 8086 hack */\r
+asm    add     bx,[slinewidth]                         // bx = (pixel*8+pixwidth)\r
+asm    mov     al,BYTE [mapmasks3-1+bx]        // -1 because pixwidth of 1 is first\r
+asm    mov     ds,WORD PTR [linecmds+2]\r
+asm    or      al,al\r
+asm    jz      notthreebyte                            // scale across three bytes\r
+asm    jmp     threebyte\r
+notthreebyte:\r
+asm    mov     al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first\r
+asm    or      al,al\r
+asm    jnz     twobyte                                         // scale across two bytes\r
+\r
+//\r
+// one byte scaling\r
+//\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    out     dx,al                                           // set map mask register\r
+\r
+scalesingle:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     dl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+\r
+asm    mov     es,cx                                           // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],dl                     // unpatch the RETF\r
+asm    jmp     scalesingle                                     // do the next segment\r
+\r
+\r
+//\r
+// done\r
+//\r
+linedone:\r
+asm    mov     ax,ss\r
+asm    mov     ds,ax\r
+return;\r
+\r
+//\r
+// two byte scaling\r
+//\r
+twobyte:\r
+asm    mov     ss:[mask2],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask1],al\r
+\r
+scaledouble:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     cl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    mov     al,ss:[mask1]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask2]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    dec     di\r
+\r
+asm    mov     es,WORD PTR ss:[linescale+2] // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],cl                     // unpatch the RETF\r
+asm    jmp     scaledouble                                     // do the next segment\r
+\r
+\r
+//\r
+// three byte scaling\r
+//\r
+threebyte:\r
+asm    mov     ss:[mask3],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask2],al\r
+asm    mov     al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first\r
+asm    mov     ss:[mask1],al\r
+\r
+scaletriple:\r
+\r
+asm    mov     bx,[ds:bp]                                      // table location of rtl to patch\r
+asm    or      bx,bx\r
+asm    jz      linedone                                        // 0 signals end of segment list\r
+asm    mov     bx,[es:bx]\r
+asm    mov     cl,[es:bx]                                      // save old value\r
+asm    mov     BYTE PTR es:[bx],OP_RETF        // patch a RETF in\r
+asm    mov     si,[ds:bp+4]                            // table location of entry spot\r
+asm    mov     ax,[es:si]\r
+asm    mov     WORD PTR ss:[linescale],ax      // call here to start scaling\r
+asm    mov     si,[ds:bp+2]                            // corrected top of shape for this segment\r
+asm    add     bp,6                                            // next segment list\r
+\r
+asm    mov     ax,SCREENSEG\r
+asm    mov     es,ax\r
+asm    mov     al,ss:[mask1]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask2]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    inc     di\r
+asm    mov     al,ss:[mask3]\r
+asm    out     dx,al                                           // set map mask register\r
+asm    call ss:[linescale]                             // scale the segment of pixels\r
+asm    dec     di\r
+asm    dec     di\r
+\r
+asm    mov     es,WORD PTR ss:[linescale+2] // segment of scaler\r
+asm    mov     BYTE PTR es:[bx],cl                     // unpatch the RETF\r
+asm    jmp     scaletriple                                     // do the next segment\r
+\r
+\r
+}\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= ScaleShape\r
+=\r
+= Draws a compiled shape at [scale] pixels high\r
+=\r
+= each vertical line of the shape has a pointer to segment data:\r
+=      end of segment pixel*2 (0 terminates line) used to patch rtl in scaler\r
+=      top of virtual line with segment in proper place\r
+=      start of segment pixel*2, used to jsl into compiled scaler\r
+=      <repeat>\r
+=\r
+= Setup for call\r
+= --------------\r
+= GC_MODE                      read mode 1, write mode 2\r
+= GC_COLORDONTCARE  set to 0, so all reads from video memory return 0xff\r
+= GC_INDEX                     pointing at GC_BITMASK\r
+=\r
+=======================\r
+*/\r
+\r
+static long            longtemp;\r
+\r
+void ScaleShape (int xcenter, int shapenum, unsigned height)\r
+{\r
+       t_compshape     _seg *shape;\r
+       t_compscale _seg *comptable;\r
+       unsigned        scale,srcx,stopx,tempx;\r
+       int                     t;\r
+       unsigned        far *cmdptr;\r
+       boolean         leftvis,rightvis;\r
+\r
+\r
+       shape = PM_GetSpritePage (shapenum);\r
+\r
+       scale = height>>3;                                              // low three bits are fractional\r
+       if (!scale || scale>maxscale)\r
+               return;                                                         // too close or far away\r
+       comptable = scaledirectory[scale];\r
+\r
+       *(((unsigned *)&linescale)+1)=(unsigned)comptable;      // seg of far call\r
+       *(((unsigned *)&linecmds)+1)=(unsigned)shape;           // seg of shape\r
+\r
+//\r
+// scale to the left (from pixel 31 to shape->leftpix)\r
+//\r
+       srcx = 32;\r
+       slinex = xcenter;\r
+       stopx = shape->leftpix;\r
+       cmdptr = &shape->dataofs[31-stopx];\r
+\r
+       while ( --srcx >=stopx && slinex>0)\r
+       {\r
+               (unsigned)linecmds = *cmdptr--;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               if (slinewidth == 1)\r
+               {\r
+                       slinex--;\r
+                       if (slinex<viewwidth)\r
+                       {\r
+                               if (wallheight[slinex] >= height)\r
+                                       continue;               // obscured by closer wall\r
+                               ScaleLine ();\r
+                       }\r
+                       continue;\r
+               }\r
+\r
+               //\r
+               // handle multi pixel lines\r
+               //\r
+               if (slinex>viewwidth)\r
+               {\r
+                       slinex -= slinewidth;\r
+                       slinewidth = viewwidth-slinex;\r
+                       if (slinewidth<1)\r
+                               continue;               // still off the right side\r
+               }\r
+               else\r
+               {\r
+                       if (slinewidth>slinex)\r
+                               slinewidth = slinex;\r
+                       slinex -= slinewidth;\r
+               }\r
+\r
+\r
+               leftvis = (wallheight[slinex] < height);\r
+               rightvis = (wallheight[slinex+slinewidth-1] < height);\r
+\r
+               if (leftvis)\r
+               {\r
+                       if (rightvis)\r
+                               ScaleLine ();\r
+                       else\r
+                       {\r
+                               while (wallheight[slinex+slinewidth-1] >= height)\r
+                                       slinewidth--;\r
+                               ScaleLine ();\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       if (!rightvis)\r
+                               continue;               // totally obscured\r
+\r
+                       while (wallheight[slinex] >= height)\r
+                       {\r
+                               slinex++;\r
+                               slinewidth--;\r
+                       }\r
+                       ScaleLine ();\r
+                       break;                  // the rest of the shape is gone\r
+               }\r
+       }\r
+\r
+\r
+//\r
+// scale to the right\r
+//\r
+       slinex = xcenter;\r
+       stopx = shape->rightpix;\r
+       if (shape->leftpix<31)\r
+       {\r
+               srcx = 31;\r
+               cmdptr = &shape->dataofs[32-shape->leftpix];\r
+       }\r
+       else\r
+       {\r
+               srcx = shape->leftpix-1;\r
+               cmdptr = &shape->dataofs[0];\r
+       }\r
+       slinewidth = 0;\r
+\r
+       while ( ++srcx <= stopx && (slinex+=slinewidth)<viewwidth)\r
+       {\r
+               (unsigned)linecmds = *cmdptr++;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               if (slinewidth == 1)\r
+               {\r
+                       if (slinex>=0 && wallheight[slinex] < height)\r
+                       {\r
+                               ScaleLine ();\r
+                       }\r
+                       continue;\r
+               }\r
+\r
+               //\r
+               // handle multi pixel lines\r
+               //\r
+               if (slinex<0)\r
+               {\r
+                       if (slinewidth <= -slinex)\r
+                               continue;               // still off the left edge\r
+\r
+                       slinewidth += slinex;\r
+                       slinex = 0;\r
+               }\r
+               else\r
+               {\r
+                       if (slinex + slinewidth > viewwidth)\r
+                               slinewidth = viewwidth-slinex;\r
+               }\r
+\r
+\r
+               leftvis = (wallheight[slinex] < height);\r
+               rightvis = (wallheight[slinex+slinewidth-1] < height);\r
+\r
+               if (leftvis)\r
+               {\r
+                       if (rightvis)\r
+                       {\r
+                               ScaleLine ();\r
+                       }\r
+                       else\r
+                       {\r
+                               while (wallheight[slinex+slinewidth-1] >= height)\r
+                                       slinewidth--;\r
+                               ScaleLine ();\r
+                               break;                  // the rest of the shape is gone\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       if (rightvis)\r
+                       {\r
+                               while (wallheight[slinex] >= height)\r
+                               {\r
+                                       slinex++;\r
+                                       slinewidth--;\r
+                               }\r
+                               ScaleLine ();\r
+                       }\r
+                       else\r
+                               continue;               // totally obscured\r
+               }\r
+       }\r
+}\r
+\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= SimpleScaleShape\r
+=\r
+= NO CLIPPING, height in pixels\r
+=\r
+= Draws a compiled shape at [scale] pixels high\r
+=\r
+= each vertical line of the shape has a pointer to segment data:\r
+=      end of segment pixel*2 (0 terminates line) used to patch rtl in scaler\r
+=      top of virtual line with segment in proper place\r
+=      start of segment pixel*2, used to jsl into compiled scaler\r
+=      <repeat>\r
+=\r
+= Setup for call\r
+= --------------\r
+= GC_MODE                      read mode 1, write mode 2\r
+= GC_COLORDONTCARE  set to 0, so all reads from video memory return 0xff\r
+= GC_INDEX                     pointing at GC_BITMASK\r
+=\r
+=======================\r
+*/\r
+\r
+void SimpleScaleShape (int xcenter, int shapenum, unsigned height)\r
+{\r
+       t_compshape     _seg *shape;\r
+       t_compscale _seg *comptable;\r
+       unsigned        scale,srcx,stopx,tempx;\r
+       int                     t;\r
+       unsigned        far *cmdptr;\r
+       boolean         leftvis,rightvis;\r
+\r
+\r
+       shape = PM_GetSpritePage (shapenum);\r
+\r
+       scale = height>>1;\r
+       comptable = scaledirectory[scale];\r
+\r
+       *(((unsigned *)&linescale)+1)=(unsigned)comptable;      // seg of far call\r
+       *(((unsigned *)&linecmds)+1)=(unsigned)shape;           // seg of shape\r
+\r
+//\r
+// scale to the left (from pixel 31 to shape->leftpix)\r
+//\r
+       srcx = 32;\r
+       slinex = xcenter;\r
+       stopx = shape->leftpix;\r
+       cmdptr = &shape->dataofs[31-stopx];\r
+\r
+       while ( --srcx >=stopx )\r
+       {\r
+               (unsigned)linecmds = *cmdptr--;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               slinex -= slinewidth;\r
+               ScaleLine ();\r
+       }\r
+\r
+\r
+//\r
+// scale to the right\r
+//\r
+       slinex = xcenter;\r
+       stopx = shape->rightpix;\r
+       if (shape->leftpix<31)\r
+       {\r
+               srcx = 31;\r
+               cmdptr = &shape->dataofs[32-shape->leftpix];\r
+       }\r
+       else\r
+       {\r
+               srcx = shape->leftpix-1;\r
+               cmdptr = &shape->dataofs[0];\r
+       }\r
+       slinewidth = 0;\r
+\r
+       while ( ++srcx <= stopx )\r
+       {\r
+               (unsigned)linecmds = *cmdptr++;\r
+               if ( !(slinewidth = comptable->width[srcx]) )\r
+                       continue;\r
+\r
+               ScaleLine ();\r
+               slinex+=slinewidth;\r
+       }\r
+}\r
+\r
+\r
+\r
+\r
+//\r
+// bit mask tables for drawing scaled strips up to eight pixels wide\r
+//\r
+// down here so the STUPID inline assembler doesn't get confused!\r
+//\r
+\r
+\r
+byte   mapmasks1[4][8] = {\r
+{1 ,3 ,7 ,15,15,15,15,15},\r
+{2 ,6 ,14,14,14,14,14,14},\r
+{4 ,12,12,12,12,12,12,12},\r
+{8 ,8 ,8 ,8 ,8 ,8 ,8 ,8} };\r
+\r
+byte   mapmasks2[4][8] = {\r
+{0 ,0 ,0 ,0 ,1 ,3 ,7 ,15},\r
+{0 ,0 ,0 ,1 ,3 ,7 ,15,15},\r
+{0 ,0 ,1 ,3 ,7 ,15,15,15},\r
+{0 ,1 ,3 ,7 ,15,15,15,15} };\r
+\r
+byte   mapmasks3[4][8] = {\r
+{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0},\r
+{0 ,0 ,0 ,0 ,0 ,0 ,0 ,1},\r
+{0 ,0 ,0 ,0 ,0 ,0 ,1 ,3},\r
+{0 ,0 ,0 ,0 ,0 ,1 ,3 ,7} };\r
+\r
+\r
+unsigned       wordmasks[8][8] = {\r
+{0x0080,0x00c0,0x00e0,0x00f0,0x00f8,0x00fc,0x00fe,0x00ff},\r
+{0x0040,0x0060,0x0070,0x0078,0x007c,0x007e,0x007f,0x807f},\r
+{0x0020,0x0030,0x0038,0x003c,0x003e,0x003f,0x803f,0xc03f},\r
+{0x0010,0x0018,0x001c,0x001e,0x001f,0x801f,0xc01f,0xe01f},\r
+{0x0008,0x000c,0x000e,0x000f,0x800f,0xc00f,0xe00f,0xf00f},\r
+{0x0004,0x0006,0x0007,0x8007,0xc007,0xe007,0xf007,0xf807},\r
+{0x0002,0x0003,0x8003,0xc003,0xe003,0xf003,0xf803,0xfc03},\r
+{0x0001,0x8001,0xc001,0xe001,0xf001,0xf801,0xfc01,0xfe01} };\r
+\r
+int                    slinex,slinewidth;\r
+unsigned       far *linecmds;\r
+long           linescale;\r
+unsigned       maskword;\r
+\r
diff --git a/16/wf3d8086/wl_state.c b/16/wf3d8086/wl_state.c
new file mode 100755 (executable)
index 0000000..ad534ba
--- /dev/null
@@ -0,0 +1,1480 @@
+// WL_STATE.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma hdrstop\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+dirtype opposite[9] =\r
+       {west,southwest,south,southeast,east,northeast,north,northwest,nodir};\r
+\r
+dirtype diagonal[9][9] =\r
+{\r
+/* east */     {nodir,nodir,northeast,nodir,nodir,nodir,southeast,nodir,nodir},\r
+                       {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir},\r
+/* north */ {northeast,nodir,nodir,nodir,northwest,nodir,nodir,nodir,nodir},\r
+                       {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir},\r
+/* west */  {nodir,nodir,northwest,nodir,nodir,nodir,southwest,nodir,nodir},\r
+                       {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir},\r
+/* south */ {southeast,nodir,nodir,nodir,southwest,nodir,nodir,nodir,nodir},\r
+                       {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir},\r
+                       {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir}\r
+};\r
+\r
+\r
+\r
+void   SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state);\r
+void   NewState (objtype *ob, statetype *state);\r
+\r
+boolean TryWalk (objtype *ob);\r
+void   MoveObj (objtype *ob, long move);\r
+\r
+void   KillActor (objtype *ob);\r
+void   DamageActor (objtype *ob, unsigned damage);\r
+\r
+boolean CheckLine (objtype *ob);\r
+void FirstSighting (objtype *ob);\r
+boolean        CheckSight (objtype *ob);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= SpawnNewObj\r
+=\r
+= Spaws a new actor at the given TILE coordinates, with the given state, and\r
+= the given size in GLOBAL units.\r
+=\r
+= new                  = a pointer to an initialized new actor\r
+=\r
+===================\r
+*/\r
+\r
+void SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state)\r
+{\r
+       GetNewActor ();\r
+       new->state = state;\r
+       if (state->tictime)\r
+               new->ticcount = US_RndT () % state->tictime;\r
+       else\r
+               new->ticcount = 0;\r
+\r
+       new->tilex = tilex;\r
+       new->tiley = tiley;\r
+       new->x = ((long)tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+       new->y = ((long)tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+       new->dir = nodir;\r
+\r
+       actorat[tilex][tiley] = new;\r
+       new->areanumber =\r
+               *(mapsegs[0] + farmapylookup[new->tiley]+new->tilex) - AREATILE;\r
+}\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= NewState\r
+=\r
+= Changes ob to a new state, setting ticcount to the max for that state\r
+=\r
+===================\r
+*/\r
+\r
+void NewState (objtype *ob, statetype *state)\r
+{\r
+       ob->state = state;\r
+       ob->ticcount = state->tictime;\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                               ENEMY TILE WORLD MOVEMENT CODE\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+==================================\r
+=\r
+= TryWalk\r
+=\r
+= Attempts to move ob in its current (ob->dir) direction.\r
+=\r
+= If blocked by either a wall or an actor returns FALSE\r
+=\r
+= If move is either clear or blocked only by a door, returns TRUE and sets\r
+=\r
+= ob->tilex                    = new destination\r
+= ob->tiley\r
+= ob->areanumber    = the floor tile number (0-(NUMAREAS-1)) of destination\r
+= ob->distance         = TILEGLOBAl, or -doornumber if a door is blocking the way\r
+=\r
+= If a door is in the way, an OpenDoor call is made to start it opening.\r
+= The actor code should wait until\r
+=      doorobjlist[-ob->distance].action = dr_open, meaning the door has been\r
+=      fully opened\r
+=\r
+==================================\r
+*/\r
+\r
+#define CHECKDIAG(x,y)                                                         \\r
+{                                                   \\r
+       temp=(unsigned)actorat[x][y];                   \\r
+       if (temp)                                       \\r
+       {                                               \\r
+               if (temp<256)                               \\r
+                       return false;                           \\r
+               if (((objtype *)temp)->flags&FL_SHOOTABLE)  \\r
+                       return false;                           \\r
+       }                                               \\r
+}\r
+\r
+#define CHECKSIDE(x,y)                                                         \\r
+{                                                   \\r
+       temp=(unsigned)actorat[x][y];                   \\r
+       if (temp)                                       \\r
+       {                                               \\r
+               if (temp<128)                               \\r
+                       return false;                           \\r
+               if (temp<256)                               \\r
+                       doornum = temp&63;                      \\r
+               else if (((objtype *)temp)->flags&FL_SHOOTABLE)\\r
+                       return false;                           \\r
+       }                                               \\r
+}\r
+\r
+\r
+boolean TryWalk (objtype *ob)\r
+{\r
+       int                     doornum;\r
+       unsigned        temp;\r
+\r
+       doornum = -1;\r
+\r
+       if (ob->obclass == inertobj)\r
+       {\r
+               switch (ob->dir)\r
+               {\r
+               case north:\r
+                       ob->tiley--;\r
+                       break;\r
+\r
+               case northeast:\r
+                       ob->tilex++;\r
+                       ob->tiley--;\r
+                       break;\r
+\r
+               case east:\r
+                       ob->tilex++;\r
+                       break;\r
+\r
+               case southeast:\r
+                       ob->tilex++;\r
+                       ob->tiley++;\r
+                       break;\r
+\r
+               case south:\r
+                       ob->tiley++;\r
+                       break;\r
+\r
+               case southwest:\r
+                       ob->tilex--;\r
+                       ob->tiley++;\r
+                       break;\r
+\r
+               case west:\r
+                       ob->tilex--;\r
+                       break;\r
+\r
+               case northwest:\r
+                       ob->tilex--;\r
+                       ob->tiley--;\r
+                       break;\r
+               }\r
+       }\r
+       else\r
+               switch (ob->dir)\r
+               {\r
+               case north:\r
+                       if (ob->obclass == dogobj || ob->obclass == fakeobj)\r
+                       {\r
+                               CHECKDIAG(ob->tilex,ob->tiley-1);\r
+                       }\r
+                       else\r
+                       {\r
+                               CHECKSIDE(ob->tilex,ob->tiley-1);\r
+                       }\r
+                       ob->tiley--;\r
+                       break;\r
+\r
+               case northeast:\r
+                       CHECKDIAG(ob->tilex+1,ob->tiley-1);\r
+                       CHECKDIAG(ob->tilex+1,ob->tiley);\r
+                       CHECKDIAG(ob->tilex,ob->tiley-1);\r
+                       ob->tilex++;\r
+                       ob->tiley--;\r
+                       break;\r
+\r
+               case east:\r
+                       if (ob->obclass == dogobj || ob->obclass == fakeobj)\r
+                       {\r
+                               CHECKDIAG(ob->tilex+1,ob->tiley);\r
+                       }\r
+                       else\r
+                       {\r
+                               CHECKSIDE(ob->tilex+1,ob->tiley);\r
+                       }\r
+                       ob->tilex++;\r
+                       break;\r
+\r
+               case southeast:\r
+                       CHECKDIAG(ob->tilex+1,ob->tiley+1);\r
+                       CHECKDIAG(ob->tilex+1,ob->tiley);\r
+                       CHECKDIAG(ob->tilex,ob->tiley+1);\r
+                       ob->tilex++;\r
+                       ob->tiley++;\r
+                       break;\r
+\r
+               case south:\r
+                       if (ob->obclass == dogobj || ob->obclass == fakeobj)\r
+                       {\r
+                               CHECKDIAG(ob->tilex,ob->tiley+1);\r
+                       }\r
+                       else\r
+                       {\r
+                               CHECKSIDE(ob->tilex,ob->tiley+1);\r
+                       }\r
+                       ob->tiley++;\r
+                       break;\r
+\r
+               case southwest:\r
+                       CHECKDIAG(ob->tilex-1,ob->tiley+1);\r
+                       CHECKDIAG(ob->tilex-1,ob->tiley);\r
+                       CHECKDIAG(ob->tilex,ob->tiley+1);\r
+                       ob->tilex--;\r
+                       ob->tiley++;\r
+                       break;\r
+\r
+               case west:\r
+                       if (ob->obclass == dogobj || ob->obclass == fakeobj)\r
+                       {\r
+                               CHECKDIAG(ob->tilex-1,ob->tiley);\r
+                       }\r
+                       else\r
+                       {\r
+                               CHECKSIDE(ob->tilex-1,ob->tiley);\r
+                       }\r
+                       ob->tilex--;\r
+                       break;\r
+\r
+               case northwest:\r
+                       CHECKDIAG(ob->tilex-1,ob->tiley-1);\r
+                       CHECKDIAG(ob->tilex-1,ob->tiley);\r
+                       CHECKDIAG(ob->tilex,ob->tiley-1);\r
+                       ob->tilex--;\r
+                       ob->tiley--;\r
+                       break;\r
+\r
+               case nodir:\r
+                       return false;\r
+\r
+               default:\r
+                       Quit ("Walk: Bad dir");\r
+               }\r
+\r
+       if (doornum != -1)\r
+       {\r
+               OpenDoor (doornum);\r
+               ob->distance = -doornum-1;\r
+               return true;\r
+       }\r
+\r
+\r
+       ob->areanumber =\r
+               *(mapsegs[0] + farmapylookup[ob->tiley]+ob->tilex) - AREATILE;\r
+\r
+       ob->distance = TILEGLOBAL;\r
+       return true;\r
+}\r
+\r
+\r
+\r
+/*\r
+==================================\r
+=\r
+= SelectDodgeDir\r
+=\r
+= Attempts to choose and initiate a movement for ob that sends it towards\r
+= the player while dodging\r
+=\r
+= If there is no possible move (ob is totally surrounded)\r
+=\r
+= ob->dir                      =       nodir\r
+=\r
+= Otherwise\r
+=\r
+= ob->dir                      = new direction to follow\r
+= ob->distance         = TILEGLOBAL or -doornumber\r
+= ob->tilex                    = new destination\r
+= ob->tiley\r
+= ob->areanumber    = the floor tile number (0-(NUMAREAS-1)) of destination\r
+=\r
+==================================\r
+*/\r
+\r
+void SelectDodgeDir (objtype *ob)\r
+{\r
+       int             deltax,deltay,i;\r
+       unsigned        absdx,absdy;\r
+       dirtype         dirtry[5];\r
+       dirtype         turnaround,tdir;\r
+\r
+       if (ob->flags & FL_FIRSTATTACK)\r
+       {\r
+       //\r
+       // turning around is only ok the very first time after noticing the\r
+       // player\r
+       //\r
+               turnaround = nodir;\r
+               ob->flags &= ~FL_FIRSTATTACK;\r
+       }\r
+       else\r
+               turnaround=opposite[ob->dir];\r
+\r
+       deltax = player->tilex - ob->tilex;\r
+       deltay = player->tiley - ob->tiley;\r
+\r
+//\r
+// arange 5 direction choices in order of preference\r
+// the four cardinal directions plus the diagonal straight towards\r
+// the player\r
+//\r
+\r
+       if (deltax>0)\r
+       {\r
+               dirtry[1]= east;\r
+               dirtry[3]= west;\r
+       }\r
+       else\r
+       {\r
+               dirtry[1]= west;\r
+               dirtry[3]= east;\r
+       }\r
+\r
+       if (deltay>0)\r
+       {\r
+               dirtry[2]= south;\r
+               dirtry[4]= north;\r
+       }\r
+       else\r
+       {\r
+               dirtry[2]= north;\r
+               dirtry[4]= south;\r
+       }\r
+\r
+//\r
+// randomize a bit for dodging\r
+//\r
+       absdx = abs(deltax);\r
+       absdy = abs(deltay);\r
+\r
+       if (absdx > absdy)\r
+       {\r
+               tdir = dirtry[1];\r
+               dirtry[1] = dirtry[2];\r
+               dirtry[2] = tdir;\r
+               tdir = dirtry[3];\r
+               dirtry[3] = dirtry[4];\r
+               dirtry[4] = tdir;\r
+       }\r
+\r
+       if (US_RndT() < 128)\r
+       {\r
+               tdir = dirtry[1];\r
+               dirtry[1] = dirtry[2];\r
+               dirtry[2] = tdir;\r
+               tdir = dirtry[3];\r
+               dirtry[3] = dirtry[4];\r
+               dirtry[4] = tdir;\r
+       }\r
+\r
+       dirtry[0] = diagonal [ dirtry[1] ] [ dirtry[2] ];\r
+\r
+//\r
+// try the directions util one works\r
+//\r
+       for (i=0;i<5;i++)\r
+       {\r
+               if ( dirtry[i] == nodir || dirtry[i] == turnaround)\r
+                       continue;\r
+\r
+               ob->dir = dirtry[i];\r
+               if (TryWalk(ob))\r
+                       return;\r
+       }\r
+\r
+//\r
+// turn around only as a last resort\r
+//\r
+       if (turnaround != nodir)\r
+       {\r
+               ob->dir = turnaround;\r
+\r
+               if (TryWalk(ob))\r
+                       return;\r
+       }\r
+\r
+       ob->dir = nodir;\r
+}\r
+\r
+\r
+/*\r
+============================\r
+=\r
+= SelectChaseDir\r
+=\r
+= As SelectDodgeDir, but doesn't try to dodge\r
+=\r
+============================\r
+*/\r
+\r
+void SelectChaseDir (objtype *ob)\r
+{\r
+       int deltax,deltay,i;\r
+       dirtype d[3];\r
+       dirtype tdir, olddir, turnaround;\r
+\r
+\r
+       olddir=ob->dir;\r
+       turnaround=opposite[olddir];\r
+\r
+       deltax=player->tilex - ob->tilex;\r
+       deltay=player->tiley - ob->tiley;\r
+\r
+       d[1]=nodir;\r
+       d[2]=nodir;\r
+\r
+       if (deltax>0)\r
+               d[1]= east;\r
+       else if (deltax<0)\r
+               d[1]= west;\r
+       if (deltay>0)\r
+               d[2]=south;\r
+       else if (deltay<0)\r
+               d[2]=north;\r
+\r
+       if (abs(deltay)>abs(deltax))\r
+       {\r
+               tdir=d[1];\r
+               d[1]=d[2];\r
+               d[2]=tdir;\r
+       }\r
+\r
+       if (d[1]==turnaround)\r
+               d[1]=nodir;\r
+       if (d[2]==turnaround)\r
+               d[2]=nodir;\r
+\r
+\r
+       if (d[1]!=nodir)\r
+       {\r
+               ob->dir=d[1];\r
+               if (TryWalk(ob))\r
+                       return;     /*either moved forward or attacked*/\r
+       }\r
+\r
+       if (d[2]!=nodir)\r
+       {\r
+               ob->dir=d[2];\r
+               if (TryWalk(ob))\r
+                       return;\r
+       }\r
+\r
+/* there is no direct path to the player, so pick another direction */\r
+\r
+       if (olddir!=nodir)\r
+       {\r
+               ob->dir=olddir;\r
+               if (TryWalk(ob))\r
+                       return;\r
+       }\r
+\r
+       if (US_RndT()>128)      /*randomly determine direction of search*/\r
+       {\r
+               for (tdir=north;tdir<=west;tdir++)\r
+               {\r
+                       if (tdir!=turnaround)\r
+                       {\r
+                               ob->dir=tdir;\r
+                               if ( TryWalk(ob) )\r
+                                       return;\r
+                       }\r
+               }\r
+       }\r
+       else\r
+       {\r
+               for (tdir=west;tdir>=north;tdir--)\r
+               {\r
+                       if (tdir!=turnaround)\r
+                       {\r
+                         ob->dir=tdir;\r
+                         if ( TryWalk(ob) )\r
+                               return;\r
+                       }\r
+               }\r
+       }\r
+\r
+       if (turnaround !=  nodir)\r
+       {\r
+               ob->dir=turnaround;\r
+               if (ob->dir != nodir)\r
+               {\r
+                       if ( TryWalk(ob) )\r
+                               return;\r
+               }\r
+       }\r
+\r
+       ob->dir = nodir;                // can't move\r
+}\r
+\r
+\r
+/*\r
+============================\r
+=\r
+= SelectRunDir\r
+=\r
+= Run Away from player\r
+=\r
+============================\r
+*/\r
+\r
+void SelectRunDir (objtype *ob)\r
+{\r
+       int deltax,deltay,i;\r
+       dirtype d[3];\r
+       dirtype tdir, olddir, turnaround;\r
+\r
+\r
+       deltax=player->tilex - ob->tilex;\r
+       deltay=player->tiley - ob->tiley;\r
+\r
+       if (deltax<0)\r
+               d[1]= east;\r
+       else\r
+               d[1]= west;\r
+       if (deltay<0)\r
+               d[2]=south;\r
+       else\r
+               d[2]=north;\r
+\r
+       if (abs(deltay)>abs(deltax))\r
+       {\r
+               tdir=d[1];\r
+               d[1]=d[2];\r
+               d[2]=tdir;\r
+       }\r
+\r
+       ob->dir=d[1];\r
+       if (TryWalk(ob))\r
+               return;     /*either moved forward or attacked*/\r
+\r
+       ob->dir=d[2];\r
+       if (TryWalk(ob))\r
+               return;\r
+\r
+/* there is no direct path to the player, so pick another direction */\r
+\r
+       if (US_RndT()>128)      /*randomly determine direction of search*/\r
+       {\r
+               for (tdir=north;tdir<=west;tdir++)\r
+               {\r
+                       ob->dir=tdir;\r
+                       if ( TryWalk(ob) )\r
+                               return;\r
+               }\r
+       }\r
+       else\r
+       {\r
+               for (tdir=west;tdir>=north;tdir--)\r
+               {\r
+                       ob->dir=tdir;\r
+                       if ( TryWalk(ob) )\r
+                         return;\r
+               }\r
+       }\r
+\r
+       ob->dir = nodir;                // can't move\r
+}\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= MoveObj\r
+=\r
+= Moves ob be move global units in ob->dir direction\r
+= Actors are not allowed to move inside the player\r
+= Does NOT check to see if the move is tile map valid\r
+=\r
+= ob->x                        = adjusted for new position\r
+= ob->y\r
+=\r
+=================\r
+*/\r
+\r
+void MoveObj (objtype *ob, long move)\r
+{\r
+       long    deltax,deltay;\r
+\r
+       switch (ob->dir)\r
+       {\r
+       case north:\r
+               ob->y -= move;\r
+               break;\r
+       case northeast:\r
+               ob->x += move;\r
+               ob->y -= move;\r
+               break;\r
+       case east:\r
+               ob->x += move;\r
+               break;\r
+       case southeast:\r
+               ob->x += move;\r
+               ob->y += move;\r
+               break;\r
+       case south:\r
+               ob->y += move;\r
+               break;\r
+       case southwest:\r
+               ob->x -= move;\r
+               ob->y += move;\r
+               break;\r
+       case west:\r
+               ob->x -= move;\r
+               break;\r
+       case northwest:\r
+               ob->x -= move;\r
+               ob->y -= move;\r
+               break;\r
+\r
+       case nodir:\r
+               return;\r
+\r
+       default:\r
+               Quit ("MoveObj: bad dir!");\r
+       }\r
+\r
+//\r
+// check to make sure it's not on top of player\r
+//\r
+       if (areabyplayer[ob->areanumber])\r
+       {\r
+               deltax = ob->x - player->x;\r
+               if (deltax < -MINACTORDIST || deltax > MINACTORDIST)\r
+                       goto moveok;\r
+               deltay = ob->y - player->y;\r
+               if (deltay < -MINACTORDIST || deltay > MINACTORDIST)\r
+                       goto moveok;\r
+\r
+               if (ob->obclass == ghostobj || ob->obclass == spectreobj)\r
+                       TakeDamage (tics*2,ob);\r
+\r
+       //\r
+       // back up\r
+       //\r
+               switch (ob->dir)\r
+               {\r
+               case north:\r
+                       ob->y += move;\r
+                       break;\r
+               case northeast:\r
+                       ob->x -= move;\r
+                       ob->y += move;\r
+                       break;\r
+               case east:\r
+                       ob->x -= move;\r
+                       break;\r
+               case southeast:\r
+                       ob->x -= move;\r
+                       ob->y -= move;\r
+                       break;\r
+               case south:\r
+                       ob->y -= move;\r
+                       break;\r
+               case southwest:\r
+                       ob->x += move;\r
+                       ob->y -= move;\r
+                       break;\r
+               case west:\r
+                       ob->x += move;\r
+                       break;\r
+               case northwest:\r
+                       ob->x += move;\r
+                       ob->y += move;\r
+                       break;\r
+\r
+               case nodir:\r
+                       return;\r
+               }\r
+               return;\r
+       }\r
+moveok:\r
+       ob->distance -=move;\r
+}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       STUFF\r
+\r
+=============================================================================\r
+*/\r
+\r
+/*\r
+===============\r
+=\r
+= DropItem\r
+=\r
+= Tries to drop a bonus item somewhere in the tiles surrounding the\r
+= given tilex/tiley\r
+=\r
+===============\r
+*/\r
+\r
+void DropItem (stat_t itemtype, int tilex, int tiley)\r
+{\r
+       int     x,y,xl,xh,yl,yh;\r
+\r
+//\r
+// find a free spot to put it in\r
+//\r
+       if (!actorat[tilex][tiley])\r
+       {\r
+               PlaceItemType (itemtype, tilex,tiley);\r
+               return;\r
+       }\r
+\r
+       xl = tilex-1;\r
+       xh = tilex+1;\r
+       yl = tiley-1;\r
+       yh = tiley+1;\r
+\r
+       for (x=xl ; x<= xh ; x++)\r
+               for (y=yl ; y<= yh ; y++)\r
+                       if (!actorat[x][y])\r
+                       {\r
+                               PlaceItemType (itemtype, x,y);\r
+                               return;\r
+                       }\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= KillActor\r
+=\r
+===============\r
+*/\r
+\r
+void KillActor (objtype *ob)\r
+{\r
+       int     tilex,tiley;\r
+\r
+       tilex = ob->tilex = ob->x >> TILESHIFT;         // drop item on center\r
+       tiley = ob->tiley = ob->y >> TILESHIFT;\r
+\r
+       switch (ob->obclass)\r
+       {\r
+       case guardobj:\r
+               GivePoints (100);\r
+               NewState (ob,&s_grddie1);\r
+               PlaceItemType (bo_clip2,tilex,tiley);\r
+               break;\r
+\r
+       case officerobj:\r
+               GivePoints (400);\r
+               NewState (ob,&s_ofcdie1);\r
+               PlaceItemType (bo_clip2,tilex,tiley);\r
+               break;\r
+\r
+       case mutantobj:\r
+               GivePoints (700);\r
+               NewState (ob,&s_mutdie1);\r
+               PlaceItemType (bo_clip2,tilex,tiley);\r
+               break;\r
+\r
+       case ssobj:\r
+               GivePoints (500);\r
+               NewState (ob,&s_ssdie1);\r
+               if (gamestate.bestweapon < wp_machinegun)\r
+                       PlaceItemType (bo_machinegun,tilex,tiley);\r
+               else\r
+                       PlaceItemType (bo_clip2,tilex,tiley);\r
+               break;\r
+\r
+       case dogobj:\r
+               GivePoints (200);\r
+               NewState (ob,&s_dogdie1);\r
+               break;\r
+\r
+#ifndef SPEAR\r
+       case bossobj:\r
+               GivePoints (5000);\r
+               NewState (ob,&s_bossdie1);\r
+               PlaceItemType (bo_key1,tilex,tiley);\r
+               break;\r
+\r
+       case gretelobj:\r
+               GivePoints (5000);\r
+               NewState (ob,&s_greteldie1);\r
+               PlaceItemType (bo_key1,tilex,tiley);\r
+               break;\r
+\r
+       case giftobj:\r
+               GivePoints (5000);\r
+               gamestate.killx = player->x;\r
+               gamestate.killy = player->y;\r
+               NewState (ob,&s_giftdie1);\r
+               break;\r
+\r
+       case fatobj:\r
+               GivePoints (5000);\r
+               gamestate.killx = player->x;\r
+               gamestate.killy = player->y;\r
+               NewState (ob,&s_fatdie1);\r
+               break;\r
+\r
+       case schabbobj:\r
+               GivePoints (5000);\r
+               gamestate.killx = player->x;\r
+               gamestate.killy = player->y;\r
+               NewState (ob,&s_schabbdie1);\r
+               A_DeathScream(ob);\r
+               break;\r
+       case fakeobj:\r
+               GivePoints (2000);\r
+               NewState (ob,&s_fakedie1);\r
+               break;\r
+\r
+       case mechahitlerobj:\r
+               GivePoints (5000);\r
+               NewState (ob,&s_mechadie1);\r
+               break;\r
+       case realhitlerobj:\r
+               GivePoints (5000);\r
+               gamestate.killx = player->x;\r
+               gamestate.killy = player->y;\r
+               NewState (ob,&s_hitlerdie1);\r
+               A_DeathScream(ob);\r
+               break;\r
+#else\r
+       case spectreobj:\r
+               GivePoints (200);\r
+               NewState (ob,&s_spectredie1);\r
+               break;\r
+\r
+       case angelobj:\r
+               GivePoints (5000);\r
+               NewState (ob,&s_angeldie1);\r
+               break;\r
+\r
+       case transobj:\r
+               GivePoints (5000);\r
+               NewState (ob,&s_transdie0);\r
+               PlaceItemType (bo_key1,tilex,tiley);\r
+               break;\r
+\r
+       case uberobj:\r
+               GivePoints (5000);\r
+               NewState (ob,&s_uberdie0);\r
+               PlaceItemType (bo_key1,tilex,tiley);\r
+               break;\r
+\r
+       case willobj:\r
+               GivePoints (5000);\r
+               NewState (ob,&s_willdie1);\r
+               PlaceItemType (bo_key1,tilex,tiley);\r
+               break;\r
+\r
+       case deathobj:\r
+               GivePoints (5000);\r
+               NewState (ob,&s_deathdie1);\r
+               PlaceItemType (bo_key1,tilex,tiley);\r
+               break;\r
+#endif\r
+       }\r
+\r
+       gamestate.killcount++;\r
+       ob->flags &= ~FL_SHOOTABLE;\r
+       actorat[ob->tilex][ob->tiley] = NULL;\r
+       ob->flags |= FL_NONMARK;\r
+}\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= DamageActor\r
+=\r
+= Called when the player succesfully hits an enemy.\r
+=\r
+= Does damage points to enemy ob, either putting it into a stun frame or\r
+= killing it.\r
+=\r
+===================\r
+*/\r
+\r
+void DamageActor (objtype *ob, unsigned damage)\r
+{\r
+       madenoise = true;\r
+\r
+//\r
+// do double damage if shooting a non attack mode actor\r
+//\r
+       if ( !(ob->flags & FL_ATTACKMODE) )\r
+               damage <<= 1;\r
+\r
+       ob->hitpoints -= damage;\r
+\r
+       if (ob->hitpoints<=0)\r
+               KillActor (ob);\r
+       else\r
+       {\r
+               if (! (ob->flags & FL_ATTACKMODE) )\r
+                       FirstSighting (ob);             // put into combat mode\r
+\r
+               switch (ob->obclass)            // dogs only have one hit point\r
+               {\r
+               case guardobj:\r
+                       if (ob->hitpoints&1)\r
+                               NewState (ob,&s_grdpain);\r
+                       else\r
+                               NewState (ob,&s_grdpain1);\r
+                       break;\r
+\r
+               case officerobj:\r
+                       if (ob->hitpoints&1)\r
+                               NewState (ob,&s_ofcpain);\r
+                       else\r
+                               NewState (ob,&s_ofcpain1);\r
+                       break;\r
+\r
+               case mutantobj:\r
+                       if (ob->hitpoints&1)\r
+                               NewState (ob,&s_mutpain);\r
+                       else\r
+                               NewState (ob,&s_mutpain1);\r
+                       break;\r
+\r
+               case ssobj:\r
+                       if (ob->hitpoints&1)\r
+                               NewState (ob,&s_sspain);\r
+                       else\r
+                               NewState (ob,&s_sspain1);\r
+\r
+                       break;\r
+\r
+               }\r
+       }\r
+}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       CHECKSIGHT\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= CheckLine\r
+=\r
+= Returns true if a straight line between the player and ob is unobstructed\r
+=\r
+=====================\r
+*/\r
+\r
+boolean CheckLine (objtype *ob)\r
+{\r
+       int     x1,y1,xt1,yt1,x2,y2,xt2,yt2;\r
+       int     x,y;\r
+       int     xdist,ydist,xstep,ystep;\r
+       int     temp;\r
+       int     partial,delta;\r
+       long    ltemp;\r
+       int     xfrac,yfrac,deltafrac;\r
+       unsigned        value,intercept;\r
+\r
+       x1 = ob->x >> UNSIGNEDSHIFT;            // 1/256 tile precision\r
+       y1 = ob->y >> UNSIGNEDSHIFT;\r
+       xt1 = x1 >> 8;\r
+       yt1 = y1 >> 8;\r
+\r
+       x2 = plux;\r
+       y2 = pluy;\r
+       xt2 = player->tilex;\r
+       yt2 = player->tiley;\r
+\r
+\r
+       xdist = abs(xt2-xt1);\r
+\r
+       if (xdist > 0)\r
+       {\r
+               if (xt2 > xt1)\r
+               {\r
+                       partial = 256-(x1&0xff);\r
+                       xstep = 1;\r
+               }\r
+               else\r
+               {\r
+                       partial = x1&0xff;\r
+                       xstep = -1;\r
+               }\r
+\r
+               deltafrac = abs(x2-x1);\r
+               delta = y2-y1;\r
+               ltemp = ((long)delta<<8)/deltafrac;\r
+               if (ltemp > 0x7fffl)\r
+                       ystep = 0x7fff;\r
+               else if (ltemp < -0x7fffl)\r
+                       ystep = -0x7fff;\r
+               else\r
+                       ystep = ltemp;\r
+               yfrac = y1 + (((long)ystep*partial) >>8);\r
+\r
+               x = xt1+xstep;\r
+               xt2 += xstep;\r
+               do\r
+               {\r
+                       y = yfrac>>8;\r
+                       yfrac += ystep;\r
+\r
+                       value = (unsigned)tilemap[x][y];\r
+                       x += xstep;\r
+\r
+                       if (!value)\r
+                               continue;\r
+\r
+                       if (value<128 || value>256)\r
+                               return false;\r
+\r
+                       //\r
+                       // see if the door is open enough\r
+                       //\r
+                       value &= ~0x80;\r
+                       intercept = yfrac-ystep/2;\r
+\r
+                       if (intercept>doorposition[value])\r
+                               return false;\r
+\r
+               } while (x != xt2);\r
+       }\r
+\r
+       ydist = abs(yt2-yt1);\r
+\r
+       if (ydist > 0)\r
+       {\r
+               if (yt2 > yt1)\r
+               {\r
+                       partial = 256-(y1&0xff);\r
+                       ystep = 1;\r
+               }\r
+               else\r
+               {\r
+                       partial = y1&0xff;\r
+                       ystep = -1;\r
+               }\r
+\r
+               deltafrac = abs(y2-y1);\r
+               delta = x2-x1;\r
+               ltemp = ((long)delta<<8)/deltafrac;\r
+               if (ltemp > 0x7fffl)\r
+                       xstep = 0x7fff;\r
+               else if (ltemp < -0x7fffl)\r
+                       xstep = -0x7fff;\r
+               else\r
+                       xstep = ltemp;\r
+               xfrac = x1 + (((long)xstep*partial) >>8);\r
+\r
+               y = yt1 + ystep;\r
+               yt2 += ystep;\r
+               do\r
+               {\r
+                       x = xfrac>>8;\r
+                       xfrac += xstep;\r
+\r
+                       value = (unsigned)tilemap[x][y];\r
+                       y += ystep;\r
+\r
+                       if (!value)\r
+                               continue;\r
+\r
+                       if (value<128 || value>256)\r
+                               return false;\r
+\r
+                       //\r
+                       // see if the door is open enough\r
+                       //\r
+                       value &= ~0x80;\r
+                       intercept = xfrac-xstep/2;\r
+\r
+                       if (intercept>doorposition[value])\r
+                               return false;\r
+               } while (y != yt2);\r
+       }\r
+\r
+       return true;\r
+}\r
+\r
+\r
+\r
+/*\r
+================\r
+=\r
+= CheckSight\r
+=\r
+= Checks a straight line between player and current object\r
+=\r
+= If the sight is ok, check alertness and angle to see if they notice\r
+=\r
+= returns true if the player has been spoted\r
+=\r
+================\r
+*/\r
+\r
+#define MINSIGHT       0x18000l\r
+\r
+boolean CheckSight (objtype *ob)\r
+{\r
+       long            deltax,deltay;\r
+\r
+//\r
+// don't bother tracing a line if the area isn't connected to the player's\r
+//\r
+       if (!areabyplayer[ob->areanumber])\r
+               return false;\r
+\r
+//\r
+// if the player is real close, sight is automatic\r
+//\r
+       deltax = player->x - ob->x;\r
+       deltay = player->y - ob->y;\r
+\r
+       if (deltax > -MINSIGHT && deltax < MINSIGHT\r
+       && deltay > -MINSIGHT && deltay < MINSIGHT)\r
+               return true;\r
+\r
+//\r
+// see if they are looking in the right direction\r
+//\r
+       switch (ob->dir)\r
+       {\r
+       case north:\r
+               if (deltay > 0)\r
+                       return false;\r
+               break;\r
+\r
+       case east:\r
+               if (deltax < 0)\r
+                       return false;\r
+               break;\r
+\r
+       case south:\r
+               if (deltay < 0)\r
+                       return false;\r
+               break;\r
+\r
+       case west:\r
+               if (deltax > 0)\r
+                       return false;\r
+               break;\r
+       }\r
+\r
+//\r
+// trace a line to check for blocking tiles (corners)\r
+//\r
+       return CheckLine (ob);\r
+\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= FirstSighting\r
+=\r
+= Puts an actor into attack mode and possibly reverses the direction\r
+= if the player is behind it\r
+=\r
+===============\r
+*/\r
+\r
+void FirstSighting (objtype *ob)\r
+{\r
+//\r
+// react to the player\r
+//\r
+       switch (ob->obclass)\r
+       {\r
+       case guardobj:\r
+               PlaySoundLocActor(HALTSND,ob);\r
+               NewState (ob,&s_grdchase1);\r
+               ob->speed *= 3;                 // go faster when chasing player\r
+               break;\r
+\r
+       case officerobj:\r
+               PlaySoundLocActor(SPIONSND,ob);\r
+               NewState (ob,&s_ofcchase1);\r
+               ob->speed *= 5;                 // go faster when chasing player\r
+               break;\r
+\r
+       case mutantobj:\r
+               NewState (ob,&s_mutchase1);\r
+               ob->speed *= 3;                 // go faster when chasing player\r
+               break;\r
+\r
+       case ssobj:\r
+               PlaySoundLocActor(SCHUTZADSND,ob);\r
+               NewState (ob,&s_sschase1);\r
+               ob->speed *= 4;                 // go faster when chasing player\r
+               break;\r
+\r
+       case dogobj:\r
+               PlaySoundLocActor(DOGBARKSND,ob);\r
+               NewState (ob,&s_dogchase1);\r
+               ob->speed *= 2;                 // go faster when chasing player\r
+               break;\r
+\r
+#ifndef SPEAR\r
+       case bossobj:\r
+               SD_PlaySound(GUTENTAGSND);\r
+               NewState (ob,&s_bosschase1);\r
+               ob->speed = SPDPATROL*3;        // go faster when chasing player\r
+               break;\r
+\r
+       case gretelobj:\r
+               SD_PlaySound(KEINSND);\r
+               NewState (ob,&s_gretelchase1);\r
+               ob->speed *= 3;                 // go faster when chasing player\r
+               break;\r
+\r
+       case giftobj:\r
+               SD_PlaySound(EINESND);\r
+               NewState (ob,&s_giftchase1);\r
+               ob->speed *= 3;                 // go faster when chasing player\r
+               break;\r
+\r
+       case fatobj:\r
+               SD_PlaySound(ERLAUBENSND);\r
+               NewState (ob,&s_fatchase1);\r
+               ob->speed *= 3;                 // go faster when chasing player\r
+               break;\r
+\r
+       case schabbobj:\r
+               SD_PlaySound(SCHABBSHASND);\r
+               NewState (ob,&s_schabbchase1);\r
+               ob->speed *= 3;                 // go faster when chasing player\r
+               break;\r
+\r
+       case fakeobj:\r
+               SD_PlaySound(TOT_HUNDSND);\r
+               NewState (ob,&s_fakechase1);\r
+               ob->speed *= 3;                 // go faster when chasing player\r
+               break;\r
+\r
+       case mechahitlerobj:\r
+               SD_PlaySound(DIESND);\r
+               NewState (ob,&s_mechachase1);\r
+               ob->speed *= 3;                 // go faster when chasing player\r
+               break;\r
+\r
+       case realhitlerobj:\r
+               SD_PlaySound(DIESND);\r
+               NewState (ob,&s_hitlerchase1);\r
+               ob->speed *= 5;                 // go faster when chasing player\r
+               break;\r
+\r
+       case ghostobj:\r
+               NewState (ob,&s_blinkychase1);\r
+               ob->speed *= 2;                 // go faster when chasing player\r
+               break;\r
+#else\r
+\r
+       case spectreobj:\r
+               SD_PlaySound(GHOSTSIGHTSND);\r
+               NewState (ob,&s_spectrechase1);\r
+               ob->speed = 800;                        // go faster when chasing player\r
+               break;\r
+\r
+       case angelobj:\r
+               SD_PlaySound(ANGELSIGHTSND);\r
+               NewState (ob,&s_angelchase1);\r
+               ob->speed = 1536;                       // go faster when chasing player\r
+               break;\r
+\r
+       case transobj:\r
+               SD_PlaySound(TRANSSIGHTSND);\r
+               NewState (ob,&s_transchase1);\r
+               ob->speed = 1536;                       // go faster when chasing player\r
+               break;\r
+\r
+       case uberobj:\r
+               NewState (ob,&s_uberchase1);\r
+               ob->speed = 3000;                       // go faster when chasing player\r
+               break;\r
+\r
+       case willobj:\r
+               SD_PlaySound(WILHELMSIGHTSND);\r
+               NewState (ob,&s_willchase1);\r
+               ob->speed = 2048;                       // go faster when chasing player\r
+               break;\r
+\r
+       case deathobj:\r
+               SD_PlaySound(KNIGHTSIGHTSND);\r
+               NewState (ob,&s_deathchase1);\r
+               ob->speed = 2048;                       // go faster when chasing player\r
+               break;\r
+\r
+#endif\r
+       }\r
+\r
+       if (ob->distance < 0)\r
+               ob->distance = 0;       // ignore the door opening command\r
+\r
+       ob->flags |= FL_ATTACKMODE|FL_FIRSTATTACK;\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SightPlayer\r
+=\r
+= Called by actors that ARE NOT chasing the player.  If the player\r
+= is detected (by sight, noise, or proximity), the actor is put into\r
+= it's combat frame and true is returned.\r
+=\r
+= Incorporates a random reaction delay\r
+=\r
+===============\r
+*/\r
+\r
+boolean SightPlayer (objtype *ob)\r
+{\r
+       if (ob->flags & FL_ATTACKMODE)\r
+               Quit ("An actor in ATTACKMODE called SightPlayer!");\r
+\r
+       if (ob->temp2)\r
+       {\r
+       //\r
+       // count down reaction time\r
+       //\r
+               ob->temp2 -= tics;\r
+               if (ob->temp2 > 0)\r
+                       return false;\r
+               ob->temp2 = 0;                                  // time to react\r
+       }\r
+       else\r
+       {\r
+               if (!areabyplayer[ob->areanumber])\r
+                       return false;\r
+\r
+               if (ob->flags & FL_AMBUSH)\r
+               {\r
+                       if (!CheckSight (ob))\r
+                               return false;\r
+                       ob->flags &= ~FL_AMBUSH;\r
+               }\r
+               else\r
+               {\r
+                       if (!madenoise && !CheckSight (ob))\r
+                               return false;\r
+               }\r
+\r
+\r
+               switch (ob->obclass)\r
+               {\r
+               case guardobj:\r
+                       ob->temp2 = 1+US_RndT()/4;\r
+                       break;\r
+               case officerobj:\r
+                       ob->temp2 = 2;\r
+                       break;\r
+               case mutantobj:\r
+                       ob->temp2 = 1+US_RndT()/6;\r
+                       break;\r
+               case ssobj:\r
+                       ob->temp2 = 1+US_RndT()/6;\r
+                       break;\r
+               case dogobj:\r
+                       ob->temp2 = 1+US_RndT()/8;\r
+                       break;\r
+\r
+               case bossobj:\r
+               case schabbobj:\r
+               case fakeobj:\r
+               case mechahitlerobj:\r
+               case realhitlerobj:\r
+               case gretelobj:\r
+               case giftobj:\r
+               case fatobj:\r
+               case spectreobj:\r
+               case angelobj:\r
+               case transobj:\r
+               case uberobj:\r
+               case willobj:\r
+               case deathobj:\r
+                       ob->temp2 = 1;\r
+                       break;\r
+               }\r
+               return false;\r
+       }\r
+\r
+       FirstSighting (ob);\r
+\r
+       return true;\r
+}\r
+\r
+\r
diff --git a/16/wf3d8086/wl_text.c b/16/wf3d8086/wl_text.c
new file mode 100755 (executable)
index 0000000..1df86b8
--- /dev/null
@@ -0,0 +1,859 @@
+// WL_TEXT.C\r
+\r
+#include "WL_DEF.H"\r
+#pragma        hdrstop\r
+\r
+/*\r
+=============================================================================\r
+\r
+TEXT FORMATTING COMMANDS\r
+------------------------\r
+^C<hex digit>                          Change text color\r
+^E[enter]                              End of layout (all pages)\r
+^G<y>,<x>,<pic>[enter] Draw a graphic and push margins\r
+^P[enter]                              start new page, must be the first chars in a layout\r
+^L<x>,<y>[ENTER]               Locate to a specific spot, x in pixels, y in lines\r
+\r
+=============================================================================\r
+*/\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#define BACKCOLOR              0x11\r
+\r
+\r
+#define WORDLIMIT              80\r
+#define FONTHEIGHT             10\r
+#define        TOPMARGIN               16\r
+#define BOTTOMMARGIN   32\r
+#define LEFTMARGIN             16\r
+#define RIGHTMARGIN            16\r
+#define PICMARGIN              8\r
+#define TEXTROWS               ((200-TOPMARGIN-BOTTOMMARGIN)/FONTHEIGHT)\r
+#define        SPACEWIDTH              7\r
+#define SCREENPIXWIDTH 320\r
+#define SCREENMID              (SCREENPIXWIDTH/2)\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+int                    pagenum,numpages;\r
+\r
+unsigned       leftmargin[TEXTROWS],rightmargin[TEXTROWS];\r
+char           far *text;\r
+unsigned       rowon;\r
+\r
+int                    picx,picy,picnum,picdelay;\r
+boolean                layoutdone;\r
+\r
+//===========================================================================\r
+\r
+#ifndef JAPAN\r
+/*\r
+=====================\r
+=\r
+= RipToEOL\r
+=\r
+=====================\r
+*/\r
+\r
+void RipToEOL (void)\r
+{\r
+       while (*text++ != '\n')         // scan to end of line\r
+       ;\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= ParseNumber\r
+=\r
+=====================\r
+*/\r
+\r
+int    ParseNumber (void)\r
+{\r
+       char    ch;\r
+       char    num[80],*numptr;\r
+\r
+//\r
+// scan until a number is found\r
+//\r
+       ch = *text;\r
+       while (ch < '0' || ch >'9')\r
+               ch = *++text;\r
+\r
+//\r
+// copy the number out\r
+//\r
+       numptr = num;\r
+       do\r
+       {\r
+               *numptr++ = ch;\r
+               ch = *++text;\r
+       } while (ch >= '0' && ch <= '9');\r
+       *numptr = 0;\r
+\r
+       return atoi (num);\r
+}\r
+\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= ParsePicCommand\r
+=\r
+= Call with text pointing just after a ^P\r
+= Upon exit text points to the start of next line\r
+=\r
+=====================\r
+*/\r
+\r
+void   ParsePicCommand (void)\r
+{\r
+       picy=ParseNumber();\r
+       picx=ParseNumber();\r
+       picnum=ParseNumber();\r
+       RipToEOL ();\r
+}\r
+\r
+\r
+void   ParseTimedCommand (void)\r
+{\r
+       picy=ParseNumber();\r
+       picx=ParseNumber();\r
+       picnum=ParseNumber();\r
+       picdelay=ParseNumber();\r
+       RipToEOL ();\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= TimedPicCommand\r
+=\r
+= Call with text pointing just after a ^P\r
+= Upon exit text points to the start of next line\r
+=\r
+=====================\r
+*/\r
+\r
+void   TimedPicCommand (void)\r
+{\r
+       ParseTimedCommand ();\r
+\r
+//\r
+// update the screen, and wait for time delay\r
+//\r
+       VW_UpdateScreen ();\r
+\r
+//\r
+// wait for time\r
+//\r
+       TimeCount = 0;\r
+       while (TimeCount < picdelay)\r
+       ;\r
+\r
+//\r
+// draw pic\r
+//\r
+       VWB_DrawPic (picx&~7,picy,picnum);\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= HandleCommand\r
+=\r
+=====================\r
+*/\r
+\r
+void HandleCommand (void)\r
+{\r
+       int     i,margin,top,bottom;\r
+       int     picwidth,picheight,picmid;\r
+\r
+       switch (toupper(*++text))\r
+       {\r
+       case 'B':\r
+               picy=ParseNumber();\r
+               picx=ParseNumber();\r
+               picwidth=ParseNumber();\r
+               picheight=ParseNumber();\r
+               VWB_Bar(picx,picy,picwidth,picheight,BACKCOLOR);\r
+               RipToEOL();\r
+               break;\r
+       case ';':               // comment\r
+               RipToEOL();\r
+               break;\r
+       case 'P':               // ^P is start of next page, ^E is end of file\r
+       case 'E':\r
+               layoutdone = true;\r
+               text--;         // back up to the '^'\r
+               break;\r
+\r
+       case 'C':               // ^c<hex digit> changes text color\r
+               i = toupper(*++text);\r
+               if (i>='0' && i<='9')\r
+                       fontcolor = i-'0';\r
+               else if (i>='A' && i<='F')\r
+                       fontcolor = i-'A'+10;\r
+\r
+               fontcolor *= 16;\r
+               i = toupper(*++text);\r
+               if (i>='0' && i<='9')\r
+                       fontcolor += i-'0';\r
+               else if (i>='A' && i<='F')\r
+                       fontcolor += i-'A'+10;\r
+               text++;\r
+               break;\r
+\r
+       case '>':\r
+               px = 160;\r
+               text++;\r
+               break;\r
+\r
+       case 'L':\r
+               py=ParseNumber();\r
+               rowon = (py-TOPMARGIN)/FONTHEIGHT;\r
+               py = TOPMARGIN+rowon*FONTHEIGHT;\r
+               px=ParseNumber();\r
+               while (*text++ != '\n')         // scan to end of line\r
+               ;\r
+               break;\r
+\r
+       case 'T':               // ^Tyyy,xxx,ppp,ttt waits ttt tics, then draws pic\r
+               TimedPicCommand ();\r
+               break;\r
+\r
+       case 'G':               // ^Gyyy,xxx,ppp draws graphic\r
+               ParsePicCommand ();\r
+               VWB_DrawPic (picx&~7,picy,picnum);\r
+               picwidth = pictable[picnum-STARTPICS].width;\r
+               picheight = pictable[picnum-STARTPICS].height;\r
+               //\r
+               // adjust margins\r
+               //\r
+               picmid = picx + picwidth/2;\r
+               if (picmid > SCREENMID)\r
+                       margin = picx-PICMARGIN;                        // new right margin\r
+               else\r
+                       margin = picx+picwidth+PICMARGIN;       // new left margin\r
+\r
+               top = (picy-TOPMARGIN)/FONTHEIGHT;\r
+               if (top<0)\r
+                       top = 0;\r
+               bottom = (picy+picheight-TOPMARGIN)/FONTHEIGHT;\r
+               if (bottom>=TEXTROWS)\r
+                       bottom = TEXTROWS-1;\r
+\r
+               for (i=top;i<=bottom;i++)\r
+                       if (picmid > SCREENMID)\r
+                               rightmargin[i] = margin;\r
+                       else\r
+                               leftmargin[i] = margin;\r
+\r
+               //\r
+               // adjust this line if needed\r
+               //\r
+               if (px < leftmargin[rowon])\r
+                       px = leftmargin[rowon];\r
+               break;\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= NewLine\r
+=\r
+=====================\r
+*/\r
+\r
+void NewLine (void)\r
+{\r
+       char    ch;\r
+\r
+       if (++rowon == TEXTROWS)\r
+       {\r
+       //\r
+       // overflowed the page, so skip until next page break\r
+       //\r
+               layoutdone = true;\r
+               do\r
+               {\r
+                       if (*text == '^')\r
+                       {\r
+                               ch = toupper(*(text+1));\r
+                               if (ch == 'E' || ch == 'P')\r
+                               {\r
+                                       layoutdone = true;\r
+                                       return;\r
+                               }\r
+                       }\r
+                       text++;\r
+\r
+               } while (1);\r
+\r
+       }\r
+       px = leftmargin[rowon];\r
+       py+= FONTHEIGHT;\r
+}\r
+\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= HandleCtrls\r
+=\r
+=====================\r
+*/\r
+\r
+void HandleCtrls (void)\r
+{\r
+       char    ch;\r
+\r
+       ch = *text++;                   // get the character and advance\r
+\r
+       if (ch == '\n')\r
+       {\r
+               NewLine ();\r
+               return;\r
+       }\r
+\r
+}\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= HandleWord\r
+=\r
+=====================\r
+*/\r
+\r
+void HandleWord (void)\r
+{\r
+       char            word[WORDLIMIT];\r
+       int                     i,wordindex;\r
+       unsigned        wwidth,wheight,newpos;\r
+\r
+\r
+       //\r
+       // copy the next word into [word]\r
+       //\r
+       word[0] = *text++;\r
+       wordindex = 1;\r
+       while (*text>32)\r
+       {\r
+               word[wordindex] = *text++;\r
+               if (++wordindex == WORDLIMIT)\r
+                       Quit ("PageLayout: Word limit exceeded");\r
+       }\r
+       word[wordindex] = 0;            // stick a null at end for C\r
+\r
+       //\r
+       // see if it fits on this line\r
+       //\r
+       VW_MeasurePropString (word,&wwidth,&wheight);\r
+\r
+       while (px+wwidth > rightmargin[rowon])\r
+       {\r
+               NewLine ();\r
+               if (layoutdone)\r
+                       return;         // overflowed page\r
+       }\r
+\r
+       //\r
+       // print it\r
+       //\r
+       newpos = px+wwidth;\r
+       VWB_DrawPropString (word);\r
+       px = newpos;\r
+\r
+       //\r
+       // suck up any extra spaces\r
+       //\r
+       while (*text == ' ')\r
+       {\r
+               px += SPACEWIDTH;\r
+               text++;\r
+       }\r
+}\r
+\r
+/*\r
+=====================\r
+=\r
+= PageLayout\r
+=\r
+= Clears the screen, draws the pics on the page, and word wraps the text.\r
+= Returns a pointer to the terminating command\r
+=\r
+=====================\r
+*/\r
+\r
+void PageLayout (boolean shownumber)\r
+{\r
+       int             i,oldfontcolor;\r
+       char    ch;\r
+\r
+       oldfontcolor = fontcolor;\r
+\r
+       fontcolor = 0;\r
+\r
+//\r
+// clear the screen\r
+//\r
+       VWB_Bar (0,0,320,200,BACKCOLOR);\r
+       VWB_DrawPic (0,0,H_TOPWINDOWPIC);\r
+       VWB_DrawPic (0,8,H_LEFTWINDOWPIC);\r
+       VWB_DrawPic (312,8,H_RIGHTWINDOWPIC);\r
+       VWB_DrawPic (8,176,H_BOTTOMINFOPIC);\r
+\r
+\r
+       for (i=0;i<TEXTROWS;i++)\r
+       {\r
+               leftmargin[i] = LEFTMARGIN;\r
+               rightmargin[i] = SCREENPIXWIDTH-RIGHTMARGIN;\r
+       }\r
+\r
+       px = LEFTMARGIN;\r
+       py = TOPMARGIN;\r
+       rowon = 0;\r
+       layoutdone = false;\r
+\r
+//\r
+// make sure we are starting layout text (^P first command)\r
+//\r
+       while (*text <= 32)\r
+               text++;\r
+\r
+       if (*text != '^' || toupper(*++text) != 'P')\r
+               Quit ("PageLayout: Text not headed with ^P");\r
+\r
+       while (*text++ != '\n')\r
+       ;\r
+\r
+\r
+//\r
+// process text stream\r
+//\r
+       do\r
+       {\r
+               ch = *text;\r
+\r
+               if (ch == '^')\r
+                       HandleCommand ();\r
+               else\r
+               if (ch == 9)\r
+               {\r
+                px = (px+8)&0xf8;\r
+                text++;\r
+               }\r
+               else if (ch <= 32)\r
+                       HandleCtrls ();\r
+               else\r
+                       HandleWord ();\r
+\r
+       } while (!layoutdone);\r
+\r
+       pagenum++;\r
+\r
+       if (shownumber)\r
+       {\r
+               #ifdef SPANISH\r
+               strcpy (str,"Hoja ");\r
+               itoa (pagenum,str2,10);\r
+               strcat (str,str2);\r
+               strcat (str," de ");\r
+               py = 183;\r
+               px = 208;\r
+               #else\r
+               strcpy (str,"pg ");\r
+               itoa (pagenum,str2,10);\r
+               strcat (str,str2);\r
+               strcat (str," of ");\r
+               py = 183;\r
+               px = 213;\r
+               #endif\r
+               itoa (numpages,str2,10);\r
+               strcat (str,str2);\r
+               fontcolor = 0x4f;                          //12^BACKCOLOR;\r
+\r
+               VWB_DrawPropString (str);\r
+       }\r
+\r
+       fontcolor = oldfontcolor;\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= BackPage\r
+=\r
+= Scans for a previous ^P\r
+=\r
+=====================\r
+*/\r
+\r
+void BackPage (void)\r
+{\r
+       pagenum--;\r
+       do\r
+       {\r
+               text--;\r
+               if (*text == '^' && toupper(*(text+1)) == 'P')\r
+                       return;\r
+       } while (1);\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= CacheLayoutGraphics\r
+=\r
+= Scans an entire layout file (until a ^E) marking all graphics used, and\r
+= counting pages, then caches the graphics in\r
+=\r
+=====================\r
+*/\r
+void CacheLayoutGraphics (void)\r
+{\r
+       char    far *bombpoint, far *textstart;\r
+       char    ch;\r
+\r
+       textstart = text;\r
+       bombpoint = text+30000;\r
+       numpages = pagenum = 0;\r
+\r
+       do\r
+       {\r
+               if (*text == '^')\r
+               {\r
+                       ch = toupper(*++text);\r
+                       if (ch == 'P')          // start of a page\r
+                               numpages++;\r
+                       if (ch == 'E')          // end of file, so load graphics and return\r
+                       {\r
+                               CA_MarkGrChunk(H_TOPWINDOWPIC);\r
+                               CA_MarkGrChunk(H_LEFTWINDOWPIC);\r
+                               CA_MarkGrChunk(H_RIGHTWINDOWPIC);\r
+                               CA_MarkGrChunk(H_BOTTOMINFOPIC);\r
+                               CA_CacheMarks ();\r
+                               text = textstart;\r
+                               return;\r
+                       }\r
+                       if (ch == 'G')          // draw graphic command, so mark graphics\r
+                       {\r
+                               ParsePicCommand ();\r
+                               CA_MarkGrChunk (picnum);\r
+                       }\r
+                       if (ch == 'T')          // timed draw graphic command, so mark graphics\r
+                       {\r
+                               ParseTimedCommand ();\r
+                               CA_MarkGrChunk (picnum);\r
+                       }\r
+               }\r
+               else\r
+                       text++;\r
+\r
+       } while (text<bombpoint);\r
+\r
+       Quit ("CacheLayoutGraphics: No ^E to terminate file!");\r
+}\r
+#endif\r
+\r
+\r
+/*\r
+=====================\r
+=\r
+= ShowArticle\r
+=\r
+=====================\r
+*/\r
+\r
+#ifdef JAPAN\r
+void ShowArticle (int which)\r
+#else\r
+void ShowArticle (char far *article)\r
+#endif\r
+{\r
+       #ifdef JAPAN\r
+       int             snames[10] = {  H_HELP1PIC,\r
+                                                       H_HELP2PIC,\r
+                                                       H_HELP3PIC,\r
+                                                       H_HELP4PIC,\r
+                                                       H_HELP5PIC,\r
+                                                       H_HELP6PIC,\r
+                                                       H_HELP7PIC,\r
+                                                       H_HELP8PIC,\r
+                                                       H_HELP9PIC,\r
+                                                       H_HELP10PIC};\r
+       int             enames[14] = {\r
+                                                       0,0,\r
+                                                       #ifndef JAPDEMO\r
+                                                       C_ENDGAME1APIC,\r
+                                                       C_ENDGAME1BPIC,\r
+                                                       C_ENDGAME2APIC,\r
+                                                       C_ENDGAME2BPIC,\r
+                                                       C_ENDGAME3APIC,\r
+                                                       C_ENDGAME3BPIC,\r
+                                                       C_ENDGAME4APIC,\r
+                                                       C_ENDGAME4BPIC,\r
+                                                       C_ENDGAME5APIC,\r
+                                                       C_ENDGAME5BPIC,\r
+                                                       C_ENDGAME6APIC,\r
+                                                       C_ENDGAME6BPIC\r
+                                                       #endif\r
+                                                       };\r
+       #endif\r
+       unsigned        oldfontnumber;\r
+       unsigned        temp;\r
+       boolean         newpage,firstpage;\r
+\r
+       #ifdef JAPAN\r
+       pagenum = 1;\r
+       if (!which)\r
+               numpages = 10;\r
+       else\r
+               numpages = 2;\r
+\r
+       #else\r
+\r
+       text = article;\r
+       oldfontnumber = fontnumber;\r
+       fontnumber = 0;\r
+       CA_MarkGrChunk(STARTFONT);\r
+       VWB_Bar (0,0,320,200,BACKCOLOR);\r
+       CacheLayoutGraphics ();\r
+       #endif\r
+\r
+       newpage = true;\r
+       firstpage = true;\r
+\r
+       do\r
+       {\r
+               if (newpage)\r
+               {\r
+                       newpage = false;\r
+                       #ifdef JAPAN\r
+                       if (!which)\r
+                               CA_CacheScreen(snames[pagenum - 1]);\r
+                       else\r
+                               CA_CacheScreen(enames[which*2 + pagenum - 1]);\r
+                       #else\r
+                       PageLayout (true);\r
+                       #endif\r
+                       VW_UpdateScreen ();\r
+                       if (firstpage)\r
+                       {\r
+                               VL_FadeIn(0,255,&gamepal,10);\r
+                               // VW_FadeIn ()\r
+                               firstpage = false;\r
+                       }\r
+               }\r
+\r
+               LastScan = 0;\r
+               while (!LastScan)\r
+               ;\r
+\r
+               switch (LastScan)\r
+               {\r
+               case sc_UpArrow:\r
+               case sc_PgUp:\r
+               case sc_LeftArrow:\r
+                       if (pagenum>1)\r
+                       {\r
+                               #ifndef JAPAN\r
+                               BackPage ();\r
+                               BackPage ();\r
+                               #else\r
+                               pagenum--;\r
+                               #endif\r
+                               newpage = true;\r
+                       }\r
+                       break;\r
+\r
+               case sc_Enter:\r
+               case sc_DownArrow:\r
+               case sc_PgDn:\r
+               case sc_RightArrow:             // the text allready points at next page\r
+                       if (pagenum<numpages)\r
+                       {\r
+                               newpage = true;\r
+                               #ifdef JAPAN\r
+                               pagenum++;\r
+                               #endif\r
+                       }\r
+                       break;\r
+               }\r
+\r
+               #ifndef SPEAR\r
+               if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))\r
+                       PicturePause();\r
+               #endif\r
+\r
+       } while (LastScan != sc_Escape);\r
+\r
+       IN_ClearKeysDown ();\r
+       fontnumber = oldfontnumber;\r
+}\r
+\r
+\r
+//===========================================================================\r
+\r
+#ifndef JAPAN\r
+#ifdef ARTSEXTERN\r
+int    endextern = T_ENDART1;\r
+#ifndef SPEAR\r
+int            helpextern = T_HELPART;\r
+#endif\r
+#endif\r
+char helpfilename[13] = "HELPART.",\r
+        endfilename[13] = "ENDART1.";\r
+#endif\r
+\r
+/*\r
+=================\r
+=\r
+= HelpScreens\r
+=\r
+=================\r
+*/\r
+#ifndef SPEAR\r
+void HelpScreens (void)\r
+{\r
+       int                     artnum;\r
+       char far        *text;\r
+       memptr          layout;\r
+\r
+\r
+       CA_UpLevel ();\r
+       MM_SortMem ();\r
+#ifdef JAPAN\r
+       ShowArticle (0);\r
+       VW_FadeOut();\r
+       FreeMusic ();\r
+       CA_DownLevel ();\r
+       MM_SortMem ();\r
+#else\r
+\r
+\r
+\r
+\r
+#ifdef ARTSEXTERN\r
+       artnum = helpextern;\r
+       CA_CacheGrChunk (artnum);\r
+       text = (char _seg *)grsegs[artnum];\r
+       MM_SetLock (&grsegs[artnum], true);\r
+#else\r
+       CA_LoadFile (helpfilename,&layout);\r
+       text = (char _seg *)layout;\r
+       MM_SetLock (&layout, true);\r
+#endif\r
+\r
+       ShowArticle (text);\r
+\r
+#ifdef ARTSEXTERN\r
+       MM_FreePtr (&grsegs[artnum]);\r
+#else\r
+       MM_FreePtr (&layout);\r
+#endif\r
+\r
+\r
+\r
+       VW_FadeOut();\r
+\r
+       FreeMusic ();\r
+       CA_DownLevel ();\r
+       MM_SortMem ();\r
+#endif\r
+}\r
+#endif\r
+\r
+//\r
+// END ARTICLES\r
+//\r
+void EndText (void)\r
+{\r
+       int                     artnum;\r
+       char far        *text;\r
+       memptr          layout;\r
+\r
+\r
+       ClearMemory ();\r
+\r
+       CA_UpLevel ();\r
+       MM_SortMem ();\r
+#ifdef JAPAN\r
+       ShowArticle(gamestate.episode + 1);\r
+\r
+       VW_FadeOut();\r
+\r
+       SETFONTCOLOR(0,15);\r
+       IN_ClearKeysDown();\r
+       if (MousePresent)\r
+               Mouse(MDelta);  // Clear accumulated mouse movement\r
+\r
+       FreeMusic ();\r
+       CA_DownLevel ();\r
+       MM_SortMem ();\r
+#else\r
+\r
+\r
+\r
+#ifdef ARTSEXTERN\r
+       artnum = endextern+gamestate.episode;\r
+       CA_CacheGrChunk (artnum);\r
+       text = (char _seg *)grsegs[artnum];\r
+       MM_SetLock (&grsegs[artnum], true);\r
+#else\r
+       endfilename[6] = '1'+gamestate.episode;\r
+       CA_LoadFile (endfilename,&layout);\r
+       text = (char _seg *)layout;\r
+       MM_SetLock (&layout, true);\r
+#endif\r
+\r
+       ShowArticle (text);\r
+\r
+#ifdef ARTSEXTERN\r
+       MM_FreePtr (&grsegs[artnum]);\r
+#else\r
+       MM_FreePtr (&layout);\r
+#endif\r
+\r
+\r
+       VW_FadeOut();\r
+       SETFONTCOLOR(0,15);\r
+       IN_ClearKeysDown();\r
+       if (MousePresent)\r
+               Mouse(MDelta);  // Clear accumulated mouse movement\r
+\r
+       FreeMusic ();\r
+       CA_DownLevel ();\r
+       MM_SortMem ();\r
+#endif\r
+}\r
diff --git a/16/wf3d8086/wlfj1ver.h b/16/wf3d8086/wlfj1ver.h
new file mode 100755 (executable)
index 0000000..13e1340
--- /dev/null
@@ -0,0 +1,9 @@
+//#define SPEAR\r
+#define JAPAN\r
+#define JAPDEMO\r
+#define UPLOAD\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+#define CARMACIZED\r
diff --git a/16/wf3d8086/wolf.ide b/16/wf3d8086/wolf.ide
new file mode 100755 (executable)
index 0000000..c8d1413
Binary files /dev/null and b/16/wf3d8086/wolf.ide differ
diff --git a/16/wf3d8086/wolf.obr b/16/wf3d8086/wolf.obr
new file mode 100755 (executable)
index 0000000..d51eda7
Binary files /dev/null and b/16/wf3d8086/wolf.obr differ
diff --git a/16/wf3d8086/wolf.~de b/16/wf3d8086/wolf.~de
new file mode 100755 (executable)
index 0000000..a44dea4
Binary files /dev/null and b/16/wf3d8086/wolf.~de differ
diff --git a/16/wf3d8086/wolf1ver.h b/16/wf3d8086/wolf1ver.h
new file mode 100755 (executable)
index 0000000..6db05ff
--- /dev/null
@@ -0,0 +1,7 @@
+//#define SPEAR\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+#define CARMACIZED\r
+#define UPLOAD\r
diff --git a/16/wf3d8086/wolf3d.dsk b/16/wf3d8086/wolf3d.dsk
new file mode 100755 (executable)
index 0000000..521bac9
Binary files /dev/null and b/16/wf3d8086/wolf3d.dsk differ
diff --git a/16/wf3d8086/wolf3d.map b/16/wf3d8086/wolf3d.map
new file mode 100755 (executable)
index 0000000..a1b3b62
--- /dev/null
@@ -0,0 +1,3660 @@
+\r
+ Start  Stop   Length Name               Class\r
+\r
+ 00000H 044BBH 044BCH _TEXT              CODE\r
+ 044BCH 044BCH 00000H H_LDIV_TEXT        CODE\r
+ 044BCH 04855H 0039AH WOLFHACK_TEXT      CODE\r
+ 04858H 048BCH 00065H WHACK_A_TEXT       CODE\r
+ 048C0H 048FAH 0003BH WL_ASM_TEXT        CODE\r
+ 048FBH 060ABH 017B1H WL_MAIN_TEXT       CODE\r
+ 060ACH 06A53H 009A8H WL_TEXT_TEXT       CODE\r
+ 06A54H 0A853H 03E00H WL_MENU_TEXT       CODE\r
+ 0A854H 0BC65H 01412H WL_INTER_TEXT      CODE\r
+ 0BC66H 0CFC6H 01361H WL_GAME_TEXT       CODE\r
+ 0CFC7H 0E0DCH 01116H WL_PLAY_TEXT       CODE\r
+ 0E0DDH 0EBCEH 00AF2H WL_DEBUG_TEXT      CODE\r
+ 0EBCFH 0FB85H 00FB7H WL_DRAW_TEXT       CODE\r
+ 0FB86H 0FFD9H 00454H WL_DR_A_TEXT       CODE\r
+ 0FFDAH 1087BH 008A2H WL_SCALE_TEXT      CODE\r
+ 1087CH 12014H 01799H WL_STATE_TEXT      CODE\r
+ 12015H 1320EH 011FAH WL_AGENT_TEXT      CODE\r
+ 1320FH 13ECBH 00CBDH WL_ACT1_TEXT       CODE\r
+ 13ECCH 160F7H 0222CH WL_ACT2_TEXT       CODE\r
+ 160F8H 177B0H 016B9H ID_CA_TEXT         CODE\r
+ 177B1H 182DFH 00B2FH ID_IN_TEXT         CODE\r
+ 182E0H 19126H 00E47H ID_MM_TEXT         CODE\r
+ 19127H 1A286H 01160H ID_PM_TEXT         CODE\r
+ 1A287H 1BB15H 0188FH ID_SD_TEXT         CODE\r
+ 1BB16H 1BF07H 003F2H ID_SD_A_TEXT       CODE\r
+ 1BF08H 1CAADH 00BA6H ID_US_1_TEXT       CODE\r
+ 1CAAEH 1CAF2H 00045H ID_US_A_TEXT       CODE\r
+ 1CAF3H 1D61FH 00B2DH ID_VL_TEXT         CODE\r
+ 1D620H 1DF01H 008E2H ID_VH_TEXT         CODE\r
+ 1DF02H 1E195H 00294H ID_VL_A_TEXT       CODE\r
+ 1E196H 1E38BH 001F6H ID_VH_A_TEXT       CODE\r
+ 1E390H 20B06H 02777H EMU_PROG           CODE\r
+ 20B10H 210D7H 005C8H E87_PROG           CODE\r
+ 210E0H 210E0H 00000H _FARDATA           FAR_DATA\r
+ 210E0H 230DFH 02000H FAR_DATA           FAR_DATA\r
+ 230E0H 231E1H 00102H FAR_DATA           FAR_DATA\r
+ 231F0H 234E3H 002F4H WL_MAIN5_DATA      FAR_DATA\r
+ 234F0H 237BFH 002D0H WL_MENU5_DATA      FAR_DATA\r
+ 237C0H 23939H 0017AH WL_MENU6_DATA      FAR_DATA\r
+ 23940H 23B37H 001F8H WL_MENU7_DATA      FAR_DATA\r
+ 23B40H 23C3BH 000FCH WL_MENU8_DATA      FAR_DATA\r
+ 23C40H 23E0DH 001CEH WL_MENU9_DATA      FAR_DATA\r
+ 23E10H 23EB7H 000A8H WL_MENU10_DATA     FAR_DATA\r
+ 23EC0H 24063H 001A4H WL_MENU11_DATA     FAR_DATA\r
+ 24070H 241E9H 0017AH WL_MENU12_DATA     FAR_DATA\r
+ 241F0H 24213H 00024H WL_MENU13_DATA     FAR_DATA\r
+ 24220H 33C1FH 0FA00H SignonSeg          FAR_DATA\r
+ 33C20H 33C9FH 00080H ID_IN5_DATA        FAR_DATA\r
+ 33CA0H 33D1FH 00080H ID_IN6_DATA        FAR_DATA\r
+ 33D20H 33D9FH 00080H ID_IN7_DATA        FAR_DATA\r
+ 33DA0H 33DA0H 00000H _FARBSS            FAR_BSS\r
+ 33DA0H 342F8H 00559H _COMDEF_AA_        FAR_BSS\r
+ 34300H 34A07H 00708H _COMDEF_AB_        FAR_BSS\r
+ 34A10H 3581FH 00E10H _COMDEF_AC_        FAR_BSS\r
+ 35820H 358B4H 00095H _COMDEF_AD_        FAR_BSS\r
+ 358C0H 36ABFH 01200H _COMDEF_AE_        FAR_BSS\r
+ 36AC0H 37CBFH 01200H _COMDEF_AF_        FAR_BSS\r
+ 37CC0H 39D8FH 020D0H _COMDEF_AG_        FAR_BSS\r
+ 39D90H 3A08FH 00300H _COMDEF_AH_        FAR_BSS\r
+ 3A090H 3A38FH 00300H _COMDEF_AI_        FAR_BSS\r
+ 3A390H 3A390H 00000H _OVERLAY_          OVRINFO\r
+ 3A390H 3A390H 00000H _1STUB_            STUBSEG\r
+ 3A390H 3EAC9H 0473AH _DATA              DATA\r
+ 3EACAH 3EACDH 00004H _CVTSEG            DATA\r
+ 3EACEH 3EAD9H 0000CH _SCNSEG            DATA\r
+ 3EADAH 3EADAH 00000H _CONST             CONST\r
+ 3EADAH 3EAF7H 0001EH _INIT_             INITDATA\r
+ 3EAF8H 3EAF8H 00000H _INITEND_          INITDATA\r
+ 3EAF8H 3EAFDH 00006H _EXIT_             EXITDATA\r
+ 3EAFEH 3EAFEH 00000H _EXITEND_          EXITDATA\r
+ 3EAFEH 3ED73H 00276H _BSS               BSS\r
+ 3ED74H 4933EH 0A5CBH _COMDEF_           BSS\r
+ 4933FH 4933FH 00000H _BSSEND            BSSEND\r
+ 49340H 493BFH 00080H _STACK             STACK\r
+\r
+\r
+Detailed map of segments\r
+\r
+ 0000:0000 02B2 C=CODE   S=_TEXT          G=(none)  M=C0.ASM     ACBP=28\r
+ 0000:02B2 00DE C=CODE   S=_TEXT          G=(none)  M=H_LDIV.ASM ACBP=28\r
+ 0000:0390 0258 C=CODE   S=_TEXT          G=(none)  M=FPINIT     ACBP=28\r
+ 0000:05E8 0000 C=CODE   S=_TEXT          G=(none)  M=E87TRAP    ACBP=28\r
+ 0000:05E8 0000 C=CODE   S=_TEXT          G=(none)  M=PROTFLAG   ACBP=28\r
+ 0000:05E8 0000 C=CODE   S=_TEXT          G=(none)  M=DEFLT87    ACBP=28\r
+ 0000:05E8 000D C=CODE   S=_TEXT          G=(none)  M=ATAN       ACBP=28\r
+ 0000:05F5 0000 C=CODE   S=_TEXT          G=(none)  M=HUGEVAL    ACBP=28\r
+ 0000:05F5 009A C=CODE   S=_TEXT          G=(none)  M=LDTRUNC    ACBP=28\r
+ 0000:068F 0000 C=CODE   S=_TEXT          G=(none)  M=MATHWHY    ACBP=28\r
+ 0000:068F 01B5 C=CODE   S=_TEXT          G=(none)  M=REALCVT    ACBP=28\r
+ 0000:0844 0361 C=CODE   S=_TEXT          G=(none)  M=SCANTOD    ACBP=28\r
+ 0000:0BA5 0205 C=CODE   S=_TEXT          G=(none)  M=XCVT       ACBP=28\r
+ 0000:0DAA 00A4 C=CODE   S=_TEXT          G=(none)  M=FPERR      ACBP=28\r
+ 0000:0E4E 00C9 C=CODE   S=_TEXT          G=(none)  M=_POW10     ACBP=28\r
+ 0000:0F17 000B C=CODE   S=_TEXT          G=(none)  M=POW10D     ACBP=28\r
+ 0000:0F22 0026 C=CODE   S=_TEXT          G=(none)  M=MATHERR    ACBP=28\r
+ 0000:0F48 004D C=CODE   S=_TEXT          G=(none)  M=SIN        ACBP=28\r
+ 0000:0F95 0050 C=CODE   S=_TEXT          G=(none)  M=TAN        ACBP=28\r
+ 0000:0FE5 0090 C=CODE   S=_TEXT          G=(none)  M=_MATHERR   ACBP=28\r
+ 0000:1075 00BB C=CODE   S=_TEXT          G=(none)  M=ATAN2      ACBP=28\r
+ 0000:1130 002C C=CODE   S=_TEXT          G=(none)  M=FFTOL      ACBP=28\r
+ 0000:115C 002D C=CODE   S=_TEXT          G=(none)  M=ATEXIT     ACBP=28\r
+ 0000:1189 0000 C=CODE   S=_TEXT          G=(none)  M=CTYPE      ACBP=28\r
+ 0000:1189 0038 C=CODE   S=_TEXT          G=(none)  M=DOSFATTR   ACBP=28\r
+ 0000:11C1 0032 C=CODE   S=_TEXT          G=(none)  M=DOSGDATE   ACBP=28\r
+ 0000:11F3 0023 C=CODE   S=_TEXT          G=(none)  M=DOSWRITE   ACBP=28\r
+ 0000:1216 0093 C=CODE   S=_TEXT          G=(none)  M=EXIT       ACBP=28\r
+ 0000:12A9 0000 C=CODE   S=_TEXT          G=(none)  M=FILES      ACBP=28\r
+ 0000:12A9 0000 C=CODE   S=_TEXT          G=(none)  M=FILES2     ACBP=28\r
+ 0000:12A9 0000 C=CODE   S=_TEXT          G=(none)  M=FMODE      ACBP=28\r
+ 0000:12A9 0000 C=CODE   S=_TEXT          G=(none)  M=FPSTKLEN   ACBP=28\r
+ 0000:12A9 0017 C=CODE   S=_TEXT          G=(none)  M=F_LXMUL    ACBP=28\r
+ 0000:12C0 0021 C=CODE   S=_TEXT          G=(none)  M=F_PCMP     ACBP=28\r
+ 0000:12E1 001C C=CODE   S=_TEXT          G=(none)  M=F_SCOPY    ACBP=28\r
+ 0000:12FD 0020 C=CODE   S=_TEXT          G=(none)  M=GETVECT    ACBP=28\r
+ 0000:131D 0000 C=CODE   S=_TEXT          G=(none)  M=HEAPLEN    ACBP=28\r
+ 0000:131D 0021 C=CODE   S=_TEXT          G=(none)  M=H_LLSH     ACBP=28\r
+ 0000:133E 0020 C=CODE   S=_TEXT          G=(none)  M=H_LRSH     ACBP=28\r
+ 0000:135E 0021 C=CODE   S=_TEXT          G=(none)  M=H_LURSH    ACBP=28\r
+ 0000:137F 0088 C=CODE   S=_TEXT          G=(none)  M=H_PADA     ACBP=28\r
+ 0000:1407 0060 C=CODE   S=_TEXT          G=(none)  M=H_PADD     ACBP=28\r
+ 0000:1467 0028 C=CODE   S=_TEXT          G=(none)  M=H_PSBP     ACBP=28\r
+ 0000:148F 0027 C=CODE   S=_TEXT          G=(none)  M=H_SPUSH    ACBP=28\r
+ 0000:14B6 004B C=CODE   S=_TEXT          G=(none)  M=IOERROR    ACBP=28\r
+ 0000:1501 0011 C=CODE   S=_TEXT          G=(none)  M=ISATTY     ACBP=28\r
+ 0000:1512 009A C=CODE   S=_TEXT          G=(none)  M=LONGTOA    ACBP=28\r
+ 0000:15AC 0029 C=CODE   S=_TEXT          G=(none)  M=LSEEK      ACBP=28\r
+ 0000:15D5 0082 C=CODE   S=_TEXT          G=(none)  M=MKNAME     ACBP=28\r
+ 0000:1657 0021 C=CODE   S=_TEXT          G=(none)  M=N_PCMP     ACBP=28\r
+ 0000:1678 0032 C=CODE   S=_TEXT          G=(none)  M=OUTPORT    ACBP=28\r
+ 0000:16AA 002D C=CODE   S=_TEXT          G=(none)  M=READA      ACBP=28\r
+ 0000:16D7 01AA C=CODE   S=_TEXT          G=(none)  M=SCANTOL    ACBP=28\r
+ 0000:1881 00A5 C=CODE   S=_TEXT          G=(none)  M=SETUPIO    ACBP=28\r
+ 0000:1926 0000 C=CODE   S=_TEXT          G=(none)  M=SIGDATA    ACBP=28\r
+ 0000:1926 0000 C=CODE   S=_TEXT          G=(none)  M=STKLEN     ACBP=28\r
+ 0000:1926 0018 C=CODE   S=_TEXT          G=(none)  M=TELL       ACBP=28\r
+ 0000:193E 002C C=CODE   S=_TEXT          G=(none)  M=TOLOWER    ACBP=28\r
+ 0000:196A 002C C=CODE   S=_TEXT          G=(none)  M=TOUPPER    ACBP=28\r
+ 0000:1996 0016 C=CODE   S=_TEXT          G=(none)  M=UNLINK     ACBP=28\r
+ 0000:19AC 04C6 C=CODE   S=_TEXT          G=(none)  M=VPRINTER   ACBP=28\r
+ 0000:1E72 009F C=CODE   S=_TEXT          G=(none)  M=VRAM       ACBP=28\r
+ 0000:1F11 001A C=CODE   S=_TEXT          G=(none)  M=XCLOSE     ACBP=28\r
+ 0000:1F2B 0029 C=CODE   S=_TEXT          G=(none)  M=_STPCPY    ACBP=28\r
+ 0000:1F54 0025 C=CODE   S=_TEXT          G=(none)  M=BIOSKEY    ACBP=28\r
+ 0000:1F79 006F C=CODE   S=_TEXT          G=(none)  M=BRK        ACBP=28\r
+ 0000:1FE8 0029 C=CODE   S=_TEXT          G=(none)  M=CLRSCR     ACBP=28\r
+ 0000:2011 0010 C=CODE   S=_TEXT          G=(none)  M=CORELEFT   ACBP=28\r
+ 0000:2021 01B3 C=CODE   S=_TEXT          G=(none)  M=CRTINIT    ACBP=28\r
+ 0000:21D4 001F C=CODE   S=_TEXT          G=(none)  M=CVTFAK     ACBP=28\r
+ 0000:21F3 0421 C=CODE   S=_TEXT          G=(none)  M=FARHEAP    ACBP=28\r
+ 0000:2614 0143 C=CODE   S=_TEXT          G=(none)  M=FBRK       ACBP=28\r
+ 0000:2757 0050 C=CODE   S=_TEXT          G=(none)  M=FCORELFT   ACBP=28\r
+ 0000:27A7 0049 C=CODE   S=_TEXT          G=(none)  M=GOTOXY     ACBP=28\r
+ 0000:27F0 0095 C=CODE   S=_TEXT          G=(none)  M=GPTEXT     ACBP=28\r
+ 0000:2885 002E C=CODE   S=_TEXT          G=(none)  M=HARD       ACBP=28\r
+ 0000:28B3 0126 C=CODE   S=_TEXT          G=(none)  M=HARDERR    ACBP=28\r
+ 0000:29D9 0027 C=CODE   S=_TEXT          G=(none)  M=IOCTL      ACBP=28\r
+ 0000:2A00 009D C=CODE   S=_TEXT          G=(none)  M=MOVETEXT   ACBP=28\r
+ 0000:2A9D 027B C=CODE   S=_TEXT          G=(none)  M=NEARHEAP   ACBP=28\r
+ 0000:2D18 0004 C=CODE   S=_TEXT          G=(none)  M=REALCVT    ACBP=28\r
+ 0000:2D1C 01AB C=CODE   S=_TEXT          G=(none)  M=SCREEN     ACBP=28\r
+ 0000:2EC7 0188 C=CODE   S=_TEXT          G=(none)  M=SCROLL     ACBP=28\r
+ 0000:304F 0115 C=CODE   S=_TEXT          G=(none)  M=SETARGV    ACBP=28\r
+ 0000:3164 001C C=CODE   S=_TEXT          G=(none)  M=SETBLOCK   ACBP=28\r
+ 0000:3180 005D C=CODE   S=_TEXT          G=(none)  M=SETENVP    ACBP=28\r
+ 0000:31DD 002C C=CODE   S=_TEXT          G=(none)  M=WHEREXY    ACBP=28\r
+ 0000:3209 007D C=CODE   S=_TEXT          G=(none)  M=ATOL       ACBP=28\r
+ 0000:3286 0010 C=CODE   S=_TEXT          G=(none)  M=BDOS       ACBP=28\r
+ 0000:3296 001B C=CODE   S=_TEXT          G=(none)  M=CHMODA     ACBP=28\r
+ 0000:32B1 0028 C=CODE   S=_TEXT          G=(none)  M=CLOSE      ACBP=28\r
+ 0000:32D9 001E C=CODE   S=_TEXT          G=(none)  M=CLOSEA     ACBP=28\r
+ 0000:32F7 008B C=CODE   S=_TEXT          G=(none)  M=CREAT      ACBP=28\r
+ 0000:3382 007D C=CODE   S=_TEXT          G=(none)  M=FCLOSE     ACBP=28\r
+ 0000:33FF 0081 C=CODE   S=_TEXT          G=(none)  M=FFLUSH     ACBP=28\r
+ 0000:3480 0060 C=CODE   S=_TEXT          G=(none)  M=FINDFIRS   ACBP=28\r
+ 0000:34E0 0041 C=CODE   S=_TEXT          G=(none)  M=FLENGTH    ACBP=28\r
+ 0000:3521 003A C=CODE   S=_TEXT          G=(none)  M=FLUSHALL   ACBP=28\r
+ 0000:355B 01A0 C=CODE   S=_TEXT          G=(none)  M=FOPEN      ACBP=28\r
+ 0000:36FB 0016 C=CODE   S=_TEXT          G=(none)  M=FPRINTF    ACBP=28\r
+ 0000:3711 0112 C=CODE   S=_TEXT          G=(none)  M=FSEEK      ACBP=28\r
+ 0000:3823 005F C=CODE   S=_TEXT          G=(none)  M=GETENV     ACBP=28\r
+ 0000:3882 0067 C=CODE   S=_TEXT          G=(none)  M=LTOA1      ACBP=28\r
+ 0000:38E9 001F C=CODE   S=_TEXT          G=(none)  M=MEMCPY     ACBP=28\r
+ 0000:3908 0022 C=CODE   S=_TEXT          G=(none)  M=MOVEDATA   ACBP=28\r
+ 0000:392A 0183 C=CODE   S=_TEXT          G=(none)  M=OPEN       ACBP=28\r
+ 0000:3AAD 004D C=CODE   S=_TEXT          G=(none)  M=OPENA      ACBP=28\r
+ 0000:3AFA 0017 C=CODE   S=_TEXT          G=(none)  M=PRINTF     ACBP=28\r
+ 0000:3B11 0302 C=CODE   S=_TEXT          G=(none)  M=PUTC       ACBP=28\r
+ 0000:3E13 004B C=CODE   S=_TEXT          G=(none)  M=PUTS       ACBP=28\r
+ 0000:3E5E 00CE C=CODE   S=_TEXT          G=(none)  M=READ       ACBP=28\r
+ 0000:3F2C 0003 C=CODE   S=_TEXT          G=(none)  M=READU      ACBP=28\r
+ 0000:3F2F 00D6 C=CODE   S=_TEXT          G=(none)  M=SETVBUF    ACBP=28\r
+ 0000:4005 0061 C=CODE   S=_TEXT          G=(none)  M=SPRINTF    ACBP=28\r
+ 0000:4066 0039 C=CODE   S=_TEXT          G=(none)  M=STRCAT     ACBP=28\r
+ 0000:409F 0022 C=CODE   S=_TEXT          G=(none)  M=STRCPY     ACBP=28\r
+ 0000:40C1 001A C=CODE   S=_TEXT          G=(none)  M=STRLEN     ACBP=28\r
+ 0000:40DB 00FF C=CODE   S=_TEXT          G=(none)  M=STRTOL     ACBP=28\r
+ 0000:41DA 010C C=CODE   S=_TEXT          G=(none)  M=WRITE      ACBP=28\r
+ 0000:42E6 003A C=CODE   S=_TEXT          G=(none)  M=WRITEA     ACBP=28\r
+ 0000:4320 0003 C=CODE   S=_TEXT          G=(none)  M=WRITEU     ACBP=28\r
+ 0000:4323 0028 C=CODE   S=_TEXT          G=(none)  M=XFCLOSE    ACBP=28\r
+ 0000:434B 0023 C=CODE   S=_TEXT          G=(none)  M=XFFLUSH    ACBP=28\r
+ 0000:436E 0028 C=CODE   S=_TEXT          G=(none)  M=FMEMCMP    ACBP=28\r
+ 0000:4396 0024 C=CODE   S=_TEXT          G=(none)  M=FMEMCPY    ACBP=28\r
+ 0000:43BA 0043 C=CODE   S=_TEXT          G=(none)  M=FMEMSET    ACBP=28\r
+ 0000:43FD 0029 C=CODE   S=_TEXT          G=(none)  M=FSTRCPY    ACBP=28\r
+ 0000:4426 0041 C=CODE   S=_TEXT          G=(none)  M=FSTRICMP   ACBP=28\r
+ 0000:4467 001F C=CODE   S=_TEXT          G=(none)  M=FSTRLEN    ACBP=28\r
+ 0000:4486 0036 C=CODE   S=_TEXT          G=(none)  M=DOSDFREE   ACBP=28\r
+ 044B:000C 0000 C=CODE   S=H_LDIV_TEXT    G=(none)  M=H_LDIV.ASM ACBP=48\r
+ 044B:000C 039A C=CODE   S=WOLFHACK_TEXT  G=(none)  M=WOLFHACK.C ACBP=28\r
+ 0485:0008 0065 C=CODE   S=WHACK_A_TEXT   G=(none)  M=WHACK_A.ASM ACBP=A8\r
+ 048C:0000 003B C=CODE   S=WL_ASM_TEXT    G=(none)  M=WL_ASM.ASM ACBP=A8\r
+ 048F:000B 17B1 C=CODE   S=WL_MAIN_TEXT   G=(none)  M=WL_MAIN.C  ACBP=28\r
+ 060A:000C 09A8 C=CODE   S=WL_TEXT_TEXT   G=(none)  M=WL_TEXT.C  ACBP=28\r
+ 06A5:0004 3E00 C=CODE   S=WL_MENU_TEXT   G=(none)  M=WL_MENU.C  ACBP=28\r
+ 0A85:0004 1412 C=CODE   S=WL_INTER_TEXT  G=(none)  M=WL_INTER.C ACBP=28\r
+ 0BC6:0006 1361 C=CODE   S=WL_GAME_TEXT   G=(none)  M=WL_GAME.C  ACBP=28\r
+ 0CFC:0007 1116 C=CODE   S=WL_PLAY_TEXT   G=(none)  M=WL_PLAY.C  ACBP=28\r
+ 0E0D:000D 0AF2 C=CODE   S=WL_DEBUG_TEXT  G=(none)  M=WL_DEBUG.C ACBP=28\r
+ 0EBC:000F 0FB7 C=CODE   S=WL_DRAW_TEXT   G=(none)  M=WL_DRAW.C  ACBP=28\r
+ 0FB8:0006 0454 C=CODE   S=WL_DR_A_TEXT   G=(none)  M=WL_DR_A.ASM ACBP=48\r
+ 0FFD:000A 08A2 C=CODE   S=WL_SCALE_TEXT  G=(none)  M=WL_SCALE.C ACBP=28\r
+ 1087:000C 1799 C=CODE   S=WL_STATE_TEXT  G=(none)  M=WL_STATE.C ACBP=28\r
+ 1201:0005 11FA C=CODE   S=WL_AGENT_TEXT  G=(none)  M=WL_AGENT.C ACBP=28\r
+ 1320:000F 0CBD C=CODE   S=WL_ACT1_TEXT   G=(none)  M=WL_ACT1.C  ACBP=28\r
+ 13EC:000C 222C C=CODE   S=WL_ACT2_TEXT   G=(none)  M=WL_ACT2.C  ACBP=28\r
+ 160F:0008 16B9 C=CODE   S=ID_CA_TEXT     G=(none)  M=ID_CA.C    ACBP=28\r
+ 177B:0001 0B2F C=CODE   S=ID_IN_TEXT     G=(none)  M=ID_IN.C    ACBP=28\r
+ 182E:0000 0E47 C=CODE   S=ID_MM_TEXT     G=(none)  M=ID_MM.C    ACBP=28\r
+ 1912:0007 1160 C=CODE   S=ID_PM_TEXT     G=(none)  M=ID_PM.C    ACBP=28\r
+ 1A28:0007 188F C=CODE   S=ID_SD_TEXT     G=(none)  M=ID_SD.C    ACBP=28\r
+ 1BB1:0006 03F2 C=CODE   S=ID_SD_A_TEXT   G=(none)  M=ID_SD_A.ASM ACBP=48\r
+ 1BF0:0008 0BA6 C=CODE   S=ID_US_1_TEXT   G=(none)  M=ID_US_1.C  ACBP=28\r
+ 1CAA:000E 0045 C=CODE   S=ID_US_A_TEXT   G=(none)  M=ID_US_A.ASM ACBP=48\r
+ 1CAF:0003 0B2D C=CODE   S=ID_VL_TEXT     G=(none)  M=ID_VL.C    ACBP=28\r
+ 1D62:0000 08E2 C=CODE   S=ID_VH_TEXT     G=(none)  M=ID_VH.C    ACBP=28\r
+ 1DF0:0002 0294 C=CODE   S=ID_VL_A_TEXT   G=(none)  M=ID_VL_A.ASM ACBP=48\r
+ 1E19:0006 01F6 C=CODE   S=ID_VH_A_TEXT   G=(none)  M=ID_VH_A.ASM ACBP=48\r
+ 1E39:0000 0000 C=CODE   S=EMU_PROG       G=(none)  M=FPINIT     ACBP=68\r
+ 1E39:0000 2777 C=CODE   S=EMU_PROG       G=(none)  M=EMU086     ACBP=68\r
+ 20B1:0000 0000 C=CODE   S=E87_PROG       G=(none)  M=FPINIT     ACBP=68\r
+ 20B1:0000 03E3 C=CODE   S=E87_PROG       G=(none)  M=EMU087     ACBP=68\r
+ 20B1:03F0 01D8 C=CODE   S=E87_PROG       G=(none)  M=E87TRAP    ACBP=68\r
+ 210E:0000 0000 C=FAR_DATA S=_FARDATA       G=(none)  M=C0.ASM     ACBP=68\r
+ 210E:0000 2000 C=FAR_DATA S=FAR_DATA       G=(none)  M=WHACK_A.ASM ACBP=60\r
+ 230E:0000 0102 C=FAR_DATA S=FAR_DATA       G=(none)  M=ID_US_A.ASM ACBP=60\r
+ 231F:0000 02F4 C=FAR_DATA S=WL_MAIN5_DATA  G=(none)  M=WL_MAIN.C  ACBP=68\r
+ 234F:0000 02D0 C=FAR_DATA S=WL_MENU5_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 237C:0000 017A C=FAR_DATA S=WL_MENU6_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 2394:0000 01F8 C=FAR_DATA S=WL_MENU7_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 23B4:0000 00FC C=FAR_DATA S=WL_MENU8_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 23C4:0000 01CE C=FAR_DATA S=WL_MENU9_DATA  G=(none)  M=WL_MENU.C  ACBP=68\r
+ 23E1:0000 00A8 C=FAR_DATA S=WL_MENU10_DATA G=(none)  M=WL_MENU.C  ACBP=68\r
+ 23EC:0000 01A4 C=FAR_DATA S=WL_MENU11_DATA G=(none)  M=WL_MENU.C  ACBP=68\r
+ 2407:0000 017A C=FAR_DATA S=WL_MENU12_DATA G=(none)  M=WL_MENU.C  ACBP=68\r
+ 241F:0000 0024 C=FAR_DATA S=WL_MENU13_DATA G=(none)  M=WL_MENU.C  ACBP=68\r
+ 2422:0000 FA00 C=FAR_DATA S=SignonSeg      G=(none)  M=SIGNON.BIN   ACBP=60\r
+ 33C2:0000 0080 C=FAR_DATA S=ID_IN5_DATA    G=(none)  M=ID_IN.C    ACBP=68\r
+ 33CA:0000 0080 C=FAR_DATA S=ID_IN6_DATA    G=(none)  M=ID_IN.C    ACBP=68\r
+ 33D2:0000 0080 C=FAR_DATA S=ID_IN7_DATA    G=(none)  M=ID_IN.C    ACBP=68\r
+ 33DA:0000 0000 C=FAR_BSS S=_FARBSS        G=(none)  M=C0.ASM     ACBP=68\r
+ 33DA:0000 0559 C=FAR_BSS S=_COMDEF_AA_    G=(none)  M=WL_ACT1.C  ACBP=60\r
+ 3430:0000 0708 C=FAR_BSS S=_COMDEF_AB_    G=(none)  M=WL_DRAW.C  ACBP=60\r
+ 34A1:0000 0E10 C=FAR_BSS S=_COMDEF_AC_    G=(none)  M=WL_DRAW.C  ACBP=60\r
+ 3582:0000 0095 C=FAR_BSS S=_COMDEF_AD_    G=(none)  M=ID_CA.C    ACBP=60\r
+ 358C:0000 1200 C=FAR_BSS S=_COMDEF_AE_    G=(none)  M=WL_PLAY.C  ACBP=60\r
+ 36AC:0000 1200 C=FAR_BSS S=_COMDEF_AF_    G=(none)  M=WL_PLAY.C  ACBP=60\r
+ 37CC:0000 20D0 C=FAR_BSS S=_COMDEF_AG_    G=(none)  M=ID_MM.C    ACBP=60\r
+ 39D9:0000 0300 C=FAR_BSS S=_COMDEF_AH_    G=(none)  M=ID_VL.C    ACBP=60\r
+ 3A09:0000 0300 C=FAR_BSS S=_COMDEF_AI_    G=(none)  M=ID_VL.C    ACBP=60\r
+ 3A39:0000 0000 C=OVRINFO S=_OVERLAY_      G=(none)  M=C0.ASM     ACBP=68\r
+ 3A39:0000 0000 C=STUBSEG S=_1STUB_        G=(none)  M=C0.ASM     ACBP=68\r
+ 3A39:0000 00D9 C=DATA   S=_DATA          G=DGROUP  M=C0.ASM     ACBP=68\r
+ 3A39:00DA 0000 C=DATA   S=_DATA          G=DGROUP  M=H_LDIV.ASM ACBP=48\r
+ 3A39:00DA 0002 C=DATA   S=_DATA          G=DGROUP  M=WOLFHACK.C ACBP=48\r
+ 3A39:00DC 0000 C=DATA   S=_DATA          G=DGROUP  M=WHACK_A.ASM ACBP=A8\r
+ 3A39:00DC 0000 C=DATA   S=_DATA          G=DGROUP  M=WL_ASM.ASM ACBP=A8\r
+ 3A39:00DC 0254 C=DATA   S=_DATA          G=DGROUP  M=WL_MAIN.C  ACBP=48\r
+ 3A39:0330 00A1 C=DATA   S=_DATA          G=DGROUP  M=WL_TEXT.C  ACBP=48\r
+ 3A39:03D2 06B4 C=DATA   S=_DATA          G=DGROUP  M=WL_MENU.C  ACBP=48\r
+ 3A39:0A86 03ED C=DATA   S=_DATA          G=DGROUP  M=WL_INTER.C ACBP=48\r
+ 3A39:0E74 03FC C=DATA   S=_DATA          G=DGROUP  M=WL_GAME.C  ACBP=48\r
+ 3A39:1270 0216 C=DATA   S=_DATA          G=DGROUP  M=WL_PLAY.C  ACBP=48\r
+ 3A39:1486 01FE C=DATA   S=_DATA          G=DGROUP  M=WL_DEBUG.C ACBP=48\r
+ 3A39:1684 0096 C=DATA   S=_DATA          G=DGROUP  M=WL_DRAW.C  ACBP=48\r
+ 3A39:171A 0000 C=DATA   S=_DATA          G=DGROUP  M=WL_DR_A.ASM ACBP=48\r
+ 3A39:171A 00F1 C=DATA   S=_DATA          G=DGROUP  M=WL_SCALE.C ACBP=48\r
+ 3A39:180C 00FF C=DATA   S=_DATA          G=DGROUP  M=WL_STATE.C ACBP=48\r
+ 3A39:190C 0112 C=DATA   S=_DATA          G=DGROUP  M=WL_AGENT.C ACBP=48\r
+ 3A39:1A1E 0119 C=DATA   S=_DATA          G=DGROUP  M=WL_ACT1.C  ACBP=48\r
+ 3A39:1B38 1412 C=DATA   S=_DATA          G=DGROUP  M=WL_ACT2.C  ACBP=48\r
+ 3A39:2F4A 0300 C=DATA   S=_DATA          G=DGROUP  M=GAMEPAL.BIN  ACBP=48\r
+ 3A39:324A 0109 C=DATA   S=_DATA          G=DGROUP  M=ID_CA.C    ACBP=48\r
+ 3A39:3354 005F C=DATA   S=_DATA          G=DGROUP  M=ID_IN.C    ACBP=48\r
+ 3A39:33B4 015B C=DATA   S=_DATA          G=DGROUP  M=ID_MM.C    ACBP=48\r
+ 3A39:3510 0490 C=DATA   S=_DATA          G=DGROUP  M=ID_PM.C    ACBP=48\r
+ 3A39:39A0 0265 C=DATA   S=_DATA          G=DGROUP  M=ID_SD.C    ACBP=48\r
+ 3A39:3C06 0104 C=DATA   S=_DATA          G=DGROUP  M=ID_SD_A.ASM ACBP=48\r
+ 3A39:3D0A 02B9 C=DATA   S=_DATA          G=DGROUP  M=ID_US_1.C  ACBP=48\r
+ 3A39:3FC4 0000 C=DATA   S=_DATA          G=DGROUP  M=ID_US_A.ASM ACBP=48\r
+ 3A39:3FC4 0097 C=DATA   S=_DATA          G=DGROUP  M=ID_VL.C    ACBP=48\r
+ 3A39:405C 0029 C=DATA   S=_DATA          G=DGROUP  M=ID_VH.C    ACBP=48\r
+ 3A39:4086 0002 C=DATA   S=_DATA          G=DGROUP  M=ID_VL_A.ASM ACBP=48\r
+ 3A39:4088 0000 C=DATA   S=_DATA          G=DGROUP  M=ID_VH_A.ASM ACBP=48\r
+ 3A39:4090 0002 C=DATA   S=_DATA          G=DGROUP  M=FPINIT     ACBP=68\r
+ 3A39:40A0 0000 C=DATA   S=_DATA          G=DGROUP  M=E87TRAP    ACBP=68\r
+ 3A39:40A0 0003 C=DATA   S=_DATA          G=DGROUP  M=PROTFLAG   ACBP=48\r
+ 3A39:40A4 0002 C=DATA   S=_DATA          G=DGROUP  M=DEFLT87    ACBP=48\r
+ 3A39:40A6 0000 C=DATA   S=_DATA          G=DGROUP  M=ATAN       ACBP=48\r
+ 3A39:40A6 0024 C=DATA   S=_DATA          G=DGROUP  M=HUGEVAL    ACBP=48\r
+ 3A39:40CA 0000 C=DATA   S=_DATA          G=DGROUP  M=LDTRUNC    ACBP=48\r
+ 3A39:40CA 0037 C=DATA   S=_DATA          G=DGROUP  M=MATHWHY    ACBP=48\r
+ 3A39:4102 0000 C=DATA   S=_DATA          G=DGROUP  M=REALCVT    ACBP=48\r
+ 3A39:4102 0018 C=DATA   S=_DATA          G=DGROUP  M=SCANTOD    ACBP=48\r
+ 3A39:411A 0000 C=DATA   S=_DATA          G=DGROUP  M=XCVT       ACBP=48\r
+ 3A39:411A 008C C=DATA   S=_DATA          G=DGROUP  M=FPERR      ACBP=48\r
+ 3A39:41A6 0080 C=DATA   S=_DATA          G=DGROUP  M=_POW10     ACBP=48\r
+ 3A39:4226 0000 C=DATA   S=_DATA          G=DGROUP  M=POW10D     ACBP=48\r
+ 3A39:4226 0000 C=DATA   S=_DATA          G=DGROUP  M=MATHERR    ACBP=48\r
+ 3A39:4226 000C C=DATA   S=_DATA          G=DGROUP  M=SIN        ACBP=48\r
+ 3A39:4232 000C C=DATA   S=_DATA          G=DGROUP  M=TAN        ACBP=48\r
+ 3A39:423E 000E C=DATA   S=_DATA          G=DGROUP  M=_MATHERR   ACBP=48\r
+ 3A39:424C 0018 C=DATA   S=_DATA          G=DGROUP  M=ATAN2      ACBP=48\r
+ 3A39:4270 0110 C=DATA   S=_DATA          G=DGROUP  M=EMUVARS    ACBP=68\r
+ 3A39:4380 0000 C=DATA   S=_DATA          G=DGROUP  M=FFTOL      ACBP=48\r
+ 3A39:4380 0002 C=DATA   S=_DATA          G=DGROUP  M=ATEXIT     ACBP=48\r
+ 3A39:4382 0101 C=DATA   S=_DATA          G=DGROUP  M=CTYPE      ACBP=48\r
+ 3A39:4484 0000 C=DATA   S=_DATA          G=DGROUP  M=DOSFATTR   ACBP=48\r
+ 3A39:4484 0000 C=DATA   S=_DATA          G=DGROUP  M=DOSGDATE   ACBP=48\r
+ 3A39:4484 0000 C=DATA   S=_DATA          G=DGROUP  M=DOSWRITE   ACBP=48\r
+ 3A39:4484 000C C=DATA   S=_DATA          G=DGROUP  M=EXIT       ACBP=48\r
+ 3A39:4490 0140 C=DATA   S=_DATA          G=DGROUP  M=FILES      ACBP=48\r
+ 3A39:45D0 002A C=DATA   S=_DATA          G=DGROUP  M=FILES2     ACBP=48\r
+ 3A39:45FA 0004 C=DATA   S=_DATA          G=DGROUP  M=FMODE      ACBP=48\r
+ 3A39:45FE 0002 C=DATA   S=_DATA          G=DGROUP  M=FPSTKLEN   ACBP=48\r
+ 3A39:4600 0000 C=DATA   S=_DATA          G=DGROUP  M=F_LXMUL    ACBP=48\r
+ 3A39:4600 0000 C=DATA   S=_DATA          G=DGROUP  M=F_PCMP     ACBP=48\r
+ 3A39:4600 0000 C=DATA   S=_DATA          G=DGROUP  M=F_SCOPY    ACBP=48\r
+ 3A39:4600 0000 C=DATA   S=_DATA          G=DGROUP  M=GETVECT    ACBP=48\r
+ 3A39:4600 0002 C=DATA   S=_DATA          G=DGROUP  M=HEAPLEN    ACBP=48\r
+ 3A39:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_LLSH     ACBP=48\r
+ 3A39:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_LRSH     ACBP=48\r
+ 3A39:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_LURSH    ACBP=48\r
+ 3A39:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_PADA     ACBP=48\r
+ 3A39:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_PADD     ACBP=48\r
+ 3A39:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_PSBP     ACBP=48\r
+ 3A39:4602 0000 C=DATA   S=_DATA          G=DGROUP  M=H_SPUSH    ACBP=48\r
+ 3A39:4602 005B C=DATA   S=_DATA          G=DGROUP  M=IOERROR    ACBP=48\r
+ 3A39:465E 0000 C=DATA   S=_DATA          G=DGROUP  M=ISATTY     ACBP=48\r
+ 3A39:465E 0000 C=DATA   S=_DATA          G=DGROUP  M=LONGTOA    ACBP=48\r
+ 3A39:465E 0000 C=DATA   S=_DATA          G=DGROUP  M=LSEEK      ACBP=48\r
+ 3A39:465E 0009 C=DATA   S=_DATA          G=DGROUP  M=MKNAME     ACBP=48\r
+ 3A39:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=N_PCMP     ACBP=48\r
+ 3A39:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=OUTPORT    ACBP=48\r
+ 3A39:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=READA      ACBP=48\r
+ 3A39:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=SCANTOL    ACBP=48\r
+ 3A39:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=SETUPIO    ACBP=48\r
+ 3A39:4668 0000 C=DATA   S=_DATA          G=DGROUP  M=SIGDATA    ACBP=48\r
+ 3A39:4668 0002 C=DATA   S=_DATA          G=DGROUP  M=STKLEN     ACBP=48\r
+ 3A39:466A 0000 C=DATA   S=_DATA          G=DGROUP  M=TELL       ACBP=48\r
+ 3A39:466A 0000 C=DATA   S=_DATA          G=DGROUP  M=TOLOWER    ACBP=48\r
+ 3A39:466A 0000 C=DATA   S=_DATA          G=DGROUP  M=TOUPPER    ACBP=48\r
+ 3A39:466A 0000 C=DATA   S=_DATA          G=DGROUP  M=UNLINK     ACBP=48\r
+ 3A39:466A 0067 C=DATA   S=_DATA          G=DGROUP  M=VPRINTER   ACBP=48\r
+ 3A39:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=VRAM       ACBP=48\r
+ 3A39:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=XCLOSE     ACBP=48\r
+ 3A39:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=_STPCPY    ACBP=48\r
+ 3A39:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=BIOSKEY    ACBP=48\r
+ 3A39:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=BRK        ACBP=48\r
+ 3A39:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=CLRSCR     ACBP=48\r
+ 3A39:46D2 0000 C=DATA   S=_DATA          G=DGROUP  M=CORELEFT   ACBP=48\r
+ 3A39:46D2 0018 C=DATA   S=_DATA          G=DGROUP  M=CRTINIT    ACBP=48\r
+ 3A39:46EA 0031 C=DATA   S=_DATA          G=DGROUP  M=CVTFAK     ACBP=48\r
+ 3A39:471C 0000 C=DATA   S=_DATA          G=DGROUP  M=FARHEAP    ACBP=48\r
+ 3A39:471C 0002 C=DATA   S=_DATA          G=DGROUP  M=FBRK       ACBP=48\r
+ 3A39:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=FCORELFT   ACBP=48\r
+ 3A39:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=GOTOXY     ACBP=48\r
+ 3A39:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=GPTEXT     ACBP=48\r
+ 3A39:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=HARD       ACBP=48\r
+ 3A39:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=HARDERR    ACBP=48\r
+ 3A39:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=IOCTL      ACBP=48\r
+ 3A39:471E 0000 C=DATA   S=_DATA          G=DGROUP  M=MOVETEXT   ACBP=48\r
+ 3A39:471E 0006 C=DATA   S=_DATA          G=DGROUP  M=NEARHEAP   ACBP=48\r
+ 3A39:4724 0000 C=DATA   S=_DATA          G=DGROUP  M=REALCVT    ACBP=48\r
+ 3A39:4724 0000 C=DATA   S=_DATA          G=DGROUP  M=SCREEN     ACBP=48\r
+ 3A39:4724 0000 C=DATA   S=_DATA          G=DGROUP  M=SCROLL     ACBP=48\r
+ 3A39:4724 000E C=DATA   S=_DATA          G=DGROUP  M=SETARGV    ACBP=48\r
+ 3A39:4732 0000 C=DATA   S=_DATA          G=DGROUP  M=SETBLOCK   ACBP=48\r
+ 3A39:4732 0002 C=DATA   S=_DATA          G=DGROUP  M=SETENVP    ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=WHEREXY    ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=ATOL       ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=BDOS       ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=CHMODA     ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=CLOSE      ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=CLOSEA     ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=CREAT      ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FCLOSE     ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FFLUSH     ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FINDFIRS   ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FLENGTH    ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FLUSHALL   ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FOPEN      ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FPRINTF    ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=FSEEK      ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=GETENV     ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=LTOA1      ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=MEMCPY     ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=MOVEDATA   ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=OPEN       ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=OPENA      ACBP=48\r
+ 3A39:4734 0000 C=DATA   S=_DATA          G=DGROUP  M=PRINTF     ACBP=48\r
+ 3A39:4734 0001 C=DATA   S=_DATA          G=DGROUP  M=PUTC       ACBP=48\r
+ 3A39:4736 0000 C=DATA   S=_DATA          G=DGROUP  M=PUTS       ACBP=48\r
+ 3A39:4736 0000 C=DATA   S=_DATA          G=DGROUP  M=READ       ACBP=48\r
+ 3A39:4736 0000 C=DATA   S=_DATA          G=DGROUP  M=READU      ACBP=48\r
+ 3A39:4736 0004 C=DATA   S=_DATA          G=DGROUP  M=SETVBUF    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=SPRINTF    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=STRCAT     ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=STRCPY     ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=STRLEN     ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=STRTOL     ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=WRITE      ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=WRITEA     ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=WRITEU     ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=XFCLOSE    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=XFFLUSH    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FMEMCMP    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FMEMCPY    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FMEMSET    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FSTRCPY    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FSTRICMP   ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=FSTRLEN    ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_DATA          G=DGROUP  M=DOSDFREE   ACBP=48\r
+ 3A39:473A 0000 C=DATA   S=_CVTSEG        G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3A39:473A 0002 C=DATA   S=_CVTSEG        G=DGROUP  M=REALCVT    ACBP=48\r
+ 3A39:473C 0002 C=DATA   S=_CVTSEG        G=DGROUP  M=CVTFAK     ACBP=48\r
+ 3A39:473E 0000 C=DATA   S=_CVTSEG        G=DGROUP  M=REALCVT    ACBP=48\r
+ 3A39:473E 0000 C=DATA   S=_SCNSEG        G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3A39:473E 0006 C=DATA   S=_SCNSEG        G=DGROUP  M=SCANTOD    ACBP=48\r
+ 3A39:4744 0006 C=DATA   S=_SCNSEG        G=DGROUP  M=CVTFAK     ACBP=48\r
+ 3A39:474A 0000 C=CONST  S=_CONST         G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3A39:474A 0000 C=INITDATA S=_INIT_         G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3A39:474A 0006 C=INITDATA S=_INIT_         G=DGROUP  M=FPINIT     ACBP=48\r
+ 3A39:4750 0006 C=INITDATA S=_INIT_         G=DGROUP  M=SETUPIO    ACBP=48\r
+ 3A39:4756 0006 C=INITDATA S=_INIT_         G=DGROUP  M=CRTINIT    ACBP=48\r
+ 3A39:475C 0006 C=INITDATA S=_INIT_         G=DGROUP  M=SETARGV    ACBP=48\r
+ 3A39:4762 0006 C=INITDATA S=_INIT_         G=DGROUP  M=SETENVP    ACBP=48\r
+ 3A39:4768 0000 C=INITDATA S=_INITEND_      G=DGROUP  M=C0.ASM     ACBP=28\r
+ 3A39:4768 0000 C=EXITDATA S=_EXIT_         G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3A39:4768 0006 C=EXITDATA S=_EXIT_         G=DGROUP  M=FPINIT     ACBP=48\r
+ 3A39:476E 0000 C=EXITDATA S=_EXITEND_      G=DGROUP  M=C0.ASM     ACBP=28\r
+ 3A39:476E 0000 C=BSS    S=_BSS           G=DGROUP  M=C0.ASM     ACBP=48\r
+ 3A39:476E 0000 C=BSS    S=_BSS           G=DGROUP  M=WOLFHACK.C ACBP=48\r
+ 3A39:476E 0002 C=BSS    S=_BSS           G=DGROUP  M=WL_MAIN.C  ACBP=48\r
+ 3A39:4770 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_TEXT.C  ACBP=48\r
+ 3A39:4770 0002 C=BSS    S=_BSS           G=DGROUP  M=WL_MENU.C  ACBP=48\r
+ 3A39:4772 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_INTER.C ACBP=48\r
+ 3A39:4772 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_GAME.C  ACBP=48\r
+ 3A39:4772 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_PLAY.C  ACBP=48\r
+ 3A39:4772 000A C=BSS    S=_BSS           G=DGROUP  M=WL_DEBUG.C ACBP=48\r
+ 3A39:477C 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_DRAW.C  ACBP=48\r
+ 3A39:477C 0004 C=BSS    S=_BSS           G=DGROUP  M=WL_SCALE.C ACBP=48\r
+ 3A39:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_STATE.C ACBP=48\r
+ 3A39:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_AGENT.C ACBP=48\r
+ 3A39:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_ACT1.C  ACBP=48\r
+ 3A39:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=WL_ACT2.C  ACBP=48\r
+ 3A39:4780 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_CA.C    ACBP=48\r
+ 3A39:4780 0014 C=BSS    S=_BSS           G=DGROUP  M=ID_IN.C    ACBP=48\r
+ 3A39:4794 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_MM.C    ACBP=48\r
+ 3A39:4794 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_PM.C    ACBP=48\r
+ 3A39:4794 0180 C=BSS    S=_BSS           G=DGROUP  M=ID_SD.C    ACBP=48\r
+ 3A39:4914 0030 C=BSS    S=_BSS           G=DGROUP  M=ID_US_1.C  ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_VL.C    ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=ID_VH.C    ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=ATAN       ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=LDTRUNC    ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=REALCVT    ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=SCANTOD    ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=XCVT       ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=_POW10     ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=SIN        ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=TAN        ACBP=48\r
+ 3A39:4944 0000 C=BSS    S=_BSS           G=DGROUP  M=ATAN2      ACBP=48\r
+ 3A39:4944 0080 C=BSS    S=_BSS           G=DGROUP  M=ATEXIT     ACBP=48\r
+ 3A39:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=DOSFATTR   ACBP=48\r
+ 3A39:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=DOSWRITE   ACBP=48\r
+ 3A39:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=GETVECT    ACBP=48\r
+ 3A39:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=IOERROR    ACBP=48\r
+ 3A39:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=ISATTY     ACBP=48\r
+ 3A39:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=LONGTOA    ACBP=48\r
+ 3A39:49C4 0000 C=BSS    S=_BSS           G=DGROUP  M=LSEEK      ACBP=48\r
+ 3A39:49C4 000D C=BSS    S=_BSS           G=DGROUP  M=MKNAME     ACBP=48\r
+ 3A39:49D2 0000 C=BSS    S=_BSS           G=DGROUP  M=OUTPORT    ACBP=48\r
+ 3A39:49D2 0000 C=BSS    S=_BSS           G=DGROUP  M=READA      ACBP=48\r
+ 3A39:49D2 0000 C=BSS    S=_BSS           G=DGROUP  M=SCANTOL    ACBP=48\r
+ 3A39:49D2 0000 C=BSS    S=_BSS           G=DGROUP  M=SETUPIO    ACBP=48\r
+ 3A39:49D2 0004 C=BSS    S=_BSS           G=DGROUP  M=SIGDATA    ACBP=48\r
+ 3A39:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=UNLINK     ACBP=48\r
+ 3A39:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=VPRINTER   ACBP=48\r
+ 3A39:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=VRAM       ACBP=48\r
+ 3A39:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=BIOSKEY    ACBP=48\r
+ 3A39:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=BRK        ACBP=48\r
+ 3A39:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=CORELEFT   ACBP=48\r
+ 3A39:49D6 0000 C=BSS    S=_BSS           G=DGROUP  M=CRTINIT    ACBP=48\r
+ 3A39:49D6 000C C=BSS    S=_BSS           G=DGROUP  M=HARDERR    ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=IOCTL      ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=SETBLOCK   ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=ATOL       ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=BDOS       ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=CHMODA     ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=CLOSEA     ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=CREAT      ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=FINDFIRS   ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=FLENGTH    ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=GETENV     ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=MEMCPY     ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=MOVEDATA   ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=OPEN       ACBP=48\r
+ 3A39:49E2 0000 C=BSS    S=_BSS           G=DGROUP  M=OPENA      ACBP=48\r
+ 3A39:49E2 0001 C=BSS    S=_BSS           G=DGROUP  M=PUTC       ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=READ       ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=STRCAT     ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=STRCPY     ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=STRLEN     ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=WRITEA     ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FMEMCMP    ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FMEMCPY    ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FMEMSET    ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FSTRCPY    ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FSTRICMP   ACBP=48\r
+ 3A39:49E4 0000 C=BSS    S=_BSS           G=DGROUP  M=FSTRLEN    ACBP=48\r
+ 3A39:49E4 A5CB C=BSS    S=_COMDEF_       G=DGROUP  M=WOLFHACK.C ACBP=48\r
+ 3A39:EFAF 0000 C=BSSEND S=_BSSEND        G=DGROUP  M=C0.ASM     ACBP=28\r
+ 4934:0000 0080 C=STACK  S=_STACK         G=(none)  M=C0.ASM     ACBP=74\r
+\r
+  Address         Publics by Name\r
+\r
+ 3A39:0000 idle  DATASEG@\r
+ 0000:02AE idle  DGROUP@\r
+ 1E39:2152       e086_Entry\r
+ 1E39:26E0       e086_Shortcut\r
+ 20B1:0306       e087_Entry\r
+ 20B1:03C6       e087_Shortcut\r
+ 20B1:0430       e087_Trap\r
+ 0000:FE32 idle  FIARQQ\r
+ 0000:0E32 idle  FICRQQ\r
+ 0000:5C32  Abs  FIDRQQ\r
+ 0000:1632  Abs  FIERQQ\r
+ 0000:0632 idle  FISRQQ\r
+ 0000:A23D  Abs  FIWRQQ\r
+ 0000:4000 idle  FJARQQ\r
+ 0000:C000 idle  FJCRQQ\r
+ 0000:8000 idle  FJSRQQ\r
+ 0000:1130 idle  FTOL@\r
+ 0000:1130       F_FTOL@\r
+ 0000:02B5       F_LDIV@\r
+ 0000:02DC       F_LMOD@\r
+ 0000:02D4 idle  F_LUDIV@\r
+ 0000:02E4 idle  F_LUMOD@\r
+ 0000:1320       F_LXLSH@\r
+ 0000:12A9       F_LXMUL@\r
+ 0000:1341       F_LXRSH@\r
+ 0000:1361       F_LXURSH@\r
+ 0000:1382       F_PADA@\r
+ 0000:140A       F_PADD@\r
+ 0000:12C0       F_PCMP@\r
+ 0000:13C6       F_PSBA@\r
+ 0000:146A       F_PSBP@\r
+ 0000:1439 idle  F_PSUB@\r
+ 0000:12E1       F_SCOPY@\r
+ 0000:1495       F_SPUSH@\r
+ 0000:02B5       LDIV@\r
+ 0000:02DC idle  LMOD@\r
+ 0000:02D4 idle  LUDIV@\r
+ 0000:02E4 idle  LUMOD@\r
+ 0000:1320 idle  LXLSH@\r
+ 0000:12A9 idle  LXMUL@\r
+ 0000:1341 idle  LXRSH@\r
+ 0000:1361 idle  LXURSH@\r
+ 0000:02B2 idle  N_LDIV@\r
+ 0000:02D9 idle  N_LMOD@\r
+ 0000:02D1 idle  N_LUDIV@\r
+ 0000:02E1 idle  N_LUMOD@\r
+ 0000:131D       N_LXLSH@\r
+ 0000:133E idle  N_LXRSH@\r
+ 0000:135E idle  N_LXURSH@\r
+ 0000:137F idle  N_PADA@\r
+ 0000:1407       N_PADD@\r
+ 0000:1657       N_PCMP@\r
+ 0000:13C3 idle  N_PSBA@\r
+ 0000:1467       N_PSBP@\r
+ 0000:1436 idle  N_PSUB@\r
+ 0000:148F idle  N_SPUSH@\r
+ 0000:1382 idle  PADA@\r
+ 0000:140A idle  PADD@\r
+ 0000:12C0 idle  PCMP@\r
+ 0000:13C6 idle  PSBA@\r
+ 0000:146A idle  PSBP@\r
+ 0000:1439 idle  PSUB@\r
+ 0000:12E1 idle  SCOPY@\r
+ 0000:1495 idle  SPUSH@\r
+ 0000:0296       _abort\r
+ 3A39:EE11       _abortprogram\r
+ 3A39:55BA       _actorat\r
+ 3A39:9C43       _AdLibPresent\r
+ 3A39:3293 idle  _afilename\r
+ 3A39:E8B0       _aftersort\r
+ 3A39:3289 idle  _aheadname\r
+ 3A39:EAB2       _alBlock\r
+ 3A39:EAAE       _alLengthLeft\r
+ 3A39:EAB8       _alNoCheck\r
+ 1A28:0D03       _alOut\r
+ 3A39:EAB4       _alSound\r
+ 3A39:EAAA       _alTimeCount\r
+ 3A39:EA9A       _alZeroInst\r
+ 3A39:D9C6       _angle\r
+ 3A39:A4E2       _anglefrac\r
+ 3A39:52DC       _areabyplayer\r
+ 33DA:0000       _areaconnect\r
+ 0FB8:0072       _AsmRefresh\r
+ 0000:05E8       _atan\r
+ 0000:1075       _atan2\r
+ 0000:115C idle  _atexit\r
+ 0000:3279 idle  _atoi\r
+ 0000:3209       _atol\r
+ 3A39:192C idle  _attackinfo\r
+ 3A39:E01D       _audiohandle\r
+ 3A39:E023       _audiohuffman\r
+ 3A39:324A       _audioname\r
+ 3A39:A054       _audiosegs\r
+ 3A39:E81B       _audiostarts\r
+ 13EC:072D       _A_DeathScream\r
+ 13EC:1220 idle  _A_HitlerMorph\r
+ 13EC:12A8 idle  _A_MechaSound\r
+ 13EC:12D8 idle  _A_Slurpie\r
+ 13EC:000C idle  _A_Smoke\r
+ 13EC:1F4F idle  _A_StartDeathCam\r
+ 3A39:9956       _backcolor\r
+ 060A:0660 idle  _BackPage\r
+ 0FFD:000A idle  _BadScale\r
+ 3A39:4C52       _basedist\r
+ 0000:3286       _bdos\r
+ 3A39:E8B4       _beforesort\r
+ 0000:1F54       _bioskey\r
+ 0A85:056F idle  _BJ_Breathe\r
+ 3A39:9957       _blockstarts\r
+ 3A39:E896       _bombonerror\r
+ 3A39:A41C       _bonuscount\r
+ 3A39:EE15       _bordercolor\r
+ 06A5:025E idle  _BossKey\r
+ 0000:1FCC idle  _brk\r
+ 3A39:E828       _btnstate\r
+ 3A39:EFAB       _bufferheight\r
+ 3A39:52D4       _bufferofs\r
+ 3A39:E826       _bufferseg\r
+ 3A39:EFAD       _bufferwidth\r
+ 0FFD:01DB idle  _BuildCompScale\r
+ 048F:0BFA idle  _BuildTables\r
+ 3A39:EE0F       _Button0\r
+ 3A39:EE0D       _Button1\r
+ 3A39:A4FE       _buttonheld\r
+ 3A39:1290       _buttonjoy\r
+ 3A39:1288       _buttonmouse\r
+ 3A39:1278       _buttonscan\r
+ 3A39:A4EA       _buttonstate\r
+ 060A:068A idle  _CacheLayoutGraphics\r
+ 06A5:2D10       _CacheLump\r
+ 0EBC:02F9 idle  _CalcHeight\r
+ 048F:0D49 idle  _CalcProjection\r
+ 0EBC:0A73 idle  _CalcRotate\r
+ 0EBC:0D9E       _CalcTics\r
+ 06A5:148E idle  _CalibrateJoystick\r
+ 160F:046B idle  _CAL_CarmackExpand\r
+ 160F:0E22 idle  _CAL_ExpandGrChunk\r
+ 160F:0088 idle  _CAL_GetGrChunkLength\r
+ 160F:0300 idle  _CAL_HuffExpand\r
+ 160F:02B5 idle  _CAL_OptimizeNodes\r
+ 160F:0B75 idle  _CAL_SetupAudioFile\r
+ 160F:078E idle  _CAL_SetupGrFile\r
+ 160F:09C0 idle  _CAL_SetupMapFile\r
+ 160F:0CF9       _CA_CacheAudioChunk\r
+ 160F:0EF4       _CA_CacheGrChunk\r
+ 160F:111A       _CA_CacheMap\r
+ 160F:135D       _CA_CacheMarks\r
+ 160F:1031       _CA_CacheScreen\r
+ 160F:165E idle  _CA_CannotOpen\r
+ 160F:12ED idle  _CA_ClearAllMarks\r
+ 160F:12CC idle  _CA_ClearMarks\r
+ 160F:0077 idle  _CA_CloseDebug\r
+ 160F:12A6       _CA_DownLevel\r
+ 160F:00E4       _CA_FarRead\r
+ 160F:012F       _CA_FarWrite\r
+ 3A39:9EE9       _ca_levelbit\r
+ 3A39:E823       _ca_levelnum\r
+ 160F:0DA1       _CA_LoadAllSounds\r
+ 160F:023B idle  _CA_LoadFile\r
+ 160F:0056 idle  _CA_OpenDebug\r
+ 160F:017A idle  _CA_ReadFile\r
+ 160F:058F idle  _CA_RLEWCompress\r
+ 160F:06D7 idle  _CA_RLEWexpand\r
+ 160F:1336       _CA_SetAllPurge\r
+ 160F:130F idle  _CA_SetGrPurge\r
+ 160F:0CD0       _CA_Shutdown\r
+ 160F:0CAF       _CA_Startup\r
+ 160F:1269       _CA_UpLevel\r
+ 160F:01E5       _CA_WriteFile\r
+ 0CFC:05E6       _CenterWindow\r
+ 3A39:9896       _centerx\r
+ 06A5:3C30       _CheckForEpisodes\r
+ 0A85:120F       _CheckHighScore\r
+ 048C:0000       _CheckIs386\r
+ 0CFC:0614 idle  _CheckKeys\r
+ 1087:0FED       _CheckLine\r
+ 06A5:3B7D idle  _CheckPause\r
+ 13EC:1EB7 idle  _CheckPosition\r
+ 1087:1291 idle  _CheckSight\r
+ 1201:0005 idle  _CheckWeaponChange\r
+ 3A39:E019       _chunkcomplen\r
+ 3A39:E015       _chunkexplen\r
+ 3A39:D866       _ChunksInFile\r
+ 06A5:2F07 idle  _CleanupControlPanel\r
+ 0BC6:017B       _ClearMemory\r
+ 06A5:2CF7       _ClearMScreen\r
+ 0CFC:0CBC idle  _ClearPaletteShifts\r
+ 0A85:0004       _ClearSplitVWB\r
+ 1201:091D idle  _ClipMove\r
+ 0000:32B1       _close\r
+ 1320:0369 idle  _CloseDoor\r
+ 0000:1FE8       _clrscr\r
+ 1201:0B37 idle  _Cmd_Fire\r
+ 1201:0B89 idle  _Cmd_Use\r
+ 3A39:0418 idle  _color_hlite\r
+ 3A39:0420 idle  _color_norml\r
+ 3A39:D846       _compatability\r
+ 3A39:00EE       _configname\r
+ 06A5:3839 idle  _Confirm\r
+ 1320:01B7 idle  _ConnectAreas\r
+ 1201:0039 idle  _ControlMovement\r
+ 3A39:E844       _Controls\r
+ 3A39:A4FC       _controlx\r
+ 3A39:A4FA       _controly\r
+ 0000:2011       _coreleft\r
+ 3A39:1694       _costable\r
+ 0E0D:00C2 idle  _CountObjects\r
+ 06A5:288C idle  _CP_ChangeView\r
+ 06A5:02A8 idle  _CP_CheckQuick\r
+ 06A5:16A9 idle  _CP_Control\r
+ 06A5:079D idle  _CP_EndGame\r
+ 06A5:0EDA idle  _CP_LoadGame\r
+ 06A5:0851 idle  _CP_NewGame\r
+ 06A5:2A7D idle  _CP_Quit\r
+ 06A5:11BB idle  _CP_SaveGame\r
+ 06A5:0ADF idle  _CP_Sound\r
+ 06A5:07F3       _CP_ViewScores\r
+ 0000:3310       _creat\r
+ 3A39:03F0 idle  _CtlItems\r
+ 23B4:0000 idle  _CtlMenu\r
+ 3A39:EE0B       _CursorBad\r
+ 3A39:EE09       _CursorX\r
+ 3A39:EE07       _CursorY\r
+ 3A39:03FA idle  _CusItems\r
+ 2407:0000 idle  _CusMenu\r
+ 06A5:1C5A idle  _CustomControls\r
+ 1087:0EF2       _DamageActor\r
+ 3A39:A41E       _damagecount\r
+ 3A39:E81F       _debughandle\r
+ 0E0D:076C       _DebugKeys\r
+ 0E0D:000D idle  _DebugMemory\r
+ 3A39:A4DE       _DebugOk\r
+ 06A5:1D37 idle  _DefineJoyBtns\r
+ 06A5:1D73 idle  _DefineKeyBtns\r
+ 06A5:1DAF idle  _DefineKeyMove\r
+ 06A5:1CFB idle  _DefineMouseBtns\r
+ 3A39:E842       _DemoBuffer\r
+ 3A39:A2AC       _demobuffer\r
+ 048F:159A idle  _DemoLoop\r
+ 3A39:335E idle  _DemoMode\r
+ 3A39:1204       _demoname\r
+ 3A39:E840       _DemoOffset\r
+ 3A39:A2B6       _demoplayback\r
+ 3A39:A2B2       _demoptr\r
+ 3A39:A2B8       _demorecord\r
+ 3A39:E83E       _DemoSize\r
+ 3A39:181E idle  _diagonal\r
+ 0BC6:0F34 idle  _Died\r
+ 3A39:ECD5       _DigiLastEnd\r
+ 3A39:ECD7       _DigiLastStart\r
+ 3A39:ECDB       _DigiLeft\r
+ 3A39:D84A       _DigiList\r
+ 3A39:9B8B       _DigiMap\r
+ 3A39:9C3B       _DigiMode\r
+ 3A39:ECEF       _DigiNumber\r
+ 3A39:ECD9       _DigiPage\r
+ 3A39:ED07       _DigiPlaying\r
+ 3A39:ECEB       _DigiPriority\r
+ 3A39:00DC       _dirangle\r
+ 3A39:46E1       _directvideo\r
+ 3A39:1270       _dirscan\r
+ 3A39:1B38 idle  _dirtable\r
+ 048F:03BA idle  _DiskFlopAnim\r
+ 3A39:9D4E       _displayofs\r
+ 0CFC:0E00 idle  _DoActor\r
+ 048F:03E9 idle  _DoChecksum\r
+ 048F:1041 idle  _DoJukebox\r
+ 1320:07B9 idle  _DoorClosing\r
+ 3A39:D85C       _doornum\r
+ 3A39:86BA       _doorobjlist\r
+ 1320:0631 idle  _DoorOpen\r
+ 1320:065F idle  _DoorOpening\r
+ 3A39:5328       _doorposition\r
+ 0BC6:09E5       _DrawAllPlayBorder\r
+ 0BC6:09BA       _DrawAllPlayBorderSides\r
+ 1201:04F5       _DrawAmmo\r
+ 06A5:29FF idle  _DrawChangeView\r
+ 06A5:1A9B idle  _DrawCtlScreen\r
+ 06A5:275E idle  _DrawCustJoy\r
+ 06A5:27F2 idle  _DrawCustKeybd\r
+ 06A5:285A idle  _DrawCustKeys\r
+ 06A5:26B7 idle  _DrawCustMouse\r
+ 06A5:23A7 idle  _DrawCustomScreen\r
+ 1201:01FF       _DrawFace\r
+ 06A5:34BE idle  _DrawGun\r
+ 06A5:347E idle  _DrawHalfStep\r
+ 1201:032A       _DrawHealth\r
+ 0A85:1041       _DrawHighScores\r
+ 1201:047F       _DrawKeys\r
+ 1201:03C2       _DrawLevel\r
+ 1201:03DB       _DrawLives\r
+ 06A5:1089 idle  _DrawLoadSaveScreen\r
+ 06A5:0E5E idle  _DrawLSAction\r
+ 06A5:01BE idle  _DrawMainMenu\r
+ 06A5:35AC       _DrawMenu\r
+ 06A5:3BBD idle  _DrawMenuGun\r
+ 06A5:17AE idle  _DrawMouseSens\r
+ 06A5:098F idle  _DrawNewEpisode\r
+ 06A5:0A3C idle  _DrawNewGame\r
+ 06A5:0AC6 idle  _DrawNewGameDiff\r
+ 06A5:2DA4 idle  _DrawOutline\r
+ 044B:027E idle  _DrawPlanes\r
+ 0BC6:0A11       _DrawPlayBorder\r
+ 0BC6:0930 idle  _DrawPlayBorderSides\r
+ 0EBC:0D02 idle  _DrawPlayerWeapon\r
+ 0BC6:0ADB       _DrawPlayScreen\r
+ 0EBC:0AEF idle  _DrawScaleds\r
+ 1201:0411       _DrawScore\r
+ 06A5:0C70 idle  _DrawSoundMenu\r
+ 044B:0034 idle  _DrawSpans\r
+ 06A5:3BF0       _DrawStripes\r
+ 1201:0468       _DrawWeapon\r
+ 06A5:2D6E       _DrawWindow\r
+ 1087:0B99 idle  _DropItem\r
+ 3A39:A422       _dummyobj\r
+ 3A39:0E74 idle  _ElevatorBackTo\r
+ 3A39:352A idle  _EMMDriverName\r
+ 3A39:E8F2       _EMSAvail\r
+ 3A39:E8F0       _EMSHandle\r
+ 3A39:E8D4       _EMSList\r
+ 3A39:E8EE       _EMSPageFrame\r
+ 3A39:A294       _EMSPagesAvail\r
+ 3A39:E8C2       _EMSPagesUsed\r
+ 3A39:E8EC       _EMSPhysicalPage\r
+ 3A39:A298       _EMSPresent\r
+ 3A39:0330 idle  _endextern\r
+ 3A39:0341       _endfilename\r
+ 234F:0000 idle  _endStrings\r
+ 060A:090C       _EndText\r
+ 06A5:1DEB idle  _EnterCtrlData\r
+ 3A39:4732       _environ\r
+ 3A39:0428 idle  _EpisodeSelect\r
+ 06A5:3407 idle  _EraseGun\r
+ 3A39:00C3       _errno\r
+ 0000:126E       _exit\r
+ 3A39:A04F       _extension\r
+ 3A39:A50E       _extravbls\r
+ 3A39:A4E0       _facecount\r
+ 0000:2757       _farcoreleft\r
+ 0000:2333       _farfree\r
+ 3A39:E8AA       _farheap\r
+ 0000:243D       _farmalloc\r
+ 3A39:863A       _farmapylookup\r
+ 0000:259A idle  _farrealloc\r
+ 0EBC:040A       _FarScalePost\r
+ 3A39:D868       _farthest\r
+ 3A39:EE13       _fastpalette\r
+ 0000:3382       _fclose\r
+ 0000:33FF       _fflush\r
+ 0000:34E0       _filelength\r
+ 0000:3480       _findfirst\r
+ 0000:34B3       _findnext\r
+ 34A1:0000       _finetangent\r
+ 0BC6:0BC7 idle  _FinishDemoRecord\r
+ 0CFC:0DD6       _FinishPaletteShifts\r
+ 048F:0F21 idle  _FinishSignon\r
+ 1087:138E idle  _FirstSighting\r
+ 0EBC:000F       _FixedByFrac\r
+ 044B:000C idle  _FixedMul\r
+ 0EBC:0E01       _FixOfs\r
+ 06A5:2237 idle  _FixupCustom\r
+ 1D62:07A1       _FizzleFade\r
+ 3A39:A2C8       _fizzlein\r
+ 0000:3521       _flushall\r
+ 3A39:989A       _focallength\r
+ 3A39:D9D0       _focaltx\r
+ 3A39:D9CE       _focalty\r
+ 3A39:9D4D       _fontcolor\r
+ 3A39:9D4B       _fontnumber\r
+ 0000:36DC       _fopen\r
+ 0000:36FB       _fprintf\r
+ 0000:3B2A       _fputc\r
+ 0000:3C5E idle  _fputchar\r
+ 3A39:A4E6       _frameon\r
+ 0000:2A9D       _free\r
+ 3A39:168A       _freelatch\r
+ 06A5:3B16       _FreeMusic\r
+ 0000:376E       _fseek\r
+ 0000:37D6 idle  _ftell\r
+ 3A39:D9DC       _fullscalefarcall\r
+ 3A39:A416       _funnyticount\r
+ 0BC6:1162       _GameLoop\r
+ 3A39:2F4A       _gamepal\r
+ 3A39:ED0B       _Games\r
+ 3A39:95C2       _gamestate\r
+ 3A39:326B idle  _gdictname\r
+ 1201:0557       _GetBonus\r
+ 0000:3823       _getenv\r
+ 0CFC:09F4       _GetNewActor\r
+ 0000:27F0       _gettext\r
+ 0000:12FD       _getvect\r
+ 3A39:3261 idle  _gfilename\r
+ 3A39:3257 idle  _gheadname\r
+ 1201:050D idle  _GiveAmmo\r
+ 1201:03F3 idle  _GiveExtraMan\r
+ 1201:0542 idle  _GiveKey\r
+ 1201:042B       _GivePoints\r
+ 1201:04CC       _GiveWeapon\r
+ 3A39:A2A8       _globalsoundx\r
+ 3A39:A2A4       _globalsoundy\r
+ 3A39:A512       _godmode\r
+ 3A39:E00B       _gotgatgun\r
+ 0000:27A7       _gotoxy\r
+ 160F:0008 idle  _GRFILEPOS\r
+ 3A39:E021       _grhandle\r
+ 3A39:E41F       _grhuffman\r
+ 3582:0000       _grneeded\r
+ 3A39:9D50       _grsegs\r
+ 3A39:E81D       _grstarts\r
+ 1201:0DFF idle  _GunAttack\r
+ 3A39:ED01       _HackCount\r
+ 3A39:00DA idle  _halfheight\r
+ 060A:00F7 idle  _HandleCommand\r
+ 060A:03A7 idle  _HandleCtrls\r
+ 06A5:2F1D       _HandleMenu\r
+ 060A:03C7 idle  _HandleWord\r
+ 0000:2885       _harderr\r
+ 0000:2897 idle  _hardresume\r
+ 0000:28A5 idle  _hardretn\r
+ 1201:039B       _HealSelf\r
+ 3A39:9606       _heightnumerator\r
+ 3A39:0332 idle  _helpextern\r
+ 3A39:0334 idle  _helpfilename\r
+ 060A:0885 idle  _HelpScreens\r
+ 0EBC:0653       _HitHorizDoor\r
+ 0EBC:0857       _HitHorizPWall\r
+ 0EBC:0531       _HitHorizWall\r
+ 0EBC:0753       _HitVertDoor\r
+ 0EBC:0931       _HitVertPWall\r
+ 0EBC:0412       _HitVertWall\r
+ 3A39:542A       _horizwall\r
+ 3A39:A04A       _ingame\r
+ 0CFC:09B0       _InitActorList\r
+ 1320:01F0       _InitAreas\r
+ 048F:1020 idle  _InitDigiMap\r
+ 1320:0218       _InitDoorList\r
+ 048F:122A idle  _InitGame\r
+ 0CFC:0B4C       _InitRedShifts\r
+ 1320:000F       _InitStaticList\r
+ 177B:01DA       _INL_GetJoyDelta\r
+ 3A39:DDF7       _insetupscaling\r
+ 06A5:2B04       _IntroScreen\r
+ 177B:0AB2       _IN_Ack\r
+ 177B:0A59       _IN_CheckAck\r
+ 177B:068B       _IN_ClearKeysDown\r
+ 177B:060E idle  _IN_Default\r
+ 177B:0141       _IN_GetJoyAbs\r
+ 177B:0336 idle  _IN_GetJoyButtonsDB\r
+ 06A5:3B39 idle  _IN_GetScanName\r
+ 177B:0B1B       _IN_JoyButtons\r
+ 177B:0B04       _IN_MouseButtons\r
+ 177B:06AA       _IN_ReadControl\r
+ 177B:09C2 idle  _IN_SetControlType\r
+ 177B:0679 idle  _IN_SetKeyHook\r
+ 177B:048B       _IN_SetupJoy\r
+ 177B:064D       _IN_Shutdown\r
+ 177B:0A0A       _IN_StartAck\r
+ 177B:0572       _IN_Startup\r
+ 177B:0AC3       _IN_UserInput\r
+ 177B:09EF       _IN_WaitForASCII\r
+ 177B:09D3 idle  _IN_WaitForKey\r
+ 0000:29D9       _ioctl\r
+ 3A39:989E       _IsA386\r
+ 0000:1501       _isatty\r
+ 0000:3882       _itoa\r
+ 048C:0028       _jabhack2\r
+ 3A39:00FC idle  _JHParmStrings\r
+ 3A39:E84C       _JoyDefs\r
+ 3A39:54B0       _joypadenabled\r
+ 3A39:E83C       _JoyPadPresent\r
+ 3A39:9C45       _JoysPresent\r
+ 3A39:54B2       _joystickenabled\r
+ 3A39:54AC       _joystickport\r
+ 3A39:54AE       _joystickprogressive\r
+ 3A39:3354 idle  _KbdDefs\r
+ 3A39:9C4B       _Keyboard\r
+ 1087:0C2C idle  _KillActor\r
+ 3A39:A2BA       _killerobj\r
+ 1201:0D6B idle  _KnifeAttack\r
+ 3A39:A04C       _LastASCII\r
+ 3A39:E009       _LastAttacker\r
+ 3A39:A2AE       _lastdemoptr\r
+ 3A39:E011       _lastdoorobj\r
+ 3A39:D9D4       _lastintercept\r
+ 3A39:B518       _lastobj\r
+ 3A39:9EE2       _LastScan\r
+ 3A39:D9D8       _lastside\r
+ 3A39:893A       _laststatobj\r
+ 3A39:D9D2       _lasttilehit\r
+ 3A39:9EEC       _lasttimecount\r
+ 1D62:062F       _LatchDrawPic\r
+ 1201:02A1 idle  _LatchNumber\r
+ 3A39:A2D2       _latchpics\r
+ 3A39:9E8E       _layoutdone\r
+ 3A39:A2A2       _leftchannel\r
+ 3A39:9EBC       _leftmargin\r
+ 3A39:3FCE idle  _leftmasks\r
+ 3A39:ECE9       _LeftPosition\r
+ 3A39:1042 idle  _lefttable\r
+ 0A85:05D1       _LevelCompleted\r
+ 3A39:9906       _LevelRatios\r
+ 3A39:DDEB       _linecmds\r
+ 3A39:DDE7       _linescale\r
+ 3A39:EFA7       _linewidth\r
+ 3A39:9B85       _loadedgame\r
+ 1D62:0687       _LoadLatchMem\r
+ 048F:0803       _LoadTheGame\r
+ 3A39:ECDF       _LocalTime\r
+ 0000:15AC       _lseek\r
+ 3A39:03E6 idle  _LSItems\r
+ 23EC:0000 idle  _LSMenu\r
+ 0000:38C4       _ltoa\r
+ 3A39:D844       _madenoise\r
+ 048F:179C       _main\r
+ 3A39:03D2       _MainItems\r
+ 3A39:E9BE       _MainMemPages\r
+ 3A39:E8F6       _MainMemUsed\r
+ 237C:0000       _MainMenu\r
+ 3A39:E8F4       _MainPagesAvail\r
+ 3A39:E8C0       _MainPagesUsed\r
+ 3A39:EA86       _MainPresent\r
+ 0000:2B6C       _malloc\r
+ 3A39:E01F       _maphandle\r
+ 3A39:A39A       _mapheaderseg\r
+ 3A39:A2CC       _mapheight\r
+ 3A39:171A       _mapmasks1\r
+ 3A39:173A       _mapmasks2\r
+ 3A39:175A       _mapmasks3\r
+ 3A39:A29E       _mapon\r
+ 3A39:D852       _maporgx\r
+ 3A39:D850       _maporgy\r
+ 0485:0008       _MapRow\r
+ 3A39:A412       _mapsegs\r
+ 3A39:A2CE       _mapwidth\r
+ 3A39:A45E       _mapwidthtable\r
+ 3A39:DDE4       _mask1\r
+ 3A39:DDE3       _mask2\r
+ 3A39:DDE2       _mask3\r
+ 3A39:DDE5       _maskword\r
+ 0000:0F22       _matherr\r
+ 3A39:DDF9       _maxscale\r
+ 3A39:D9DA       _maxscaleshl2\r
+ 3A39:960A       _maxslope\r
+ 3A39:05F2 idle  _mbarray\r
+ 0000:38E9       _memcpy\r
+ 3A39:52D2       _menuitems\r
+ 06A5:3960       _Message\r
+ 3A39:327F idle  _mfilename\r
+ 3A39:3275 idle  _mheadname\r
+ 3A39:D9C8       _midangle\r
+ 3A39:1690 idle  _mindist\r
+ 3A39:9604       _minheightdiv\r
+ 3A39:49FA       _mirrorofs\r
+ 37CC:0000       _mmblocks\r
+ 3A39:A29C       _mmerror\r
+ 3A39:E8A0       _mmfree\r
+ 3A39:E8A4       _mmhead\r
+ 3A39:9E7A       _mminfo\r
+ 182E:0000 idle  _MML_CheckForXMS\r
+ 182E:0239 idle  _MML_ClearBlock\r
+ 182E:001B idle  _MML_SetupXMS\r
+ 182E:0087 idle  _MML_ShutdownXMS\r
+ 182E:00B6       _MML_UseSpace\r
+ 3A39:E898       _mmnew\r
+ 3A39:E89C       _mmrover\r
+ 3A39:E8AE       _mmstarted\r
+ 182E:0E3C       _MM_BombOnError\r
+ 182E:0C31 idle  _MM_DumpData\r
+ 182E:0767       _MM_FreePtr\r
+ 182E:04B3       _MM_GetPtr\r
+ 182E:08A9       _MM_SetLock\r
+ 182E:082B       _MM_SetPurge\r
+ 182E:0AE0 idle  _MM_ShowMemory\r
+ 182E:048B       _MM_Shutdown\r
+ 182E:092B       _MM_SortMem\r
+ 182E:029A       _MM_Startup\r
+ 182E:0DC0       _MM_TotalFree\r
+ 182E:0D5B       _MM_UnusedMemory\r
+ 3A39:988E       _mouseadjustment\r
+ 3A39:E838       _MouseDownCount\r
+ 3A39:54B4       _mouseenabled\r
+ 3A39:9C49       _MousePresent\r
+ 06A5:18B2 idle  _MouseSensitivity\r
+ 0000:3908       _movedata\r
+ 1320:08E8       _MoveDoors\r
+ 1087:0967       _MoveObj\r
+ 3A39:0622 idle  _moveorder\r
+ 1320:0AC9       _MovePWalls\r
+ 0000:2A00       _movetext\r
+ 3A39:49EE       _mr_count\r
+ 3A39:49E4       _mr_dest\r
+ 3A39:49F0       _mr_rowofs\r
+ 3A39:49E8       _mr_xfrac\r
+ 3A39:49EC       _mr_xstep\r
+ 3A39:49E6       _mr_yfrac\r
+ 3A39:49EA       _mr_ystep\r
+ 048F:0FBA       _MS_CheckParm\r
+ 3A39:01C4 idle  _MusicItems\r
+ 231F:0000 idle  _MusicMenu\r
+ 3A39:9C39       _MusicMode\r
+ 3A39:E8A8       _nearheap\r
+ 3A39:85BA       _nearmapylookup\r
+ 3A39:ED03       _NeedsDigitized\r
+ 3A39:ED09       _NeedsMusic\r
+ 3A39:95BE       _new\r
+ 3A39:0404 idle  _NewEitems\r
+ 23C4:0000 idle  _NewEmenu\r
+ 048F:0369       _NewGame\r
+ 3A39:040E idle  _NewItems\r
+ 060A:034C idle  _NewLine\r
+ 23E1:0000 idle  _NewMenu\r
+ 1087:00BA       _NewState\r
+ 048F:148B       _NewViewSize\r
+ 3A39:ECFB       _nextsoundpos\r
+ 3A39:A510       _noclip\r
+ 0A85:1353 idle  _NonShareware\r
+ 3A39:98A0       _nospr\r
+ 3A39:01FC idle  _nosprtxt\r
+ 3A39:9B83       _NoWait\r
+ 3A39:D84C       _NumDigi\r
+ 3A39:9EDA       _numpages\r
+ 3A39:E890       _numUMBs\r
+ 3A39:B51A       _obj\r
+ 3A39:A420       _objcount\r
+ 3A39:B516       _objfreelist\r
+ 3A39:B51C       _objlist\r
+ 3A39:E013       _oldsoundmode\r
+ 0000:3955       _open\r
+ 1320:0340       _OpenDoor\r
+ 1320:05BD       _OperateDoor\r
+ 3A39:180C idle  _opposite\r
+ 3A39:05FE idle  _order\r
+ 0000:169C idle  _outp\r
+ 0000:1678       _outport\r
+ 0000:1684 idle  _outportb\r
+ 0000:1690 idle  _outpw\r
+ 3A39:3520 idle  _PageFile\r
+ 3A39:3512       _PageFileName\r
+ 060A:0475 idle  _PageLayout\r
+ 3A39:9EDC       _pagenum\r
+ 3A09:0000       _palette1\r
+ 39D9:0000       _palette2\r
+ 3A39:A41A       _palshifted\r
+ 060A:001F idle  _ParseNumber\r
+ 060A:0071 idle  _ParsePicCommand\r
+ 060A:008F idle  _ParseTimedCommand\r
+ 048F:030D idle  _Patch386\r
+ 3A39:A04D       _Paused\r
+ 3A39:ECC0       _pcLastSample\r
+ 3A39:ECB8       _pcLengthLeft\r
+ 3A39:49F2       _pcos\r
+ 3A39:ECBC       _pcSound\r
+ 3A39:EABA       _pcSoundLookup\r
+ 3A39:EFA9       _pelpan\r
+ 0A85:03CC       _PG13\r
+ 3A39:9E90       _picdelay\r
+ 3A39:9EEA       _pickquick\r
+ 3A39:9E92       _picnum\r
+ 3A39:9EE7       _pictable\r
+ 0E0D:01B3       _PicturePause\r
+ 3A39:9E96       _picx\r
+ 3A39:9E94       _picy\r
+ 3A39:960E       _pixelangle\r
+ 3A39:3FCA idle  _pixmasks\r
+ 3A39:D9B2       _pixx\r
+ 1320:00E1       _PlaceItemType\r
+ 210E:0000       _planepics\r
+ 3A39:4AC2       _planeylookup\r
+ 0BC6:0DD1       _PlayDemo\r
+ 3A39:95BC       _player\r
+ 3A39:E005       _playerxmove\r
+ 3A39:E001       _playerymove\r
+ 0CFC:0F8C       _PlayLoop\r
+ 0BC6:00F7       _PlaySoundLocGlobal\r
+ 3A39:95C0       _playstate\r
+ 3A39:DFFF       _plux\r
+ 3A39:DFFD       _pluy\r
+ 3A39:E8BA       _PMFrameCount\r
+ 1912:06B1 idle  _PML_ClosePageFile\r
+ 1912:0A96 idle  _PML_GetAPageBuffer\r
+ 1912:06E8 idle  _PML_GetEMSAddress\r
+ 1912:0BA0 idle  _PML_GetPageFromXMS\r
+ 1912:0812 idle  _PML_GiveLRUPage\r
+ 1912:08B0 idle  _PML_GiveLRUXMSPage\r
+ 1912:0C21 idle  _PML_LoadPage\r
+ 1912:0007 idle  _PML_MapEMS\r
+ 1912:04E8 idle  _PML_OpenPageFile\r
+ 1912:0920 idle  _PML_PutPageInXMS\r
+ 1912:046E idle  _PML_ReadFromFile\r
+ 1912:0155 idle  _PML_ShutdownEMS\r
+ 1912:0447 idle  _PML_ShutdownMainMem\r
+ 1912:0293 idle  _PML_ShutdownXMS\r
+ 1912:0029 idle  _PML_StartupEMS\r
+ 1912:03D0 idle  _PML_StartupMainMem\r
+ 1912:0178 idle  _PML_StartupXMS\r
+ 1912:09C9 idle  _PML_TransferPageSpace\r
+ 1912:01EA idle  _PML_XMSCopy\r
+ 3A39:E8BE       _PMNumBlocks\r
+ 3A39:D85E       _PMPages\r
+ 3A39:E8C8       _PMPanicMode\r
+ 3A39:E8B8       _PMSegPages\r
+ 3A39:D862       _PMSoundStart\r
+ 3A39:D864       _PMSpriteStart\r
+ 3A39:E8CA       _PMStarted\r
+ 3A39:E8C6       _PMThrashing\r
+ 1912:02DF       _PM_CheckMainMem\r
+ 1912:0C71       _PM_GetPage\r
+ 1912:07BF       _PM_GetPageAddress\r
+ 1912:0FBA       _PM_NextFrame\r
+ 1912:0D60       _PM_Preload\r
+ 1912:1034 idle  _PM_Reset\r
+ 1912:02B8       _PM_SetMainMemPurge\r
+ 1912:0D31       _PM_SetPageLock\r
+ 1912:114B       _PM_Shutdown\r
+ 1912:10A0       _PM_Startup\r
+ 0CFC:03B9 idle  _PollControls\r
+ 0CFC:006F idle  _PollJoystickButtons\r
+ 0CFC:0248 idle  _PollJoystickMove\r
+ 0CFC:0007 idle  _PollKeyboardButtons\r
+ 0CFC:0100 idle  _PollKeyboardMove\r
+ 0CFC:002B idle  _PollMouseButtons\r
+ 0CFC:020C idle  _PollMouseMove\r
+ 3A39:D858       _postsource\r
+ 3A39:D854       _postwidth\r
+ 3A39:D856       _postx\r
+ 0000:0F17       _pow10\r
+ 0A85:0FA5       _PreloadGraphics\r
+ 0A85:0F10 idle  _PreloadUpdate\r
+ 06A5:2714 idle  _PrintCustJoy\r
+ 06A5:27BB idle  _PrintCustKeybd\r
+ 06A5:2824 idle  _PrintCustKeys\r
+ 06A5:266D idle  _PrintCustMouse\r
+ 0000:3AFA       _printf\r
+ 06A5:112F idle  _PrintLSEntry\r
+ 3A39:A048       _PrintX\r
+ 3A39:9B81       _PrintY\r
+ 3A39:E821       _profilehandle\r
+ 13EC:005A idle  _ProjectileTryMove\r
+ 3A39:49F6       _psin\r
+ 1320:093B       _PushWall\r
+ 0000:3E13       _puts\r
+ 0000:2844       _puttext\r
+ 3A39:52D6       _pwalldir\r
+ 3A39:53A8       _pwallpos\r
+ 3A39:5326       _pwallstate\r
+ 3A39:52DA       _pwallx\r
+ 3A39:52D8       _pwally\r
+ 3A39:9EE5       _px\r
+ 3A39:9EE3       _py\r
+ 048F:14CF       _Quit\r
+ 3A39:0102 idle  _radtoint\r
+ 0000:3F2C       _read\r
+ 06A5:36DC idle  _ReadAnyControl\r
+ 048F:000B idle  _ReadConfig\r
+ 0000:2CC5 idle  _realloc\r
+ 0BC6:0C9A       _RecordDemo\r
+ 1320:016B idle  _RecursiveConnect\r
+ 36AC:0000       _redshifts\r
+ 0CFC:0A55 idle  _RemoveObj\r
+ 3A39:A2A0       _rightchannel\r
+ 3A39:9E9E       _rightmargin\r
+ 3A39:3FD2 idle  _rightmasks\r
+ 3A39:ECE7       _RightPosition\r
+ 3A39:0E80 idle  _righttable\r
+ 060A:000C idle  _RipToEOL\r
+ 230E:0002 idle  _rndtable\r
+ 3A39:9E98       _rowon\r
+ 3A39:A4E4       _running\r
+ 3A39:9EF0       _SaveGameNames\r
+ 3A39:A032       _SaveGamesAvail\r
+ 3A39:0436 idle  _SaveName\r
+ 048F:042E       _SaveTheGame\r
+ 3A39:ED05       _SBProPresent\r
+ 0000:1FD8 idle  _sbrk\r
+ 3A39:52CA       _scale\r
+ 3A39:DDFB       _scaledirectory\r
+ 0FFD:032F idle  _ScaleLine\r
+ 0EBC:0397 idle  _ScalePost\r
+ 0FFD:0479       _ScaleShape\r
+ 0BC6:0194 idle  _ScanInfoPlane\r
+ 3A39:3D1A       _Scores\r
+ 3A39:D848       _screenfaded\r
+ 3A39:1684       _screenloc\r
+ 3A39:9898       _screenofs\r
+ 3A39:3FC4       _screenseg\r
+ 1A28:0B5F       _SDL_DigitizedDone\r
+ 1BB1:0014       _SDL_IndicatePC\r
+ 1A28:08B0 idle  _SDL_LoadDigiSegment\r
+ 1A28:08E1 idle  _SDL_PlayDigiSegment\r
+ 1A28:0501 idle  _SDL_SBSetDMA\r
+ 1BB1:000C       _SDL_SetDS\r
+ 1A28:0C2D idle  _SDL_SetupDigi\r
+ 1BB1:0021       _SDL_t0ExtremeAsmService\r
+ 1BB1:009B       _SDL_t0FastAsmService\r
+ 1BB1:02CD       _SDL_t0SlowAsmService\r
+ 1A28:14B4 idle  _SD_Default\r
+ 1A28:1870 idle  _SD_FadeOutMusic\r
+ 1A28:17DA       _SD_MusicOff\r
+ 1A28:17CF       _SD_MusicOn\r
+ 1A28:1881 idle  _SD_MusicPlaying\r
+ 1A28:0A9F idle  _SD_PlayDigitized\r
+ 1A28:15A4       _SD_PlaySound\r
+ 1A28:09CC       _SD_Poll\r
+ 1A28:158D       _SD_PositionSound\r
+ 1A28:0BC9       _SD_SetDigiDevice\r
+ 1A28:1129       _SD_SetMusicMode\r
+ 1A28:0A58       _SD_SetPosition\r
+ 1A28:109B       _SD_SetSoundMode\r
+ 1A28:157B idle  _SD_SetUserHook\r
+ 1A28:1523       _SD_Shutdown\r
+ 1A28:1744       _SD_SoundPlaying\r
+ 1A28:181E       _SD_StartMusic\r
+ 1A28:117B       _SD_Startup\r
+ 1A28:092B       _SD_StopDigitized\r
+ 1A28:178B       _SD_StopSound\r
+ 1A28:17C2       _SD_WaitSoundDone\r
+ 1087:0747       _SelectChaseDir\r
+ 1087:0619       _SelectDodgeDir\r
+ 13EC:1951 idle  _SelectPathDir\r
+ 1087:089F       _SelectRunDir\r
+ 0000:3164       _setblock\r
+ 044B:0179 idle  _SetPlaneViewSize\r
+ 0BC6:0006 idle  _SetSoundLoc\r
+ 06A5:3677 idle  _SetTextColor\r
+ 06A5:2E09 idle  _SetupControlPanel\r
+ 0BC6:0683       _SetupGameLevel\r
+ 0FFD:001A       _SetupScaling\r
+ 048F:0E7C idle  _SetupWalls\r
+ 0000:3F2F       _setvbuf\r
+ 0000:130C       _setvect\r
+ 048F:13BC       _SetViewSize\r
+ 0E0D:02C5 idle  _ShapeTest\r
+ 3A39:9894       _shootdelta\r
+ 06A5:3C21 idle  _ShootSnd\r
+ 060A:0771 idle  _ShowArticle\r
+ 048F:1442       _ShowViewSize\r
+ 048F:0BD2       _ShutdownId\r
+ 1087:167A       _SightPlayer\r
+ 2422:0000       _signon\r
+ 048F:0E9F idle  _SignonScreen\r
+ 0FFD:078D       _SimpleScaleShape\r
+ 0000:0F48       _sin\r
+ 3A39:A514       _singlestep\r
+ 3430:0000       _sintable\r
+ 3A39:DDEF       _slinewidth\r
+ 3A39:DDF1       _slinex\r
+ 3A39:03DC idle  _SndItems\r
+ 2394:0000 idle  _SndMenu\r
+ 3A39:1298 idle  _songs\r
+ 3A39:9C3F       _SoundBlasterPresent\r
+ 3A39:9C3D       _SoundMode\r
+ 3A39:ECF1       _SoundNumber\r
+ 3A39:A2D0       _SoundPositioned\r
+ 3A39:ECED       _SoundPriority\r
+ 3A39:9C41       _SoundSourcePresent\r
+ 3A39:0434 idle  _SoundStatus\r
+ 3A39:ECFF       _SoundTable\r
+ 3A39:4F72       _spanstart\r
+ 13EC:1D7E       _SpawnBJVictory\r
+ 13EC:04D9       _SpawnBoss\r
+ 13EC:04BA       _SpawnDeadGuard\r
+ 1320:024B       _SpawnDoor\r
+ 13EC:1152       _SpawnFakeHitler\r
+ 13EC:0A19       _SpawnFat\r
+ 13EC:08C5       _SpawnGhosts\r
+ 13EC:09B2       _SpawnGift\r
+ 13EC:052B       _SpawnGretel\r
+ 13EC:11B9       _SpawnHitler\r
+ 1087:000C       _SpawnNewObj\r
+ 13EC:057D       _SpawnPatrol\r
+ 1201:0CCC       _SpawnPlayer\r
+ 13EC:094B       _SpawnSchabbs\r
+ 13EC:0312       _SpawnStand\r
+ 1320:001A       _SpawnStatic\r
+ 3A39:A2BE       _spearangle\r
+ 3A39:A2BC       _spearflag\r
+ 3A39:A2C4       _spearx\r
+ 3A39:A2C0       _speary\r
+ 3A39:A516       _spotvis\r
+ 0000:402D       _sprintf\r
+ 3A39:EA98       _sqActive\r
+ 3A39:EA94       _sqHack\r
+ 3A39:EA8E       _sqHackLen\r
+ 3A39:EA90       _sqHackPtr\r
+ 3A39:EA8C       _sqHackSeqLen\r
+ 3A39:EA88       _sqHackTime\r
+ 3A39:ECD1       _ssActive\r
+ 3A39:ECCF       _ssControl\r
+ 3A39:ECCB       _ssData\r
+ 3A39:ECFD       _ssIsTandy\r
+ 3A39:ECC1       _ssLengthLeft\r
+ 3A39:ECD3       _ssNoCheck\r
+ 3A39:ECC9       _ssOff\r
+ 3A39:ECCA       _ssOn\r
+ 3A39:39A0 idle  _ssPort\r
+ 3A39:ECC5       _ssSample\r
+ 3A39:ECCD       _ssStatus\r
+ 0CFC:0CC9       _StartBonusFlash\r
+ 06A5:3A8F       _StartCPMusic\r
+ 0CFC:0CD4       _StartDamageFlash\r
+ 0BC6:0B76 idle  _StartDemoRecord\r
+ 3A39:A030       _StartGame\r
+ 3A39:9892       _startgame\r
+ 3A39:1B4A idle  _starthitpoints\r
+ 0CFC:0AD6       _StartMusic\r
+ 3A39:1A1E idle  _statinfo\r
+ 3A39:893C       _statobjlist\r
+ 1201:01A8 idle  _StatusDrawPic\r
+ 3A39:DDF3       _stepbytwo\r
+ 3A39:4DE2       _stepscale\r
+ 0CFC:0AA3       _StopMusic\r
+ 3A39:98B6       _str\r
+ 3A39:98A2       _str2\r
+ 3A39:1A0C idle  _strafeangle\r
+ 0000:4066       _strcat\r
+ 0000:409F       _strcpy\r
+ 0000:40C1       _strlen\r
+ 0000:4105       _strtol\r
+ 3A39:191C idle  _s_attack\r
+ 3A39:2EB4 idle  _s_bjjump1\r
+ 3A39:2EC4 idle  _s_bjjump2\r
+ 3A39:2ED4 idle  _s_bjjump3\r
+ 3A39:2EE4 idle  _s_bjjump4\r
+ 3A39:2E54 idle  _s_bjrun1\r
+ 3A39:2E64 idle  _s_bjrun1s\r
+ 3A39:2E74 idle  _s_bjrun2\r
+ 3A39:2E84 idle  _s_bjrun3\r
+ 3A39:2E94 idle  _s_bjrun3s\r
+ 3A39:2EA4 idle  _s_bjrun4\r
+ 3A39:1DDA       _s_blinkychase1\r
+ 3A39:1DEA idle  _s_blinkychase2\r
+ 3A39:1C4A idle  _s_boom1\r
+ 3A39:1C5A idle  _s_boom2\r
+ 3A39:1C6A idle  _s_boom3\r
+ 3A39:246A       _s_bosschase1\r
+ 3A39:247A idle  _s_bosschase1s\r
+ 3A39:248A idle  _s_bosschase2\r
+ 3A39:249A idle  _s_bosschase3\r
+ 3A39:24AA idle  _s_bosschase3s\r
+ 3A39:24BA idle  _s_bosschase4\r
+ 3A39:24CA       _s_bossdie1\r
+ 3A39:24DA idle  _s_bossdie2\r
+ 3A39:24EA idle  _s_bossdie3\r
+ 3A39:24FA idle  _s_bossdie4\r
+ 3A39:250A idle  _s_bossshoot1\r
+ 3A39:251A idle  _s_bossshoot2\r
+ 3A39:252A idle  _s_bossshoot3\r
+ 3A39:253A idle  _s_bossshoot4\r
+ 3A39:254A idle  _s_bossshoot5\r
+ 3A39:255A idle  _s_bossshoot6\r
+ 3A39:256A idle  _s_bossshoot7\r
+ 3A39:257A idle  _s_bossshoot8\r
+ 3A39:245A idle  _s_bossstand\r
+ 3A39:1E3A idle  _s_clydechase1\r
+ 3A39:1E4A idle  _s_clydechase2\r
+ 3A39:2EF4       _s_deathcam\r
+ 3A39:1F0A       _s_dogchase1\r
+ 3A39:1F1A idle  _s_dogchase1s\r
+ 3A39:1F2A idle  _s_dogchase2\r
+ 3A39:1F3A idle  _s_dogchase3\r
+ 3A39:1F4A idle  _s_dogchase3s\r
+ 3A39:1F5A idle  _s_dogchase4\r
+ 3A39:1F9A idle  _s_dogdead\r
+ 3A39:1F6A       _s_dogdie1\r
+ 3A39:1F7A idle  _s_dogdie2\r
+ 3A39:1F8A idle  _s_dogdie3\r
+ 3A39:1EBA idle  _s_dogjump1\r
+ 3A39:1ECA idle  _s_dogjump2\r
+ 3A39:1EDA idle  _s_dogjump3\r
+ 3A39:1EEA idle  _s_dogjump4\r
+ 3A39:1EFA idle  _s_dogjump5\r
+ 3A39:1E5A idle  _s_dogpath1\r
+ 3A39:1E6A idle  _s_dogpath1s\r
+ 3A39:1E7A idle  _s_dogpath2\r
+ 3A39:1E8A idle  _s_dogpath3\r
+ 3A39:1E9A idle  _s_dogpath3s\r
+ 3A39:1EAA idle  _s_dogpath4\r
+ 3A39:2A5C       _s_fakechase1\r
+ 3A39:2A6C idle  _s_fakechase1s\r
+ 3A39:2A7C idle  _s_fakechase2\r
+ 3A39:2A8C idle  _s_fakechase3\r
+ 3A39:2A9C idle  _s_fakechase3s\r
+ 3A39:2AAC idle  _s_fakechase4\r
+ 3A39:2ABC       _s_fakedie1\r
+ 3A39:2ACC idle  _s_fakedie2\r
+ 3A39:2ADC idle  _s_fakedie3\r
+ 3A39:2AEC idle  _s_fakedie4\r
+ 3A39:2AFC idle  _s_fakedie5\r
+ 3A39:2B0C idle  _s_fakedie6\r
+ 3A39:2B1C idle  _s_fakeshoot1\r
+ 3A39:2B2C idle  _s_fakeshoot2\r
+ 3A39:2B3C idle  _s_fakeshoot3\r
+ 3A39:2B4C idle  _s_fakeshoot4\r
+ 3A39:2B5C idle  _s_fakeshoot5\r
+ 3A39:2B6C idle  _s_fakeshoot6\r
+ 3A39:2B7C idle  _s_fakeshoot7\r
+ 3A39:2B8C idle  _s_fakeshoot8\r
+ 3A39:2B9C idle  _s_fakeshoot9\r
+ 3A39:2A4C idle  _s_fakestand\r
+ 3A39:291C       _s_fatchase1\r
+ 3A39:292C idle  _s_fatchase1s\r
+ 3A39:293C idle  _s_fatchase2\r
+ 3A39:294C idle  _s_fatchase3\r
+ 3A39:295C idle  _s_fatchase3s\r
+ 3A39:296C idle  _s_fatchase4\r
+ 3A39:297C idle  _s_fatdeathcam\r
+ 3A39:298C       _s_fatdie1\r
+ 3A39:299C idle  _s_fatdie2\r
+ 3A39:29AC idle  _s_fatdie3\r
+ 3A39:29BC idle  _s_fatdie4\r
+ 3A39:29CC idle  _s_fatdie5\r
+ 3A39:29DC idle  _s_fatdie6\r
+ 3A39:29EC idle  _s_fatshoot1\r
+ 3A39:29FC idle  _s_fatshoot2\r
+ 3A39:2A0C idle  _s_fatshoot3\r
+ 3A39:2A1C idle  _s_fatshoot4\r
+ 3A39:2A2C idle  _s_fatshoot5\r
+ 3A39:2A3C idle  _s_fatshoot6\r
+ 3A39:290C idle  _s_fatstand\r
+ 3A39:2BAC idle  _s_fire1\r
+ 3A39:2BBC idle  _s_fire2\r
+ 3A39:281C       _s_giftchase1\r
+ 3A39:282C idle  _s_giftchase1s\r
+ 3A39:283C idle  _s_giftchase2\r
+ 3A39:284C idle  _s_giftchase3\r
+ 3A39:285C idle  _s_giftchase3s\r
+ 3A39:286C idle  _s_giftchase4\r
+ 3A39:287C idle  _s_giftdeathcam\r
+ 3A39:288C       _s_giftdie1\r
+ 3A39:289C idle  _s_giftdie2\r
+ 3A39:28AC idle  _s_giftdie3\r
+ 3A39:28BC idle  _s_giftdie4\r
+ 3A39:28CC idle  _s_giftdie5\r
+ 3A39:28DC idle  _s_giftdie6\r
+ 3A39:28EC idle  _s_giftshoot1\r
+ 3A39:28FC idle  _s_giftshoot2\r
+ 3A39:280C idle  _s_giftstand\r
+ 3A39:1D3A       _s_grdchase1\r
+ 3A39:1D4A idle  _s_grdchase1s\r
+ 3A39:1D5A idle  _s_grdchase2\r
+ 3A39:1D6A idle  _s_grdchase3\r
+ 3A39:1D7A idle  _s_grdchase3s\r
+ 3A39:1D8A idle  _s_grdchase4\r
+ 3A39:1D9A       _s_grddie1\r
+ 3A39:1DAA idle  _s_grddie2\r
+ 3A39:1DBA idle  _s_grddie3\r
+ 3A39:1DCA idle  _s_grddie4\r
+ 3A39:1CEA       _s_grdpain\r
+ 3A39:1CFA       _s_grdpain1\r
+ 3A39:1C8A idle  _s_grdpath1\r
+ 3A39:1C9A idle  _s_grdpath1s\r
+ 3A39:1CAA idle  _s_grdpath2\r
+ 3A39:1CBA idle  _s_grdpath3\r
+ 3A39:1CCA idle  _s_grdpath3s\r
+ 3A39:1CDA idle  _s_grdpath4\r
+ 3A39:1D0A idle  _s_grdshoot1\r
+ 3A39:1D1A idle  _s_grdshoot2\r
+ 3A39:1D2A idle  _s_grdshoot3\r
+ 3A39:1C7A idle  _s_grdstand\r
+ 3A39:259A       _s_gretelchase1\r
+ 3A39:25AA idle  _s_gretelchase1s\r
+ 3A39:25BA idle  _s_gretelchase2\r
+ 3A39:25CA idle  _s_gretelchase3\r
+ 3A39:25DA idle  _s_gretelchase3s\r
+ 3A39:25EA idle  _s_gretelchase4\r
+ 3A39:25FA       _s_greteldie1\r
+ 3A39:260A idle  _s_greteldie2\r
+ 3A39:261A idle  _s_greteldie3\r
+ 3A39:262A idle  _s_greteldie4\r
+ 3A39:263A idle  _s_gretelshoot1\r
+ 3A39:264A idle  _s_gretelshoot2\r
+ 3A39:265A idle  _s_gretelshoot3\r
+ 3A39:266A idle  _s_gretelshoot4\r
+ 3A39:267A idle  _s_gretelshoot5\r
+ 3A39:268A idle  _s_gretelshoot6\r
+ 3A39:269A idle  _s_gretelshoot7\r
+ 3A39:26AA idle  _s_gretelshoot8\r
+ 3A39:258A idle  _s_gretelstand\r
+ 3A39:2CDC       _s_hitlerchase1\r
+ 3A39:2CEC idle  _s_hitlerchase1s\r
+ 3A39:2CFC idle  _s_hitlerchase2\r
+ 3A39:2D0C idle  _s_hitlerchase3\r
+ 3A39:2D1C idle  _s_hitlerchase3s\r
+ 3A39:2D2C idle  _s_hitlerchase4\r
+ 3A39:2D3C idle  _s_hitlerdeathcam\r
+ 3A39:2D4C       _s_hitlerdie1\r
+ 3A39:2DDC idle  _s_hitlerdie10\r
+ 3A39:2D5C idle  _s_hitlerdie2\r
+ 3A39:2D6C idle  _s_hitlerdie3\r
+ 3A39:2D7C idle  _s_hitlerdie4\r
+ 3A39:2D8C idle  _s_hitlerdie5\r
+ 3A39:2D9C idle  _s_hitlerdie6\r
+ 3A39:2DAC idle  _s_hitlerdie7\r
+ 3A39:2DBC idle  _s_hitlerdie8\r
+ 3A39:2DCC idle  _s_hitlerdie9\r
+ 3A39:2DEC idle  _s_hitlershoot1\r
+ 3A39:2DFC idle  _s_hitlershoot2\r
+ 3A39:2E0C idle  _s_hitlershoot3\r
+ 3A39:2E1C idle  _s_hitlershoot4\r
+ 3A39:2E2C idle  _s_hitlershoot5\r
+ 3A39:2E3C idle  _s_hitlershoot6\r
+ 3A39:1DFA idle  _s_inkychase1\r
+ 3A39:1E0A idle  _s_inkychase2\r
+ 3A39:2BDC       _s_mechachase1\r
+ 3A39:2BEC idle  _s_mechachase1s\r
+ 3A39:2BFC idle  _s_mechachase2\r
+ 3A39:2C0C idle  _s_mechachase3\r
+ 3A39:2C1C idle  _s_mechachase3s\r
+ 3A39:2C2C idle  _s_mechachase4\r
+ 3A39:2C3C       _s_mechadie1\r
+ 3A39:2C4C idle  _s_mechadie2\r
+ 3A39:2C5C idle  _s_mechadie3\r
+ 3A39:2C6C idle  _s_mechadie4\r
+ 3A39:2C7C idle  _s_mechashoot1\r
+ 3A39:2C8C idle  _s_mechashoot2\r
+ 3A39:2C9C idle  _s_mechashoot3\r
+ 3A39:2CAC idle  _s_mechashoot4\r
+ 3A39:2CBC idle  _s_mechashoot5\r
+ 3A39:2CCC idle  _s_mechashoot6\r
+ 3A39:2BCC idle  _s_mechastand\r
+ 3A39:21EA       _s_mutchase1\r
+ 3A39:21FA idle  _s_mutchase1s\r
+ 3A39:220A idle  _s_mutchase2\r
+ 3A39:221A idle  _s_mutchase3\r
+ 3A39:222A idle  _s_mutchase3s\r
+ 3A39:223A idle  _s_mutchase4\r
+ 3A39:224A       _s_mutdie1\r
+ 3A39:225A idle  _s_mutdie2\r
+ 3A39:226A idle  _s_mutdie3\r
+ 3A39:227A idle  _s_mutdie4\r
+ 3A39:228A idle  _s_mutdie5\r
+ 3A39:218A       _s_mutpain\r
+ 3A39:219A       _s_mutpain1\r
+ 3A39:212A idle  _s_mutpath1\r
+ 3A39:213A idle  _s_mutpath1s\r
+ 3A39:214A idle  _s_mutpath2\r
+ 3A39:215A idle  _s_mutpath3\r
+ 3A39:216A idle  _s_mutpath3s\r
+ 3A39:217A idle  _s_mutpath4\r
+ 3A39:21AA idle  _s_mutshoot1\r
+ 3A39:21BA idle  _s_mutshoot2\r
+ 3A39:21CA idle  _s_mutshoot3\r
+ 3A39:21DA idle  _s_mutshoot4\r
+ 3A39:211A idle  _s_mutstand\r
+ 3A39:27CC idle  _s_needle1\r
+ 3A39:27DC idle  _s_needle2\r
+ 3A39:27EC idle  _s_needle3\r
+ 3A39:27FC idle  _s_needle4\r
+ 3A39:206A       _s_ofcchase1\r
+ 3A39:207A idle  _s_ofcchase1s\r
+ 3A39:208A idle  _s_ofcchase2\r
+ 3A39:209A idle  _s_ofcchase3\r
+ 3A39:20AA idle  _s_ofcchase3s\r
+ 3A39:20BA idle  _s_ofcchase4\r
+ 3A39:20CA       _s_ofcdie1\r
+ 3A39:20DA idle  _s_ofcdie2\r
+ 3A39:20EA idle  _s_ofcdie3\r
+ 3A39:20FA idle  _s_ofcdie4\r
+ 3A39:210A idle  _s_ofcdie5\r
+ 3A39:201A       _s_ofcpain\r
+ 3A39:202A       _s_ofcpain1\r
+ 3A39:1FBA idle  _s_ofcpath1\r
+ 3A39:1FCA idle  _s_ofcpath1s\r
+ 3A39:1FDA idle  _s_ofcpath2\r
+ 3A39:1FEA idle  _s_ofcpath3\r
+ 3A39:1FFA idle  _s_ofcpath3s\r
+ 3A39:200A idle  _s_ofcpath4\r
+ 3A39:203A idle  _s_ofcshoot1\r
+ 3A39:204A idle  _s_ofcshoot2\r
+ 3A39:205A idle  _s_ofcshoot3\r
+ 3A39:1FAA idle  _s_ofcstand\r
+ 3A39:1E1A idle  _s_pinkychase1\r
+ 3A39:1E2A idle  _s_pinkychase2\r
+ 3A39:190C idle  _s_player\r
+ 3A39:1BFA idle  _s_rocket\r
+ 3A39:26DC       _s_schabbchase1\r
+ 3A39:26EC idle  _s_schabbchase1s\r
+ 3A39:26FC idle  _s_schabbchase2\r
+ 3A39:270C idle  _s_schabbchase3\r
+ 3A39:271C idle  _s_schabbchase3s\r
+ 3A39:272C idle  _s_schabbchase4\r
+ 3A39:273C idle  _s_schabbdeathcam\r
+ 3A39:274C       _s_schabbdie1\r
+ 3A39:275C idle  _s_schabbdie2\r
+ 3A39:276C idle  _s_schabbdie3\r
+ 3A39:277C idle  _s_schabbdie4\r
+ 3A39:278C idle  _s_schabbdie5\r
+ 3A39:279C idle  _s_schabbdie6\r
+ 3A39:27AC idle  _s_schabbshoot1\r
+ 3A39:27BC idle  _s_schabbshoot2\r
+ 3A39:26CC idle  _s_schabbstand\r
+ 3A39:1C0A idle  _s_smoke1\r
+ 3A39:1C1A idle  _s_smoke2\r
+ 3A39:1C2A idle  _s_smoke3\r
+ 3A39:1C3A idle  _s_smoke4\r
+ 3A39:23BA       _s_sschase1\r
+ 3A39:23CA idle  _s_sschase1s\r
+ 3A39:23DA idle  _s_sschase2\r
+ 3A39:23EA idle  _s_sschase3\r
+ 3A39:23FA idle  _s_sschase3s\r
+ 3A39:240A idle  _s_sschase4\r
+ 3A39:241A       _s_ssdie1\r
+ 3A39:242A idle  _s_ssdie2\r
+ 3A39:243A idle  _s_ssdie3\r
+ 3A39:244A idle  _s_ssdie4\r
+ 3A39:230A       _s_sspain\r
+ 3A39:231A       _s_sspain1\r
+ 3A39:22AA idle  _s_sspath1\r
+ 3A39:22BA idle  _s_sspath1s\r
+ 3A39:22CA idle  _s_sspath2\r
+ 3A39:22DA idle  _s_sspath3\r
+ 3A39:22EA idle  _s_sspath3s\r
+ 3A39:22FA idle  _s_sspath4\r
+ 3A39:232A idle  _s_ssshoot1\r
+ 3A39:233A idle  _s_ssshoot2\r
+ 3A39:234A idle  _s_ssshoot3\r
+ 3A39:235A idle  _s_ssshoot4\r
+ 3A39:236A idle  _s_ssshoot5\r
+ 3A39:237A idle  _s_ssshoot6\r
+ 3A39:238A idle  _s_ssshoot7\r
+ 3A39:239A idle  _s_ssshoot8\r
+ 3A39:23AA idle  _s_ssshoot9\r
+ 3A39:229A idle  _s_ssstand\r
+ 3A39:ECE3       _t0OldService\r
+ 1201:0342       _TakeDamage\r
+ 0000:0F95       _tan\r
+ 3A39:9B89       _tedlevel\r
+ 3A39:9B87       _tedlevelnum\r
+ 0000:1926       _tell\r
+ 3A39:9E9A       _text\r
+ 0EBC:0F15       _ThreeDRefresh\r
+ 1201:0A51 idle  _Thrust\r
+ 3A39:E00D       _thrustspeed\r
+ 06A5:3570 idle  _TicDelay\r
+ 3A39:A2CA       _tics\r
+ 3A39:168C       _tileglobal\r
+ 3A39:D9B4       _tilehit\r
+ 3A39:75BA       _tilemap\r
+ 3A39:9EDE       _TimeCount\r
+ 060A:00B4 idle  _TimedPicCommand\r
+ 3A39:ECF3       _TimerCount\r
+ 3A39:ECF7       _TimerDivisor\r
+ 3A39:ECDD       _TimerRate\r
+ 3A39:E824       _tinf\r
+ 0000:193E       _tolower\r
+ 0000:196A       _toupper\r
+ 06A5:1062 idle  _TrackWhichGame\r
+ 0EBC:004D idle  _TransformActor\r
+ 0EBC:018B idle  _TransformTile\r
+ 1201:0794 idle  _TryMove\r
+ 1087:00D2       _TryWalk\r
+ 1201:0FEB idle  _T_Attack\r
+ 13EC:1CA5 idle  _T_Bite\r
+ 13EC:1EAC idle  _T_BJDone\r
+ 13EC:1E66 idle  _T_BJJump\r
+ 13EC:1DD1 idle  _T_BJRun\r
+ 13EC:1E8C idle  _T_BJYell\r
+ 13EC:14EC idle  _T_Chase\r
+ 13EC:17EF idle  _T_DogChase\r
+ 13EC:1404 idle  _T_Fake\r
+ 13EC:12E7 idle  _T_FakeFire\r
+ 13EC:0FCA idle  _T_Fat\r
+ 13EC:1743 idle  _T_Ghosts\r
+ 13EC:0E42 idle  _T_Gift\r
+ 13EC:0B9D idle  _T_GiftThrow\r
+ 13EC:199D idle  _T_Path\r
+ 1201:117D idle  _T_Player\r
+ 13EC:00F3 idle  _T_Projectile\r
+ 13EC:0CBA idle  _T_Schabb\r
+ 13EC:0A80 idle  _T_SchabbThrow\r
+ 13EC:1ACC idle  _T_Shoot\r
+ 13EC:14DC idle  _T_Stand\r
+ 0000:38AA       _ultoa\r
+ 3A39:E87C       _UMBbase\r
+ 06A5:2D2F       _UnCacheLump\r
+ 0000:1996       _unlink\r
+ 3A39:54B6       _update\r
+ 1201:025B idle  _UpdateFace\r
+ 0CFC:0CE0 idle  _UpdatePaletteShifts\r
+ 3A39:9B79       _updateptr\r
+ 0BC6:0148       _UpdateSoundLoc\r
+ 3A39:3D16 idle  _USL_DrawString\r
+ 1BF0:0008 idle  _USL_HardError\r
+ 3A39:3D12       _USL_MeasureString\r
+ 1BF0:03C2 idle  _USL_PrintInCenter\r
+ 1BF0:0669 idle  _US_CenterWindow\r
+ 1BF0:020F       _US_CheckParm\r
+ 1BF0:0528       _US_ClearWindow\r
+ 06A5:0004       _US_ControlPanel\r
+ 1BF0:04BF       _US_CPrint\r
+ 1BF0:0462 idle  _US_CPrintLine\r
+ 1BF0:0553       _US_DrawWindow\r
+ 1CAA:0010       _US_InitRndT\r
+ 1BF0:0782       _US_LineInput\r
+ 1BF0:02D4       _US_Print\r
+ 1BF0:0420       _US_PrintCentered\r
+ 1BF0:039D idle  _US_PrintSigned\r
+ 1BF0:0378       _US_PrintUnsigned\r
+ 1BF0:06BA idle  _US_RestoreWindow\r
+ 1CAA:0038       _US_RndT\r
+ 1BF0:068D idle  _US_SaveWindow\r
+ 1BF0:02B5 idle  _US_SetPrintRoutines\r
+ 1BF0:01FD       _US_Shutdown\r
+ 1BF0:0131       _US_Startup\r
+ 3A39:9B5F       _uwidthtable\r
+ 3A39:53AA       _vertwall\r
+ 3A39:1698 idle  _vgaCeiling\r
+ 0EBC:0A0B idle  _VGAClearScreen\r
+ 1E19:0006       _VH_UpdateScreen\r
+ 0A85:0031       _Victory\r
+ 1201:0F2E idle  _VictorySpin\r
+ 1201:0A41 idle  _VictoryTile\r
+ 3A39:DDE0       _viewangle\r
+ 3A39:503A       _viewcos\r
+ 3A39:52CE       _viewheight\r
+ 3A39:503E       _viewsin\r
+ 3A39:54AA       _viewsize\r
+ 3A39:D9CC       _viewtx\r
+ 3A39:D9CA       _viewty\r
+ 3A39:D84E       _viewtype\r
+ 3A39:52D0       _viewwidth\r
+ 3A39:5046       _viewx\r
+ 3A39:5042       _viewy\r
+ 3A39:9890       _virtualreality\r
+ 3A39:D86E       _vislist\r
+ 3A39:D86C       _visptr\r
+ 3A39:D86A       _visstep\r
+ 1CAF:0646       _VL_Bar\r
+ 1CAF:0092 idle  _VL_ClearVideo\r
+ 1CAF:04A5       _VL_ColorBorder\r
+ 1CAF:00BC idle  _VL_DePlaneVGA\r
+ 1CAF:0A5B idle  _VL_DrawLatch8String\r
+ 1CAF:092E idle  _VL_DrawTile8String\r
+ 1CAF:0374       _VL_FadeIn\r
+ 1CAF:0256       _VL_FadeOut\r
+ 1CAF:0198 idle  _VL_FillPalette\r
+ 1CAF:01D8 idle  _VL_GetColor\r
+ 1CAF:0235 idle  _VL_GetPalette\r
+ 1CAF:0504       _VL_Hlin\r
+ 1CAF:08C5       _VL_LatchToScreen\r
+ 1CAF:0837 idle  _VL_MaskedToScreen\r
+ 1CAF:0749       _VL_MemToLatch\r
+ 1CAF:079C       _VL_MemToScreen\r
+ 1D62:022E       _VL_MungePic\r
+ 1CAF:04B9       _VL_Plot\r
+ 1DF0:00AA       _VL_ScreenToScreen\r
+ 1CAF:01BD idle  _VL_SetColor\r
+ 1DF0:0019 idle  _VL_SetCRTC\r
+ 1CAF:0113 idle  _VL_SetLineWidth\r
+ 1CAF:0203       _VL_SetPalette\r
+ 1DF0:003D       _VL_SetScreen\r
+ 1CAF:014C idle  _VL_SetSplitScreen\r
+ 1CAF:0088 idle  _VL_SetTextMode\r
+ 1CAF:0065       _VL_SetVGAPlaneMode\r
+ 1CAF:005B       _VL_Shutdown\r
+ 1CAF:0B07 idle  _VL_SizeTile8String\r
+ 1CAF:0003       _VL_Startup\r
+ 1CAF:044A       _VL_TestPaletteSet\r
+ 1DF0:012A       _VL_VideoID\r
+ 1CAF:05DF       _VL_Vlin\r
+ 1DF0:0002       _VL_WaitVBL\r
+ 0000:404A idle  _vsprintf\r
+ 1D62:0556       _VWB_Bar\r
+ 1D62:04B3       _VWB_DrawPic\r
+ 1D62:051F       _VWB_DrawPropString\r
+ 1D62:042B       _VWB_DrawTile8\r
+ 1D62:046E idle  _VWB_DrawTile8M\r
+ 1D62:05BD       _VWB_Hlin\r
+ 1D62:0592       _VWB_Plot\r
+ 1D62:05F1       _VWB_Vlin\r
+ 1D62:02EC idle  _VWL_MeasureString\r
+ 1D62:0113 idle  _VW_DrawColorPropString\r
+ 1D62:0000 idle  _VW_DrawPropString\r
+ 1D62:0370       _VW_MarkUpdateBlock\r
+ 1D62:034E idle  _VW_MeasureMPropString\r
+ 1D62:032C       _VW_MeasurePropString\r
+ 1D62:0625       _VW_UpdateScreen\r
+ 06A5:36AC idle  _WaitKeyUp\r
+ 3A39:504A       _wallheight\r
+ 0EBC:0E24 idle  _WallRefresh\r
+ 3A39:1710 idle  _weaponscale\r
+ 0000:31E7 idle  _wherex\r
+ 0000:31F6 idle  _wherey\r
+ 358C:0000       _whiteshifts\r
+ 3A39:A046       _WindowH\r
+ 3A39:9B7B       _WindowW\r
+ 3A39:9B7F       _WindowX\r
+ 3A39:9B7D       _WindowY\r
+ 3A39:177A idle  _wordmasks\r
+ 3A39:DDF5       _work\r
+ 0000:4320       _write\r
+ 0A85:046A       _Write\r
+ 048F:020F idle  _WriteConfig\r
+ 3A39:D9A6       _xintercept\r
+ 3A39:D9B8       _xinttile\r
+ 3A39:E892       _XMSaddr\r
+ 3A39:E8D2       _XMSAvail\r
+ 3A39:E8CC       _XMSDriver\r
+ 3A39:E8D0       _XMSHandle\r
+ 3A39:A296       _XMSPagesAvail\r
+ 3A39:E8C4       _XMSPagesUsed\r
+ 3A39:A29A       _XMSPresent\r
+ 3A39:3510 idle  _XMSProtectPage\r
+ 3A39:D9C4       _xpartial\r
+ 3A39:D9BE       _xpartialdown\r
+ 3A39:D9C0       _xpartialup\r
+ 3A39:D99E       _xstep\r
+ 3A39:D9B0       _xtile\r
+ 3A39:D9AC       _xtilestep\r
+ 3A39:D9A2       _yintercept\r
+ 3A39:D9B6       _yinttile\r
+ 3A39:EE17       _ylookup\r
+ 3A39:D9C2       _ypartial\r
+ 3A39:D9BA       _ypartialdown\r
+ 3A39:D9BC       _ypartialup\r
+ 3A39:D99A       _ystep\r
+ 3A39:D9AE       _ytile\r
+ 3A39:D9AA       _ytilestep\r
+ 3A39:4090       __8087\r
+ 0000:1000 idle  __AHINCR\r
+ 0000:000C idle  __AHSHIFT\r
+ 3A39:4724       __argc\r
+ 3A39:4726       __argv\r
+ 3A39:4380       __atexitcnt\r
+ 3A39:4944       __atexittbl\r
+ 0000:268A       __brk\r
+ 3A39:00D1       __brklvl\r
+ 3A39:00B3       __C0argc\r
+ 3A39:00B5       __C0argv\r
+ 0000:20DD idle  __c0crtinit\r
+ 3A39:00B7       __C0environ\r
+ 0000:128F idle  __cexit\r
+ 0000:0189       __checknull\r
+ 0000:3296       __chmod\r
+ 0000:0176       __cleanup\r
+ 0000:32D9       __close\r
+ 0000:20FA idle  __crtinit\r
+ 3A39:4382       __ctype\r
+ 0000:0000  Abs  __cvtfak\r
+ 0000:129D idle  __c_exit\r
+ 3A39:40A4       __default87\r
+ 3A39:4602       __doserrno\r
+ 0000:14EF       __DOSERROR\r
+ 3A39:4604 idle  __dosErrorToSV\r
+ 0000:11C1 idle  __dos_getdate\r
+ 0000:4486       __dos_getdiskfree\r
+ 0000:1189       __dos_getfileattr\r
+ 0000:11DA       __dos_gettime\r
+ 0000:11A6 idle  __dos_setfileattr\r
+ 0000:11F3       __dos_write\r
+ 3A39:4270       __emu\r
+ 3A39:00B9       __envLng\r
+ 3A39:00BB       __envseg\r
+ 3A39:00BD       __envSize\r
+ 0000:127D       __exit\r
+ 3A39:4484       __exitbuf\r
+ 3A39:4488       __exitfopen\r
+ 3A39:448C       __exitopen\r
+ 3A39:471E idle  __first\r
+ 0000:8087 idle  __floatconvert\r
+ 0000:436E       __fmemcmp\r
+ 0000:4396       __fmemcpy\r
+ 0000:43DE       __fmemset\r
+ 3A39:45FA       __fmode\r
+ 0000:0DAA       __fperror\r
+ 3A39:45FE       __fpstklen\r
+ 0000:05E4       __fpuint\r
+ 0000:3B11 idle  __fputc\r
+ 0000:3C70       __FPUTN\r
+ 0000:43BA idle  __fsetmem\r
+ 0000:43FD       __fstrcpy\r
+ 0000:4426       __fstricmp\r
+ 0000:4467       __fstrlen\r
+ 0000:36B1 idle  __GETFP\r
+ 0000:2933 idle  __harderr\r
+ 0000:295F       __hardresume\r
+ 0000:297A       __hardretn\r
+ 3A39:00CD       __heapbase\r
+ 3A39:4600       __heaplen\r
+ 3A39:00D5       __heaptop\r
+ 3A39:40AA       __huge_dble\r
+ 3A39:40A6 idle  __huge_flt\r
+ 3A39:40B2 idle  __huge_ldble\r
+ 3A39:40BC idle  __indefinite\r
+ 3A39:00A3 idle  __Int0Vector\r
+ 3A39:00A7 idle  __Int4Vector\r
+ 3A39:00AB idle  __Int5Vector\r
+ 3A39:00AF idle  __Int6Vector\r
+ 0000:14B6       __IOERROR\r
+ 3A39:4720 idle  __last\r
+ 3A39:40A1       __LDT\r
+ 0000:05F5       __LDTRUNC\r
+ 0000:1512       __LONGTOA\r
+ 0000:0FE5       __matherr\r
+ 3A39:40CA       __mathwhy\r
+ 0000:15D5       __MKNAME\r
+ 0000:02B0 idle  __MMODEL\r
+ 3A39:45D0       __nfile\r
+ 3A39:45FC       __notUmask\r
+ 0000:3AAD       __open\r
+ 3A39:45D2       __openfd\r
+ 0000:3615 idle  __OPENFP\r
+ 3A39:00C1       __osmajor\r
+ 3A39:00C2 idle  __osminor\r
+ 3A39:00C1 idle  __osversion\r
+ 0000:0E4E       __POW10\r
+ 3A39:40A0       __protected\r
+ 3A39:00BF       __psp\r
+ 0000:16AA       __read\r
+ 0000:2D18       __REALCVT\r
+ 3A39:473A       __RealCvtVector\r
+ 0000:020A       __restorezero\r
+ 3A39:4722 idle  __rover\r
+ 0000:26C9       __sbrk\r
+ 3A39:473E idle  __ScanTodVector\r
+ 0000:1702       __scantol\r
+ 0000:2E48       __SCREENIO\r
+ 0000:2EE9       __SCROLL\r
+ 0000:0000 idle  __setargv__\r
+ 0000:0000 idle  __setenvp__\r
+ 0000:1881       __setupio\r
+ 3A39:00C5 idle  __StartTime\r
+ 3A39:4668       __stklen\r
+ 0000:1F2B       __stpcpy\r
+ 3A39:4490       __streams\r
+ 0000:01B4       __terminate\r
+ 3A39:40C0 idle  __tiny_ldble\r
+ 0000:1614 idle  __TMPNAM\r
+ 0000:0000 idle  __turboCrt\r
+ 0000:0000  Abs  __turboCvt\r
+ 0000:8087  Abs  __turboFloat\r
+ 0000:158F       __UTOA\r
+ 0000:2E84       __VALIDATEXY\r
+ 3A39:00C1       __version\r
+ 3A39:46D2       __video\r
+ 0000:2059       __VideoInt\r
+ 0000:19C4       __VPRINTER\r
+ 0000:1E72       __VPTR\r
+ 0000:1E97       __VRAM\r
+ 0000:31DD       __wherexy\r
+ 0000:42E6       __write\r
+ 0000:1F11       __xclose\r
+ 0000:0BA5       __XCVT\r
+ 0000:4323       __xfclose\r
+ 0000:434B       __xfflush\r
+ 0000:1F79       ___brk\r
+ 3A39:00CB       ___brklvl\r
+ 0000:21F3 idle  ___first\r
+ 0000:04FD idle  ___fpreset\r
+ 0000:2907       ___harderr\r
+ 3A39:00C9 idle  ___heapbase\r
+ 0000:21F5 idle  ___last\r
+ 0000:3E5E       ___read\r
+ 0000:21F7 idle  ___rover\r
+ 0000:1F9B       ___sbrk\r
+ 3A39:49D2       ___SignalPtr\r
+ 0000:41DA       ___write\r
+\r
+  Address         Publics by Value\r
+\r
+ 0000:0000  Abs  __turboCvt\r
+ 0000:0000 idle  __turboCrt\r
+ 0000:0000  Abs  __cvtfak\r
+ 0000:0000 idle  __setargv__\r
+ 0000:0000 idle  __setenvp__\r
+ 0000:000C idle  __AHSHIFT\r
+ 0000:0632 idle  FISRQQ\r
+ 0000:0E32 idle  FICRQQ\r
+ 0000:1000 idle  __AHINCR\r
+ 0000:1632  Abs  FIERQQ\r
+ 0000:4000 idle  FJARQQ\r
+ 0000:5C32  Abs  FIDRQQ\r
+ 0000:8000 idle  FJSRQQ\r
+ 0000:8087  Abs  __turboFloat\r
+ 0000:8087 idle  __floatconvert\r
+ 0000:A23D  Abs  FIWRQQ\r
+ 0000:C000 idle  FJCRQQ\r
+ 0000:FE32 idle  FIARQQ\r
+ 0000:0176       __cleanup\r
+ 0000:0189       __checknull\r
+ 0000:01B4       __terminate\r
+ 0000:020A       __restorezero\r
+ 0000:0296       _abort\r
+ 0000:02AE idle  DGROUP@\r
+ 0000:02B0 idle  __MMODEL\r
+ 0000:02B2 idle  N_LDIV@\r
+ 0000:02B5       LDIV@\r
+ 0000:02B5       F_LDIV@\r
+ 0000:02D1 idle  N_LUDIV@\r
+ 0000:02D4 idle  F_LUDIV@\r
+ 0000:02D4 idle  LUDIV@\r
+ 0000:02D9 idle  N_LMOD@\r
+ 0000:02DC       F_LMOD@\r
+ 0000:02DC idle  LMOD@\r
+ 0000:02E1 idle  N_LUMOD@\r
+ 0000:02E4 idle  LUMOD@\r
+ 0000:02E4 idle  F_LUMOD@\r
+ 0000:04FD idle  ___fpreset\r
+ 0000:05E4       __fpuint\r
+ 0000:05E8       _atan\r
+ 0000:05F5       __LDTRUNC\r
+ 0000:0BA5       __XCVT\r
+ 0000:0DAA       __fperror\r
+ 0000:0E4E       __POW10\r
+ 0000:0F17       _pow10\r
+ 0000:0F22       _matherr\r
+ 0000:0F48       _sin\r
+ 0000:0F95       _tan\r
+ 0000:0FE5       __matherr\r
+ 0000:1075       _atan2\r
+ 0000:1130       F_FTOL@\r
+ 0000:1130 idle  FTOL@\r
+ 0000:115C idle  _atexit\r
+ 0000:1189       __dos_getfileattr\r
+ 0000:11A6 idle  __dos_setfileattr\r
+ 0000:11C1 idle  __dos_getdate\r
+ 0000:11DA       __dos_gettime\r
+ 0000:11F3       __dos_write\r
+ 0000:126E       _exit\r
+ 0000:127D       __exit\r
+ 0000:128F idle  __cexit\r
+ 0000:129D idle  __c_exit\r
+ 0000:12A9       F_LXMUL@\r
+ 0000:12A9 idle  LXMUL@\r
+ 0000:12C0       F_PCMP@\r
+ 0000:12C0 idle  PCMP@\r
+ 0000:12E1       F_SCOPY@\r
+ 0000:12E1 idle  SCOPY@\r
+ 0000:12FD       _getvect\r
+ 0000:130C       _setvect\r
+ 0000:131D       N_LXLSH@\r
+ 0000:1320       F_LXLSH@\r
+ 0000:1320 idle  LXLSH@\r
+ 0000:133E idle  N_LXRSH@\r
+ 0000:1341       F_LXRSH@\r
+ 0000:1341 idle  LXRSH@\r
+ 0000:135E idle  N_LXURSH@\r
+ 0000:1361       F_LXURSH@\r
+ 0000:1361 idle  LXURSH@\r
+ 0000:137F idle  N_PADA@\r
+ 0000:1382       F_PADA@\r
+ 0000:1382 idle  PADA@\r
+ 0000:13C3 idle  N_PSBA@\r
+ 0000:13C6       F_PSBA@\r
+ 0000:13C6 idle  PSBA@\r
+ 0000:1407       N_PADD@\r
+ 0000:140A       F_PADD@\r
+ 0000:140A idle  PADD@\r
+ 0000:1436 idle  N_PSUB@\r
+ 0000:1439 idle  F_PSUB@\r
+ 0000:1439 idle  PSUB@\r
+ 0000:1467       N_PSBP@\r
+ 0000:146A       F_PSBP@\r
+ 0000:146A idle  PSBP@\r
+ 0000:148F idle  N_SPUSH@\r
+ 0000:1495       F_SPUSH@\r
+ 0000:1495 idle  SPUSH@\r
+ 0000:14B6       __IOERROR\r
+ 0000:14EF       __DOSERROR\r
+ 0000:1501       _isatty\r
+ 0000:1512       __LONGTOA\r
+ 0000:158F       __UTOA\r
+ 0000:15AC       _lseek\r
+ 0000:15D5       __MKNAME\r
+ 0000:1614 idle  __TMPNAM\r
+ 0000:1657       N_PCMP@\r
+ 0000:1678       _outport\r
+ 0000:1684 idle  _outportb\r
+ 0000:1690 idle  _outpw\r
+ 0000:169C idle  _outp\r
+ 0000:16AA       __read\r
+ 0000:1702       __scantol\r
+ 0000:1881       __setupio\r
+ 0000:1926       _tell\r
+ 0000:193E       _tolower\r
+ 0000:196A       _toupper\r
+ 0000:1996       _unlink\r
+ 0000:19C4       __VPRINTER\r
+ 0000:1E72       __VPTR\r
+ 0000:1E97       __VRAM\r
+ 0000:1F11       __xclose\r
+ 0000:1F2B       __stpcpy\r
+ 0000:1F54       _bioskey\r
+ 0000:1F79       ___brk\r
+ 0000:1F9B       ___sbrk\r
+ 0000:1FCC idle  _brk\r
+ 0000:1FD8 idle  _sbrk\r
+ 0000:1FE8       _clrscr\r
+ 0000:2011       _coreleft\r
+ 0000:2059       __VideoInt\r
+ 0000:20DD idle  __c0crtinit\r
+ 0000:20FA idle  __crtinit\r
+ 0000:21F3 idle  ___first\r
+ 0000:21F5 idle  ___last\r
+ 0000:21F7 idle  ___rover\r
+ 0000:2333       _farfree\r
+ 0000:243D       _farmalloc\r
+ 0000:259A idle  _farrealloc\r
+ 0000:268A       __brk\r
+ 0000:26C9       __sbrk\r
+ 0000:2757       _farcoreleft\r
+ 0000:27A7       _gotoxy\r
+ 0000:27F0       _gettext\r
+ 0000:2844       _puttext\r
+ 0000:2885       _harderr\r
+ 0000:2897 idle  _hardresume\r
+ 0000:28A5 idle  _hardretn\r
+ 0000:2907       ___harderr\r
+ 0000:2933 idle  __harderr\r
+ 0000:295F       __hardresume\r
+ 0000:297A       __hardretn\r
+ 0000:29D9       _ioctl\r
+ 0000:2A00       _movetext\r
+ 0000:2A9D       _free\r
+ 0000:2B6C       _malloc\r
+ 0000:2CC5 idle  _realloc\r
+ 0000:2D18       __REALCVT\r
+ 0000:2E48       __SCREENIO\r
+ 0000:2E84       __VALIDATEXY\r
+ 0000:2EE9       __SCROLL\r
+ 0000:3164       _setblock\r
+ 0000:31DD       __wherexy\r
+ 0000:31E7 idle  _wherex\r
+ 0000:31F6 idle  _wherey\r
+ 0000:3209       _atol\r
+ 0000:3279 idle  _atoi\r
+ 0000:3286       _bdos\r
+ 0000:3296       __chmod\r
+ 0000:32B1       _close\r
+ 0000:32D9       __close\r
+ 0000:3310       _creat\r
+ 0000:3382       _fclose\r
+ 0000:33FF       _fflush\r
+ 0000:3480       _findfirst\r
+ 0000:34B3       _findnext\r
+ 0000:34E0       _filelength\r
+ 0000:3521       _flushall\r
+ 0000:3615 idle  __OPENFP\r
+ 0000:36B1 idle  __GETFP\r
+ 0000:36DC       _fopen\r
+ 0000:36FB       _fprintf\r
+ 0000:376E       _fseek\r
+ 0000:37D6 idle  _ftell\r
+ 0000:3823       _getenv\r
+ 0000:3882       _itoa\r
+ 0000:38AA       _ultoa\r
+ 0000:38C4       _ltoa\r
+ 0000:38E9       _memcpy\r
+ 0000:3908       _movedata\r
+ 0000:3955       _open\r
+ 0000:3AAD       __open\r
+ 0000:3AFA       _printf\r
+ 0000:3B11 idle  __fputc\r
+ 0000:3B2A       _fputc\r
+ 0000:3C5E idle  _fputchar\r
+ 0000:3C70       __FPUTN\r
+ 0000:3E13       _puts\r
+ 0000:3E5E       ___read\r
+ 0000:3F2C       _read\r
+ 0000:3F2F       _setvbuf\r
+ 0000:402D       _sprintf\r
+ 0000:404A idle  _vsprintf\r
+ 0000:4066       _strcat\r
+ 0000:409F       _strcpy\r
+ 0000:40C1       _strlen\r
+ 0000:4105       _strtol\r
+ 0000:41DA       ___write\r
+ 0000:42E6       __write\r
+ 0000:4320       _write\r
+ 0000:4323       __xfclose\r
+ 0000:434B       __xfflush\r
+ 0000:436E       __fmemcmp\r
+ 0000:4396       __fmemcpy\r
+ 0000:43BA idle  __fsetmem\r
+ 0000:43DE       __fmemset\r
+ 0000:43FD       __fstrcpy\r
+ 0000:4426       __fstricmp\r
+ 0000:4467       __fstrlen\r
+ 0000:4486       __dos_getdiskfree\r
+ 044B:000C idle  _FixedMul\r
+ 044B:0034 idle  _DrawSpans\r
+ 044B:0179 idle  _SetPlaneViewSize\r
+ 044B:027E idle  _DrawPlanes\r
+ 0485:0008       _MapRow\r
+ 048C:0000       _CheckIs386\r
+ 048C:0028       _jabhack2\r
+ 048F:000B idle  _ReadConfig\r
+ 048F:020F idle  _WriteConfig\r
+ 048F:030D idle  _Patch386\r
+ 048F:0369       _NewGame\r
+ 048F:03BA idle  _DiskFlopAnim\r
+ 048F:03E9 idle  _DoChecksum\r
+ 048F:042E       _SaveTheGame\r
+ 048F:0803       _LoadTheGame\r
+ 048F:0BD2       _ShutdownId\r
+ 048F:0BFA idle  _BuildTables\r
+ 048F:0D49 idle  _CalcProjection\r
+ 048F:0E7C idle  _SetupWalls\r
+ 048F:0E9F idle  _SignonScreen\r
+ 048F:0F21 idle  _FinishSignon\r
+ 048F:0FBA       _MS_CheckParm\r
+ 048F:1020 idle  _InitDigiMap\r
+ 048F:1041 idle  _DoJukebox\r
+ 048F:122A idle  _InitGame\r
+ 048F:13BC       _SetViewSize\r
+ 048F:1442       _ShowViewSize\r
+ 048F:148B       _NewViewSize\r
+ 048F:14CF       _Quit\r
+ 048F:159A idle  _DemoLoop\r
+ 048F:179C       _main\r
+ 060A:000C idle  _RipToEOL\r
+ 060A:001F idle  _ParseNumber\r
+ 060A:0071 idle  _ParsePicCommand\r
+ 060A:008F idle  _ParseTimedCommand\r
+ 060A:00B4 idle  _TimedPicCommand\r
+ 060A:00F7 idle  _HandleCommand\r
+ 060A:034C idle  _NewLine\r
+ 060A:03A7 idle  _HandleCtrls\r
+ 060A:03C7 idle  _HandleWord\r
+ 060A:0475 idle  _PageLayout\r
+ 060A:0660 idle  _BackPage\r
+ 060A:068A idle  _CacheLayoutGraphics\r
+ 060A:0771 idle  _ShowArticle\r
+ 060A:0885 idle  _HelpScreens\r
+ 060A:090C       _EndText\r
+ 06A5:0004       _US_ControlPanel\r
+ 06A5:01BE idle  _DrawMainMenu\r
+ 06A5:025E idle  _BossKey\r
+ 06A5:02A8 idle  _CP_CheckQuick\r
+ 06A5:079D idle  _CP_EndGame\r
+ 06A5:07F3       _CP_ViewScores\r
+ 06A5:0851 idle  _CP_NewGame\r
+ 06A5:098F idle  _DrawNewEpisode\r
+ 06A5:0A3C idle  _DrawNewGame\r
+ 06A5:0AC6 idle  _DrawNewGameDiff\r
+ 06A5:0ADF idle  _CP_Sound\r
+ 06A5:0C70 idle  _DrawSoundMenu\r
+ 06A5:0E5E idle  _DrawLSAction\r
+ 06A5:0EDA idle  _CP_LoadGame\r
+ 06A5:1062 idle  _TrackWhichGame\r
+ 06A5:1089 idle  _DrawLoadSaveScreen\r
+ 06A5:112F idle  _PrintLSEntry\r
+ 06A5:11BB idle  _CP_SaveGame\r
+ 06A5:148E idle  _CalibrateJoystick\r
+ 06A5:16A9 idle  _CP_Control\r
+ 06A5:17AE idle  _DrawMouseSens\r
+ 06A5:18B2 idle  _MouseSensitivity\r
+ 06A5:1A9B idle  _DrawCtlScreen\r
+ 06A5:1C5A idle  _CustomControls\r
+ 06A5:1CFB idle  _DefineMouseBtns\r
+ 06A5:1D37 idle  _DefineJoyBtns\r
+ 06A5:1D73 idle  _DefineKeyBtns\r
+ 06A5:1DAF idle  _DefineKeyMove\r
+ 06A5:1DEB idle  _EnterCtrlData\r
+ 06A5:2237 idle  _FixupCustom\r
+ 06A5:23A7 idle  _DrawCustomScreen\r
+ 06A5:266D idle  _PrintCustMouse\r
+ 06A5:26B7 idle  _DrawCustMouse\r
+ 06A5:2714 idle  _PrintCustJoy\r
+ 06A5:275E idle  _DrawCustJoy\r
+ 06A5:27BB idle  _PrintCustKeybd\r
+ 06A5:27F2 idle  _DrawCustKeybd\r
+ 06A5:2824 idle  _PrintCustKeys\r
+ 06A5:285A idle  _DrawCustKeys\r
+ 06A5:288C idle  _CP_ChangeView\r
+ 06A5:29FF idle  _DrawChangeView\r
+ 06A5:2A7D idle  _CP_Quit\r
+ 06A5:2B04       _IntroScreen\r
+ 06A5:2CF7       _ClearMScreen\r
+ 06A5:2D10       _CacheLump\r
+ 06A5:2D2F       _UnCacheLump\r
+ 06A5:2D6E       _DrawWindow\r
+ 06A5:2DA4 idle  _DrawOutline\r
+ 06A5:2E09 idle  _SetupControlPanel\r
+ 06A5:2F07 idle  _CleanupControlPanel\r
+ 06A5:2F1D       _HandleMenu\r
+ 06A5:3407 idle  _EraseGun\r
+ 06A5:347E idle  _DrawHalfStep\r
+ 06A5:34BE idle  _DrawGun\r
+ 06A5:3570 idle  _TicDelay\r
+ 06A5:35AC       _DrawMenu\r
+ 06A5:3677 idle  _SetTextColor\r
+ 06A5:36AC idle  _WaitKeyUp\r
+ 06A5:36DC idle  _ReadAnyControl\r
+ 06A5:3839 idle  _Confirm\r
+ 06A5:3960       _Message\r
+ 06A5:3A8F       _StartCPMusic\r
+ 06A5:3B16       _FreeMusic\r
+ 06A5:3B39 idle  _IN_GetScanName\r
+ 06A5:3B7D idle  _CheckPause\r
+ 06A5:3BBD idle  _DrawMenuGun\r
+ 06A5:3BF0       _DrawStripes\r
+ 06A5:3C21 idle  _ShootSnd\r
+ 06A5:3C30       _CheckForEpisodes\r
+ 0A85:0004       _ClearSplitVWB\r
+ 0A85:0031       _Victory\r
+ 0A85:03CC       _PG13\r
+ 0A85:046A       _Write\r
+ 0A85:056F idle  _BJ_Breathe\r
+ 0A85:05D1       _LevelCompleted\r
+ 0A85:0F10 idle  _PreloadUpdate\r
+ 0A85:0FA5       _PreloadGraphics\r
+ 0A85:1041       _DrawHighScores\r
+ 0A85:120F       _CheckHighScore\r
+ 0A85:1353 idle  _NonShareware\r
+ 0BC6:0006 idle  _SetSoundLoc\r
+ 0BC6:00F7       _PlaySoundLocGlobal\r
+ 0BC6:0148       _UpdateSoundLoc\r
+ 0BC6:017B       _ClearMemory\r
+ 0BC6:0194 idle  _ScanInfoPlane\r
+ 0BC6:0683       _SetupGameLevel\r
+ 0BC6:0930 idle  _DrawPlayBorderSides\r
+ 0BC6:09BA       _DrawAllPlayBorderSides\r
+ 0BC6:09E5       _DrawAllPlayBorder\r
+ 0BC6:0A11       _DrawPlayBorder\r
+ 0BC6:0ADB       _DrawPlayScreen\r
+ 0BC6:0B76 idle  _StartDemoRecord\r
+ 0BC6:0BC7 idle  _FinishDemoRecord\r
+ 0BC6:0C9A       _RecordDemo\r
+ 0BC6:0DD1       _PlayDemo\r
+ 0BC6:0F34 idle  _Died\r
+ 0BC6:1162       _GameLoop\r
+ 0CFC:0007 idle  _PollKeyboardButtons\r
+ 0CFC:002B idle  _PollMouseButtons\r
+ 0CFC:006F idle  _PollJoystickButtons\r
+ 0CFC:0100 idle  _PollKeyboardMove\r
+ 0CFC:020C idle  _PollMouseMove\r
+ 0CFC:0248 idle  _PollJoystickMove\r
+ 0CFC:03B9 idle  _PollControls\r
+ 0CFC:05E6       _CenterWindow\r
+ 0CFC:0614 idle  _CheckKeys\r
+ 0CFC:09B0       _InitActorList\r
+ 0CFC:09F4       _GetNewActor\r
+ 0CFC:0A55 idle  _RemoveObj\r
+ 0CFC:0AA3       _StopMusic\r
+ 0CFC:0AD6       _StartMusic\r
+ 0CFC:0B4C       _InitRedShifts\r
+ 0CFC:0CBC idle  _ClearPaletteShifts\r
+ 0CFC:0CC9       _StartBonusFlash\r
+ 0CFC:0CD4       _StartDamageFlash\r
+ 0CFC:0CE0 idle  _UpdatePaletteShifts\r
+ 0CFC:0DD6       _FinishPaletteShifts\r
+ 0CFC:0E00 idle  _DoActor\r
+ 0CFC:0F8C       _PlayLoop\r
+ 0E0D:000D idle  _DebugMemory\r
+ 0E0D:00C2 idle  _CountObjects\r
+ 0E0D:01B3       _PicturePause\r
+ 0E0D:02C5 idle  _ShapeTest\r
+ 0E0D:076C       _DebugKeys\r
+ 0EBC:000F       _FixedByFrac\r
+ 0EBC:004D idle  _TransformActor\r
+ 0EBC:018B idle  _TransformTile\r
+ 0EBC:02F9 idle  _CalcHeight\r
+ 0EBC:0397 idle  _ScalePost\r
+ 0EBC:040A       _FarScalePost\r
+ 0EBC:0412       _HitVertWall\r
+ 0EBC:0531       _HitHorizWall\r
+ 0EBC:0653       _HitHorizDoor\r
+ 0EBC:0753       _HitVertDoor\r
+ 0EBC:0857       _HitHorizPWall\r
+ 0EBC:0931       _HitVertPWall\r
+ 0EBC:0A0B idle  _VGAClearScreen\r
+ 0EBC:0A73 idle  _CalcRotate\r
+ 0EBC:0AEF idle  _DrawScaleds\r
+ 0EBC:0D02 idle  _DrawPlayerWeapon\r
+ 0EBC:0D9E       _CalcTics\r
+ 0EBC:0E01       _FixOfs\r
+ 0EBC:0E24 idle  _WallRefresh\r
+ 0EBC:0F15       _ThreeDRefresh\r
+ 0FB8:0072       _AsmRefresh\r
+ 0FFD:000A idle  _BadScale\r
+ 0FFD:001A       _SetupScaling\r
+ 0FFD:01DB idle  _BuildCompScale\r
+ 0FFD:032F idle  _ScaleLine\r
+ 0FFD:0479       _ScaleShape\r
+ 0FFD:078D       _SimpleScaleShape\r
+ 1087:000C       _SpawnNewObj\r
+ 1087:00BA       _NewState\r
+ 1087:00D2       _TryWalk\r
+ 1087:0619       _SelectDodgeDir\r
+ 1087:0747       _SelectChaseDir\r
+ 1087:089F       _SelectRunDir\r
+ 1087:0967       _MoveObj\r
+ 1087:0B99 idle  _DropItem\r
+ 1087:0C2C idle  _KillActor\r
+ 1087:0EF2       _DamageActor\r
+ 1087:0FED       _CheckLine\r
+ 1087:1291 idle  _CheckSight\r
+ 1087:138E idle  _FirstSighting\r
+ 1087:167A       _SightPlayer\r
+ 1201:0005 idle  _CheckWeaponChange\r
+ 1201:0039 idle  _ControlMovement\r
+ 1201:01A8 idle  _StatusDrawPic\r
+ 1201:01FF       _DrawFace\r
+ 1201:025B idle  _UpdateFace\r
+ 1201:02A1 idle  _LatchNumber\r
+ 1201:032A       _DrawHealth\r
+ 1201:0342       _TakeDamage\r
+ 1201:039B       _HealSelf\r
+ 1201:03C2       _DrawLevel\r
+ 1201:03DB       _DrawLives\r
+ 1201:03F3 idle  _GiveExtraMan\r
+ 1201:0411       _DrawScore\r
+ 1201:042B       _GivePoints\r
+ 1201:0468       _DrawWeapon\r
+ 1201:047F       _DrawKeys\r
+ 1201:04CC       _GiveWeapon\r
+ 1201:04F5       _DrawAmmo\r
+ 1201:050D idle  _GiveAmmo\r
+ 1201:0542 idle  _GiveKey\r
+ 1201:0557       _GetBonus\r
+ 1201:0794 idle  _TryMove\r
+ 1201:091D idle  _ClipMove\r
+ 1201:0A41 idle  _VictoryTile\r
+ 1201:0A51 idle  _Thrust\r
+ 1201:0B37 idle  _Cmd_Fire\r
+ 1201:0B89 idle  _Cmd_Use\r
+ 1201:0CCC       _SpawnPlayer\r
+ 1201:0D6B idle  _KnifeAttack\r
+ 1201:0DFF idle  _GunAttack\r
+ 1201:0F2E idle  _VictorySpin\r
+ 1201:0FEB idle  _T_Attack\r
+ 1201:117D idle  _T_Player\r
+ 1320:000F       _InitStaticList\r
+ 1320:001A       _SpawnStatic\r
+ 1320:00E1       _PlaceItemType\r
+ 1320:016B idle  _RecursiveConnect\r
+ 1320:01B7 idle  _ConnectAreas\r
+ 1320:01F0       _InitAreas\r
+ 1320:0218       _InitDoorList\r
+ 1320:024B       _SpawnDoor\r
+ 1320:0340       _OpenDoor\r
+ 1320:0369 idle  _CloseDoor\r
+ 1320:05BD       _OperateDoor\r
+ 1320:0631 idle  _DoorOpen\r
+ 1320:065F idle  _DoorOpening\r
+ 1320:07B9 idle  _DoorClosing\r
+ 1320:08E8       _MoveDoors\r
+ 1320:093B       _PushWall\r
+ 1320:0AC9       _MovePWalls\r
+ 13EC:000C idle  _A_Smoke\r
+ 13EC:005A idle  _ProjectileTryMove\r
+ 13EC:00F3 idle  _T_Projectile\r
+ 13EC:0312       _SpawnStand\r
+ 13EC:04BA       _SpawnDeadGuard\r
+ 13EC:04D9       _SpawnBoss\r
+ 13EC:052B       _SpawnGretel\r
+ 13EC:057D       _SpawnPatrol\r
+ 13EC:072D       _A_DeathScream\r
+ 13EC:08C5       _SpawnGhosts\r
+ 13EC:094B       _SpawnSchabbs\r
+ 13EC:09B2       _SpawnGift\r
+ 13EC:0A19       _SpawnFat\r
+ 13EC:0A80 idle  _T_SchabbThrow\r
+ 13EC:0B9D idle  _T_GiftThrow\r
+ 13EC:0CBA idle  _T_Schabb\r
+ 13EC:0E42 idle  _T_Gift\r
+ 13EC:0FCA idle  _T_Fat\r
+ 13EC:1152       _SpawnFakeHitler\r
+ 13EC:11B9       _SpawnHitler\r
+ 13EC:1220 idle  _A_HitlerMorph\r
+ 13EC:12A8 idle  _A_MechaSound\r
+ 13EC:12D8 idle  _A_Slurpie\r
+ 13EC:12E7 idle  _T_FakeFire\r
+ 13EC:1404 idle  _T_Fake\r
+ 13EC:14DC idle  _T_Stand\r
+ 13EC:14EC idle  _T_Chase\r
+ 13EC:1743 idle  _T_Ghosts\r
+ 13EC:17EF idle  _T_DogChase\r
+ 13EC:1951 idle  _SelectPathDir\r
+ 13EC:199D idle  _T_Path\r
+ 13EC:1ACC idle  _T_Shoot\r
+ 13EC:1CA5 idle  _T_Bite\r
+ 13EC:1D7E       _SpawnBJVictory\r
+ 13EC:1DD1 idle  _T_BJRun\r
+ 13EC:1E66 idle  _T_BJJump\r
+ 13EC:1E8C idle  _T_BJYell\r
+ 13EC:1EAC idle  _T_BJDone\r
+ 13EC:1EB7 idle  _CheckPosition\r
+ 13EC:1F4F idle  _A_StartDeathCam\r
+ 160F:0008 idle  _GRFILEPOS\r
+ 160F:0056 idle  _CA_OpenDebug\r
+ 160F:0077 idle  _CA_CloseDebug\r
+ 160F:0088 idle  _CAL_GetGrChunkLength\r
+ 160F:00E4       _CA_FarRead\r
+ 160F:012F       _CA_FarWrite\r
+ 160F:017A idle  _CA_ReadFile\r
+ 160F:01E5       _CA_WriteFile\r
+ 160F:023B idle  _CA_LoadFile\r
+ 160F:02B5 idle  _CAL_OptimizeNodes\r
+ 160F:0300 idle  _CAL_HuffExpand\r
+ 160F:046B idle  _CAL_CarmackExpand\r
+ 160F:058F idle  _CA_RLEWCompress\r
+ 160F:06D7 idle  _CA_RLEWexpand\r
+ 160F:078E idle  _CAL_SetupGrFile\r
+ 160F:09C0 idle  _CAL_SetupMapFile\r
+ 160F:0B75 idle  _CAL_SetupAudioFile\r
+ 160F:0CAF       _CA_Startup\r
+ 160F:0CD0       _CA_Shutdown\r
+ 160F:0CF9       _CA_CacheAudioChunk\r
+ 160F:0DA1       _CA_LoadAllSounds\r
+ 160F:0E22 idle  _CAL_ExpandGrChunk\r
+ 160F:0EF4       _CA_CacheGrChunk\r
+ 160F:1031       _CA_CacheScreen\r
+ 160F:111A       _CA_CacheMap\r
+ 160F:1269       _CA_UpLevel\r
+ 160F:12A6       _CA_DownLevel\r
+ 160F:12CC idle  _CA_ClearMarks\r
+ 160F:12ED idle  _CA_ClearAllMarks\r
+ 160F:130F idle  _CA_SetGrPurge\r
+ 160F:1336       _CA_SetAllPurge\r
+ 160F:135D       _CA_CacheMarks\r
+ 160F:165E idle  _CA_CannotOpen\r
+ 177B:0141       _IN_GetJoyAbs\r
+ 177B:01DA       _INL_GetJoyDelta\r
+ 177B:0336 idle  _IN_GetJoyButtonsDB\r
+ 177B:048B       _IN_SetupJoy\r
+ 177B:0572       _IN_Startup\r
+ 177B:060E idle  _IN_Default\r
+ 177B:064D       _IN_Shutdown\r
+ 177B:0679 idle  _IN_SetKeyHook\r
+ 177B:068B       _IN_ClearKeysDown\r
+ 177B:06AA       _IN_ReadControl\r
+ 177B:09C2 idle  _IN_SetControlType\r
+ 177B:09D3 idle  _IN_WaitForKey\r
+ 177B:09EF       _IN_WaitForASCII\r
+ 177B:0A0A       _IN_StartAck\r
+ 177B:0A59       _IN_CheckAck\r
+ 177B:0AB2       _IN_Ack\r
+ 177B:0AC3       _IN_UserInput\r
+ 177B:0B04       _IN_MouseButtons\r
+ 177B:0B1B       _IN_JoyButtons\r
+ 182E:0000 idle  _MML_CheckForXMS\r
+ 182E:001B idle  _MML_SetupXMS\r
+ 182E:0087 idle  _MML_ShutdownXMS\r
+ 182E:00B6       _MML_UseSpace\r
+ 182E:0239 idle  _MML_ClearBlock\r
+ 182E:029A       _MM_Startup\r
+ 182E:048B       _MM_Shutdown\r
+ 182E:04B3       _MM_GetPtr\r
+ 182E:0767       _MM_FreePtr\r
+ 182E:082B       _MM_SetPurge\r
+ 182E:08A9       _MM_SetLock\r
+ 182E:092B       _MM_SortMem\r
+ 182E:0AE0 idle  _MM_ShowMemory\r
+ 182E:0C31 idle  _MM_DumpData\r
+ 182E:0D5B       _MM_UnusedMemory\r
+ 182E:0DC0       _MM_TotalFree\r
+ 182E:0E3C       _MM_BombOnError\r
+ 1912:0007 idle  _PML_MapEMS\r
+ 1912:0029 idle  _PML_StartupEMS\r
+ 1912:0155 idle  _PML_ShutdownEMS\r
+ 1912:0178 idle  _PML_StartupXMS\r
+ 1912:01EA idle  _PML_XMSCopy\r
+ 1912:0293 idle  _PML_ShutdownXMS\r
+ 1912:02B8       _PM_SetMainMemPurge\r
+ 1912:02DF       _PM_CheckMainMem\r
+ 1912:03D0 idle  _PML_StartupMainMem\r
+ 1912:0447 idle  _PML_ShutdownMainMem\r
+ 1912:046E idle  _PML_ReadFromFile\r
+ 1912:04E8 idle  _PML_OpenPageFile\r
+ 1912:06B1 idle  _PML_ClosePageFile\r
+ 1912:06E8 idle  _PML_GetEMSAddress\r
+ 1912:07BF       _PM_GetPageAddress\r
+ 1912:0812 idle  _PML_GiveLRUPage\r
+ 1912:08B0 idle  _PML_GiveLRUXMSPage\r
+ 1912:0920 idle  _PML_PutPageInXMS\r
+ 1912:09C9 idle  _PML_TransferPageSpace\r
+ 1912:0A96 idle  _PML_GetAPageBuffer\r
+ 1912:0BA0 idle  _PML_GetPageFromXMS\r
+ 1912:0C21 idle  _PML_LoadPage\r
+ 1912:0C71       _PM_GetPage\r
+ 1912:0D31       _PM_SetPageLock\r
+ 1912:0D60       _PM_Preload\r
+ 1912:0FBA       _PM_NextFrame\r
+ 1912:1034 idle  _PM_Reset\r
+ 1912:10A0       _PM_Startup\r
+ 1912:114B       _PM_Shutdown\r
+ 1A28:0501 idle  _SDL_SBSetDMA\r
+ 1A28:08B0 idle  _SDL_LoadDigiSegment\r
+ 1A28:08E1 idle  _SDL_PlayDigiSegment\r
+ 1A28:092B       _SD_StopDigitized\r
+ 1A28:09CC       _SD_Poll\r
+ 1A28:0A58       _SD_SetPosition\r
+ 1A28:0A9F idle  _SD_PlayDigitized\r
+ 1A28:0B5F       _SDL_DigitizedDone\r
+ 1A28:0BC9       _SD_SetDigiDevice\r
+ 1A28:0C2D idle  _SDL_SetupDigi\r
+ 1A28:0D03       _alOut\r
+ 1A28:109B       _SD_SetSoundMode\r
+ 1A28:1129       _SD_SetMusicMode\r
+ 1A28:117B       _SD_Startup\r
+ 1A28:14B4 idle  _SD_Default\r
+ 1A28:1523       _SD_Shutdown\r
+ 1A28:157B idle  _SD_SetUserHook\r
+ 1A28:158D       _SD_PositionSound\r
+ 1A28:15A4       _SD_PlaySound\r
+ 1A28:1744       _SD_SoundPlaying\r
+ 1A28:178B       _SD_StopSound\r
+ 1A28:17C2       _SD_WaitSoundDone\r
+ 1A28:17CF       _SD_MusicOn\r
+ 1A28:17DA       _SD_MusicOff\r
+ 1A28:181E       _SD_StartMusic\r
+ 1A28:1870 idle  _SD_FadeOutMusic\r
+ 1A28:1881 idle  _SD_MusicPlaying\r
+ 1BB1:000C       _SDL_SetDS\r
+ 1BB1:0014       _SDL_IndicatePC\r
+ 1BB1:0021       _SDL_t0ExtremeAsmService\r
+ 1BB1:009B       _SDL_t0FastAsmService\r
+ 1BB1:02CD       _SDL_t0SlowAsmService\r
+ 1BF0:0008 idle  _USL_HardError\r
+ 1BF0:0131       _US_Startup\r
+ 1BF0:01FD       _US_Shutdown\r
+ 1BF0:020F       _US_CheckParm\r
+ 1BF0:02B5 idle  _US_SetPrintRoutines\r
+ 1BF0:02D4       _US_Print\r
+ 1BF0:0378       _US_PrintUnsigned\r
+ 1BF0:039D idle  _US_PrintSigned\r
+ 1BF0:03C2 idle  _USL_PrintInCenter\r
+ 1BF0:0420       _US_PrintCentered\r
+ 1BF0:0462 idle  _US_CPrintLine\r
+ 1BF0:04BF       _US_CPrint\r
+ 1BF0:0528       _US_ClearWindow\r
+ 1BF0:0553       _US_DrawWindow\r
+ 1BF0:0669 idle  _US_CenterWindow\r
+ 1BF0:068D idle  _US_SaveWindow\r
+ 1BF0:06BA idle  _US_RestoreWindow\r
+ 1BF0:0782       _US_LineInput\r
+ 1CAA:0010       _US_InitRndT\r
+ 1CAA:0038       _US_RndT\r
+ 1CAF:0003       _VL_Startup\r
+ 1CAF:005B       _VL_Shutdown\r
+ 1CAF:0065       _VL_SetVGAPlaneMode\r
+ 1CAF:0088 idle  _VL_SetTextMode\r
+ 1CAF:0092 idle  _VL_ClearVideo\r
+ 1CAF:00BC idle  _VL_DePlaneVGA\r
+ 1CAF:0113 idle  _VL_SetLineWidth\r
+ 1CAF:014C idle  _VL_SetSplitScreen\r
+ 1CAF:0198 idle  _VL_FillPalette\r
+ 1CAF:01BD idle  _VL_SetColor\r
+ 1CAF:01D8 idle  _VL_GetColor\r
+ 1CAF:0203       _VL_SetPalette\r
+ 1CAF:0235 idle  _VL_GetPalette\r
+ 1CAF:0256       _VL_FadeOut\r
+ 1CAF:0374       _VL_FadeIn\r
+ 1CAF:044A       _VL_TestPaletteSet\r
+ 1CAF:04A5       _VL_ColorBorder\r
+ 1CAF:04B9       _VL_Plot\r
+ 1CAF:0504       _VL_Hlin\r
+ 1CAF:05DF       _VL_Vlin\r
+ 1CAF:0646       _VL_Bar\r
+ 1CAF:0749       _VL_MemToLatch\r
+ 1CAF:079C       _VL_MemToScreen\r
+ 1CAF:0837 idle  _VL_MaskedToScreen\r
+ 1CAF:08C5       _VL_LatchToScreen\r
+ 1CAF:092E idle  _VL_DrawTile8String\r
+ 1CAF:0A5B idle  _VL_DrawLatch8String\r
+ 1CAF:0B07 idle  _VL_SizeTile8String\r
+ 1D62:0000 idle  _VW_DrawPropString\r
+ 1D62:0113 idle  _VW_DrawColorPropString\r
+ 1D62:022E       _VL_MungePic\r
+ 1D62:02EC idle  _VWL_MeasureString\r
+ 1D62:032C       _VW_MeasurePropString\r
+ 1D62:034E idle  _VW_MeasureMPropString\r
+ 1D62:0370       _VW_MarkUpdateBlock\r
+ 1D62:042B       _VWB_DrawTile8\r
+ 1D62:046E idle  _VWB_DrawTile8M\r
+ 1D62:04B3       _VWB_DrawPic\r
+ 1D62:051F       _VWB_DrawPropString\r
+ 1D62:0556       _VWB_Bar\r
+ 1D62:0592       _VWB_Plot\r
+ 1D62:05BD       _VWB_Hlin\r
+ 1D62:05F1       _VWB_Vlin\r
+ 1D62:0625       _VW_UpdateScreen\r
+ 1D62:062F       _LatchDrawPic\r
+ 1D62:0687       _LoadLatchMem\r
+ 1D62:07A1       _FizzleFade\r
+ 1DF0:0002       _VL_WaitVBL\r
+ 1DF0:0019 idle  _VL_SetCRTC\r
+ 1DF0:003D       _VL_SetScreen\r
+ 1DF0:00AA       _VL_ScreenToScreen\r
+ 1DF0:012A       _VL_VideoID\r
+ 1E19:0006       _VH_UpdateScreen\r
+ 1E39:2152       e086_Entry\r
+ 1E39:26E0       e086_Shortcut\r
+ 20B1:0306       e087_Entry\r
+ 20B1:03C6       e087_Shortcut\r
+ 20B1:0430       e087_Trap\r
+ 210E:0000       _planepics\r
+ 230E:0002 idle  _rndtable\r
+ 231F:0000 idle  _MusicMenu\r
+ 234F:0000 idle  _endStrings\r
+ 237C:0000       _MainMenu\r
+ 2394:0000 idle  _SndMenu\r
+ 23B4:0000 idle  _CtlMenu\r
+ 23C4:0000 idle  _NewEmenu\r
+ 23E1:0000 idle  _NewMenu\r
+ 23EC:0000 idle  _LSMenu\r
+ 2407:0000 idle  _CusMenu\r
+ 2422:0000       _signon\r
+ 33DA:0000       _areaconnect\r
+ 3430:0000       _sintable\r
+ 34A1:0000       _finetangent\r
+ 3582:0000       _grneeded\r
+ 358C:0000       _whiteshifts\r
+ 36AC:0000       _redshifts\r
+ 37CC:0000       _mmblocks\r
+ 39D9:0000       _palette2\r
+ 3A09:0000       _palette1\r
+ 3A39:0000 idle  DATASEG@\r
+ 3A39:00A3 idle  __Int0Vector\r
+ 3A39:00A7 idle  __Int4Vector\r
+ 3A39:00AB idle  __Int5Vector\r
+ 3A39:00AF idle  __Int6Vector\r
+ 3A39:00B3       __C0argc\r
+ 3A39:00B5       __C0argv\r
+ 3A39:00B7       __C0environ\r
+ 3A39:00B9       __envLng\r
+ 3A39:00BB       __envseg\r
+ 3A39:00BD       __envSize\r
+ 3A39:00BF       __psp\r
+ 3A39:00C1 idle  __osversion\r
+ 3A39:00C1       __osmajor\r
+ 3A39:00C1       __version\r
+ 3A39:00C2 idle  __osminor\r
+ 3A39:00C3       _errno\r
+ 3A39:00C5 idle  __StartTime\r
+ 3A39:00C9 idle  ___heapbase\r
+ 3A39:00CB       ___brklvl\r
+ 3A39:00CD       __heapbase\r
+ 3A39:00D1       __brklvl\r
+ 3A39:00D5       __heaptop\r
+ 3A39:00DA idle  _halfheight\r
+ 3A39:00DC       _dirangle\r
+ 3A39:00EE       _configname\r
+ 3A39:00FC idle  _JHParmStrings\r
+ 3A39:0102 idle  _radtoint\r
+ 3A39:01C4 idle  _MusicItems\r
+ 3A39:01FC idle  _nosprtxt\r
+ 3A39:0330 idle  _endextern\r
+ 3A39:0332 idle  _helpextern\r
+ 3A39:0334 idle  _helpfilename\r
+ 3A39:0341       _endfilename\r
+ 3A39:03D2       _MainItems\r
+ 3A39:03DC idle  _SndItems\r
+ 3A39:03E6 idle  _LSItems\r
+ 3A39:03F0 idle  _CtlItems\r
+ 3A39:03FA idle  _CusItems\r
+ 3A39:0404 idle  _NewEitems\r
+ 3A39:040E idle  _NewItems\r
+ 3A39:0418 idle  _color_hlite\r
+ 3A39:0420 idle  _color_norml\r
+ 3A39:0428 idle  _EpisodeSelect\r
+ 3A39:0434 idle  _SoundStatus\r
+ 3A39:0436 idle  _SaveName\r
+ 3A39:05F2 idle  _mbarray\r
+ 3A39:05FE idle  _order\r
+ 3A39:0622 idle  _moveorder\r
+ 3A39:0E74 idle  _ElevatorBackTo\r
+ 3A39:0E80 idle  _righttable\r
+ 3A39:1042 idle  _lefttable\r
+ 3A39:1204       _demoname\r
+ 3A39:1270       _dirscan\r
+ 3A39:1278       _buttonscan\r
+ 3A39:1288       _buttonmouse\r
+ 3A39:1290       _buttonjoy\r
+ 3A39:1298 idle  _songs\r
+ 3A39:1684       _screenloc\r
+ 3A39:168A       _freelatch\r
+ 3A39:168C       _tileglobal\r
+ 3A39:1690 idle  _mindist\r
+ 3A39:1694       _costable\r
+ 3A39:1698 idle  _vgaCeiling\r
+ 3A39:1710 idle  _weaponscale\r
+ 3A39:171A       _mapmasks1\r
+ 3A39:173A       _mapmasks2\r
+ 3A39:175A       _mapmasks3\r
+ 3A39:177A idle  _wordmasks\r
+ 3A39:180C idle  _opposite\r
+ 3A39:181E idle  _diagonal\r
+ 3A39:190C idle  _s_player\r
+ 3A39:191C idle  _s_attack\r
+ 3A39:192C idle  _attackinfo\r
+ 3A39:1A0C idle  _strafeangle\r
+ 3A39:1A1E idle  _statinfo\r
+ 3A39:1B38 idle  _dirtable\r
+ 3A39:1B4A idle  _starthitpoints\r
+ 3A39:1BFA idle  _s_rocket\r
+ 3A39:1C0A idle  _s_smoke1\r
+ 3A39:1C1A idle  _s_smoke2\r
+ 3A39:1C2A idle  _s_smoke3\r
+ 3A39:1C3A idle  _s_smoke4\r
+ 3A39:1C4A idle  _s_boom1\r
+ 3A39:1C5A idle  _s_boom2\r
+ 3A39:1C6A idle  _s_boom3\r
+ 3A39:1C7A idle  _s_grdstand\r
+ 3A39:1C8A idle  _s_grdpath1\r
+ 3A39:1C9A idle  _s_grdpath1s\r
+ 3A39:1CAA idle  _s_grdpath2\r
+ 3A39:1CBA idle  _s_grdpath3\r
+ 3A39:1CCA idle  _s_grdpath3s\r
+ 3A39:1CDA idle  _s_grdpath4\r
+ 3A39:1CEA       _s_grdpain\r
+ 3A39:1CFA       _s_grdpain1\r
+ 3A39:1D0A idle  _s_grdshoot1\r
+ 3A39:1D1A idle  _s_grdshoot2\r
+ 3A39:1D2A idle  _s_grdshoot3\r
+ 3A39:1D3A       _s_grdchase1\r
+ 3A39:1D4A idle  _s_grdchase1s\r
+ 3A39:1D5A idle  _s_grdchase2\r
+ 3A39:1D6A idle  _s_grdchase3\r
+ 3A39:1D7A idle  _s_grdchase3s\r
+ 3A39:1D8A idle  _s_grdchase4\r
+ 3A39:1D9A       _s_grddie1\r
+ 3A39:1DAA idle  _s_grddie2\r
+ 3A39:1DBA idle  _s_grddie3\r
+ 3A39:1DCA idle  _s_grddie4\r
+ 3A39:1DDA       _s_blinkychase1\r
+ 3A39:1DEA idle  _s_blinkychase2\r
+ 3A39:1DFA idle  _s_inkychase1\r
+ 3A39:1E0A idle  _s_inkychase2\r
+ 3A39:1E1A idle  _s_pinkychase1\r
+ 3A39:1E2A idle  _s_pinkychase2\r
+ 3A39:1E3A idle  _s_clydechase1\r
+ 3A39:1E4A idle  _s_clydechase2\r
+ 3A39:1E5A idle  _s_dogpath1\r
+ 3A39:1E6A idle  _s_dogpath1s\r
+ 3A39:1E7A idle  _s_dogpath2\r
+ 3A39:1E8A idle  _s_dogpath3\r
+ 3A39:1E9A idle  _s_dogpath3s\r
+ 3A39:1EAA idle  _s_dogpath4\r
+ 3A39:1EBA idle  _s_dogjump1\r
+ 3A39:1ECA idle  _s_dogjump2\r
+ 3A39:1EDA idle  _s_dogjump3\r
+ 3A39:1EEA idle  _s_dogjump4\r
+ 3A39:1EFA idle  _s_dogjump5\r
+ 3A39:1F0A       _s_dogchase1\r
+ 3A39:1F1A idle  _s_dogchase1s\r
+ 3A39:1F2A idle  _s_dogchase2\r
+ 3A39:1F3A idle  _s_dogchase3\r
+ 3A39:1F4A idle  _s_dogchase3s\r
+ 3A39:1F5A idle  _s_dogchase4\r
+ 3A39:1F6A       _s_dogdie1\r
+ 3A39:1F7A idle  _s_dogdie2\r
+ 3A39:1F8A idle  _s_dogdie3\r
+ 3A39:1F9A idle  _s_dogdead\r
+ 3A39:1FAA idle  _s_ofcstand\r
+ 3A39:1FBA idle  _s_ofcpath1\r
+ 3A39:1FCA idle  _s_ofcpath1s\r
+ 3A39:1FDA idle  _s_ofcpath2\r
+ 3A39:1FEA idle  _s_ofcpath3\r
+ 3A39:1FFA idle  _s_ofcpath3s\r
+ 3A39:200A idle  _s_ofcpath4\r
+ 3A39:201A       _s_ofcpain\r
+ 3A39:202A       _s_ofcpain1\r
+ 3A39:203A idle  _s_ofcshoot1\r
+ 3A39:204A idle  _s_ofcshoot2\r
+ 3A39:205A idle  _s_ofcshoot3\r
+ 3A39:206A       _s_ofcchase1\r
+ 3A39:207A idle  _s_ofcchase1s\r
+ 3A39:208A idle  _s_ofcchase2\r
+ 3A39:209A idle  _s_ofcchase3\r
+ 3A39:20AA idle  _s_ofcchase3s\r
+ 3A39:20BA idle  _s_ofcchase4\r
+ 3A39:20CA       _s_ofcdie1\r
+ 3A39:20DA idle  _s_ofcdie2\r
+ 3A39:20EA idle  _s_ofcdie3\r
+ 3A39:20FA idle  _s_ofcdie4\r
+ 3A39:210A idle  _s_ofcdie5\r
+ 3A39:211A idle  _s_mutstand\r
+ 3A39:212A idle  _s_mutpath1\r
+ 3A39:213A idle  _s_mutpath1s\r
+ 3A39:214A idle  _s_mutpath2\r
+ 3A39:215A idle  _s_mutpath3\r
+ 3A39:216A idle  _s_mutpath3s\r
+ 3A39:217A idle  _s_mutpath4\r
+ 3A39:218A       _s_mutpain\r
+ 3A39:219A       _s_mutpain1\r
+ 3A39:21AA idle  _s_mutshoot1\r
+ 3A39:21BA idle  _s_mutshoot2\r
+ 3A39:21CA idle  _s_mutshoot3\r
+ 3A39:21DA idle  _s_mutshoot4\r
+ 3A39:21EA       _s_mutchase1\r
+ 3A39:21FA idle  _s_mutchase1s\r
+ 3A39:220A idle  _s_mutchase2\r
+ 3A39:221A idle  _s_mutchase3\r
+ 3A39:222A idle  _s_mutchase3s\r
+ 3A39:223A idle  _s_mutchase4\r
+ 3A39:224A       _s_mutdie1\r
+ 3A39:225A idle  _s_mutdie2\r
+ 3A39:226A idle  _s_mutdie3\r
+ 3A39:227A idle  _s_mutdie4\r
+ 3A39:228A idle  _s_mutdie5\r
+ 3A39:229A idle  _s_ssstand\r
+ 3A39:22AA idle  _s_sspath1\r
+ 3A39:22BA idle  _s_sspath1s\r
+ 3A39:22CA idle  _s_sspath2\r
+ 3A39:22DA idle  _s_sspath3\r
+ 3A39:22EA idle  _s_sspath3s\r
+ 3A39:22FA idle  _s_sspath4\r
+ 3A39:230A       _s_sspain\r
+ 3A39:231A       _s_sspain1\r
+ 3A39:232A idle  _s_ssshoot1\r
+ 3A39:233A idle  _s_ssshoot2\r
+ 3A39:234A idle  _s_ssshoot3\r
+ 3A39:235A idle  _s_ssshoot4\r
+ 3A39:236A idle  _s_ssshoot5\r
+ 3A39:237A idle  _s_ssshoot6\r
+ 3A39:238A idle  _s_ssshoot7\r
+ 3A39:239A idle  _s_ssshoot8\r
+ 3A39:23AA idle  _s_ssshoot9\r
+ 3A39:23BA       _s_sschase1\r
+ 3A39:23CA idle  _s_sschase1s\r
+ 3A39:23DA idle  _s_sschase2\r
+ 3A39:23EA idle  _s_sschase3\r
+ 3A39:23FA idle  _s_sschase3s\r
+ 3A39:240A idle  _s_sschase4\r
+ 3A39:241A       _s_ssdie1\r
+ 3A39:242A idle  _s_ssdie2\r
+ 3A39:243A idle  _s_ssdie3\r
+ 3A39:244A idle  _s_ssdie4\r
+ 3A39:245A idle  _s_bossstand\r
+ 3A39:246A       _s_bosschase1\r
+ 3A39:247A idle  _s_bosschase1s\r
+ 3A39:248A idle  _s_bosschase2\r
+ 3A39:249A idle  _s_bosschase3\r
+ 3A39:24AA idle  _s_bosschase3s\r
+ 3A39:24BA idle  _s_bosschase4\r
+ 3A39:24CA       _s_bossdie1\r
+ 3A39:24DA idle  _s_bossdie2\r
+ 3A39:24EA idle  _s_bossdie3\r
+ 3A39:24FA idle  _s_bossdie4\r
+ 3A39:250A idle  _s_bossshoot1\r
+ 3A39:251A idle  _s_bossshoot2\r
+ 3A39:252A idle  _s_bossshoot3\r
+ 3A39:253A idle  _s_bossshoot4\r
+ 3A39:254A idle  _s_bossshoot5\r
+ 3A39:255A idle  _s_bossshoot6\r
+ 3A39:256A idle  _s_bossshoot7\r
+ 3A39:257A idle  _s_bossshoot8\r
+ 3A39:258A idle  _s_gretelstand\r
+ 3A39:259A       _s_gretelchase1\r
+ 3A39:25AA idle  _s_gretelchase1s\r
+ 3A39:25BA idle  _s_gretelchase2\r
+ 3A39:25CA idle  _s_gretelchase3\r
+ 3A39:25DA idle  _s_gretelchase3s\r
+ 3A39:25EA idle  _s_gretelchase4\r
+ 3A39:25FA       _s_greteldie1\r
+ 3A39:260A idle  _s_greteldie2\r
+ 3A39:261A idle  _s_greteldie3\r
+ 3A39:262A idle  _s_greteldie4\r
+ 3A39:263A idle  _s_gretelshoot1\r
+ 3A39:264A idle  _s_gretelshoot2\r
+ 3A39:265A idle  _s_gretelshoot3\r
+ 3A39:266A idle  _s_gretelshoot4\r
+ 3A39:267A idle  _s_gretelshoot5\r
+ 3A39:268A idle  _s_gretelshoot6\r
+ 3A39:269A idle  _s_gretelshoot7\r
+ 3A39:26AA idle  _s_gretelshoot8\r
+ 3A39:26CC idle  _s_schabbstand\r
+ 3A39:26DC       _s_schabbchase1\r
+ 3A39:26EC idle  _s_schabbchase1s\r
+ 3A39:26FC idle  _s_schabbchase2\r
+ 3A39:270C idle  _s_schabbchase3\r
+ 3A39:271C idle  _s_schabbchase3s\r
+ 3A39:272C idle  _s_schabbchase4\r
+ 3A39:273C idle  _s_schabbdeathcam\r
+ 3A39:274C       _s_schabbdie1\r
+ 3A39:275C idle  _s_schabbdie2\r
+ 3A39:276C idle  _s_schabbdie3\r
+ 3A39:277C idle  _s_schabbdie4\r
+ 3A39:278C idle  _s_schabbdie5\r
+ 3A39:279C idle  _s_schabbdie6\r
+ 3A39:27AC idle  _s_schabbshoot1\r
+ 3A39:27BC idle  _s_schabbshoot2\r
+ 3A39:27CC idle  _s_needle1\r
+ 3A39:27DC idle  _s_needle2\r
+ 3A39:27EC idle  _s_needle3\r
+ 3A39:27FC idle  _s_needle4\r
+ 3A39:280C idle  _s_giftstand\r
+ 3A39:281C       _s_giftchase1\r
+ 3A39:282C idle  _s_giftchase1s\r
+ 3A39:283C idle  _s_giftchase2\r
+ 3A39:284C idle  _s_giftchase3\r
+ 3A39:285C idle  _s_giftchase3s\r
+ 3A39:286C idle  _s_giftchase4\r
+ 3A39:287C idle  _s_giftdeathcam\r
+ 3A39:288C       _s_giftdie1\r
+ 3A39:289C idle  _s_giftdie2\r
+ 3A39:28AC idle  _s_giftdie3\r
+ 3A39:28BC idle  _s_giftdie4\r
+ 3A39:28CC idle  _s_giftdie5\r
+ 3A39:28DC idle  _s_giftdie6\r
+ 3A39:28EC idle  _s_giftshoot1\r
+ 3A39:28FC idle  _s_giftshoot2\r
+ 3A39:290C idle  _s_fatstand\r
+ 3A39:291C       _s_fatchase1\r
+ 3A39:292C idle  _s_fatchase1s\r
+ 3A39:293C idle  _s_fatchase2\r
+ 3A39:294C idle  _s_fatchase3\r
+ 3A39:295C idle  _s_fatchase3s\r
+ 3A39:296C idle  _s_fatchase4\r
+ 3A39:297C idle  _s_fatdeathcam\r
+ 3A39:298C       _s_fatdie1\r
+ 3A39:299C idle  _s_fatdie2\r
+ 3A39:29AC idle  _s_fatdie3\r
+ 3A39:29BC idle  _s_fatdie4\r
+ 3A39:29CC idle  _s_fatdie5\r
+ 3A39:29DC idle  _s_fatdie6\r
+ 3A39:29EC idle  _s_fatshoot1\r
+ 3A39:29FC idle  _s_fatshoot2\r
+ 3A39:2A0C idle  _s_fatshoot3\r
+ 3A39:2A1C idle  _s_fatshoot4\r
+ 3A39:2A2C idle  _s_fatshoot5\r
+ 3A39:2A3C idle  _s_fatshoot6\r
+ 3A39:2A4C idle  _s_fakestand\r
+ 3A39:2A5C       _s_fakechase1\r
+ 3A39:2A6C idle  _s_fakechase1s\r
+ 3A39:2A7C idle  _s_fakechase2\r
+ 3A39:2A8C idle  _s_fakechase3\r
+ 3A39:2A9C idle  _s_fakechase3s\r
+ 3A39:2AAC idle  _s_fakechase4\r
+ 3A39:2ABC       _s_fakedie1\r
+ 3A39:2ACC idle  _s_fakedie2\r
+ 3A39:2ADC idle  _s_fakedie3\r
+ 3A39:2AEC idle  _s_fakedie4\r
+ 3A39:2AFC idle  _s_fakedie5\r
+ 3A39:2B0C idle  _s_fakedie6\r
+ 3A39:2B1C idle  _s_fakeshoot1\r
+ 3A39:2B2C idle  _s_fakeshoot2\r
+ 3A39:2B3C idle  _s_fakeshoot3\r
+ 3A39:2B4C idle  _s_fakeshoot4\r
+ 3A39:2B5C idle  _s_fakeshoot5\r
+ 3A39:2B6C idle  _s_fakeshoot6\r
+ 3A39:2B7C idle  _s_fakeshoot7\r
+ 3A39:2B8C idle  _s_fakeshoot8\r
+ 3A39:2B9C idle  _s_fakeshoot9\r
+ 3A39:2BAC idle  _s_fire1\r
+ 3A39:2BBC idle  _s_fire2\r
+ 3A39:2BCC idle  _s_mechastand\r
+ 3A39:2BDC       _s_mechachase1\r
+ 3A39:2BEC idle  _s_mechachase1s\r
+ 3A39:2BFC idle  _s_mechachase2\r
+ 3A39:2C0C idle  _s_mechachase3\r
+ 3A39:2C1C idle  _s_mechachase3s\r
+ 3A39:2C2C idle  _s_mechachase4\r
+ 3A39:2C3C       _s_mechadie1\r
+ 3A39:2C4C idle  _s_mechadie2\r
+ 3A39:2C5C idle  _s_mechadie3\r
+ 3A39:2C6C idle  _s_mechadie4\r
+ 3A39:2C7C idle  _s_mechashoot1\r
+ 3A39:2C8C idle  _s_mechashoot2\r
+ 3A39:2C9C idle  _s_mechashoot3\r
+ 3A39:2CAC idle  _s_mechashoot4\r
+ 3A39:2CBC idle  _s_mechashoot5\r
+ 3A39:2CCC idle  _s_mechashoot6\r
+ 3A39:2CDC       _s_hitlerchase1\r
+ 3A39:2CEC idle  _s_hitlerchase1s\r
+ 3A39:2CFC idle  _s_hitlerchase2\r
+ 3A39:2D0C idle  _s_hitlerchase3\r
+ 3A39:2D1C idle  _s_hitlerchase3s\r
+ 3A39:2D2C idle  _s_hitlerchase4\r
+ 3A39:2D3C idle  _s_hitlerdeathcam\r
+ 3A39:2D4C       _s_hitlerdie1\r
+ 3A39:2D5C idle  _s_hitlerdie2\r
+ 3A39:2D6C idle  _s_hitlerdie3\r
+ 3A39:2D7C idle  _s_hitlerdie4\r
+ 3A39:2D8C idle  _s_hitlerdie5\r
+ 3A39:2D9C idle  _s_hitlerdie6\r
+ 3A39:2DAC idle  _s_hitlerdie7\r
+ 3A39:2DBC idle  _s_hitlerdie8\r
+ 3A39:2DCC idle  _s_hitlerdie9\r
+ 3A39:2DDC idle  _s_hitlerdie10\r
+ 3A39:2DEC idle  _s_hitlershoot1\r
+ 3A39:2DFC idle  _s_hitlershoot2\r
+ 3A39:2E0C idle  _s_hitlershoot3\r
+ 3A39:2E1C idle  _s_hitlershoot4\r
+ 3A39:2E2C idle  _s_hitlershoot5\r
+ 3A39:2E3C idle  _s_hitlershoot6\r
+ 3A39:2E54 idle  _s_bjrun1\r
+ 3A39:2E64 idle  _s_bjrun1s\r
+ 3A39:2E74 idle  _s_bjrun2\r
+ 3A39:2E84 idle  _s_bjrun3\r
+ 3A39:2E94 idle  _s_bjrun3s\r
+ 3A39:2EA4 idle  _s_bjrun4\r
+ 3A39:2EB4 idle  _s_bjjump1\r
+ 3A39:2EC4 idle  _s_bjjump2\r
+ 3A39:2ED4 idle  _s_bjjump3\r
+ 3A39:2EE4 idle  _s_bjjump4\r
+ 3A39:2EF4       _s_deathcam\r
+ 3A39:2F4A       _gamepal\r
+ 3A39:324A       _audioname\r
+ 3A39:3257 idle  _gheadname\r
+ 3A39:3261 idle  _gfilename\r
+ 3A39:326B idle  _gdictname\r
+ 3A39:3275 idle  _mheadname\r
+ 3A39:327F idle  _mfilename\r
+ 3A39:3289 idle  _aheadname\r
+ 3A39:3293 idle  _afilename\r
+ 3A39:3354 idle  _KbdDefs\r
+ 3A39:335E idle  _DemoMode\r
+ 3A39:3510 idle  _XMSProtectPage\r
+ 3A39:3512       _PageFileName\r
+ 3A39:3520 idle  _PageFile\r
+ 3A39:352A idle  _EMMDriverName\r
+ 3A39:39A0 idle  _ssPort\r
+ 3A39:3D12       _USL_MeasureString\r
+ 3A39:3D16 idle  _USL_DrawString\r
+ 3A39:3D1A       _Scores\r
+ 3A39:3FC4       _screenseg\r
+ 3A39:3FCA idle  _pixmasks\r
+ 3A39:3FCE idle  _leftmasks\r
+ 3A39:3FD2 idle  _rightmasks\r
+ 3A39:4090       __8087\r
+ 3A39:40A0       __protected\r
+ 3A39:40A1       __LDT\r
+ 3A39:40A4       __default87\r
+ 3A39:40A6 idle  __huge_flt\r
+ 3A39:40AA       __huge_dble\r
+ 3A39:40B2 idle  __huge_ldble\r
+ 3A39:40BC idle  __indefinite\r
+ 3A39:40C0 idle  __tiny_ldble\r
+ 3A39:40CA       __mathwhy\r
+ 3A39:4270       __emu\r
+ 3A39:4380       __atexitcnt\r
+ 3A39:4382       __ctype\r
+ 3A39:4484       __exitbuf\r
+ 3A39:4488       __exitfopen\r
+ 3A39:448C       __exitopen\r
+ 3A39:4490       __streams\r
+ 3A39:45D0       __nfile\r
+ 3A39:45D2       __openfd\r
+ 3A39:45FA       __fmode\r
+ 3A39:45FC       __notUmask\r
+ 3A39:45FE       __fpstklen\r
+ 3A39:4600       __heaplen\r
+ 3A39:4602       __doserrno\r
+ 3A39:4604 idle  __dosErrorToSV\r
+ 3A39:4668       __stklen\r
+ 3A39:46D2       __video\r
+ 3A39:46E1       _directvideo\r
+ 3A39:471E idle  __first\r
+ 3A39:4720 idle  __last\r
+ 3A39:4722 idle  __rover\r
+ 3A39:4724       __argc\r
+ 3A39:4726       __argv\r
+ 3A39:4732       _environ\r
+ 3A39:473A       __RealCvtVector\r
+ 3A39:473E idle  __ScanTodVector\r
+ 3A39:4944       __atexittbl\r
+ 3A39:49D2       ___SignalPtr\r
+ 3A39:49E4       _mr_dest\r
+ 3A39:49E6       _mr_yfrac\r
+ 3A39:49E8       _mr_xfrac\r
+ 3A39:49EA       _mr_ystep\r
+ 3A39:49EC       _mr_xstep\r
+ 3A39:49EE       _mr_count\r
+ 3A39:49F0       _mr_rowofs\r
+ 3A39:49F2       _pcos\r
+ 3A39:49F6       _psin\r
+ 3A39:49FA       _mirrorofs\r
+ 3A39:4AC2       _planeylookup\r
+ 3A39:4C52       _basedist\r
+ 3A39:4DE2       _stepscale\r
+ 3A39:4F72       _spanstart\r
+ 3A39:503A       _viewcos\r
+ 3A39:503E       _viewsin\r
+ 3A39:5042       _viewy\r
+ 3A39:5046       _viewx\r
+ 3A39:504A       _wallheight\r
+ 3A39:52CA       _scale\r
+ 3A39:52CE       _viewheight\r
+ 3A39:52D0       _viewwidth\r
+ 3A39:52D2       _menuitems\r
+ 3A39:52D4       _bufferofs\r
+ 3A39:52D6       _pwalldir\r
+ 3A39:52D8       _pwally\r
+ 3A39:52DA       _pwallx\r
+ 3A39:52DC       _areabyplayer\r
+ 3A39:5326       _pwallstate\r
+ 3A39:5328       _doorposition\r
+ 3A39:53A8       _pwallpos\r
+ 3A39:53AA       _vertwall\r
+ 3A39:542A       _horizwall\r
+ 3A39:54AA       _viewsize\r
+ 3A39:54AC       _joystickport\r
+ 3A39:54AE       _joystickprogressive\r
+ 3A39:54B0       _joypadenabled\r
+ 3A39:54B2       _joystickenabled\r
+ 3A39:54B4       _mouseenabled\r
+ 3A39:54B6       _update\r
+ 3A39:55BA       _actorat\r
+ 3A39:75BA       _tilemap\r
+ 3A39:85BA       _nearmapylookup\r
+ 3A39:863A       _farmapylookup\r
+ 3A39:86BA       _doorobjlist\r
+ 3A39:893A       _laststatobj\r
+ 3A39:893C       _statobjlist\r
+ 3A39:95BC       _player\r
+ 3A39:95BE       _new\r
+ 3A39:95C0       _playstate\r
+ 3A39:95C2       _gamestate\r
+ 3A39:9604       _minheightdiv\r
+ 3A39:9606       _heightnumerator\r
+ 3A39:960A       _maxslope\r
+ 3A39:960E       _pixelangle\r
+ 3A39:988E       _mouseadjustment\r
+ 3A39:9890       _virtualreality\r
+ 3A39:9892       _startgame\r
+ 3A39:9894       _shootdelta\r
+ 3A39:9896       _centerx\r
+ 3A39:9898       _screenofs\r
+ 3A39:989A       _focallength\r
+ 3A39:989E       _IsA386\r
+ 3A39:98A0       _nospr\r
+ 3A39:98A2       _str2\r
+ 3A39:98B6       _str\r
+ 3A39:9906       _LevelRatios\r
+ 3A39:9956       _backcolor\r
+ 3A39:9957       _blockstarts\r
+ 3A39:9B5F       _uwidthtable\r
+ 3A39:9B79       _updateptr\r
+ 3A39:9B7B       _WindowW\r
+ 3A39:9B7D       _WindowY\r
+ 3A39:9B7F       _WindowX\r
+ 3A39:9B81       _PrintY\r
+ 3A39:9B83       _NoWait\r
+ 3A39:9B85       _loadedgame\r
+ 3A39:9B87       _tedlevelnum\r
+ 3A39:9B89       _tedlevel\r
+ 3A39:9B8B       _DigiMap\r
+ 3A39:9C39       _MusicMode\r
+ 3A39:9C3B       _DigiMode\r
+ 3A39:9C3D       _SoundMode\r
+ 3A39:9C3F       _SoundBlasterPresent\r
+ 3A39:9C41       _SoundSourcePresent\r
+ 3A39:9C43       _AdLibPresent\r
+ 3A39:9C45       _JoysPresent\r
+ 3A39:9C49       _MousePresent\r
+ 3A39:9C4B       _Keyboard\r
+ 3A39:9D4B       _fontnumber\r
+ 3A39:9D4D       _fontcolor\r
+ 3A39:9D4E       _displayofs\r
+ 3A39:9D50       _grsegs\r
+ 3A39:9E7A       _mminfo\r
+ 3A39:9E8E       _layoutdone\r
+ 3A39:9E90       _picdelay\r
+ 3A39:9E92       _picnum\r
+ 3A39:9E94       _picy\r
+ 3A39:9E96       _picx\r
+ 3A39:9E98       _rowon\r
+ 3A39:9E9A       _text\r
+ 3A39:9E9E       _rightmargin\r
+ 3A39:9EBC       _leftmargin\r
+ 3A39:9EDA       _numpages\r
+ 3A39:9EDC       _pagenum\r
+ 3A39:9EDE       _TimeCount\r
+ 3A39:9EE2       _LastScan\r
+ 3A39:9EE3       _py\r
+ 3A39:9EE5       _px\r
+ 3A39:9EE7       _pictable\r
+ 3A39:9EE9       _ca_levelbit\r
+ 3A39:9EEA       _pickquick\r
+ 3A39:9EEC       _lasttimecount\r
+ 3A39:9EF0       _SaveGameNames\r
+ 3A39:A030       _StartGame\r
+ 3A39:A032       _SaveGamesAvail\r
+ 3A39:A046       _WindowH\r
+ 3A39:A048       _PrintX\r
+ 3A39:A04A       _ingame\r
+ 3A39:A04C       _LastASCII\r
+ 3A39:A04D       _Paused\r
+ 3A39:A04F       _extension\r
+ 3A39:A054       _audiosegs\r
+ 3A39:A294       _EMSPagesAvail\r
+ 3A39:A296       _XMSPagesAvail\r
+ 3A39:A298       _EMSPresent\r
+ 3A39:A29A       _XMSPresent\r
+ 3A39:A29C       _mmerror\r
+ 3A39:A29E       _mapon\r
+ 3A39:A2A0       _rightchannel\r
+ 3A39:A2A2       _leftchannel\r
+ 3A39:A2A4       _globalsoundy\r
+ 3A39:A2A8       _globalsoundx\r
+ 3A39:A2AC       _demobuffer\r
+ 3A39:A2AE       _lastdemoptr\r
+ 3A39:A2B2       _demoptr\r
+ 3A39:A2B6       _demoplayback\r
+ 3A39:A2B8       _demorecord\r
+ 3A39:A2BA       _killerobj\r
+ 3A39:A2BC       _spearflag\r
+ 3A39:A2BE       _spearangle\r
+ 3A39:A2C0       _speary\r
+ 3A39:A2C4       _spearx\r
+ 3A39:A2C8       _fizzlein\r
+ 3A39:A2CA       _tics\r
+ 3A39:A2CC       _mapheight\r
+ 3A39:A2CE       _mapwidth\r
+ 3A39:A2D0       _SoundPositioned\r
+ 3A39:A2D2       _latchpics\r
+ 3A39:A39A       _mapheaderseg\r
+ 3A39:A412       _mapsegs\r
+ 3A39:A416       _funnyticount\r
+ 3A39:A41A       _palshifted\r
+ 3A39:A41C       _bonuscount\r
+ 3A39:A41E       _damagecount\r
+ 3A39:A420       _objcount\r
+ 3A39:A422       _dummyobj\r
+ 3A39:A45E       _mapwidthtable\r
+ 3A39:A4DE       _DebugOk\r
+ 3A39:A4E0       _facecount\r
+ 3A39:A4E2       _anglefrac\r
+ 3A39:A4E4       _running\r
+ 3A39:A4E6       _frameon\r
+ 3A39:A4EA       _buttonstate\r
+ 3A39:A4FA       _controly\r
+ 3A39:A4FC       _controlx\r
+ 3A39:A4FE       _buttonheld\r
+ 3A39:A50E       _extravbls\r
+ 3A39:A510       _noclip\r
+ 3A39:A512       _godmode\r
+ 3A39:A514       _singlestep\r
+ 3A39:A516       _spotvis\r
+ 3A39:B516       _objfreelist\r
+ 3A39:B518       _lastobj\r
+ 3A39:B51A       _obj\r
+ 3A39:B51C       _objlist\r
+ 3A39:D844       _madenoise\r
+ 3A39:D846       _compatability\r
+ 3A39:D848       _screenfaded\r
+ 3A39:D84A       _DigiList\r
+ 3A39:D84C       _NumDigi\r
+ 3A39:D84E       _viewtype\r
+ 3A39:D850       _maporgy\r
+ 3A39:D852       _maporgx\r
+ 3A39:D854       _postwidth\r
+ 3A39:D856       _postx\r
+ 3A39:D858       _postsource\r
+ 3A39:D85C       _doornum\r
+ 3A39:D85E       _PMPages\r
+ 3A39:D862       _PMSoundStart\r
+ 3A39:D864       _PMSpriteStart\r
+ 3A39:D866       _ChunksInFile\r
+ 3A39:D868       _farthest\r
+ 3A39:D86A       _visstep\r
+ 3A39:D86C       _visptr\r
+ 3A39:D86E       _vislist\r
+ 3A39:D99A       _ystep\r
+ 3A39:D99E       _xstep\r
+ 3A39:D9A2       _yintercept\r
+ 3A39:D9A6       _xintercept\r
+ 3A39:D9AA       _ytilestep\r
+ 3A39:D9AC       _xtilestep\r
+ 3A39:D9AE       _ytile\r
+ 3A39:D9B0       _xtile\r
+ 3A39:D9B2       _pixx\r
+ 3A39:D9B4       _tilehit\r
+ 3A39:D9B6       _yinttile\r
+ 3A39:D9B8       _xinttile\r
+ 3A39:D9BA       _ypartialdown\r
+ 3A39:D9BC       _ypartialup\r
+ 3A39:D9BE       _xpartialdown\r
+ 3A39:D9C0       _xpartialup\r
+ 3A39:D9C2       _ypartial\r
+ 3A39:D9C4       _xpartial\r
+ 3A39:D9C6       _angle\r
+ 3A39:D9C8       _midangle\r
+ 3A39:D9CA       _viewty\r
+ 3A39:D9CC       _viewtx\r
+ 3A39:D9CE       _focalty\r
+ 3A39:D9D0       _focaltx\r
+ 3A39:D9D2       _lasttilehit\r
+ 3A39:D9D4       _lastintercept\r
+ 3A39:D9D8       _lastside\r
+ 3A39:D9DA       _maxscaleshl2\r
+ 3A39:D9DC       _fullscalefarcall\r
+ 3A39:DDE0       _viewangle\r
+ 3A39:DDE2       _mask3\r
+ 3A39:DDE3       _mask2\r
+ 3A39:DDE4       _mask1\r
+ 3A39:DDE5       _maskword\r
+ 3A39:DDE7       _linescale\r
+ 3A39:DDEB       _linecmds\r
+ 3A39:DDEF       _slinewidth\r
+ 3A39:DDF1       _slinex\r
+ 3A39:DDF3       _stepbytwo\r
+ 3A39:DDF5       _work\r
+ 3A39:DDF7       _insetupscaling\r
+ 3A39:DDF9       _maxscale\r
+ 3A39:DDFB       _scaledirectory\r
+ 3A39:DFFD       _pluy\r
+ 3A39:DFFF       _plux\r
+ 3A39:E001       _playerymove\r
+ 3A39:E005       _playerxmove\r
+ 3A39:E009       _LastAttacker\r
+ 3A39:E00B       _gotgatgun\r
+ 3A39:E00D       _thrustspeed\r
+ 3A39:E011       _lastdoorobj\r
+ 3A39:E013       _oldsoundmode\r
+ 3A39:E015       _chunkexplen\r
+ 3A39:E019       _chunkcomplen\r
+ 3A39:E01D       _audiohandle\r
+ 3A39:E01F       _maphandle\r
+ 3A39:E021       _grhandle\r
+ 3A39:E023       _audiohuffman\r
+ 3A39:E41F       _grhuffman\r
+ 3A39:E81B       _audiostarts\r
+ 3A39:E81D       _grstarts\r
+ 3A39:E81F       _debughandle\r
+ 3A39:E821       _profilehandle\r
+ 3A39:E823       _ca_levelnum\r
+ 3A39:E824       _tinf\r
+ 3A39:E826       _bufferseg\r
+ 3A39:E828       _btnstate\r
+ 3A39:E838       _MouseDownCount\r
+ 3A39:E83C       _JoyPadPresent\r
+ 3A39:E83E       _DemoSize\r
+ 3A39:E840       _DemoOffset\r
+ 3A39:E842       _DemoBuffer\r
+ 3A39:E844       _Controls\r
+ 3A39:E84C       _JoyDefs\r
+ 3A39:E87C       _UMBbase\r
+ 3A39:E890       _numUMBs\r
+ 3A39:E892       _XMSaddr\r
+ 3A39:E896       _bombonerror\r
+ 3A39:E898       _mmnew\r
+ 3A39:E89C       _mmrover\r
+ 3A39:E8A0       _mmfree\r
+ 3A39:E8A4       _mmhead\r
+ 3A39:E8A8       _nearheap\r
+ 3A39:E8AA       _farheap\r
+ 3A39:E8AE       _mmstarted\r
+ 3A39:E8B0       _aftersort\r
+ 3A39:E8B4       _beforesort\r
+ 3A39:E8B8       _PMSegPages\r
+ 3A39:E8BA       _PMFrameCount\r
+ 3A39:E8BE       _PMNumBlocks\r
+ 3A39:E8C0       _MainPagesUsed\r
+ 3A39:E8C2       _EMSPagesUsed\r
+ 3A39:E8C4       _XMSPagesUsed\r
+ 3A39:E8C6       _PMThrashing\r
+ 3A39:E8C8       _PMPanicMode\r
+ 3A39:E8CA       _PMStarted\r
+ 3A39:E8CC       _XMSDriver\r
+ 3A39:E8D0       _XMSHandle\r
+ 3A39:E8D2       _XMSAvail\r
+ 3A39:E8D4       _EMSList\r
+ 3A39:E8EC       _EMSPhysicalPage\r
+ 3A39:E8EE       _EMSPageFrame\r
+ 3A39:E8F0       _EMSHandle\r
+ 3A39:E8F2       _EMSAvail\r
+ 3A39:E8F4       _MainPagesAvail\r
+ 3A39:E8F6       _MainMemUsed\r
+ 3A39:E9BE       _MainMemPages\r
+ 3A39:EA86       _MainPresent\r
+ 3A39:EA88       _sqHackTime\r
+ 3A39:EA8C       _sqHackSeqLen\r
+ 3A39:EA8E       _sqHackLen\r
+ 3A39:EA90       _sqHackPtr\r
+ 3A39:EA94       _sqHack\r
+ 3A39:EA98       _sqActive\r
+ 3A39:EA9A       _alZeroInst\r
+ 3A39:EAAA       _alTimeCount\r
+ 3A39:EAAE       _alLengthLeft\r
+ 3A39:EAB2       _alBlock\r
+ 3A39:EAB4       _alSound\r
+ 3A39:EAB8       _alNoCheck\r
+ 3A39:EABA       _pcSoundLookup\r
+ 3A39:ECB8       _pcLengthLeft\r
+ 3A39:ECBC       _pcSound\r
+ 3A39:ECC0       _pcLastSample\r
+ 3A39:ECC1       _ssLengthLeft\r
+ 3A39:ECC5       _ssSample\r
+ 3A39:ECC9       _ssOff\r
+ 3A39:ECCA       _ssOn\r
+ 3A39:ECCB       _ssData\r
+ 3A39:ECCD       _ssStatus\r
+ 3A39:ECCF       _ssControl\r
+ 3A39:ECD1       _ssActive\r
+ 3A39:ECD3       _ssNoCheck\r
+ 3A39:ECD5       _DigiLastEnd\r
+ 3A39:ECD7       _DigiLastStart\r
+ 3A39:ECD9       _DigiPage\r
+ 3A39:ECDB       _DigiLeft\r
+ 3A39:ECDD       _TimerRate\r
+ 3A39:ECDF       _LocalTime\r
+ 3A39:ECE3       _t0OldService\r
+ 3A39:ECE7       _RightPosition\r
+ 3A39:ECE9       _LeftPosition\r
+ 3A39:ECEB       _DigiPriority\r
+ 3A39:ECED       _SoundPriority\r
+ 3A39:ECEF       _DigiNumber\r
+ 3A39:ECF1       _SoundNumber\r
+ 3A39:ECF3       _TimerCount\r
+ 3A39:ECF7       _TimerDivisor\r
+ 3A39:ECFB       _nextsoundpos\r
+ 3A39:ECFD       _ssIsTandy\r
+ 3A39:ECFF       _SoundTable\r
+ 3A39:ED01       _HackCount\r
+ 3A39:ED03       _NeedsDigitized\r
+ 3A39:ED05       _SBProPresent\r
+ 3A39:ED07       _DigiPlaying\r
+ 3A39:ED09       _NeedsMusic\r
+ 3A39:ED0B       _Games\r
+ 3A39:EE07       _CursorY\r
+ 3A39:EE09       _CursorX\r
+ 3A39:EE0B       _CursorBad\r
+ 3A39:EE0D       _Button1\r
+ 3A39:EE0F       _Button0\r
+ 3A39:EE11       _abortprogram\r
+ 3A39:EE13       _fastpalette\r
+ 3A39:EE15       _bordercolor\r
+ 3A39:EE17       _ylookup\r
+ 3A39:EFA7       _linewidth\r
+ 3A39:EFA9       _pelpan\r
+ 3A39:EFAB       _bufferheight\r
+ 3A39:EFAD       _bufferwidth\r
+\r
+Program entry point at 0000:0000\r
+\r
diff --git a/16/wf3d8086/wolf3d.prj b/16/wf3d8086/wolf3d.prj
new file mode 100755 (executable)
index 0000000..7a80b86
Binary files /dev/null and b/16/wf3d8086/wolf3d.prj differ
diff --git a/16/wf3d8086/wolfgtv.h b/16/wf3d8086/wolfgtv.h
new file mode 100755 (executable)
index 0000000..05abb0e
--- /dev/null
@@ -0,0 +1,10 @@
+//#define SPEAR\r
+//#define JAPAN\r
+#define GOODTIMES\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+#define CARMACIZED\r
+//#define UPLOAD\r
+\1a
\ No newline at end of file
diff --git a/16/wf3d8086/wolfhack.c b/16/wf3d8086/wolfhack.c
new file mode 100755 (executable)
index 0000000..343d3b9
--- /dev/null
@@ -0,0 +1,186 @@
+// WOLFHACK.C\r
+\r
+#include "WL_DEF.H"\r
+\r
+#define        MAXVIEWHEIGHT   200\r
+\r
+int            spanstart[MAXVIEWHEIGHT/2];\r
+\r
+fixed  stepscale[MAXVIEWHEIGHT/2];\r
+fixed  basedist[MAXVIEWHEIGHT/2];\r
+\r
+extern char    far     planepics[8192];        // 4k of ceiling, 4k of floor\r
+\r
+int            halfheight = 0;\r
+\r
+byte   far *planeylookup[MAXVIEWHEIGHT/2];\r
+unsigned       mirrorofs[MAXVIEWHEIGHT/2];\r
+\r
+fixed  psin, pcos;\r
+\r
+fixed FixedMul (fixed a, fixed b)\r
+{\r
+       return (a>>8)*(b>>8);\r
+}\r
+\r
+\r
+int            mr_rowofs;\r
+int            mr_count;\r
+int            mr_xstep;\r
+int            mr_ystep;\r
+int            mr_xfrac;\r
+int            mr_yfrac;\r
+int            mr_dest;\r
+\r
+\r
+/*\r
+==============\r
+=\r
+= DrawSpans\r
+=\r
+= Height ranges from 0 (infinity) to viewheight/2 (nearest)\r
+==============\r
+*/\r
+\r
+void DrawSpans (int x1, int x2, int height)\r
+{\r
+       fixed           length;\r
+       int                     ofs;\r
+       int                     prestep;\r
+       fixed           startxfrac, startyfrac;\r
+\r
+       int                     x, startx, count, plane, startplane;\r
+       byte            far     *toprow, far *dest;\r
+\r
+       toprow = planeylookup[height]+bufferofs;\r
+       mr_rowofs = mirrorofs[height];\r
+\r
+       mr_xstep = (psin<<1)/height;\r
+       mr_ystep = (pcos<<1)/height;\r
+\r
+       length = basedist[height];\r
+       startxfrac = (viewx + FixedMul(length,pcos));\r
+       startyfrac = (viewy - FixedMul(length,psin));\r
+\r
+// draw two spans simultaniously\r
+\r
+       plane = startplane = x1&3;\r
+       prestep = viewwidth/2 - x1;\r
+       do\r
+       {\r
+               outportb (SC_INDEX+1,1<<plane);\r
+               mr_xfrac = startxfrac - (mr_xstep>>2)*prestep;\r
+               mr_yfrac = startyfrac - (mr_ystep>>2)*prestep;\r
+\r
+               startx = x1>>2;\r
+               mr_dest = (unsigned)toprow + startx;\r
+               mr_count = ((x2-plane)>>2) - startx + 1;\r
+               x1++;\r
+               prestep--;\r
+               if (mr_count)\r
+                       MapRow ();\r
+               plane = (plane+1)&3;\r
+       } while (plane != startplane);\r
+\r
+}\r
+\r
+\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= SetPlaneViewSize\r
+=\r
+===================\r
+*/\r
+\r
+void SetPlaneViewSize (void)\r
+{\r
+       int             x,y;\r
+       byte    far *dest, far *src;\r
+\r
+       halfheight = viewheight>>1;\r
+\r
+\r
+       for (y=0 ; y<halfheight ; y++)\r
+       {\r
+               planeylookup[y] = (byte far *)0xa0000000l + (halfheight-1-y)*SCREENBWIDE;;\r
+               mirrorofs[y] = (y*2+1)*SCREENBWIDE;\r
+\r
+               stepscale[y] = y*GLOBAL1/32;\r
+               if (y>0)\r
+                       basedist[y] = GLOBAL1/2*scale/y;\r
+       }\r
+\r
+       src = PM_GetPage(0);\r
+       dest = planepics;\r
+       for (x=0 ; x<4096 ; x++)\r
+       {\r
+               *dest = *src++;\r
+               dest += 2;\r
+       }\r
+       src = PM_GetPage(1);\r
+       dest = planepics+1;\r
+       for (x=0 ; x<4096 ; x++)\r
+       {\r
+               *dest = *src++;\r
+               dest += 2;\r
+       }\r
+\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= DrawPlanes\r
+=\r
+===================\r
+*/\r
+\r
+void DrawPlanes (void)\r
+{\r
+       int             height, lastheight;\r
+       int             x;\r
+\r
+       if (viewheight>>1 != halfheight)\r
+               SetPlaneViewSize ();            // screen size has changed\r
+\r
+\r
+       psin = viewsin;\r
+       if (psin < 0)\r
+               psin = -(psin&0xffff);\r
+       pcos = viewcos;\r
+       if (pcos < 0)\r
+               pcos = -(pcos&0xffff);\r
+\r
+//\r
+// loop over all columns\r
+//\r
+       lastheight = halfheight;\r
+\r
+       for (x=0 ; x<viewwidth ; x++)\r
+       {\r
+               height = wallheight[x]>>3;\r
+               if (height < lastheight)\r
+               {       // more starts\r
+                       do\r
+                       {\r
+                               spanstart[--lastheight] = x;\r
+                       } while (lastheight > height);\r
+               }\r
+               else if (height > lastheight)\r
+               {       // draw spans\r
+                       if (height > halfheight)\r
+                               height = halfheight;\r
+                       for ( ; lastheight < height ; lastheight++)\r
+                               DrawSpans (spanstart[lastheight], x-1, lastheight);\r
+               }\r
+       }\r
+\r
+       height = halfheight;\r
+       for ( ; lastheight < height ; lastheight++)\r
+               DrawSpans (spanstart[lastheight], x-1, lastheight);\r
+}\r
+\r
diff --git a/16/wf3d8086/wolfjver.h b/16/wf3d8086/wolfjver.h
new file mode 100755 (executable)
index 0000000..c5510ba
--- /dev/null
@@ -0,0 +1,8 @@
+//#define SPEAR\r
+#define JAPAN\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+#define CARMACIZED\r
+//#define UPLOAD\r
diff --git a/16/wf3d8086/wolfver.h b/16/wf3d8086/wolfver.h
new file mode 100755 (executable)
index 0000000..1208b35
--- /dev/null
@@ -0,0 +1,7 @@
+//#define SPEAR\r
+#define ARTSEXTERN\r
+#define DEMOSEXTERN\r
+//#define MYPROFILE\r
+//#define DEBCHECK\r
+#define CARMACIZED\r
+//#define UPLOAD\r