add "listmapthings" and "listunusedsprites" commands
the former also shows duplicated mapthings
This commit is contained in:
1 parent
52cd614613
commit
df63b3ece0
5 files changed
+195
-23
No files matched your search
+150
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "console.h"
|
||||
#include "command.h"
|
||||
#include "dehacked.h"
|
||||
#include "i_time.h"
|
||||
#include "i_system.h"
|
||||
#include "g_game.h"
|
||||
@@ -141,6 +142,8 @@ static void Command_Addfile(void);
|
||||
static void Command_Addskins(void);
|
||||
static void Command_GLocalSkin(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
static void Command_ListDoomednums_f(void);
|
||||
static void Command_ListUnusedSprites_f(void);
|
||||
static void Command_RunSOC(void);
|
||||
static void Command_Pause(void);
|
||||
static void Command_Respawn(void);
|
||||
@@ -705,6 +708,8 @@ void D_RegisterServerCommands(void)
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("localskin", Command_GLocalSkin);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
|
||||
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
|
||||
|
||||
COM_AddCommand("runsoc", Command_RunSOC);
|
||||
COM_AddCommand("pause", Command_Pause);
|
||||
@@ -4604,6 +4609,151 @@ static void Command_ListWADS_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define MAXDOOMEDNUM 4095
|
||||
|
||||
static void Command_ListDoomednums_f(void)
|
||||
{
|
||||
INT16 i, j, k = 0, l = 0;
|
||||
INT32 argc = COM_Argc();
|
||||
INT16 table[MAXDOOMEDNUM];
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 1:
|
||||
l = MAXDOOMEDNUM;
|
||||
break;
|
||||
case 3:
|
||||
l = atoi(COM_Argv(2));
|
||||
if (l < 1 || l > MAXDOOMEDNUM)
|
||||
{
|
||||
CONS_Printf("arg 2: doomednum \x82""%d \x85out of range (1-4095)\n", k);
|
||||
return;
|
||||
}
|
||||
//FALLTHRU
|
||||
case 2:
|
||||
k = atoi(COM_Argv(1));
|
||||
if (k < 1 || k > MAXDOOMEDNUM)
|
||||
{
|
||||
CONS_Printf("arg 1: doomednum \x82""%d \x85out of range (1-4095)\n", k);
|
||||
return;
|
||||
}
|
||||
if (!l)
|
||||
l = k;
|
||||
else if (l < k) // silently and helpfully swap.
|
||||
{
|
||||
j = k;
|
||||
k = l;
|
||||
l = j;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CONS_Printf("listmapthings: \x86too many arguments!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// see P_SpawnNonMobjMapThing
|
||||
memset(table, 0, sizeof(table));
|
||||
for (i = 1; i <= MAXPLAYERS; i++)
|
||||
table[i-1] = MT_PLAYER; // playerstarts
|
||||
table[33-1] = table[34-1] = table[35-1] = MT_PLAYER; // battle/team starts
|
||||
table[750-1] = table[777-1] = table[778-1] = MT_UNKNOWN; // slopes
|
||||
for (i = 600; i <= 609; i++)
|
||||
table[i-1] = MT_RING; // placement patterns
|
||||
table[1705-1] = table[1713-1] = MT_HOOP; // types of hoop
|
||||
|
||||
CONS_Printf("\x82""Checking for double defines...\n");
|
||||
for (i = 1; i < MT_FIRSTFREESLOT+NUMMOBJFREESLOTS; i++)
|
||||
{
|
||||
j = mobjinfo[i].doomednum;
|
||||
if (j < (k ? k : 1) || j > (l ? l : MAXDOOMEDNUM))
|
||||
continue;
|
||||
if (table[j-1])
|
||||
{
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is \x85""double-defined\x80 by ", j);
|
||||
if (i < MT_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf("\x87""hardcode %s <-- MAJOR ERROR\n", MOBJTYPE_LIST[i]);
|
||||
continue;
|
||||
}
|
||||
CONS_Printf("\x81""freeslot MT_""%s\n", FREE_MOBJS[i-MT_FIRSTFREESLOT]);
|
||||
continue;
|
||||
}
|
||||
table[j-1] = i;
|
||||
}
|
||||
CONS_Printf("\x82Printing doomednum usage...\n");
|
||||
if (!k)
|
||||
{
|
||||
i = 35; // skip MT_PLAYER spam
|
||||
CONS_Printf(" doomednums \x82""1-35""\x80 are used by ""\x87""hardcode MT_PLAYER\n");
|
||||
}
|
||||
else
|
||||
i = k-1;
|
||||
|
||||
for (; i < l; i++)
|
||||
{
|
||||
if (!table[i])
|
||||
{
|
||||
if (k)
|
||||
{
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is \x83""free!", i+1);
|
||||
if (i < 99) // above the humble crawla? how dare you
|
||||
CONS_Printf(" (Don't freeslot this low...)");
|
||||
CONS_Printf("\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is used by ", i+1);
|
||||
if (table[i] < MT_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf("\x87""hardcode %s\n", MOBJTYPE_LIST[table[i]]);
|
||||
continue;
|
||||
}
|
||||
CONS_Printf("\x81""freeslot MT_""%s\n", FREE_MOBJS[table[i]-MT_FIRSTFREESLOT]);
|
||||
}
|
||||
}
|
||||
|
||||
#undef MAXDOOMEDNUM
|
||||
|
||||
void Command_ListUnusedSprites_f(void)
|
||||
{
|
||||
size_t i, j;
|
||||
|
||||
CONS_Printf("\x82Printing sprite non-usage...\n");
|
||||
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
if (sprites[i].numframes)
|
||||
{
|
||||
// We're only showing unused sprites...
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i < SPR_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf(" \x87""hardcode SPR_""%.4s\n", sprnames[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] == 0xFF)
|
||||
{
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
CONS_Printf(" \x81""freeslot SPR_""%.4s\n", sprnames[i+j]);
|
||||
}
|
||||
|
||||
i += j;
|
||||
}
|
||||
|
||||
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8)))
|
||||
{
|
||||
CONS_Printf(" \x81""freeslot SPR_""%.4s\n", sprnames[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// MISC. COMMANDS
|
||||
// =========================================================================
|
||||
|
||||
+22
-22
@@ -14,7 +14,6 @@
|
||||
#include "d_main.h" // for srb2home
|
||||
#include "g_game.h"
|
||||
#include "sounds.h"
|
||||
#include "info.h"
|
||||
#include "d_think.h"
|
||||
#include "m_argv.h"
|
||||
#include "z_zone.h"
|
||||
@@ -33,12 +32,12 @@
|
||||
#include "r_sky.h"
|
||||
#include "r_draw.h" // translation colormap consts (for lua)
|
||||
#include "fastcmp.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_glib.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#include "d_clisrv.h"
|
||||
#include "v_video.h" // video flags (for lua)
|
||||
|
||||
#include "lua_glib.h"
|
||||
#include "lua_hook.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
@@ -48,13 +47,14 @@
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
static char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
static char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
static UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
|
||||
#define initfreeslots() {\
|
||||
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
|
||||
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
|
||||
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
|
||||
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
|
||||
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
|
||||
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
|
||||
}
|
||||
|
||||
// Crazy word-reading stuff
|
||||
@@ -3131,7 +3131,7 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
|
||||
// RegEx to generate this from info.h: ^\tS_([^,]+), --> \t"S_\1",
|
||||
// I am leaving the prefixes solely for clarity to programmers,
|
||||
// because sadly no one remembers this place while searching for full state names.
|
||||
static const char *const STATE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
const char *const STATE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
"S_NULL",
|
||||
"S_UNKNOWN",
|
||||
"S_INVISIBLE", // state for invisible sprite
|
||||
@@ -6345,7 +6345,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
||||
// RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1",
|
||||
// I am leaving the prefixes solely for clarity to programmers,
|
||||
// because sadly no one remembers this place while searching for full state names.
|
||||
static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
"MT_NULL",
|
||||
"MT_UNKNOWN",
|
||||
|
||||
@@ -7136,7 +7136,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
|
||||
#endif
|
||||
};
|
||||
|
||||
static const char *const MOBJFLAG_LIST[] = {
|
||||
const char *const MOBJFLAG_LIST[] = {
|
||||
"SPECIAL",
|
||||
"SOLID",
|
||||
"SHOOTABLE",
|
||||
@@ -7172,7 +7172,7 @@ static const char *const MOBJFLAG_LIST[] = {
|
||||
};
|
||||
|
||||
// \tMF2_(\S+).*// (.+) --> \t"\1", // \2
|
||||
static const char *const MOBJFLAG2_LIST[] = {
|
||||
const char *const MOBJFLAG2_LIST[] = {
|
||||
"AXIS", // It's a NiGHTS axis! (For faster checking)
|
||||
"TWOD", // Moves like it's in a 2D level
|
||||
"DONTRESPAWN", // Don't respawn this object!
|
||||
@@ -7205,7 +7205,7 @@ static const char *const MOBJFLAG2_LIST[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *const MOBJEFLAG_LIST[] = {
|
||||
const char *const MOBJEFLAG_LIST[] = {
|
||||
"ONGROUND", // The mobj stands on solid floor (not on another mobj or in air)
|
||||
"JUSTHITFLOOR", // The mobj just hit the floor while falling, this is cleared on next frame
|
||||
"TOUCHWATER", // The mobj stands in a sector with water, and touches the surface
|
||||
@@ -7223,14 +7223,14 @@ static const char *const MOBJEFLAG_LIST[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *const MAPTHINGFLAG_LIST[4] = {
|
||||
const char *const MAPTHINGFLAG_LIST[4] = {
|
||||
NULL,
|
||||
"OBJECTFLIP", // Reverse gravity flag for objects.
|
||||
"OBJECTSPECIAL", // Special flag used with certain objects.
|
||||
"AMBUSH" // Deaf monsters/do not react to sound.
|
||||
};
|
||||
|
||||
static const char *const PLAYERFLAG_LIST[] = {
|
||||
const char *const PLAYERFLAG_LIST[] = {
|
||||
// Flip camera angle with gravity flip prefrence.
|
||||
"FLIPCAM",
|
||||
|
||||
@@ -7302,7 +7302,7 @@ static const char *const PLAYERFLAG_LIST[] = {
|
||||
};
|
||||
|
||||
// Linedef flags
|
||||
static const char *const ML_LIST[16] = {
|
||||
const char *const ML_LIST[16] = {
|
||||
"IMPASSIBLE",
|
||||
"BLOCKMONSTERS",
|
||||
"TWOSIDED",
|
||||
@@ -7323,7 +7323,7 @@ static const char *const ML_LIST[16] = {
|
||||
|
||||
// This DOES differ from r_draw's Color_Names, unfortunately.
|
||||
// Also includes Super colors
|
||||
static const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
"NONE", // SKINCOLOR_NONE
|
||||
"WHITE", // SKINCOLOR_WHITE
|
||||
"SILVER", // SKINCOLOR_SILVER
|
||||
@@ -7491,7 +7491,7 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
"CSUPER5" // SKINCOLOR_CSUPER5,
|
||||
};
|
||||
|
||||
static const char *const POWERS_LIST[] = {
|
||||
const char *const POWERS_LIST[] = {
|
||||
"INVULNERABILITY",
|
||||
"SNEAKERS",
|
||||
"FLASHING",
|
||||
@@ -7526,7 +7526,7 @@ static const char *const POWERS_LIST[] = {
|
||||
"INGOOP" // In goop
|
||||
};
|
||||
|
||||
static const char *const KARTSTUFF_LIST[] = {
|
||||
const char *const KARTSTUFF_LIST[] = {
|
||||
"POSITION",
|
||||
"OLDPOSITION",
|
||||
"POSITIONDELAY",
|
||||
@@ -7613,7 +7613,7 @@ static const char *const KARTSTUFF_LIST[] = {
|
||||
"GROWCANCEL"
|
||||
};
|
||||
|
||||
static const char *const HUDITEMS_LIST[] = {
|
||||
const char *const HUDITEMS_LIST[] = {
|
||||
"LIVESNAME",
|
||||
"LIVESPIC",
|
||||
"LIVESNUM",
|
||||
|
||||
@@ -14,6 +14,26 @@
|
||||
#define __DEHACKED_H__
|
||||
|
||||
#include "m_fixed.h" // for get_number
|
||||
#include "info.h"
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
extern char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
extern char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
extern UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
|
||||
extern const char *const STATE_LIST[];
|
||||
extern const char *const MOBJTYPE_LIST[];
|
||||
extern const char *const MOBJFLAG_LIST[];
|
||||
extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2
|
||||
extern const char *const MOBJEFLAG_LIST[];
|
||||
extern const char *const MAPTHINGFLAG_LIST[4];
|
||||
extern const char *const PLAYERFLAG_LIST[];
|
||||
extern const char *const ML_LIST[]; // Linedef flags
|
||||
extern const char *COLOR_ENUMS[];
|
||||
extern const char *const POWERS_LIST[];
|
||||
extern const char *KARTSTUFF_LIST[];
|
||||
extern const char *const HUDITEMS_LIST[];
|
||||
|
||||
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
||||
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
#include "doomtype.h"
|
||||
#include "i_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "s_sound.h" //for soundprecaching
|
||||
#include "s_sound.h" // for soundprecaching
|
||||
#include "m_argv.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_things.h"
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#ifndef __SOUNDS__
|
||||
#define __SOUNDS__
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
// Customisable sounds for Skins
|
||||
typedef enum
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user