- MBF21: remaining actor properties.

This commit is contained in:
Christoph Oelckers 2021-06-29 22:32:38 +02:00
parent e2e8ec8b3e
commit 9b3782ea0f
4 changed files with 69 additions and 60 deletions

View file

@ -1110,3 +1110,4 @@ xy(menu_advance, "menu/advance")
xx(zoomsize)
xx(ScreenJobRunner)
xx(RazeStatusBar)
xx(RipSound)

View file

@ -1004,34 +1004,81 @@ static int PatchThing (int thingy)
}
else if (linelen == 16 && stricmp(Line1, "infighting group") == 0)
{
stripwhite(Line2);
int grp = atoi(Line2);
if (grp < 0)
if (val < 0)
{
Printf("Infighting groups must be >= 0 (check your dehacked)\n");
grp = 0;
val = 0;
}
type->ActorInfo()->infighting_group = grp;
type->ActorInfo()->infighting_group = val;
}
else if (linelen == 16 && stricmp(Line1, "projectile group") == 0)
{
stripwhite(Line2);
int grp = atoi(Line2);
if (grp < 0) grp = -1;
type->ActorInfo()->projectile_group = grp;
if (val < 0) val = -1;
type->ActorInfo()->projectile_group = val;
}
else if (linelen == 12 && stricmp(Line1, "splash group") == 0)
{
stripwhite(Line2);
int grp = atoi(Line2);
if (grp < 0)
if (val < 0)
{
Printf("Splash groups must be >= 0 (check your dehacked)\n");
grp = 0;
val = 0;
}
type->ActorInfo()->splash_group = grp;
type->ActorInfo()->splash_group = val;
}
else if (linelen == 10 && stricmp(Line1, "fast speed") == 0)
{
double fval = val >= 256 ? DEHToDouble(val) : val;
info->FloatVar(NAME_FastSpeed) = fval;
}
else if (linelen == 11 && stricmp(Line1, "melee range") == 0)
{
info->meleerange = DEHToDouble(val);
}
else if (linelen == 10 && stricmp(Line1, "MBF21 Bits") == 0)
{
uint32_t value = 0;
bool vchanged = false;
char* strval;
for (strval = Line2; (strval = strtok(strval, ",+| \t\f\r")); strval = NULL)
{
if (IsNum(strval))
{
value |= (unsigned long)strtoll(strval, NULL, 10);
vchanged = true;
}
else
{
unsigned i;
for (i = 0; i < countof(deh_mobjflags_mbf21); i++)
{
if (!stricmp(strval, deh_mobjflags_mbf21[i].name))
{
vchanged = true;
value |= 1 << i;
break;
}
}
if (i == countof(deh_mobjflags_mbf21))
{
DPrintf(DMSG_ERROR, "Unknown bit mnemonic %s\n", strval);
}
}
}
if (vchanged)
{
ClearBits2Stuff(info);
for (size_t i = 0; i < countof(deh_mobjflags_mbf21); i++)
{
if (value & (1 << i))
{
deh_mobjflags_mbf21[i].setter(info);
}
}
}
DPrintf(DMSG_SPAMMY, "MBF21 Bits: %d (0x%08x)\n", info->flags.GetValue(), info->flags.GetValue());
}
else if (linelen > 6)
{
if (stricmp (Line1 + linelen - 6, " frame") == 0)
@ -1100,6 +1147,9 @@ static int PatchThing (int thingy)
info->DeathSound = snd;
else if (!strnicmp (Line1, "Action", 6))
info->ActiveSound = snd;
else if (!strnicmp(Line1, "Rip", 3))
info->SoundVar(NAME_RipSound) = snd;
}
}
else if (linelen == 4)
@ -1307,51 +1357,6 @@ static int PatchThing (int thingy)
DPrintf (DMSG_SPAMMY, "Bits: %d,%d (0x%08x,0x%08x)\n", info->flags.GetValue(), info->flags2.GetValue(),
info->flags.GetValue(), info->flags2.GetValue());
}
else if (stricmp(Line1, "MBF21 Bits") == 0)
{
uint32_t value = 0;
bool vchanged = false;
char* strval;
for (strval = Line2; (strval = strtok(strval, ",+| \t\f\r")); strval = NULL)
{
if (IsNum(strval))
{
value |= (unsigned long)strtoll(strval, NULL, 10);
vchanged = true;
}
else
{
unsigned i;
for (i = 0; i < countof(deh_mobjflags_mbf21); i++)
{
if (!stricmp(strval, deh_mobjflags_mbf21[i].name))
{
vchanged = true;
value |= 1 << i;
break;
}
}
if (i == countof(deh_mobjflags_mbf21))
{
DPrintf(DMSG_ERROR, "Unknown bit mnemonic %s\n", strval);
}
}
}
if (vchanged)
{
ClearBits2Stuff(info);
for (size_t i = 0; i < countof(deh_mobjflags_mbf21); i++)
{
if (value & (1 << i))
{
deh_mobjflags_mbf21[i].setter(info);
}
}
}
DPrintf(DMSG_SPAMMY, "MBF21 Bits: %d (0x%08x)\n", info->flags.GetValue(), info->flags.GetValue());
}
else if (stricmp (Line1, "ID #") == 0)
{
*ednum = (int16_t)val;

View file

@ -1599,7 +1599,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
{ // Ok to spawn blood
P_RipperBlood(tm.thing, thing);
}
S_Sound(tm.thing, CHAN_BODY, 0, "misc/ripslop", 1, ATTN_IDLE);
S_Sound(tm.thing, CHAN_BODY, 0, tm.thing->SoundVar(NAME_RipSound), 1, ATTN_IDLE);
// Do poisoning (if using new style poison)
if (tm.thing->PoisonDamage > 0 && tm.thing->PoisonDuration != INT_MIN)

View file

@ -262,6 +262,7 @@ class Actor : Thinker native
meta int ExplosionDamage;
meta int MeleeDamage;
meta Sound MeleeSound;
meta Sound RipSound;
meta double MissileHeight;
meta Name MissileName;
meta double FastSpeed; // speed in fast mode
@ -340,6 +341,7 @@ class Actor : Thinker native
property Ripperlevel: RipperLevel;
property RipLevelMin: RipLevelMin;
property RipLevelMax: RipLevelMax;
property RipSound: RipSound;
property RenderHidden: RenderHidden;
property RenderRequired: RenderRequired;
property FriendlySeeBlocks: FriendlySeeBlocks;
@ -403,6 +405,7 @@ class Actor : Thinker native
RipperLevel 0;
RipLevelMin 0;
RipLevelMax 0;
RipSound "misc/ripslop";
DefThreshold 100;
BloodType "Blood", "BloodSplatter", "AxeBlood";
ExplosionDamage 128;