Skip to content

Commit

Permalink
- MBF21: remaining actor properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jun 29, 2021
1 parent e2e8ec8 commit 9b3782e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 60 deletions.
1 change: 1 addition & 0 deletions src/common/engine/namedef.h
Expand Up @@ -1110,3 +1110,4 @@ xy(menu_advance, "menu/advance")
xx(zoomsize)
xx(ScreenJobRunner)
xx(RazeStatusBar)
xx(RipSound)
123 changes: 64 additions & 59 deletions src/gamedata/d_dehacked.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/playsim/p_map.cpp
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions wadsrc/static/zscript/actors/actor.zs
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9b3782e

Please sign in to comment.