Sign in to follow this  
Followers 0

damagetype

I'm seeking help with this one.

1. Can I define my own damagetypes?
2. I remember there were predefined damagetypes somewhere. But I can't find them in the EDF. Are they in the code? They were together with a note for us to limit ourselves to those damagetypes, not add new ones. If predefined damagetypes still exist, which are they?
3. The whole damagetype EDF block is suggested by this part of the 3.37.00 code (e_mod.c)? What I mean: these 4 are all the fields it uses?

//
// damagetype options
//

#define ITEM_DAMAGETYPE_NUM        "num"
#define ITEM_DAMAGETYPE_OBIT       "obituary"
#define ITEM_DAMAGETYPE_SELFOBIT   "obituaryself"
#define ITEM_DAMAGETYPE_SOURCELESS "sourceless"

cfg_opt_t edf_dmgtype_opts[] =
{
   CFG_INT(ITEM_DAMAGETYPE_NUM,         -1,        CFGF_NONE),
   CFG_STR(ITEM_DAMAGETYPE_OBIT,        NULL,      CFGF_NONE),
   CFG_STR(ITEM_DAMAGETYPE_SELFOBIT,    NULL,      CFGF_NONE),
   CFG_BOOL(ITEM_DAMAGETYPE_SOURCELESS, cfg_false, CFGF_NONE),
   CFG_END()
};
4. Finally, is it actually recommended to use them at this stage?

Share this post


Link to post

Interesting. Very interesting. Looks like damagetypes are differentiated by weapons, and I can make monsters behave differently when hit by something or another... and even be resistant.

Only "grenade" bothers me somewhat, because it's not in Doom and was only added as a MBF "selling" point (albeit not a bad one). What exactly marks a player-shot projectile as a grenade, not, say, a rocket?

Can I use damagefactor to make actors more vulnerable?

Share this post


Link to post
printz said:

Only "grenade" bothers me somewhat, because it's not in Doom and was only added as a MBF "selling" point (albeit not a bad one). What exactly marks a player-shot projectile as a grenade, not, say, a rocket?

Take a rocket. In DeHackEd, remove the MISSILE flag, and instead add the BOUNCES flag. You now have a grenade.

Yeah that's how they're done in MBF. Bouncing rocket that's not a missile. The result is a lot of hackery around (to make things with the BOUNCES flag pass the same checks that those with the MISSILE flag do, and also to mess around with cyberdemon/spiderdemon immunity to splash damage) to make it work.

Share this post


Link to post
Gez said:

and also to mess around with cyberdemon/spiderdemon immunity to splash damage)

I noticed that Eternity quietly removed that hack, so now, bouncing objects no longer breach through the BOSS barrier. Thankfully, I'll be adding an EDF patch that corrects it: FORCERADIUSDMG ;)

Does the grenade have to be a "rocket (in air)" (rocketshot) actor?

Share this post


Link to post
printz said:

I noticed that Eternity quietly removed that hack, so now, bouncing objects no longer breach through the BOSS barrier. Thankfully, I'll be adding an EDF patch that corrects it: FORCERADIUSDMG ;)

Does the grenade have to be a "rocket (in air)" (rocketshot) actor?

Damage types are not attached to any particular actor so you can give them to whatever you want. The GRENADE damagetype is actually a throwback to Eternity TC, which had a grenade launcher "attachment" for the rocket launcher as weapon 2 on slot 5. Because it has always been documented, I couldn't really remove it. And now that they're dynamic via EDF, it really doesn't matter.

Share this post


Link to post

Despite what is written in base\things.edf, can I make my own damagetypes, and the way to attach them to actors is through the mod thingtype keyword?

Share this post


Link to post
printz said:

I noticed that Eternity quietly removed that hack, so now, bouncing objects no longer breach through the BOSS barrier. Thankfully, I'll be adding an EDF patch that corrects it: FORCERADIUSDMG ;)

Does the grenade have to be a "rocket (in air)" (rocketshot) actor?


I think so but I don't remember.

Here's the code I had written to handle BOUNCES in DeHackEd for ZDoom:

if (value[0] & MF_BOUNCES)
{
	// BOUNCES (which occupies in MBF the MF_NOLIFTDROP slot)
	// This flag is especially convoluted as what it does depend on what
	// other flags the actor also has, and whether it's "sentient" or not.
	value[0] &= ~MF_BOUNCES; // clean the slot

	// MBF considers that things that bounce can be damaged, even if not shootable.
	info->flags6 |= MF6_VULNERABLE;
	// MBF also considers that bouncers pass through blocking lines as projectiles.
	info->flags3 |= MF3_NOBLOCKMONST;
	// MBF also considers that bouncers that explode are grenades, and MBF grenades
	// are supposed to hurt everything, except cyberdemons if they're fired by cybies.
	// Let's translate that in a more generic way as grenades which hurt everything
	// except the class of their shooter. Yes, it does diverge a bit from MBF, as for
	// example a dehacked arachnotron that shoots grenade would kill itself quickly
	// in MBF and will not here. But class-specific checks are cumbersome and limiting.
	info->flags4 |= (MF4_FORCERADIUSDMG | MF4_DONTHARMCLASS);

	// MBF bouncing missiles rebound on floors and ceiling, but not on walls.
	// This is different from BOUNCE_Heretic behavior as in Heretic the missiles
	// die when they bounce, while in MBF they will continue to bounce until they
	// collide with a wall or a solid actor.
	if (value[0] & MF_MISSILE) info->BounceFlags = BOUNCE_Classic;
	// MBF bouncing actors that do not have the missile flag will also rebound on
	// walls, and this does correspond roughly to the ZDoom bounce style.
	else info->BounceFlags = BOUNCE_Grenade;

	// MBF grenades are dehacked rockets that gain the BOUNCES flag but
	// lose the MISSILE flag, so they can be identified here easily.
	if (!(value[0] & MF_MISSILE) && info->effects & FX_ROCKET)
	{
		info->effects &= ~FX_ROCKET;	// replace rocket trail
		info->effects |= FX_GRENADE;	// by grenade trail
	}

	// MBF bounce factors depend on flag combos:
	enum
	{
		MBF_BOUNCE_NOGRAVITY	= FRACUNIT,		// With NOGRAVITY: full momentum
		MBF_BOUNCE_FLOATDROPOFF	= (FRACUNIT * 85) / 100,// With FLOAT and DROPOFF: 85%
		MBF_BOUNCE_FLOAT	= (FRACUNIT * 70) / 100,// With FLOAT alone: 70%
		MBF_BOUNCE_DEFAULT	= (FRACUNIT * 45) / 100,// Without the above flags: 45%
		MBF_BOUNCE_WALL		= (FRACUNIT * 50) / 100,// Bouncing off walls: 50%
	};
	info->bouncefactor = ((value[0] & MF_NOGRAVITY) ? MBF_BOUNCE_NOGRAVITY
		: (value[0] & MF_FLOAT) ? (value[0] & MF_DROPOFF) ? MBF_BOUNCE_FLOATDROPOFF
		: MBF_BOUNCE_FLOAT : MBF_BOUNCE_DEFAULT);

	info->wallbouncefactor = ((value[0] & MF_NOGRAVITY) ? MBF_BOUNCE_NOGRAVITY : MBF_BOUNCE_WALL);

	// MBF sentient actors with BOUNCE and FLOAT are able to "jump" by floating up.
	if (info->IsSentient())
	{
		if (value[0] & MF_FLOAT) info->flags6 |= MF6_CANJUMP;
	}
	// Non sentient actors can be damaged but they shouldn't bleed.
	else
	{
		value[0] |= MF_NOBLOOD;
	}
}
You can see how annoying it was to deal with that flag's highly context-dependent behavior.

Share this post


Link to post

It really is about the worst thing Lee did. Like he couldn't just add a flags2 field >_>

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0