PlayerUse / PlayerBump states

Moderator: GZDoom Developers

Post Reply
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

PlayerUse / PlayerBump states

Post by bagheadspidey »

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.
use_bump_states_r1857.patch.txt
(948 Bytes) Downloaded 36 times
edit - this version honors the Activation flags THINGSPEC_ThingTargets and THINGSPEC_TriggerTargets.
use_bump_states_2_r1857.patch.txt
(1.29 KiB) Downloaded 30 times
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: PlayerUse / PlayerBump states

Post by Gez »

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:
usestate.zip
(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.
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

Re: PlayerUse / PlayerBump states

Post by bagheadspidey »

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?

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"
    }

} 
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.
Yeah, I thought that too, makes sense to me...

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?
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: PlayerUse / PlayerBump states

Post by Gez »

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? :?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: PlayerUse / PlayerBump states

Post by Graf Zahl »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: PlayerUse / PlayerBump states

Post by Graf Zahl »

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:
usestate.zip
(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.
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

Re: PlayerUse / PlayerBump states

Post by bagheadspidey »

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.
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: PlayerUse / PlayerBump states

Post by Gez »

I've something that's working, and relies on the Active and Inactive states.

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
}
User avatar
Captain Ventris
Posts: 4608
Joined: Mon Jul 31, 2006 4:25 pm
Location: San Antonio, TX

Re: PlayerUse / PlayerBump states

Post by Captain Ventris »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: PlayerUse / PlayerBump states

Post by Graf Zahl »

@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.
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: PlayerUse / PlayerBump states

Post by Gez »

Reworking it.

Reworked it.
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: PlayerUse / PlayerBump states

Post by Gez »

I suppose I should have made a new post rather than editing the old.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: PlayerUse / PlayerBump states

Post by Graf Zahl »

Correct! The thread was never flagged as updated so I didn't check.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”