Implement separate Woof!-exclusive Thing flags (#2279)

* add MIRROREDCORPSE enemy corpses to Legacy of Rust

* implement 'Woof Bits' randomly flipped corspes

* add 'Woof Bits' to save data
This commit is contained in:
elf-alchemist 2025-06-02 05:25:57 -03:00 committed by GitHub
parent c378d97aef
commit 451618d435
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 105 additions and 16 deletions

View File

@ -220,6 +220,7 @@ set(BASE_SOURCES
hacx.wad/brghtmps.lmp
hacx.wad/dehacked.deh
id1.wad/dehacked.lmp
id1.wad/sbardef.lmp
rekkr.wad/dehacked.lmp

26
base/id1.wad/dehacked.lmp Normal file
View File

@ -0,0 +1,26 @@
# [Woof!] Randomly mirrored corpses.
Thing 150
Woof Bits = MIRROREDCORPSE
Thing 151
Woof Bits = MIRROREDCORPSE
Thing 152
Woof Bits = MIRROREDCORPSE
Thing 153
Woof Bits = MIRROREDCORPSE
Thing 154
Woof Bits = MIRROREDCORPSE
Thing 155
Woof Bits = MIRROREDCORPSE
Thing 156
Woof Bits = MIRROREDCORPSE
Thing 157
Woof Bits = MIRROREDCORPSE

View File

@ -1159,6 +1159,7 @@ enum
// [Woof!]
DEH_MOBJINFO_BLOODCOLOR,
DEH_MOBJINFO_FLAGS_EXTRA,
// DEHEXTRA
DEH_MOBJINFO_DROPPEDITEM,
@ -1202,6 +1203,7 @@ static const char *deh_mobjinfo[] = {
// [Woof!]
"Blood color", // .bloodcolor
"Woof Bits", // .flags_extra
// DEHEXTRA
"Dropped item", // .droppeditem
@ -1287,6 +1289,10 @@ static const deh_flag_t deh_mobjflags_mbf21[] = {
{"FULLVOLSOUNDS", MF2_FULLVOLSOUNDS}, // full volume see / death sound
};
static const deh_flag_t deh_mobjflags_extra[] = {
{"MIRROREDCORPSE", MFX_MIRROREDCORPSE} // [crispy] randomly flip corpse, blood and death animation sprites
};
static const deh_flag_t deh_weaponflags_mbf21[] = {
{"NOTHRUST", WPF_NOTHRUST}, // doesn't thrust Mobj's
{"SILENT", WPF_SILENT}, // weapon is silent
@ -1905,6 +1911,39 @@ static void deh_procThing(DEHFILE *fpin, char *line)
switch (ix)
{
// Woof!
case DEH_MOBJINFO_FLAGS_EXTRA:
if (!value)
{
for (value = 0; (strval = strtok(strval, ",+| \t\f\r"));
strval = NULL)
{
size_t iy;
for (iy = 0; iy < arrlen(deh_mobjflags_extra); iy++)
{
if (strcasecmp(strval,
deh_mobjflags_extra[iy].name))
{
continue;
}
value |= deh_mobjflags_extra[iy].value;
break;
}
if (iy >= arrlen(deh_mobjflags_extra))
{
deh_log(
"Could not find Woof bit mnemonic %s\n",
strval);
}
}
}
mobjinfo[indexnum].flags_extra = value;
break;
// mbf21: process thing flags
case DEH_MOBJINFO_FLAGS2:
if (!value)

View File

@ -1566,16 +1566,16 @@ static void D_InitTables(void)
case MT_CYBORG:
continue;
}
mobjinfo[i].flags2 |= MF2_FLIPPABLE;
mobjinfo[i].flags_extra |= MFX_MIRROREDCORPSE;
}
mobjinfo[MT_PUFF].flags2 |= MF2_FLIPPABLE;
mobjinfo[MT_BLOOD].flags2 |= MF2_FLIPPABLE;
mobjinfo[MT_PUFF].flags_extra |= MFX_MIRROREDCORPSE;
mobjinfo[MT_BLOOD].flags_extra |= MFX_MIRROREDCORPSE;
for (i = MT_MISC61; i <= MT_MISC69; ++i)
mobjinfo[i].flags2 |= MF2_FLIPPABLE;
mobjinfo[i].flags_extra |= MFX_MIRROREDCORPSE;
mobjinfo[MT_DOGS].flags2 |= MF2_FLIPPABLE;
mobjinfo[MT_DOGS].flags_extra |= MFX_MIRROREDCORPSE;
for (i = S_SARG_RUN1; i <= S_SARG_PAIN2; ++i)
states[i].flags |= STATEF_SKILL5FAST;

View File

@ -1519,6 +1519,7 @@ typedef struct
int meleerange;
// [Woof!]
int flags_extra; // [EA] Woof!-exclusive extension
int bloodcolor; // [FG] colored blood and gibs
// DEHEXTRA
mobjtype_t droppeditem; // mobj to drop after death

View File

@ -1771,7 +1771,7 @@ static boolean P_HealCorpse(mobj_t* actor, int radius, statenum_t healstate, sfx
corpsehit->type, corpsehit->x>>FRACBITS, corpsehit->y>>FRACBITS);
}
corpsehit->flags2 &= ~MF2_COLOREDBLOOD;
corpsehit->flags_extra &= ~MFX_COLOREDBLOOD;
corpsehit->bloodcolor = 0;
corpsehit->health = info->spawnhealth;

View File

@ -766,7 +766,7 @@ static void P_KillMobj(mobj_t *source, mobj_t *target, method_t mod)
target->tics -= P_Random(pr_killtics)&3;
// [crispy] randomly flip corpse, blood and death animation sprites
if (target->flags2 & MF2_FLIPPABLE)
if (target->flags_extra & MFX_MIRROREDCORPSE)
{
if (Woof_Random() & 1)
target->intflags |= MIF_FLIP;

View File

@ -2048,7 +2048,7 @@ boolean PIT_ChangeSector(mobj_t *thing)
thing->height = thing->radius = 0;
if (thing->info->bloodcolor)
{
thing->flags2 |= MF2_COLOREDBLOOD;
thing->flags_extra |= MFX_COLOREDBLOOD;
thing->bloodcolor = V_BloodColor(thing->info->bloodcolor);
}
return true; // keep checking
@ -2088,7 +2088,7 @@ boolean PIT_ChangeSector(mobj_t *thing)
if (thing->info->bloodcolor)
{
mo->flags2 |= MF2_COLOREDBLOOD;
mo->flags_extra |= MFX_COLOREDBLOOD;
mo->bloodcolor = V_BloodColor(thing->info->bloodcolor);
}

View File

@ -843,6 +843,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->height = info->height; // phares
mobj->flags = info->flags;
mobj->flags2 = info->flags2;
mobj->flags_extra = info->flags_extra;
// killough 8/23/98: no friends, bouncers, or touchy things in old demos
if (demo_version < DV_MBF)
@ -901,7 +902,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->friction = ORIG_FRICTION; // phares 3/17/98
// [crispy] randomly flip corpse, blood and death animation sprites
if (mobj->flags2 & MF2_FLIPPABLE && !(mobj->flags & MF_SHOOTABLE))
if (mobj->flags_extra & MFX_MIRROREDCORPSE && !(mobj->flags & MF_SHOOTABLE))
{
if (Woof_Random() & 1)
mobj->intflags |= MIF_FLIP;
@ -1388,7 +1389,7 @@ void P_SpawnBlood(fixed_t x,fixed_t y,fixed_t z,int damage,mobj_t *bleeder)
th->tics -= P_Random(pr_spawnblood)&3;
if (bleeder->info->bloodcolor)
{
th->flags2 |= MF2_COLOREDBLOOD;
th->flags_extra |= MFX_COLOREDBLOOD;
th->bloodcolor = V_BloodColor(bleeder->info->bloodcolor);
}

View File

@ -220,10 +220,15 @@ typedef enum
MF2_E4M8BOSS = 0x00010000, // is an E4M8 boss
MF2_RIP = 0x00020000, // missile rips through solid
MF2_FULLVOLSOUNDS = 0x00040000, // full volume see / death sound
MF2_COLOREDBLOOD = 0x00080000, // [FG] colored blood and gibs
MF2_FLIPPABLE = 0x00100000, // [crispy] randomly flip corpse, blood and death animation sprites
} mobjflag2_t;
// [EA] Woof!-exclusive extension
typedef enum
{
MFX_COLOREDBLOOD = 0x00000001, // [FG] colored blood and gibs
MFX_MIRROREDCORPSE = 0x00000002, // [crispy] randomly flip corpse, blood and death animation sprites
} mobjflag_extra_t;
// killough 9/15/98: Same, but internal flags, not intended for .deh
// (some degree of opaqueness is good, to avoid compatibility woes)
@ -306,6 +311,7 @@ typedef struct mobj_s
state_t* state;
int flags;
int flags2; // mbf21
int flags_extra; // Woof!
int intflags; // killough 9/15/98: internal flags
int health;

View File

@ -332,6 +332,13 @@ static void saveg_read_mobj_t(mobj_t *str)
str->flags2 = mobjinfo[str->type].flags2;
}
if (saveg_compat > saveg_woof1500)
{
// Woof!-exclusive extension
// int flags_extra;
str->flags_extra = saveg_read32();
}
// int intflags
str->intflags = saveg_read32();
@ -526,6 +533,10 @@ static void saveg_write_mobj_t(mobj_t *str)
// [Woof!]: mbf21: int flags2;
saveg_write32(str->flags2);
// Woof!-exclusive extension
// int flags_extra;
saveg_write32(str->flags_extra);
// int intflags;
saveg_write32(str->intflags);

View File

@ -383,6 +383,7 @@ typedef struct vissprite_s
int patch;
int mobjflags;
int mobjflags2;
int mobjflags_extra; // Woof!
// for color translation and shadow draw, maxbright frames as well
lighttable_t *colormap[2];

View File

@ -437,7 +437,7 @@ void R_DrawVisSprite(vissprite_t *vis, int x1, int x2)
colfunc = R_DrawFuzzColumn; // killough 3/14/98
else
// [FG] colored blood and gibs
if (vis->mobjflags2 & MF2_COLOREDBLOOD)
if (vis->mobjflags_extra & MFX_COLOREDBLOOD)
{
colfunc = R_DrawTranslatedColumn;
dc_translation = red2col[vis->color];
@ -585,7 +585,7 @@ static void R_ProjectSprite (mobj_t* thing)
// [crispy] randomly flip corpse, blood and death animation sprites
if (STRICTMODE(flipcorpses) &&
(thing->flags2 & MF2_FLIPPABLE) &&
(thing->flags_extra & MFX_MIRROREDCORPSE) &&
!(thing->flags & MF_SHOOTABLE) &&
(thing->intflags & MIF_FLIP))
{
@ -647,6 +647,7 @@ static void R_ProjectSprite (mobj_t* thing)
vis->mobjflags = thing->flags;
vis->mobjflags2 = thing->flags2;
vis->mobjflags_extra = thing->flags_extra;
vis->scale = xscale;
vis->gx = interpx;
vis->gy = interpy;
@ -857,6 +858,7 @@ void R_DrawPSprite (pspdef_t *psp)
vis = &avis;
vis->mobjflags = 0;
vis->mobjflags2 = 0;
vis->mobjflags_extra = 0;
// killough 12/98: fix psprite positioning problem
vis->texturemid = (BASEYCENTER<<FRACBITS) /* + FRACUNIT/2 */ -

View File

@ -672,6 +672,7 @@ boolean VX_ProjectVoxel (mobj_t * thing)
vis->mobjflags = thing->flags;
vis->mobjflags2 = thing->flags2;
vis->mobjflags_extra = thing->flags_extra;
vis->scale = xscale;
vis->gx = gx;
@ -1045,7 +1046,7 @@ void VX_DrawVoxel (vissprite_t * spr)
spr->colormap[0] = new_colormap;
}
if ((spr->mobjflags2 & MF2_COLOREDBLOOD) && (spr->colormap[0] != NULL))
if ((spr->mobjflags_extra & MFX_COLOREDBLOOD) && (spr->colormap[0] != NULL))
{
static const byte * prev_trans = NULL, * prev_map = NULL;
const byte * trans = red2col[spr->color], * map = spr->colormap[0];