Action Special to reveal lines on automap

Moderator: GZDoom Developers

User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Action Special to reveal lines on automap

Post by RockstarRaccoon »

How about this then?

Code: Select all

AutoMap_RevealLine(int Lid = 0, int Tid = 0)

Code: Select all

AutoMap_RevealFloor(int Sid = 0, int Tid = 0)
Lid/Sid 0 is the whole map
Tid 0 is every player

I should ask though, because I wouldn't know, does the automap-pickup also reveal the floors for people who have that feature turned on? Because if not, lines would be enough... Of it is, I actually kinda would like control over that...
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Action Special to reveal lines on automap

Post by RockstarRaccoon »

Ok, so I'm looking at the code right now, and it seems like the first part of the solution would be to add the flag "ML_REVEALED" to the "ELineFlags" enums at line 131 of doomdata.h and line 105 of zscript/mapdata.txt, and to change line 2667 of am_map.cpp to...

Code: Select all

			else if (allmap || (line.flags & ML_REVEALED))
to allow the automap to draw lines with that flag.

Then it'd require an Action Special or something to be added to set that flag, obviously...

Would that work? Or is there a better way to do it? (it's been a long while since I've delved into the Doom source code, and this is way more complicated...)
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Action Special to reveal lines on automap

Post by Gez »

RockstarRaccoon wrote:How about this then?

Code: Select all

AutoMap_RevealLine(int Lid = 0, int Tid = 0)

Code: Select all

AutoMap_RevealFloor(int Sid = 0, int Tid = 0)
Lid/Sid 0 is the whole map
Tid 0 is every player
tid 0 is traditionally the activator. And since only players can have maps, you'd better do like the functions that use a player number directly, such as (random example) [wiki]GetAirSupply[/wiki].

I'm gonna insist on the generic, multipurpose solution:

Code: Select all

Line_SetFlag(int lid, enum flag, int playernum)
For reveal line, then, you'd have something like:

Code: Select all

Line_SetFlag(1337, LF_REVEALED, int 0)
See? Does what you want, and a lot more.
RockstarRaccoon wrote: I should ask though, because I wouldn't know, does the automap-pickup also reveal the floors for people who have that feature turned on? Because if not, lines would be enough... Of it is, I actually kinda would like control over that...
It doesn't.
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Action Special to reveal lines on automap

Post by RockstarRaccoon »

Gez wrote:tid 0 is traditionally the activator. And since only players can have maps, you'd better do like the functions that use a player number directly, such as (random example) [wiki]GetAirSupply[/wiki]
Oh right, duh. I forgot about that... -1 then?

And yeah, your example works just fine for me, the problem is really just that GZDoom currently has an all-or-nothing approach to this, and that's what I'd like to be changed.
RockstarRaccoon wrote:does the automap-pickup also reveal the floors for people who have that feature turned on?
It doesn't.
Ok, see, that's what I thought.
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Action Special to reveal lines on automap

Post by AFADoomer »

So, for the manual "stop-gap" - For the line mapping piece, at least, you can do something like this in ZScript:

Code: Select all

class LineRevealer : Thinker
{
    static void RevealLines(int lineid)
    {
        if (!lineid) { return; }

        LineIdIterator lines = LineIdIterator.Create(lineid);

        int l = lines.Next();

        while (l > -1)
        {
            level.lines[l].flags |= Line.ML_MAPPED;
            l = lines.Next();
        }
    }
}
Then do something like this in ACS:

Code: Select all

script "Reveal" (int lineid)
{
	ScriptCall("LineRevealer", "RevealLines", lineid);
}
Where Calling Script "Reveal" with an argument of 666 would reveal any line tagged with id 666. Not tested in multiplayer - so I don't know if it only affects the current player or if everyone gets the lines mapped.

EDIT: Demo. Check the map before/after using each switch.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Action Special to reveal lines on automap

Post by Nash »

RockstarRaccoon wrote:Ok, so I'm looking at the code right now, and it seems like the first part of the solution would be to add the flag "ML_REVEALED" to the "ELineFlags" enums at line 131 of doomdata.h and line 105 of zscript/mapdata.txt, and to change line 2667 of am_map.cpp to...

Code: Select all

			else if (allmap || (line.flags & ML_REVEALED))
to allow the automap to draw lines with that flag.

Then it'd require an Action Special or something to be added to set that flag, obviously...

Would that work? Or is there a better way to do it? (it's been a long while since I've delved into the Doom source code, and this is way more complicated...)
No. As I already said before, it's not just a matter of adding a new flag. The drawing logic in AM_drawWalls needs to be modified to use this new data in a meaningful way.
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Action Special to reveal lines on automap

Post by RockstarRaccoon »

Nash wrote:No. As I already said before, it's not just a matter of adding a new flag. The drawing logic in AM_drawWalls needs to be modified to use this new data in a meaningful way.
Um... You didn't look closely enough at what I said there...
RockstarRaccoon wrote:add the flag "ML_REVEALED" to the "ELineFlags" enums at line 131 of doomdata.h and line 105 of zscript/mapdata.txt, and to change line 2667 of am_map.cpp to...

Code: Select all

			else if (allmap || (line.flags & ML_REVEALED))
to allow the automap to draw lines with that flag.
Line 2667 of AM_map is the part of AM_drawWalls that draws the stuff that's been mapped but not seen.
User avatar
SuperDon
Posts: 12
Joined: Sun Apr 24, 2016 6:38 am

Re: Action Special to reveal lines on automap

Post by SuperDon »

I would totally use this in Membrane if it gets implemented. I currently have computer terminals that reveal the whole map, but it would be better to reveal part of the map.
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Action Special to reveal lines on automap

Post by RockstarRaccoon »

RockstarRaccoon wrote:Ok, so I'm looking at the code right now, and it seems like the first part of the solution would be to add the flag "ML_REVEALED" to the "ELineFlags" enums at line 131 of doomdata.h and line 105 of zscript/mapdata.txt, and to change line 2667 of am_map.cpp to...

Code: Select all

			else if (allmap || (line.flags & ML_REVEALED))
to allow the automap to draw lines with that flag.

Then it'd require an Action Special or something to be added to set that flag, obviously...

Would that work? Or is there a better way to do it? (it's been a long while since I've delved into the Doom source code, and this is way more complicated...)
This implementation works, I have an experimental build and plan to submit it as soon as I can give the mapper dynamic control through a script or something (it's just a UDMF flag right now), along with an implentation of a linedef display field.
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Action Special to reveal lines on automap

Post by RockstarRaccoon »

Done.
Image

UDMF flag is "revealed", and uses the exact same drawing code as if the player picked up an automap item.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Action Special to reveal lines on automap

Post by Graf Zahl »

RockstarRaccoon wrote:Done.
Where?
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Action Special to reveal lines on automap

Post by RockstarRaccoon »

I haven't submitted the code yet. I'm just making sure it's all clean first. You should have it by the end of the day.
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Action Special to reveal lines on automap

Post by RockstarRaccoon »

https://github.com/coelckers/gzdoom/pull/483
Here it is. Sorry for the mess of it being to an older version of the files: I didn't think to set up the git stuff...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Action Special to reveal lines on automap

Post by Graf Zahl »

How did you commit this? It has some line ending conflicts which make it impossible to merge without whacking the repo. I fortunately noticed before pushing and creating a real problem.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Action Special to reveal lines on automap

Post by Nash »

Looks like a very dirty PR, for a feature this minimal. I'd recommend pulling the latest commit from master and redoing everything cleanly.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”