shithub: nanobsp

Download patch

ref: fbd46067bd0aa9c6b11cd1955605195f06471594
parent: 12ec4ff80c88fd9698bf0d9b4271c903ecb38b33
author: qwx <qwx@sciops.net>
date: Mon Feb 16 17:47:19 EST 2026

npe port

--- a/d_loop.h
+++ b/d_loop.h
@@ -32,7 +32,7 @@
 {
     // Read events from the event queue, and process them.
 
-    void (*ProcessEvents)();
+    void (*ProcessEvents)(void);
 
     // Given the current input state, fill in the fields of the specified
     // ticcmd_t structure with data for a new tic.
@@ -45,7 +45,7 @@
 
     // Run the menu (runs independently of the game).
 
-    void (*RunMenu)();
+    void (*RunMenu)(void);
 } loop_interface_t;
 
 // Register callback functions for the main loop code to use.
--- a/d_think.h
+++ b/d_think.h
@@ -22,10 +22,6 @@
 #ifndef __D_THINK__
 #define __D_THINK__
 
-
-
-
-
 //
 // Experimental stuff.
 // To compile this as "ANSI C with classes"
@@ -32,20 +28,17 @@
 //  we will need to handle the various
 //  action functions cleanly.
 //
-typedef  void (*actionf_v)();
-typedef  void (*actionf_p1)( void* );
-typedef  void (*actionf_p2)( void*, void* );
+typedef  void (*actionf_v)(void);
+typedef  void (*actionf_p1)( struct mobj_s* );
+typedef  void (*actionf_p2)( struct player_s*, struct pspdef_s* );
 
 typedef union
 {
-  actionf_v	acv;
   actionf_p1	acp1;
   actionf_p2	acp2;
+  actionf_v	acv;
 
 } actionf_t;
-
-
-
 
 
 // Historically, "think_t" is yet another
--- a/doomdata.h
+++ b/doomdata.h
@@ -54,15 +54,17 @@
 
 
 // A single Vertex.
+#pragma pack on
 typedef PACKED_STRUCT (
 {
   short		x;
   short		y;
 }) mapvertex_t;
+#pragma pack off
 
-
 // A SideDef, defining the visual appearance of a wall,
 // by setting textures and offsets.
+#pragma pack on
 typedef PACKED_STRUCT (
 {
   short		textureoffset;
@@ -73,11 +75,12 @@
   // Front sector, towards viewer.
   short		sector;
 }) mapsidedef_t;
+#pragma pack off
 
 
-
 // A LineDef, as used for editing, and as input
 // to the BSP builder.
+#pragma pack on
 typedef PACKED_STRUCT (
 {
   short		v1;
@@ -88,8 +91,8 @@
   // sidenum[1] will be -1 if one sided
   short		sidenum[2];		
 }) maplinedef_t;
+#pragma pack off
 
-
 //
 // LineDef attributes.
 //
@@ -135,6 +138,7 @@
 
 
 // Sector definition, from editing.
+#pragma pack on
 typedef	PACKED_STRUCT (
 {
   short		floorheight;
@@ -145,8 +149,10 @@
   short		special;
   short		tag;
 }) mapsector_t;
+#pragma pack off
 
 // SubSector, as generated by BSP.
+#pragma pack on
 typedef PACKED_STRUCT (
 {
   short		numsegs;
@@ -153,10 +159,11 @@
   // Index of first one, segs are stored sequentially.
   short		firstseg;	
 }) mapsubsector_t;
+#pragma pack off
 
-
 // LineSeg, generated by splitting LineDefs
 // using partition lines selected by BSP builder.
+#pragma pack on
 typedef PACKED_STRUCT (
 {
   short		v1;
@@ -166,14 +173,15 @@
   short		side;
   short		offset;
 }) mapseg_t;
+#pragma pack off
 
 
-
 // BSP node structure.
 
 // Indicate a leaf.
 #define	NF_SUBSECTOR	0x8000
 
+#pragma pack on
 typedef PACKED_STRUCT (
 {
   // Partition line from (x,y) to x+dx,y+dy)
@@ -191,6 +199,7 @@
   unsigned short	children[2];
 
 }) mapnode_t;
+#pragma pack off
 
 
 
@@ -197,6 +206,7 @@
 
 // Thing definition, position, orientation and type,
 // plus skill/visibility flags and attributes.
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     short		x;
@@ -205,7 +215,7 @@
     short		type;
     short		options;
 }) mapthing_t;
-
+#pragma pack off
 
 
 
--- a/doomdef.h
+++ b/doomdef.h
@@ -161,4 +161,11 @@
     
 } powerduration_t;
 
+typedef struct mobj_s mobj_t;
+typedef struct player_s player_t;
+typedef struct pspdef_s pspdef_t;
+#pragma incomplete mobj_t;
+#pragma incomplete player_t;
+#pragma incomplete pspdef_t;
+
 #endif          // __DOOMDEF__
--- a/i_input.c
+++ b/i_input.c
@@ -17,8 +17,8 @@
 //
 
 
-#include "SDL.h"
-#include "SDL_keycode.h"
+#include "SDL2/SDL.h"
+#include "SDL2/SDL_keycode.h"
 
 #include "doomkeys.h"
 #include "doomtype.h"
--- a/i_main.c
+++ b/i_main.c
@@ -20,7 +20,7 @@
 
 #include <stdio.h>
 
-#include "SDL.h"
+#include "SDL2/SDL.h"
 
 #include "doomtype.h"
 #include "i_system.h"
--- a/i_oplmusic.c
+++ b/i_oplmusic.c
@@ -43,6 +43,7 @@
 
 #define PERCUSSION_LOG_LEN 16
 
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     byte tremolo;
@@ -52,7 +53,9 @@
     byte scale;
     byte level;
 }) genmidi_op_t;
+#pragma pack off
 
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     genmidi_op_t modulator;
@@ -61,7 +64,9 @@
     byte unused;
     short base_note_offset;
 }) genmidi_voice_t;
+#pragma pack off
 
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     unsigned short flags;
@@ -70,6 +75,7 @@
 
     genmidi_voice_t voices[2];
 }) genmidi_instr_t;
+#pragma pack off
 
 // Data associated with a channel of a track that is currently playing.
 
--- a/i_png.c
+++ b/i_png.c
@@ -120,7 +120,7 @@
 }
 
 
-static void Write_Line (const pixel_t * pix, int width, _Bool is_last)
+static void Write_Line (const pixel_t * pix, int width, int is_last)
 {
 	// deflate header (3 bits)
 	Chunk_Byte (is_last ? 0x01 : 0x00);
--- a/i_sdlsound.c
+++ b/i_sdlsound.c
@@ -24,8 +24,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
-#include "SDL.h"
-#include "SDL_mixer.h"
+#include "SDL2/SDL.h"
+#include "SDL2/SDL_mixer.h"
 
 #include "deh_str.h"
 #include "i_sound.h"
--- a/i_sound.c
+++ b/i_sound.c
@@ -18,7 +18,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "SDL_mixer.h"
+#include "SDL2/SDL.h"
+#include "SDL2/SDL_mixer.h"
 
 #include "config.h"
 #include "doomtype.h"
--- a/i_sound.h
+++ b/i_sound.h
@@ -135,6 +135,7 @@
 boolean I_SoundIsPlaying(int channel);
 
 typedef struct allocated_sound_s allocated_sound_t;
+#pragma incomplete allocated_sound_t
 
 allocated_sound_t * I_FindAllocatedSound  (sfxinfo_t *sfx);
 allocated_sound_t * I_CreateAllocatedSound(sfxinfo_t *sfx, byte *data, int length);
--- a/i_system.c
+++ b/i_system.c
@@ -34,7 +34,8 @@
 #include <sys/types.h>
 #endif
 
-#include "SDL.h"
+#include "SDL2/SDL.h"
+#include "SDL2/SDL_endian.h"
 
 #include "config.h"
 
--- a/i_timer.c
+++ b/i_timer.c
@@ -16,7 +16,7 @@
 //      Timer functions.
 //
 
-#include "SDL.h"
+#include "SDL2/SDL.h"
 
 #include "i_timer.h"
 #include "doomtype.h"
--- a/i_video.c
+++ b/i_video.c
@@ -16,9 +16,9 @@
 //	DOOM graphics stuff for SDL.
 //
 
-#define _XOPEN_SOURCE 1  // for putenv()
+//#define _XOPEN_SOURCE 1  // for putenv()
 
-#include "SDL.h"
+#include "SDL2/SDL.h"
 
 #ifdef _WIN32
 #ifndef WIN32_LEAN_AND_MEAN
@@ -174,7 +174,7 @@
 // not used
 unsigned int joywait = 0;
 
-static boolean MouseShouldBeGrabbed()
+static boolean MouseShouldBeGrabbed(void)
 {
     // if the window doesn't have focus, never grab it
 
@@ -983,9 +983,10 @@
     {
         char *env_string;
 
-        env_string = M_StringJoin("SDL_VIDEODRIVER=", video_driver, NULL);
-        putenv(env_string);
-        free(env_string);
+        //env_string = M_StringJoin("SDL_VIDEODRIVER=", video_driver, NULL);
+        //putenv(env_string);
+        putenv("SDL_VIDEODRIVER", video_driver);
+        //free(env_string);
     }
 }
 
@@ -1158,9 +1159,9 @@
 
     // Force integer scales for resolution-independent rendering.
 
-#if SDL_VERSION_ATLEAST(2, 0, 5)
+//#if SDL_VERSION_ATLEAST(2, 0, 5)
     SDL_RenderSetIntegerScale(renderer, integer_scaling);
-#endif
+//#endif
 
     // Blank out the full screen area in case there is any junk in
     // the borders that won't otherwise be overwritten.
--- a/info.c
+++ b/info.c
@@ -47,107 +47,106 @@
 };
 
 
-// Doesn't work with g++, needs actionf_p1
-void  A_Light0();
-void A_WeaponReady();
-void A_Lower();
-void A_Raise();
-void A_Punch();
-void A_ReFire();
-void A_FirePistol();
-void A_Light1();
-void A_FireShotgun();
-void A_Light2();
-void A_FireShotgun2();
-void A_CheckReload();
-void A_OpenShotgun2();
-void A_LoadShotgun2();
-void A_CloseShotgun2();
-void A_FireCGun();
-void A_GunFlash();
-void A_FireMissile();
-void A_Saw();
-void A_FirePlasma();
-void A_BFGsound();
-void A_FireBFG();
-void A_BFGSpray();
-void A_Explode();
-void A_Pain();
-void A_PlayerScream();
-void A_Fall();
-void A_XScream();
-void A_Look();
-void A_Chase();
-void A_FaceTarget();
-void A_PosAttack();
-void A_Scream();
-void A_SPosAttack();
-void A_VileChase();
-void A_VileStart();
-void A_VileTarget();
-void A_VileAttack();
-void A_StartFire();
-void A_Fire();
-void A_FireCrackle();
-void A_Tracer();
-void A_SkelWhoosh();
-void A_SkelFist();
-void A_SkelMissile();
-void A_FatRaise();
-void A_FatAttack1();
-void A_FatAttack2();
-void A_FatAttack3();
-void A_BossDeath();
-void A_CPosAttack();
-void A_CPosRefire();
-void A_TroopAttack();
-void A_SargAttack();
-void A_HeadAttack();
-void A_BruisAttack();
-void A_SkullAttack();
-void A_Metal();
-void A_SpidRefire();
-void A_BabyMetal();
-void A_BspiAttack();
-void A_Hoof();
-void A_CyberAttack();
-void A_PainAttack();
-void A_PainDie();
-void A_KeenDie();
-void A_BrainPain();
-void A_BrainScream();
-void A_BrainDie();
-void A_BrainAwake();
-void A_BrainSpit();
-void A_SpawnSound();
-void A_SpawnFly();
-void A_BrainExplode();
+void A_BFGSpray(mobj_t*);
+void A_BFGsound(struct player_s*, struct pspdef_s*);
+void A_BabyMetal(struct mobj_s*);
+void A_BossDeath(struct mobj_s*);
+void A_BrainAwake(struct mobj_s*);
+void A_BrainDie(struct mobj_s*);
+void A_BrainExplode(struct mobj_s*);
+void A_BrainPain(struct mobj_s*);
+void A_BrainScream(struct mobj_s*);
+void A_BrainSpit(struct mobj_s*);
+void A_BruisAttack(struct mobj_s*);
+void A_BspiAttack(struct mobj_s*);
+void A_CPosAttack(struct mobj_s*);
+void A_CPosRefire(struct mobj_s*);
+void A_Chase(struct mobj_s*);
+void A_CheckReload(struct player_s*, struct pspdef_s*);
+void A_CloseShotgun2(struct player_s*, struct pspdef_s*);
+void A_CyberAttack(struct mobj_s*);
+void A_Explode(struct mobj_s*);
+void A_FaceTarget(struct mobj_s*);
+void A_Fall(struct mobj_s*);
+void A_FatAttack1(struct mobj_s*);
+void A_FatAttack2(struct mobj_s*);
+void A_FatAttack3(struct mobj_s*);
+void A_FatRaise(struct mobj_s*);
+void A_Fire(struct mobj_s*);
+void A_FireBFG(struct player_s*, struct pspdef_s*);
+void A_FireCGun(struct player_s*, struct pspdef_s*);
+void A_FireCrackle(struct mobj_s*);
+void A_FireMissile(struct player_s*, struct pspdef_s*);
+void A_FirePistol(struct player_s*, struct pspdef_s*);
+void A_FirePlasma(struct player_s*, struct pspdef_s*);
+void A_FireShotgun(struct player_s*, struct pspdef_s*);
+void A_FireShotgun2(struct player_s*, struct pspdef_s*);
+void A_GunFlash(struct player_s*, struct pspdef_s*);
+void A_HeadAttack(struct mobj_s*);
+void A_Hoof(struct mobj_s*);
+void A_KeenDie(struct mobj_s*);
+void A_Light0(struct player_s*, struct pspdef_s*);
+void A_Light1(struct player_s*, struct pspdef_s*);
+void A_Light2(struct player_s*, struct pspdef_s*);
+void A_LoadShotgun2(struct player_s*, struct pspdef_s*);
+void A_Look(struct mobj_s*);
+void A_Lower(struct player_s*, struct pspdef_s*);
+void A_Metal(struct mobj_s*);
+void A_OpenShotgun2(struct player_s*, struct pspdef_s*);
+void A_Pain(struct mobj_s*);
+void A_PainAttack(struct mobj_s*);
+void A_PainDie(struct mobj_s*);
+void A_PlayerScream(struct mobj_s*);
+void A_PosAttack(struct mobj_s*);
+void A_Punch(struct player_s*, struct pspdef_s*);
+void A_Raise(struct player_s*, struct pspdef_s*);
+void A_ReFire(struct player_s*, struct pspdef_s*);
+void A_SPosAttack(struct mobj_s*);
+void A_SargAttack(struct mobj_s*);
+void A_Saw(struct player_s*, struct pspdef_s*);
+void A_Scream(struct mobj_s*);
+void A_SkelFist(struct mobj_s*);
+void A_SkelMissile(struct mobj_s*);
+void A_SkelWhoosh(struct mobj_s*);
+void A_SkullAttack(struct mobj_s*);
+void A_SpawnFly(struct mobj_s*);
+void A_SpawnSound(struct mobj_s*);
+void A_SpidRefire(struct mobj_s*);
+void A_StartFire(struct mobj_s*);
+void A_Tracer(struct mobj_s*);
+void A_TroopAttack(struct mobj_s*);
+void A_VileAttack(struct mobj_s*);
+void A_VileChase(struct mobj_s*);
+void A_VileStart(struct mobj_s*);
+void A_VileTarget(struct mobj_s*);
+void A_WeaponReady(struct player_s*, struct pspdef_s*);
+void A_XScream(struct mobj_s*);
 
 
 state_t	states[NUMSTATES] = {
     {SPR_TROO,0,-1,{NULL},S_NULL,0,0},	// S_NULL
-    {SPR_SHTG,4,0,{A_Light0},S_NULL,0,0},	// S_LIGHTDONE
-    {SPR_PUNG,0,1,{A_WeaponReady},S_PUNCH,0,0},	// S_PUNCH
-    {SPR_PUNG,0,1,{A_Lower},S_PUNCHDOWN,0,0},	// S_PUNCHDOWN
-    {SPR_PUNG,0,1,{A_Raise},S_PUNCHUP,0,0},	// S_PUNCHUP
+    {SPR_SHTG,4,0,{.acp2 A_Light0},S_NULL,0,0},	// S_LIGHTDONE
+    {SPR_PUNG,0,1,{.acp2 A_WeaponReady},S_PUNCH,0,0},	// S_PUNCH
+    {SPR_PUNG,0,1,{.acp2 A_Lower},S_PUNCHDOWN,0,0},	// S_PUNCHDOWN
+    {SPR_PUNG,0,1,{.acp2 A_Raise},S_PUNCHUP,0,0},	// S_PUNCHUP
     {SPR_PUNG,1,4,{NULL},S_PUNCH2,0,0},		// S_PUNCH1
-    {SPR_PUNG,2,4,{A_Punch},S_PUNCH3,0,0},	// S_PUNCH2
+    {SPR_PUNG,2,4,{.acp2 A_Punch},S_PUNCH3,0,0},	// S_PUNCH2
     {SPR_PUNG,3,5,{NULL},S_PUNCH4,0,0},		// S_PUNCH3
     {SPR_PUNG,2,4,{NULL},S_PUNCH5,0,0},		// S_PUNCH4
-    {SPR_PUNG,1,5,{A_ReFire},S_PUNCH,0,0},	// S_PUNCH5
-    {SPR_PISG,0,1,{A_WeaponReady},S_PISTOL,0,0},// S_PISTOL
-    {SPR_PISG,0,1,{A_Lower},S_PISTOLDOWN,0,0},	// S_PISTOLDOWN
-    {SPR_PISG,0,1,{A_Raise},S_PISTOLUP,0,0},	// S_PISTOLUP
+    {SPR_PUNG,1,5,{.acp2 A_ReFire},S_PUNCH,0,0},	// S_PUNCH5
+    {SPR_PISG,0,1,{.acp2 A_WeaponReady},S_PISTOL,0,0},// S_PISTOL
+    {SPR_PISG,0,1,{.acp2 A_Lower},S_PISTOLDOWN,0,0},	// S_PISTOLDOWN
+    {SPR_PISG,0,1,{.acp2 A_Raise},S_PISTOLUP,0,0},	// S_PISTOLUP
     {SPR_PISG,0,4,{NULL},S_PISTOL2,0,0},	// S_PISTOL1
-    {SPR_PISG,1,6,{A_FirePistol},S_PISTOL3,0,0},// S_PISTOL2
+    {SPR_PISG,1,6,{.acp2 A_FirePistol},S_PISTOL3,0,0},// S_PISTOL2
     {SPR_PISG,2,4,{NULL},S_PISTOL4,0,0},	// S_PISTOL3
-    {SPR_PISG,1,5,{A_ReFire},S_PISTOL,0,0},	// S_PISTOL4
-    {SPR_PISF,32768,7,{A_Light1},S_LIGHTDONE,0,0},	// S_PISTOLFLASH
-    {SPR_SHTG,0,1,{A_WeaponReady},S_SGUN,0,0},	// S_SGUN
-    {SPR_SHTG,0,1,{A_Lower},S_SGUNDOWN,0,0},	// S_SGUNDOWN
-    {SPR_SHTG,0,1,{A_Raise},S_SGUNUP,0,0},	// S_SGUNUP
+    {SPR_PISG,1,5,{.acp2 A_ReFire},S_PISTOL,0,0},	// S_PISTOL4
+    {SPR_PISF,32768,7,{.acp2 A_Light1},S_LIGHTDONE,0,0},	// S_PISTOLFLASH
+    {SPR_SHTG,0,1,{.acp2 A_WeaponReady},S_SGUN,0,0},	// S_SGUN
+    {SPR_SHTG,0,1,{.acp2 A_Lower},S_SGUNDOWN,0,0},	// S_SGUNDOWN
+    {SPR_SHTG,0,1,{.acp2 A_Raise},S_SGUNUP,0,0},	// S_SGUNUP
     {SPR_SHTG,0,3,{NULL},S_SGUN2,0,0},	// S_SGUN1
-    {SPR_SHTG,0,7,{A_FireShotgun},S_SGUN3,0,0},	// S_SGUN2
+    {SPR_SHTG,0,7,{.acp2 A_FireShotgun},S_SGUN3,0,0},	// S_SGUN2
     {SPR_SHTG,1,5,{NULL},S_SGUN4,0,0},	// S_SGUN3
     {SPR_SHTG,2,5,{NULL},S_SGUN5,0,0},	// S_SGUN4
     {SPR_SHTG,3,4,{NULL},S_SGUN6,0,0},	// S_SGUN5
@@ -154,67 +153,67 @@
     {SPR_SHTG,2,5,{NULL},S_SGUN7,0,0},	// S_SGUN6
     {SPR_SHTG,1,5,{NULL},S_SGUN8,0,0},	// S_SGUN7
     {SPR_SHTG,0,3,{NULL},S_SGUN9,0,0},	// S_SGUN8
-    {SPR_SHTG,0,7,{A_ReFire},S_SGUN,0,0},	// S_SGUN9
-    {SPR_SHTF,32768,4,{A_Light1},S_SGUNFLASH2,0,0},	// S_SGUNFLASH1
-    {SPR_SHTF,32769,3,{A_Light2},S_LIGHTDONE,0,0},	// S_SGUNFLASH2
-    {SPR_SHT2,0,1,{A_WeaponReady},S_DSGUN,0,0},	// S_DSGUN
-    {SPR_SHT2,0,1,{A_Lower},S_DSGUNDOWN,0,0},	// S_DSGUNDOWN
-    {SPR_SHT2,0,1,{A_Raise},S_DSGUNUP,0,0},	// S_DSGUNUP
+    {SPR_SHTG,0,7,{.acp2 A_ReFire},S_SGUN,0,0},	// S_SGUN9
+    {SPR_SHTF,32768,4,{.acp2 A_Light1},S_SGUNFLASH2,0,0},	// S_SGUNFLASH1
+    {SPR_SHTF,32769,3,{.acp2 A_Light2},S_LIGHTDONE,0,0},	// S_SGUNFLASH2
+    {SPR_SHT2,0,1,{.acp2 A_WeaponReady},S_DSGUN,0,0},	// S_DSGUN
+    {SPR_SHT2,0,1,{.acp2 A_Lower},S_DSGUNDOWN,0,0},	// S_DSGUNDOWN
+    {SPR_SHT2,0,1,{.acp2 A_Raise},S_DSGUNUP,0,0},	// S_DSGUNUP
     {SPR_SHT2,0,3,{NULL},S_DSGUN2,0,0},	// S_DSGUN1
-    {SPR_SHT2,0,7,{A_FireShotgun2},S_DSGUN3,0,0},	// S_DSGUN2
+    {SPR_SHT2,0,7,{.acp2 A_FireShotgun2},S_DSGUN3,0,0},	// S_DSGUN2
     {SPR_SHT2,1,7,{NULL},S_DSGUN4,0,0},	// S_DSGUN3
-    {SPR_SHT2,2,7,{A_CheckReload},S_DSGUN5,0,0},	// S_DSGUN4
-    {SPR_SHT2,3,7,{A_OpenShotgun2},S_DSGUN6,0,0},	// S_DSGUN5
+    {SPR_SHT2,2,7,{.acp2 A_CheckReload},S_DSGUN5,0,0},	// S_DSGUN4
+    {SPR_SHT2,3,7,{.acp2 A_OpenShotgun2},S_DSGUN6,0,0},	// S_DSGUN5
     {SPR_SHT2,4,7,{NULL},S_DSGUN7,0,0},	// S_DSGUN6
-    {SPR_SHT2,5,7,{A_LoadShotgun2},S_DSGUN8,0,0},	// S_DSGUN7
+    {SPR_SHT2,5,7,{.acp2 A_LoadShotgun2},S_DSGUN8,0,0},	// S_DSGUN7
     {SPR_SHT2,6,6,{NULL},S_DSGUN9,0,0},	// S_DSGUN8
-    {SPR_SHT2,7,6,{A_CloseShotgun2},S_DSGUN10,0,0},	// S_DSGUN9
-    {SPR_SHT2,0,5,{A_ReFire},S_DSGUN,0,0},	// S_DSGUN10
+    {SPR_SHT2,7,6,{.acp2 A_CloseShotgun2},S_DSGUN10,0,0},	// S_DSGUN9
+    {SPR_SHT2,0,5,{.acp2 A_ReFire},S_DSGUN,0,0},	// S_DSGUN10
     {SPR_SHT2,1,7,{NULL},S_DSNR2,0,0},	// S_DSNR1
     {SPR_SHT2,0,3,{NULL},S_DSGUNDOWN,0,0},	// S_DSNR2
-    {SPR_SHT2,32776,5,{A_Light1},S_DSGUNFLASH2,0,0},	// S_DSGUNFLASH1
-    {SPR_SHT2,32777,4,{A_Light2},S_LIGHTDONE,0,0},	// S_DSGUNFLASH2
-    {SPR_CHGG,0,1,{A_WeaponReady},S_CHAIN,0,0},	// S_CHAIN
-    {SPR_CHGG,0,1,{A_Lower},S_CHAINDOWN,0,0},	// S_CHAINDOWN
-    {SPR_CHGG,0,1,{A_Raise},S_CHAINUP,0,0},	// S_CHAINUP
-    {SPR_CHGG,0,4,{A_FireCGun},S_CHAIN2,0,0},	// S_CHAIN1
-    {SPR_CHGG,1,4,{A_FireCGun},S_CHAIN3,0,0},	// S_CHAIN2
-    {SPR_CHGG,1,0,{A_ReFire},S_CHAIN,0,0},	// S_CHAIN3
-    {SPR_CHGF,32768,5,{A_Light1},S_LIGHTDONE,0,0},	// S_CHAINFLASH1
-    {SPR_CHGF,32769,5,{A_Light2},S_LIGHTDONE,0,0},	// S_CHAINFLASH2
-    {SPR_MISG,0,1,{A_WeaponReady},S_MISSILE,0,0},	// S_MISSILE
-    {SPR_MISG,0,1,{A_Lower},S_MISSILEDOWN,0,0},	// S_MISSILEDOWN
-    {SPR_MISG,0,1,{A_Raise},S_MISSILEUP,0,0},	// S_MISSILEUP
-    {SPR_MISG,1,8,{A_GunFlash},S_MISSILE2,0,0},	// S_MISSILE1
-    {SPR_MISG,1,12,{A_FireMissile},S_MISSILE3,0,0},	// S_MISSILE2
-    {SPR_MISG,1,0,{A_ReFire},S_MISSILE,0,0},	// S_MISSILE3
-    {SPR_MISF,32768,3,{A_Light1},S_MISSILEFLASH2,0,0},	// S_MISSILEFLASH1
+    {SPR_SHT2,32776,5,{.acp2 A_Light1},S_DSGUNFLASH2,0,0},	// S_DSGUNFLASH1
+    {SPR_SHT2,32777,4,{.acp2 A_Light2},S_LIGHTDONE,0,0},	// S_DSGUNFLASH2
+    {SPR_CHGG,0,1,{.acp2 A_WeaponReady},S_CHAIN,0,0},	// S_CHAIN
+    {SPR_CHGG,0,1,{.acp2 A_Lower},S_CHAINDOWN,0,0},	// S_CHAINDOWN
+    {SPR_CHGG,0,1,{.acp2 A_Raise},S_CHAINUP,0,0},	// S_CHAINUP
+    {SPR_CHGG,0,4,{.acp2 A_FireCGun},S_CHAIN2,0,0},	// S_CHAIN1
+    {SPR_CHGG,1,4,{.acp2 A_FireCGun},S_CHAIN3,0,0},	// S_CHAIN2
+    {SPR_CHGG,1,0,{.acp2 A_ReFire},S_CHAIN,0,0},	// S_CHAIN3
+    {SPR_CHGF,32768,5,{.acp2 A_Light1},S_LIGHTDONE,0,0},	// S_CHAINFLASH1
+    {SPR_CHGF,32769,5,{.acp2 A_Light2},S_LIGHTDONE,0,0},	// S_CHAINFLASH2
+    {SPR_MISG,0,1,{.acp2 A_WeaponReady},S_MISSILE,0,0},	// S_MISSILE
+    {SPR_MISG,0,1,{.acp2 A_Lower},S_MISSILEDOWN,0,0},	// S_MISSILEDOWN
+    {SPR_MISG,0,1,{.acp2 A_Raise},S_MISSILEUP,0,0},	// S_MISSILEUP
+    {SPR_MISG,1,8,{.acp2 A_GunFlash},S_MISSILE2,0,0},	// S_MISSILE1
+    {SPR_MISG,1,12,{.acp2 A_FireMissile},S_MISSILE3,0,0},	// S_MISSILE2
+    {SPR_MISG,1,0,{.acp2 A_ReFire},S_MISSILE,0,0},	// S_MISSILE3
+    {SPR_MISF,32768,3,{.acp2 A_Light1},S_MISSILEFLASH2,0,0},	// S_MISSILEFLASH1
     {SPR_MISF,32769,4,{NULL},S_MISSILEFLASH3,0,0},	// S_MISSILEFLASH2
-    {SPR_MISF,32770,4,{A_Light2},S_MISSILEFLASH4,0,0},	// S_MISSILEFLASH3
-    {SPR_MISF,32771,4,{A_Light2},S_LIGHTDONE,0,0},	// S_MISSILEFLASH4
-    {SPR_SAWG,2,4,{A_WeaponReady},S_SAWB,0,0},	// S_SAW
-    {SPR_SAWG,3,4,{A_WeaponReady},S_SAW,0,0},	// S_SAWB
-    {SPR_SAWG,2,1,{A_Lower},S_SAWDOWN,0,0},	// S_SAWDOWN
-    {SPR_SAWG,2,1,{A_Raise},S_SAWUP,0,0},	// S_SAWUP
-    {SPR_SAWG,0,4,{A_Saw},S_SAW2,0,0},	// S_SAW1
-    {SPR_SAWG,1,4,{A_Saw},S_SAW3,0,0},	// S_SAW2
-    {SPR_SAWG,1,0,{A_ReFire},S_SAW,0,0},	// S_SAW3
-    {SPR_PLSG,0,1,{A_WeaponReady},S_PLASMA,0,0},	// S_PLASMA
-    {SPR_PLSG,0,1,{A_Lower},S_PLASMADOWN,0,0},	// S_PLASMADOWN
-    {SPR_PLSG,0,1,{A_Raise},S_PLASMAUP,0,0},	// S_PLASMAUP
-    {SPR_PLSG,0,3,{A_FirePlasma},S_PLASMA2,0,0},	// S_PLASMA1
-    {SPR_PLSG,1,20,{A_ReFire},S_PLASMA,0,0},	// S_PLASMA2
-    {SPR_PLSF,32768,4,{A_Light1},S_LIGHTDONE,0,0},	// S_PLASMAFLASH1
-    {SPR_PLSF,32769,4,{A_Light1},S_LIGHTDONE,0,0},	// S_PLASMAFLASH2
-    {SPR_BFGG,0,1,{A_WeaponReady},S_BFG,0,0},	// S_BFG
-    {SPR_BFGG,0,1,{A_Lower},S_BFGDOWN,0,0},	// S_BFGDOWN
-    {SPR_BFGG,0,1,{A_Raise},S_BFGUP,0,0},	// S_BFGUP
-    {SPR_BFGG,0,20,{A_BFGsound},S_BFG2,0,0},	// S_BFG1
-    {SPR_BFGG,1,10,{A_GunFlash},S_BFG3,0,0},	// S_BFG2
-    {SPR_BFGG,1,10,{A_FireBFG},S_BFG4,0,0},	// S_BFG3
-    {SPR_BFGG,1,20,{A_ReFire},S_BFG,0,0},	// S_BFG4
-    {SPR_BFGF,32768,11,{A_Light1},S_BFGFLASH2,0,0},	// S_BFGFLASH1
-    {SPR_BFGF,32769,6,{A_Light2},S_LIGHTDONE,0,0},	// S_BFGFLASH2
+    {SPR_MISF,32770,4,{.acp2 A_Light2},S_MISSILEFLASH4,0,0},	// S_MISSILEFLASH3
+    {SPR_MISF,32771,4,{.acp2 A_Light2},S_LIGHTDONE,0,0},	// S_MISSILEFLASH4
+    {SPR_SAWG,2,4,{.acp2 A_WeaponReady},S_SAWB,0,0},	// S_SAW
+    {SPR_SAWG,3,4,{.acp2 A_WeaponReady},S_SAW,0,0},	// S_SAWB
+    {SPR_SAWG,2,1,{.acp2 A_Lower},S_SAWDOWN,0,0},	// S_SAWDOWN
+    {SPR_SAWG,2,1,{.acp2 A_Raise},S_SAWUP,0,0},	// S_SAWUP
+    {SPR_SAWG,0,4,{.acp2 A_Saw},S_SAW2,0,0},	// S_SAW1
+    {SPR_SAWG,1,4,{.acp2 A_Saw},S_SAW3,0,0},	// S_SAW2
+    {SPR_SAWG,1,0,{.acp2 A_ReFire},S_SAW,0,0},	// S_SAW3
+    {SPR_PLSG,0,1,{.acp2 A_WeaponReady},S_PLASMA,0,0},	// S_PLASMA
+    {SPR_PLSG,0,1,{.acp2 A_Lower},S_PLASMADOWN,0,0},	// S_PLASMADOWN
+    {SPR_PLSG,0,1,{.acp2 A_Raise},S_PLASMAUP,0,0},	// S_PLASMAUP
+    {SPR_PLSG,0,3,{.acp2 A_FirePlasma},S_PLASMA2,0,0},	// S_PLASMA1
+    {SPR_PLSG,1,20,{.acp2 A_ReFire},S_PLASMA,0,0},	// S_PLASMA2
+    {SPR_PLSF,32768,4,{.acp2 A_Light1},S_LIGHTDONE,0,0},	// S_PLASMAFLASH1
+    {SPR_PLSF,32769,4,{.acp2 A_Light1},S_LIGHTDONE,0,0},	// S_PLASMAFLASH2
+    {SPR_BFGG,0,1,{.acp2 A_WeaponReady},S_BFG,0,0},	// S_BFG
+    {SPR_BFGG,0,1,{.acp2 A_Lower},S_BFGDOWN,0,0},	// S_BFGDOWN
+    {SPR_BFGG,0,1,{.acp2 A_Raise},S_BFGUP,0,0},	// S_BFGUP
+    {SPR_BFGG,0,20,{.acp2 A_BFGsound},S_BFG2,0,0},	// S_BFG1
+    {SPR_BFGG,1,10,{.acp2 A_GunFlash},S_BFG3,0,0},	// S_BFG2
+    {SPR_BFGG,1,10,{.acp2 A_FireBFG},S_BFG4,0,0},	// S_BFG3
+    {SPR_BFGG,1,20,{.acp2 A_ReFire},S_BFG,0,0},	// S_BFG4
+    {SPR_BFGF,32768,11,{.acp2 A_Light1},S_BFGFLASH2,0,0},	// S_BFGFLASH1
+    {SPR_BFGF,32769,6,{.acp2 A_Light2},S_LIGHTDONE,0,0},	// S_BFGFLASH2
     {SPR_BLUD,2,8,{NULL},S_BLOOD2,0,0},	// S_BLOOD1
     {SPR_BLUD,1,8,{NULL},S_BLOOD3,0,0},	// S_BLOOD2
     {SPR_BLUD,0,8,{NULL},S_NULL,0,0},	// S_BLOOD3
--- a/m_menu.c
+++ b/m_menu.c
@@ -152,7 +152,7 @@
     short		numitems;	// # of menu items
     struct menu_s*	prevMenu;	// previous menu
     menuitem_t*		menuitems;	// menu items
-    void		(*routine)();	// draw routine
+    void		(*routine)(void);	// draw routine
     short		x;
     short		y;		// x,y of menu
     short		lastOn;		// last item user was on in menu
--- a/memio.h
+++ b/memio.h
@@ -19,6 +19,8 @@
 
 typedef struct _MEMFILE MEMFILE;
 
+#pragma incomplete MEMFILE;
+
 typedef enum 
 {
 	MEM_SEEK_SET,
--- a/midifile.c
+++ b/midifile.c
@@ -34,12 +34,15 @@
 #pragma pack(push, 1)
 #endif
 
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     byte chunk_id[4];
     unsigned int chunk_size;
 }) chunk_header_t;
+#pragma pack off
 
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     chunk_header_t chunk_header;
@@ -47,6 +50,7 @@
     unsigned short num_tracks;
     unsigned short time_division;
 }) midi_header_t;
+#pragma pack off
 
 // haleyjd 09/09/10: packing off.
 #ifdef _MSC_VER
--- a/midifile.h
+++ b/midifile.h
@@ -22,6 +22,8 @@
 
 typedef struct midi_file_s midi_file_t;
 typedef struct midi_track_iter_s midi_track_iter_t;
+#pragma incomplete midi_file_t
+#pragma incomplete midi_track_iter_t
 
 #define MIDI_CHANNELS_PER_TRACK 16
 
--- a/mus2mid.c
+++ b/mus2mid.c
@@ -53,6 +53,7 @@
 } midievent;
 
 // Structure to hold MUS file header
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     byte id[4];
@@ -62,6 +63,7 @@
     unsigned short secondarychannels;
     unsigned short instrumentcount;
 }) musheader;
+#pragma pack off
 
 // Standard MIDI type 0 header + track header
 static const byte midiheader[] =
--- a/opl_queue.h
+++ b/opl_queue.h
@@ -21,6 +21,7 @@
 #include "opl_sdl.h"
 
 typedef struct opl_callback_queue_s opl_callback_queue_t;
+#pragma incomplete opl_callback_queue_t
 
 opl_callback_queue_t *OPL_Queue_Create(void);
 int OPL_Queue_IsEmpty(opl_callback_queue_t *queue);
--- a/opl_sdl.c
+++ b/opl_sdl.c
@@ -22,8 +22,8 @@
 #include <errno.h>
 #include <assert.h>
 
-#include "SDL.h"
-#include "SDL_mixer.h"
+#include "SDL2/SDL.h"
+#include "SDL2/SDL_mixer.h"
 
 #include "opl3.h"
 
--- a/p_enemy.c
+++ b/p_enemy.c
@@ -542,7 +542,6 @@
     return false;
 }
 
-
 //
 // A_KeenDie
 // DOOM II special, map 32.
--- a/p_pspr.h
+++ b/p_pspr.h
@@ -59,7 +59,7 @@
 
 } psprnum_t;
 
-typedef struct
+typedef struct pspdef_s
 {
     state_t*	state;	// a NULL state means not active
     int		tics;
--- a/p_tick.c
+++ b/p_tick.c
@@ -109,7 +109,8 @@
 	else
 	{
 	    if (currentthinker->function.acp1)
-		currentthinker->function.acp1 (currentthinker);
+	    /* FIXME */
+		currentthinker->function.acp1 ((struct mobj_s*)currentthinker);
             nextthinker = currentthinker->next;
 	}
 	currentthinker = nextthinker;
--- a/r_data.c
+++ b/r_data.c
@@ -55,6 +55,7 @@
 // into the rectangular texture space using origin
 // and possibly other attributes.
 //
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     short	originx;
@@ -63,6 +64,7 @@
     short	stepdir;
     short	colormap;
 }) mappatch_t;
+#pragma pack off
 
 
 //
@@ -70,6 +72,7 @@
 // A DOOM wall texture is a list of patches
 // which are to be combined in a predefined order.
 //
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     char		name[8];
@@ -80,7 +83,7 @@
     short		patchcount;
     mappatch_t	patches[1];
 }) maptexture_t;
-
+#pragma pack off
 
 // A single patch from a texture definition,
 //  basically a rectangular area within
--- a/v_patch.h
+++ b/v_patch.h
@@ -26,6 +26,7 @@
 // and we compose textures from the TEXTURE1/2 lists
 // of patches.
 
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     short		width;		// bounding box size
@@ -35,13 +36,16 @@
     int			columnofs[8];	// only [width] used
     // the [0] is &columnofs[width]
 }) patch_t;
+#pragma pack off
 
 // posts are runs of non masked source pixels
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     byte		topdelta;	// -1 is the last post in a column
     byte		length; 	// length data bytes follows
 }) post_t;
+#pragma pack off
 
 // column_t is a list of 0 or more post_t, (byte)-1 terminated
 typedef post_t	column_t;
--- a/w_wad.c
+++ b/w_wad.c
@@ -30,6 +30,7 @@
 
 #include "w_wad.h"
 
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     // Should be "IWAD" or "PWAD".
@@ -37,8 +38,9 @@
     int			numlumps;
     int			infotableofs;
 }) wadinfo_t;
+#pragma pack off
 
-
+#pragma pack on
 typedef PACKED_STRUCT (
 {
     int			filepos;
@@ -45,6 +47,7 @@
     int			size;
     char		name[8];
 }) filelump_t;
+#pragma pack off
 
 //
 // GLOBALS
--