Expand SetLineActivation to Change Repeatableness

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Expand SetLineActivation to Change Repeatableness

Re: Expand SetLineActivation to Change Repeatableness

by Enjay » Tue Jul 15, 2025 5:01 am

Thank you. I'll open an issue on GitHub to ask for the UDB calltips to be updated too.

Re: Expand SetLineActivation to Change Repeatableness

by Blue Shadow » Mon Jul 14, 2025 5:57 pm

As long as your GZDoom and UDB are fairly recent, you should be able to use it. UDB's calltips files don't seem to be updated to include the new parameter. But they're just calltips. They shouldn't prevent you from using the new parameter and compiling the scripts successfully.

Re: Expand SetLineActivation to Change Repeatableness

by Enjay » Mon Jul 14, 2025 12:35 pm

Sorry for the bump.

It seems as if this functionality has been added to GZDoom, but I don't see any way of using it with ACS. Am I correct in assuming that "the ACC include still needs to be done later" is still the case?

Re: Expand SetLineActivation to Change Repeatableness

by Graf Zahl » Fri Apr 29, 2022 2:32 am

Added for GZDoom, the ACC include still needs to be done later

RockstarRaccoon wrote:I was thinking about this too: there needs to be a switch-reset special, if nothing else, so we can just turn them back on after they're used...

You have to set the special action again for that. It gets completely cleared when used with a one-time switch so reenabling is not possible.

Re: Expand SetLineActivation to Change Repeatableness

by RockstarRaccoon » Tue Feb 01, 2022 8:24 pm

Implementation notes...
Repeatability is defined by setting line_t.flags to ML_REPEAT_SPECIAL, defined in doomdefs.h.
We then go to bool P_ActivateLine in p_spec.cpp, where I see the following code...

Code: Select all

special = line->special;
if (!repeat && buttonSuccess)
{ // clear the special on non-retriggerable lines
	line->special = 0;
}

if (buttonSuccess)
{
	if (activationType == SPAC_Use || activationType == SPAC_Impact || activationType == SPAC_Push)
	{
		P_ChangeSwitchTexture (line->sidedef[0], repeat, special);
	}
}
...and that seems to be the only time deactivation ever comes up.

Looking at this, I'm realizing that you might be able to just reset the special and texture (and nothing else) to make it work, though, having the line remember its special so you can use an ACS special that just "resets" the line (animating the texture back to the off state and all) is FAR simpler for the mapper, and it sounds like it'd lead to more complex gameplay mechanics, something I'm always in favor of encouraging. All it'd really take is a flag in the flag-set that says if the trigger is "used" or something, then modifying the line-triggering code to check that when checking an activation on a non-repeatable (this isn't an intensively used operation like rendering, so that shouldn't be an issue).

Re: Expand SetLineActivation to Change Repeatableness

by RockstarRaccoon » Mon Jan 31, 2022 10:24 pm

I was thinking about this too: there needs to be a switch-reset special, if nothing else, so we can just turn them back on after they're used...

Expand SetLineActivation to Change Repeatableness

by Enjay » Tue Jan 04, 2022 6:18 am

For a map I have been working on, it would be useful to be able to change whether a line is repeatable or not. I am, of course, aware that there are several ways to remove a special or have a script ignore the actions of a line, but there have been a few times where it would have been best/easiest to be able to toggle whether the line was repeatable or not.

One of the most common situations where I have wanted to do this is with a switch operated line - repeatable lines always return the appearance of the switch to the off position after use. (This happens gardless of what the script does - including "brute-forcing" it to try and change the appearance by changing the texture using SetLineTexture.)

This is even more pressing where switches have several animated frames and perhaps separate on/off sounds rather than the simple on/off appearance and single sound of the default Doom switches.

So if a switch can be used many times, it needs to return to its off position to indicate that it can be used again. That's fine; that's what happens. However, if - eventually - there is one final time that the switch can be used and from that point on it is deactivated, remaining in its on appearance would look correct and give the player suitable feedback. If the repeatable nature of the switch could be turned off before that final use, setting up such a scenario would be nice and easy.

Relevant thread: viewtopic.php?f=122&t=74336

I don't know how feasible it would be, but it strikes me that adding this functionality to [wiki]SetLineActivation[/wiki] would make sense. So instead of SetLineActivation having these parameters:

SetLineActivation (int lineid, int activation);

it would have something like:

SetLineActivation (int lineid, int activation [,bool notrepeatable]);

(notrepeatable picked rather than repeatable because default should, I think, be 0/false.)

Top