A_FadeTo

Moderator: GZDoom Developers

Post Reply
Tribeam
Posts: 21
Joined: Fri Dec 22, 2006 3:23 pm

A_FadeTo

Post by Tribeam »

Pretty self explainitory but if not then let me explain.

A_FadeTo(alpha, amount)

similar to A_FadeIn and A_FadeOut except deprecate them and make one simple function

A_FadeTo(1.0, 0.2) would be the same as A_FadeIn(0.2)
A_FadeTo(0.0, 0.2) would be the same as A_FadeOut(0.2)

While deprecating the above 2 function, it'll also provide more flexibility in a way that you can actually fade to a certain alpha instead of making multiple actors or some other hacky way of making fading work.
User avatar
Captain Ventris
Posts: 4608
Joined: Mon Jul 31, 2006 4:25 pm
Location: San Antonio, TX

Re: A_FadeTo

Post by Captain Ventris »

Wouldn't it just make things more complicated if you wanted to fade relative to the actor's current alpha?
Tribeam
Posts: 21
Joined: Fri Dec 22, 2006 3:23 pm

Re: A_FadeTo

Post by Tribeam »

I really don't see how it could get complicated as it would always go from current alpha to the alpha specified
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: A_FadeTo

Post by XutaWoo »

Wait, what?

Wouldn't it be simpler just to define a value for the actor to gradually fade to, and then the speed it fades at?
Tribeam
Posts: 21
Joined: Fri Dec 22, 2006 3:23 pm

Re: A_FadeTo

Post by Tribeam »

XutaWoo wrote:Wait, what?

Wouldn't it be simpler just to define a value for the actor to gradually fade to, and then the speed it fades at?
Umm, Isn't that what i just explained?
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: A_FadeTo

Post by XutaWoo »

Oh, I thought it goes from alpha to amount.
User avatar
DavidPH
Posts: 382
Joined: Fri Aug 28, 2009 1:46 pm

Re: A_FadeTo

Post by DavidPH »

You would also need a boolean argument (or flags argument) to indicate that the actor is destroyed when it reaches the target transparency. Otherwise, it isn't actually a replacement for A_FadeOut. Or a destroy_alpha argument. Or FTF_DESTROY_AT_ZERO and FTF_DESTROY_AT_TARGET flags. (Just trying to think of what would be the most flexible.)

Other than that, the combined function makes more sense than the discreet functions (which I assume made sense at the time or are legacy). I think it's worth noting that this function could be combined with user variables to possibly great effect. Maybe the desired alpha is determined via some ornate logic and then is slowly shifted towards in the See/Idle state(s). Like, Pain state lowers the target and Melee state raises it. By using a user var, you could change the target at a different rate than you fade.

Oh! Oh! Or a monster who fades based on its current health/maximum health! Or... (etc. etc. Never a bad idea to come up with examples for a feature suggestion, right?)
User avatar
Cutmanmike
Posts: 11353
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Re: A_FadeTo

Post by Cutmanmike »

DavidPH wrote:Oh! Oh! Or a monster who fades based on its current health/maximum health!
Shhhh saying things like this usually makes the WFDS sticker rise from it's slumber :wink:
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: A_FadeTo

Post by Spleen »

Cutmanmike wrote:
DavidPH wrote:Oh! Oh! Or a monster who fades based on its current health/maximum health!
Shhhh saying things like this usually makes the WFDS sticker rise from it's slumber :wink:

[wiki]DECORATE_expressions[/wiki]

A_FadeTo(health, some_number) should already work if this is implemented :P
User avatar
DavidPH
Posts: 382
Joined: Fri Aug 28, 2009 1:46 pm

Re: A_FadeTo

Post by DavidPH »

Spleen wrote:
Cutmanmike wrote:
DavidPH wrote:Oh! Oh! Or a monster who fades based on its current health/maximum health!
Shhhh saying things like this usually makes the WFDS sticker rise from it's slumber :wink:

[wiki]DECORATE_expressions[/wiki]

A_FadeTo(health, some_number) should already work if this is implemented :P
Which was my whole point, noting all of the cool things that the addition of this one function would allow.

EDIT: Decided to try writing this myself, and came up with this:
A_FadeTo(float target, float amount = 0.1, bool remove = false)
Causes actor's transparency to move by amount towards target.
If remove is true and the actor's transparency reaches target, it is destroyed.

It works (as far as I've tested), there's just one problem: I don't know how to submit it. I know where, but not what format. Maybe there should be a Code Submissions Guidelines sticky?
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Re: A_FadeTo

Post by Ryan Cordell »

Post it as a .diff, I think.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_FadeTo

Post by Gez »

If you have something like TortoiseSVN, it's very simple. Right-click on your ZDoom source code directory, select "create patch". Then you can select which changed files to include in the patch. Do so, then save the patch. Zip it up and attach it in a post.
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: A_FadeTo

Post by Spleen »

Gez wrote:If you have something like TortoiseSVN, it's very simple. Right-click on your ZDoom source code directory, select "create patch". Then you can select which changed files to include in the patch. Do so, then save the patch. Zip it up and attach it in a post.
Thanks! Now I can go back and post a proper patch for the non-random hitscan damage. :)


I agree that there should be a "Code Submission Guidelines" sticky, also.
User avatar
DavidPH
Posts: 382
Joined: Fri Aug 28, 2009 1:46 pm

Re: A_FadeTo

Post by DavidPH »

Sorry, forgot to mention, I'm using Ubuntu (Linux). I tried using the diff program, but I'm not sure how useful the output is, in as much as it only works for one file at a time and does not provide a mechanism to properly identify the affected file(s). Mostly it's the latter that gave me uncertainty about it, since a zip containing the files actor.txt.diff and thingdef_codeptr.cpp.diff seems less than optimal to me. (Or I'm just being way overly cautious/stupid about the whole thing, but such is my way.)

EDIT: So, the command svn diff does what I needed. This is what over-reliance on man does to a... er... man...
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”