PlayerUse / PlayerBump states
Moderator: GZDoom Developers
- bagheadspidey
- Posts: 1490
- Joined: Sat Oct 20, 2007 10:31 pm
- Contact:
PlayerUse / PlayerBump states
This patch adds two new states, "PlayerUse" and "PlayerBump."
- If a thing has a "PlayerUse" state, it will jump to it when a player presses "use" on the thing (unless the thing has the USESPECIAL flag).
- If a thing has a "PlayerBump" state, it will jump to it when a player bumps into the thing.
Reasoning: this allows for activatible /bumpable items without requiring the use of ACS (SetThingSpecial) or placing specials on things in a map editor.
edit - this version honors the Activation flags THINGSPEC_ThingTargets and THINGSPEC_TriggerTargets.
- If a thing has a "PlayerUse" state, it will jump to it when a player presses "use" on the thing (unless the thing has the USESPECIAL flag).
- If a thing has a "PlayerBump" state, it will jump to it when a player bumps into the thing.
Reasoning: this allows for activatible /bumpable items without requiring the use of ACS (SetThingSpecial) or placing specials on things in a map editor.
edit - this version honors the Activation flags THINGSPEC_ThingTargets and THINGSPEC_TriggerTargets.
Re: PlayerUse / PlayerBump states
Why don't you make this as additional THINGSPEC_ flags, e.g. THINGSPEC_ChangeState? It could go into the normal USESPECIAL/BUMPSPECIAL blocks instead of following them. E.g., something like this I guess:
Speaking about THINGSPEC_ flag, I'm thinking that both USESPECIAL and BUMPSPECIAL could be removed as mobj flags and moved there. It'd make sense. Even if the flags remain convenient.
(Edit: new version without copy/pasta error. Still untested, though.) Speaking about THINGSPEC_ flag, I'm thinking that both USESPECIAL and BUMPSPECIAL could be removed as mobj flags and moved there. It'd make sense. Even if the flags remain convenient.
- bagheadspidey
- Posts: 1490
- Joined: Sat Oct 20, 2007 10:31 pm
- Contact:
Re: PlayerUse / PlayerBump states
Actually, I've been thinking about this and I'm not sure it's actually necessary... Not tested, but wouldn't something like this work?
Another flag that might be good would be a flag to make the thing not execute its special on death... is there already one for that?
Code: Select all
ACTOR z2 : ZombieMan replaces ZombieMan
{
+BUMPSPECIAL
activation THINGSPEC_ThingActs | THINGSPEC_ThingTargets
States
{
Spawn:
TNT1 A 1
TNT1 A 0 Thing_SetSpecial (0, A_Jump, 255, "GetBumped")
goto "ZombieMan::Spawn"
GetBumped:
TNT1 A 0 ACS_ExecuteAlways (...)
TNT1 A 0 A_DoStuffWithTarget
TNT1 A 0 ...
goto "ZombieMan::Spawn"
}
}
Yeah, I thought that too, makes sense to me...Speaking about THINGSPEC_ flag, I'm thinking that both USESPECIAL and BUMPSPECIAL could be removed as mobj flags and moved there. It'd make sense. Even if the flags remain convenient.
Another flag that might be good would be a flag to make the thing not execute its special on death... is there already one for that?
Re: PlayerUse / PlayerBump states
Not as far as I know. Also, THINGSPEC_Blah is a bit of a mouthful, so I suppose there could be shorter aliases defined as well. They are activation flags, so maybe AF_Blah? Or maybe do away with the prefix altogether? "activation ThingTargets|ThingActs" would look prettier in the decorate code than what we have right now.
I'd do that myself but I'm busy trying to understand why I get weird messages such as SC_GetNumber: Bad numeric constant "1,". in my current ZDoom Code Project (tm), as nowhere else does FScanner::MustGetNumber want to include the comma as part of the number, so this puzzles me. DEHSUPP, for example, contains a lot of "1," that are parsed by this function without this odd complaint, so why doesn't my new lump work?
I'd do that myself but I'm busy trying to understand why I get weird messages such as SC_GetNumber: Bad numeric constant "1,". in my current ZDoom Code Project (tm), as nowhere else does FScanner::MustGetNumber want to include the comma as part of the number, so this puzzles me. DEHSUPP, for example, contains a lot of "1," that are parsed by this function without this odd complaint, so why doesn't my new lump work?

- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49223
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: PlayerUse / PlayerBump states
Gez wrote:Not as far as I know. Also, THINGSPEC_Blah is a bit of a mouthful, so I suppose there could be shorter aliases defined as well. They are activation flags, so maybe AF_Blah? Or maybe do away with the prefix altogether? "activation ThingTargets|ThingActs" would look prettier in the decorate code than what we have right now.
Some prefix must remain. Even though they aren't right now later they will be constants.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49223
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: PlayerUse / PlayerBump states
Gez wrote:Why don't you make this as additional THINGSPEC_ flags, e.g. THINGSPEC_ChangeState? It could go into the normal USESPECIAL/BUMPSPECIAL blocks instead of following them. E.g., something like this I guess:(Edit: new version without copy/pasta error. Still untested, though.)
You can't name the state 'use'. Use already has a specific meaning and this might clash in some situations.
- bagheadspidey
- Posts: 1490
- Joined: Sat Oct 20, 2007 10:31 pm
- Contact:
Re: PlayerUse / PlayerBump states
Bumping this. That code sample I made a few posts ago will not work, since A_Jump is not a special... not sure what I was thinking. I'd like to re-open this for consideration as it would provide a way to have things do semi-complex stuff when used / bumped without any need for ACS.
Re: PlayerUse / PlayerBump states
I've something that's working, and relies on the Active and Inactive states.
I tested this code with these things in Hexen:
I tested this code with these things in Hexen:
Code: Select all
Actor BumpFireBull : ZFireBullUnlit
{
+BUMPSPECIAL
Activation THINGSPEC_Switch
}
Actor UseFireBull : ZFireBullUnlit
{
+USESPECIAL
Activation THINGSPEC_Switch
}
- Captain Ventris
- Posts: 4608
- Joined: Mon Jul 31, 2006 4:25 pm
- Location: San Antonio, TX
Re: PlayerUse / PlayerBump states
I am fully supporting of this concept. Think of the possibilities with allies! For example, pressing use to set them into some sort of guard state or something?
I have absolutely no input as far as coding, just saying that this would be epically awesome.
I have absolutely no input as far as coding, just saying that this would be epically awesome.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49223
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: PlayerUse / PlayerBump states
@Gez:
That's much better but I've got one big issue with it. The handling of the USESPECIAL/BUMPSPECIAL flags is inconsistent. If they are specified as part of 'Activation' they don't behave as expected. In fact they can't due to compatibility needs. In such a situation your flag cleanup may be more counterproductive than useful.
Also, your SaveVersion check looks wrong.
That's much better but I've got one big issue with it. The handling of the USESPECIAL/BUMPSPECIAL flags is inconsistent. If they are specified as part of 'Activation' they don't behave as expected. In fact they can't due to compatibility needs. In such a situation your flag cleanup may be more counterproductive than useful.
Also, your SaveVersion check looks wrong.
Re: PlayerUse / PlayerBump states
Reworking it.
Reworked it.
Reworked it.
Re: PlayerUse / PlayerBump states
I suppose I should have made a new post rather than editing the old.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49223
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: PlayerUse / PlayerBump states
Correct! The thread was never flagged as updated so I didn't check.