shithub: choc

Download patch

ref: 955c75d8b06876a367e2d2853443590260eab028
parent: 847056af1d9a903a66d361ca6fcbd8004c9c2466
parent: 0403e94fde9ec34e4aef1baca891b1b9d8c99564
author: Turo Lamminen <turol@users.noreply.github.com>
date: Thu Oct 6 07:56:40 EDT 2022

Merge pull request #1514 from turol/extern-hexen

Clean up extern in Hexen, part 1

--- a/src/hexen/a_action.c
+++ b/src/hexen/a_action.c
@@ -33,7 +33,6 @@
 // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
-extern fixed_t FloatBobOffsets[64];
 
 // PUBLIC DATA DEFINITIONS -------------------------------------------------
 int orbitTableX[256] = {
@@ -788,8 +787,6 @@
 void A_PoisonBagDamage(mobj_t * actor)
 {
     int bobIndex;
-
-    extern void A_Explode(mobj_t * actor);
 
     A_Explode(actor);
 
--- a/src/hexen/am_map.h
+++ b/src/hexen/am_map.h
@@ -117,6 +117,12 @@
     fixed_t slp, islp;
 } islope_t;
 
-// extern int f_x, f_y, f_w, f_h;
+
+extern int cheating;
+extern boolean automapactive;
+
+
+void AM_Stop(void);
+
 
 #endif
--- a/src/hexen/f_finale.c
+++ b/src/hexen/f_finale.c
@@ -25,7 +25,9 @@
 #include <ctype.h>
 #include "v_video.h"
 #include "i_swap.h"
+#include "am_map.h"
 
+
 // MACROS ------------------------------------------------------------------
 
 #define	TEXTSPEED	3
@@ -48,7 +50,6 @@
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
 
-extern boolean automapactive;
 extern boolean viewactive;
 
 // PUBLIC DATA DECLARATIONS ------------------------------------------------
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -34,8 +34,6 @@
 
 // External functions
 
-extern void R_InitSky(int map);
-extern void P_PlayerNextArtifact(player_t * player);
 
 // Functions
 
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -41,6 +41,7 @@
 #include "p_local.h"
 #include "v_video.h"
 #include "w_main.h"
+#include "am_map.h"
 
 #include "hexen_icon.c"
 
@@ -88,7 +89,6 @@
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
 
-extern boolean automapactive;
 extern boolean MenuActive;
 extern boolean askforquit;
 
--- a/src/hexen/h2def.h
+++ b/src/hexen/h2def.h
@@ -364,7 +364,7 @@
 	key_yellow,
 	key_green,
 	key_blue,
-	NUMKEYS
+	NUM_KEY_TYPES
 } keytype_t;
 */
 
@@ -381,7 +381,7 @@
     KEY_9,
     KEY_A,
     KEY_B,
-    NUMKEYS
+    NUM_KEY_TYPES
 } keytype_t;
 
 typedef enum
--- a/src/hexen/in_lude.c
+++ b/src/hexen/in_lude.c
@@ -24,7 +24,9 @@
 #include "p_local.h"
 #include "v_video.h"
 #include "i_swap.h"
+#include "am_map.h"
 
+
 // MACROS ------------------------------------------------------------------
 
 #define	TEXTSPEED 3
@@ -93,7 +95,6 @@
 //
 //========================================================================
 
-extern void AM_Stop(void);
 
 void IN_Start(void)
 {
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -30,7 +30,9 @@
 #include "r_local.h"
 #include "s_sound.h"
 #include "v_video.h"
+#include "am_map.h"
 
+
 // MACROS ------------------------------------------------------------------
 
 #define LEFT_DIR 0
@@ -1146,7 +1148,6 @@
     int charTyped;
     int i;
     MenuItem_t *item;
-    extern boolean automapactive;
     extern void H2_StartTitle(void);
     extern void G_CheckDemoStatus(void);
     char *textBuffer;
--- a/src/hexen/p_acs.c
+++ b/src/hexen/p_acs.c
@@ -677,8 +677,6 @@
     byte newArgs[5];
     char LockedBuffer[80];
 
-    extern char *TextKeyMessages[11];
-
     lock = args[4];
     if (!mo->player)
     {
--- a/src/hexen/p_anim.c
+++ b/src/hexen/p_anim.c
@@ -68,9 +68,6 @@
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
 
-extern fixed_t Sky1ColumnOffset;
-extern fixed_t Sky2ColumnOffset;
-extern boolean DoubleSky;
 
 // PUBLIC DATA DEFINITIONS -------------------------------------------------
 
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -26,7 +26,6 @@
 // Types
 // Private Data
 // External Data
-extern fixed_t FloatBobOffsets[64];
 
 
 //----------------------------------------------------------------------------
@@ -229,9 +228,6 @@
 fixed_t yspeed[8] =
     { 0, 47000, FRACUNIT, 47000, 0, -47000, -FRACUNIT, -47000 };
 
-#define MAXSPECIALCROSS         8
-extern line_t *spechit[MAXSPECIALCROSS];
-extern int numspechit;
 
 boolean P_Move(mobj_t * actor)
 {
@@ -4720,8 +4716,6 @@
 
 void A_FighterAttack(mobj_t * actor)
 {
-    extern void A_FSwordAttack2(mobj_t * actor);
-
     if (!actor->target)
         return;
     A_FSwordAttack2(actor);
@@ -4730,8 +4724,6 @@
 
 void A_ClericAttack(mobj_t * actor)
 {
-    extern void A_CHolyAttack3(mobj_t * actor);
-
     if (!actor->target)
         return;
     A_CHolyAttack3(actor);
@@ -4741,8 +4733,6 @@
 
 void A_MageAttack(mobj_t * actor)
 {
-    extern void A_MStaffAttack2(mobj_t * actor);
-
     if (!actor->target)
         return;
     A_MStaffAttack2(actor);
--- a/src/hexen/p_floor.c
+++ b/src/hexen/p_floor.c
@@ -19,7 +19,6 @@
 #include "i_system.h"
 #include "p_local.h"
 
-extern fixed_t FloatBobOffsets[64];
 
 //==================================================================
 //==================================================================
--- a/src/hexen/p_inter.c
+++ b/src/hexen/p_inter.c
@@ -567,8 +567,6 @@
     int hits;
     int totalArmor;
 
-    extern int ArmorMax[NUMCLASSES];
-
     if (amount == -1)
     {
         hits = ArmorIncrement[player->class][armortype];
--- a/src/hexen/p_local.h
+++ b/src/hexen/p_local.h
@@ -101,6 +101,8 @@
 
 // ***** P_USER *****
 
+
+extern int ArmorMax[NUMCLASSES];
 extern int PStateNormal[NUMCLASSES];
 extern int PStateRun[NUMCLASSES];
 extern int PStateAttack[NUMCLASSES];
@@ -108,6 +110,7 @@
 
 void P_PlayerThink(player_t * player);
 void P_Thrust(player_t * player, angle_t angle, fixed_t move);
+void P_PlayerNextArtifact(player_t *player);
 void P_PlayerRemoveArtifact(player_t * player, int slot);
 void P_PlayerUseArtifact(player_t * player, artitype_t arti);
 boolean P_UseArtifact(player_t * player, artitype_t arti);
@@ -114,7 +117,9 @@
 int P_GetPlayerNum(player_t * player);
 void P_TeleportOther(mobj_t * victim);
 void ResetBlasted(mobj_t * mo);
+boolean P_UndoPlayerMorph(player_t *player);
 
+
 // ***** P_MOBJ *****
 
 // Any floor type >= FLOOR_LIQUID will floorclip sprites
@@ -136,6 +141,9 @@
 extern mobjtype_t PuffType;
 extern mobj_t *MissileMobj;
 
+extern fixed_t FloatBobOffsets[64];
+
+
 mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
 void P_RemoveMobj(mobj_t * th);
 boolean P_SetMobjState(mobj_t * mobj, statenum_t state);
@@ -168,6 +176,7 @@
 void P_RemoveMobjFromTIDList(mobj_t * mobj);
 void P_InsertMobjIntoTIDList(mobj_t * mobj, int tid);
 mobj_t *P_FindMobjFromTID(int tid, int *searchPosition);
+void P_ExplodeMissile(mobj_t *mo);
 mobj_t *P_SpawnKoraxMissile(fixed_t x, fixed_t y, fixed_t z,
                             mobj_t * source, mobj_t * dest, mobjtype_t type);
 
@@ -181,6 +190,10 @@
 boolean P_LookForMonsters(mobj_t * actor);
 void P_InitCreatureCorpseQueue(boolean corpseScan);
 void A_DeQueueCorpse(mobj_t * actor);
+void A_Explode(mobj_t *actor);
+void A_CHolyAttack3(mobj_t *actor);
+void A_FSwordAttack2(mobj_t *actor);
+void A_MStaffAttack2(mobj_t *actor);
 
 
 // ***** P_MAPUTL *****
@@ -234,6 +247,10 @@
 
 // ***** P_MAP *****
 
+
+#define MAXSPECIALCROSS         8
+
+
 extern boolean floatok;         // if true, move would be ok if
 extern fixed_t tmfloorz, tmceilingz;    // within tmfloorz - tmceilingz
 extern int tmfloorpic;
@@ -240,6 +257,12 @@
 extern mobj_t *BlockingMobj;
 
 extern line_t *ceilingline;
+extern line_t *spechit[MAXSPECIALCROSS];
+extern int numspechit;
+
+extern fixed_t topslope, bottomslope;   // slopes to top and bottom of target
+
+
 boolean P_TestMobjLocation(mobj_t * mobj);
 boolean P_CheckPosition(mobj_t * thing, fixed_t x, fixed_t y);
 mobj_t *P_CheckOnmobj(mobj_t * thing);
@@ -277,7 +300,11 @@
 // ***** P_INTER *****
 
 extern int clipmana[NUMMANA];
+extern int ArmorIncrement[NUMCLASSES][NUMARMOR];
+extern int AutoArmorSave[NUMCLASSES];
+extern const char *TextKeyMessages[];
 
+
 void P_SetMessage(player_t * player, const char *message, boolean ultmsg);
 void P_SetYellowMessage(player_t * player, const char *message, boolean ultmsg);
 void P_ClearMessage(player_t * player);
@@ -305,7 +332,9 @@
 boolean A_LocalQuake(byte * args, mobj_t * victim);
 void P_SpawnDirt(mobj_t * actor, fixed_t radius);
 void A_BridgeRemove(mobj_t * actor);
+void A_UnHideThing(mobj_t *actor);
 
+
 // ***** SB_BAR *****
 
 extern int SB_state;
@@ -359,6 +388,8 @@
 
 extern polyobj_t *polyobjs;     // list of all poly-objects on the level
 extern int po_NumPolyobjs;
+extern polyblock_t **PolyBlockMap;
+
 
 void T_PolyDoor(polydoor_t * pd);
 void T_RotatePoly(polyevent_t * pe);
--- a/src/hexen/p_map.c
+++ b/src/hexen/p_map.c
@@ -76,7 +76,7 @@
 
 // keep track of special lines as they are hit, but don't process them
 // until the move is proven valid
-#define MAXSPECIALCROSS 8
+
 line_t *spechit[MAXSPECIALCROSS];
 int numspechit;
 
@@ -1570,7 +1570,6 @@
 
 fixed_t aimslope;
 
-extern fixed_t topslope, bottomslope;   // slopes to top and bottom of target
 
 /*
 ===============================================================================
@@ -1680,8 +1679,6 @@
     fixed_t slope;
     fixed_t dist;
     fixed_t thingtopslope, thingbottomslope;
-
-    extern mobj_t LavaInflictor;
 
     if (in->isaline)
     {
--- a/src/hexen/p_maputl.c
+++ b/src/hexen/p_maputl.c
@@ -431,7 +431,6 @@
     int i;
     polyblock_t *polyLink;
     seg_t **tempSeg;
-    extern polyblock_t **PolyBlockMap;
 
     if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
         return true;
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -45,7 +45,6 @@
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
 
-extern mobj_t LavaInflictor;
 
 // PUBLIC DATA DEFINITIONS -------------------------------------------------
 
@@ -1749,7 +1748,6 @@
 //
 //---------------------------------------------------------------------------
 
-extern fixed_t attackrange;
 
 void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z)
 {
--- a/src/hexen/p_pspr.c
+++ b/src/hexen/p_pspr.c
@@ -33,8 +33,6 @@
 
 // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
 
-extern void P_ExplodeMissile(mobj_t * mo);
-extern void A_UnHideThing(mobj_t * actor);
 
 // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
 
@@ -42,7 +40,6 @@
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
 
-extern fixed_t FloatBobOffsets[64];
 
 // PUBLIC DATA DEFINITIONS -------------------------------------------------
 
--- a/src/hexen/p_sight.c
+++ b/src/hexen/p_sight.c
@@ -97,7 +97,6 @@
     polyblock_t *polyLink;
     seg_t **segList;
     int i;
-    extern polyblock_t **PolyBlockMap;
 
     offset = y * bmapwidth + x;
 
--- a/src/hexen/p_spec.c
+++ b/src/hexen/p_spec.c
@@ -408,7 +408,6 @@
 
 static boolean CheckedLockedDoor(mobj_t * mo, byte lock)
 {
-    extern char *TextKeyMessages[11];
     char LockedBuffer[80];
 
     if (!mo->player)
--- a/src/hexen/p_spec.h
+++ b/src/hexen/p_spec.h
@@ -25,6 +25,9 @@
 extern short numlinespecials;
 extern line_t *linespeciallist[MAXLINEANIMS];
 
+extern mobj_t LavaInflictor;
+
+
 //      Define values for map objects
 #define MO_TELEPORTMAN 14
 
@@ -72,6 +75,11 @@
 //-------------------------------
 // P_anim.c
 //-------------------------------
+
+
+extern fixed_t Sky1ScrollDelta;
+extern fixed_t Sky2ScrollDelta;
+
 
 void P_AnimateSurfaces(void);
 void P_InitFTAnims(void);
--- a/src/hexen/p_user.c
+++ b/src/hexen/p_user.c
@@ -21,7 +21,6 @@
 #include "p_local.h"
 #include "s_sound.h"
 
-void P_PlayerNextArtifact(player_t * player);
 
 // Macros
 
--- a/src/hexen/r_local.h
+++ b/src/hexen/r_local.h
@@ -397,7 +397,9 @@
 extern int rw_angle1;           // angle to line origin
 extern int TransTextureStart;
 extern int TransTextureEnd;
+extern lighttable_t **walllights;
 
+
 void R_RenderMaskedSegRange(drawseg_t * ds, int x1, int x2);
 
 //
@@ -406,7 +408,10 @@
 typedef void (*planefunction_t) (int top, int bottom);
 extern planefunction_t floorfunc, ceilingfunc;
 
+extern fixed_t Sky1ColumnOffset;
+extern fixed_t Sky2ColumnOffset;
 extern int skyflatnum;
+extern boolean DoubleSky;
 
 extern short openings[MAXOPENINGS], *lastopening;
 
@@ -426,7 +431,9 @@
                         int special);
 visplane_t *R_CheckPlane(visplane_t * pl, int start, int stop);
 
+void R_InitSky(int map);
 
+
 //
 // R_debug.m
 //
@@ -511,6 +518,9 @@
 extern fixed_t dc_iscale;
 extern fixed_t dc_texturemid;
 extern byte *dc_source;         // first pixel in a column
+extern byte *ylookup[MAXHEIGHT];
+extern int columnofs[MAXWIDTH];
+
 
 void R_DrawColumn(void);
 void R_DrawColumnLow(void);
--- a/src/hexen/r_main.c
+++ b/src/hexen/r_main.c
@@ -28,7 +28,6 @@
 int validcount = 1;             // increment every time a check is made
 
 lighttable_t *fixedcolormap;
-extern lighttable_t **walllights;
 
 int centerx, centery;
 fixed_t centerxfrac, centeryfrac;
--- a/src/hexen/r_plane.c
+++ b/src/hexen/r_plane.c
@@ -20,7 +20,9 @@
 #include "h2def.h"
 #include "i_system.h"
 #include "r_local.h"
+#include "p_spec.h"
 
+
 // MACROS ------------------------------------------------------------------
 
 // TYPES -------------------------------------------------------------------
@@ -33,9 +35,6 @@
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
 
-extern fixed_t Sky1ScrollDelta;
-extern fixed_t Sky2ScrollDelta;
-
 // PUBLIC DATA DEFINITIONS -------------------------------------------------
 
 int Sky1Texture;
@@ -383,9 +382,6 @@
     int offset2;
     int skyTexture2;
     int scrollOffset;
-
-    extern byte *ylookup[MAXHEIGHT];
-    extern int columnofs[MAXWIDTH];
 
 #ifdef RANGECHECK
     if (ds_p - drawsegs > MAXDRAWSEGS)
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -65,8 +65,6 @@
 //void *mus_sndptr;
 //byte *soundCurve;
 
-extern sfxinfo_t S_sfx[];
-extern musicinfo_t S_music[];
 
 static channel_t Channel[MAX_CHANNELS];
 static void *RegisteredSong;      //the current registered song.
--- a/src/hexen/sb_bar.c
+++ b/src/hexen/sb_bar.c
@@ -27,7 +27,9 @@
 #include "s_sound.h"
 #include "v_video.h"
 #include "i_swap.h"
+#include "am_map.h"
 
+
 // TYPES -------------------------------------------------------------------
 
 typedef struct Cheat_s
@@ -85,9 +87,6 @@
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
 
-extern int ArmorIncrement[NUMCLASSES][NUMARMOR];
-extern int AutoArmorSave[NUMCLASSES];
-
 // PUBLIC DATA DECLARATIONS ------------------------------------------------
 
 boolean DebugSound;             // Debug flag for displaying sound info
@@ -740,7 +739,6 @@
 static int oldweapon = -1;
 static int oldkeys = -1;
 
-extern boolean automapactive;
 
 void SB_Drawer(void)
 {
@@ -1272,7 +1270,7 @@
     if (oldkeys != CPlayer->keys)
     {
         xPosition = 46;
-        for (i = 0; i < NUMKEYS && xPosition <= 126; i++)
+        for (i = 0; i < NUM_KEY_TYPES && xPosition <= 126; i++)
         {
             if (CPlayer->keys & (1 << i))
             {
@@ -1639,7 +1637,6 @@
 static void CheatWeaponsFunc(player_t * player, Cheat_t * cheat)
 {
     int i;
-    //extern boolean *WeaponInShareware;
 
     for (i = 0; i < NUMARMOR; i++)
     {
@@ -1775,8 +1772,6 @@
 
 static void CheatPigFunc(player_t * player, Cheat_t * cheat)
 {
-    extern boolean P_UndoPlayerMorph(player_t * player);
-
     if (player->morphTics)
     {
         P_UndoPlayerMorph(player);
@@ -1928,7 +1923,6 @@
     }
 }
 
-extern int cheating;
 
 static void CheatRevealFunc(player_t * player, Cheat_t * cheat)
 {
--- a/src/hexen/sn_sonix.c
+++ b/src/hexen/sn_sonix.c
@@ -68,7 +68,6 @@
 
 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
 
-extern sfxinfo_t S_sfx[];
 
 // PUBLIC DATA DEFINITIONS -------------------------------------------------
 
--- a/src/hexen/sounds.h
+++ b/src/hexen/sounds.h
@@ -313,4 +313,9 @@
     NUMSFX
 } sfxenum_t;
 
+
+extern sfxinfo_t S_sfx[];
+extern musicinfo_t S_music[];
+
+
 #endif