Move skincolors definition from doomdef.h to info.h

Recompiling 80% of the codebase every time was getting on my nerves...
also clean up initialization a bit
This commit is contained in:
GenericHeroGuy 2025-05-19 17:28:53 +02:00
parent 360e7419e8
commit 4d3f43b8e4
7 changed files with 33 additions and 38 deletions

View file

@ -1392,10 +1392,6 @@ void D_SRB2Main(void)
if (M_CheckParm("-password") && M_IsNextParm())
D_SetPassword(M_GetNextParm());
// player setup menu colors must be initialized before
// any wad file is added, as they may contain colors themselves
M_InitPlayerSetupColors();
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
Z_Init();
CON_SetLoadingProgress(LOADED_ZINIT);
@ -1504,7 +1500,6 @@ void D_SRB2Main(void)
R_InitPaletteRemap();
// now do it again for the SOC colors in main.pk3!
M_InitPlayerSetupColors();
// Do it before P_InitMapData because PNG patch

View file

@ -220,36 +220,6 @@ extern char logfilename[1024];
// Master Server compatibility ONLY
#define MSCOMPAT_MAXPLAYERS (32)
struct skincolor_t
{
UINT32 namehash; // Hash for internal name
UINT32 nameofs; // Offset for internal name
char name[MAXCOLORNAME+1]; // Skincolor name
UINT8 ramp[COLORRAMPSIZE]; // Colormap ramp
UINT16 invcolor; // Signpost color
UINT8 invshade; // Signpost color shade
UINT16 chatcolor; // Chat color
boolean accessible; // Accessible by the color command + setup menu
};
typedef enum
{
#define _(name, ...) SKINCOLOR_##name,
#include "info/skincolors.h"
#undef _
SKINCOLOR_FIRSTFREESLOT,
SKINCOLOR_LASTFREESLOT = SKINCOLOR_FIRSTFREESLOT + NUMCOLORFREESLOTS - 1,
MAXSKINCOLORS,
FIRSTRAINBOWCOLOR = SKINCOLOR_PINK,
FIRSTSUPERCOLOR = SKINCOLOR_SUPER1,
NUMSUPERCOLORS = ((SKINCOLOR_FIRSTFREESLOT - FIRSTSUPERCOLOR)/5)
} skincolornum_t;
extern UINT16 numskincolors;
extern skincolor_t skincolors[MAXSKINCOLORS];
// State updates, number of tics / second.
// NOTE: used to setup the timer rate, see I_StartupTimer().
#define TICRATE 35

View file

@ -198,6 +198,8 @@ void P_ResetData(INT32 flags)
if (!init)
memset(skincolors, 0, sizeof(skincolors));
numskincolors = SKINCOLOR_FIRSTFREESLOT;
if (skincolornames)
Z_Free(skincolornames);
skincolornames = strbuf_alloc();

View file

@ -141,6 +141,35 @@ struct mobjinfo_t
extern mobjinfo_t mobjinfo[NUMMOBJTYPES];
extern size_t nummobjtypes;
typedef enum
{
#define _(name, ...) SKINCOLOR_##name,
#include "info/skincolors.h"
#undef _
SKINCOLOR_FIRSTFREESLOT,
SKINCOLOR_LASTFREESLOT = SKINCOLOR_FIRSTFREESLOT + NUMCOLORFREESLOTS - 1,
MAXSKINCOLORS,
FIRSTRAINBOWCOLOR = SKINCOLOR_PINK,
FIRSTSUPERCOLOR = SKINCOLOR_SUPER1,
NUMSUPERCOLORS = ((SKINCOLOR_FIRSTFREESLOT - FIRSTSUPERCOLOR)/5)
} skincolornum_t;
struct skincolor_t
{
UINT32 namehash; // Hash for internal name
UINT32 nameofs; // Offset for internal name
char name[MAXCOLORNAME+1]; // Skincolor name
UINT8 ramp[COLORRAMPSIZE]; // Colormap ramp
UINT16 invcolor; // Signpost color
UINT8 invshade; // Signpost color shade
UINT16 chatcolor; // Chat color
boolean accessible; // Accessible by the color command + setup menu
};
extern skincolor_t skincolors[MAXSKINCOLORS];
extern UINT16 numskincolors;
void P_ResetData(INT32 flags);
#ifdef __cplusplus

View file

@ -12,7 +12,7 @@
#ifndef __K_COLOR__
#define __K_COLOR__
#include "doomdef.h"
#include "info.h"
#include "doomtype.h"
#ifdef __cplusplus

View file

@ -13,7 +13,7 @@
#ifndef __M_COND_H__
#define __M_COND_H__
#include "doomdef.h"
#include "info.h"
#ifdef __cplusplus
extern "C" {

View file

@ -7994,7 +7994,6 @@ UINT16 M_GetColorAfter(UINT16 color) {
void M_InitPlayerSetupColors(void) {
UINT16 i;
numskincolors = SKINCOLOR_FIRSTFREESLOT;
menucolorhead = menucolortail = NULL;
for (i=0; i<numskincolors; i++)
M_AddMenuColor(i);