Re: ZScript: Status Bar Questions

Tue Sep 19, 2017 12:19 pm

cotton_disciple wrote:Does anyone know how to get powermorph duration?
The same as any other powerup duration, I would speculate? (sorry I don't know for sure)


I'm thinking of possibly implementing a first focal plane reticle to at least one of the guns in HD.

Is there a way to dynamically crop an image, so I wouldn't have to have a different TEXTURES entry for every possible magnification?

Re: ZScript: Status Bar Questions

Tue Sep 19, 2017 1:01 pm

Try SetClipRect().
https://github.com/coelckers/gzdoom/blo ... e.txt#L173

Re: ZScript: Status Bar Questions

Tue Sep 19, 2017 2:23 pm

Are you trying to scale? Why not actually scale then?

Re: ZScript: Status Bar Questions

Tue Sep 19, 2017 5:01 pm

ZZYZX: I'm trying to scale an image up, but then also crop off the parts of the image that extend beyond certain bounds of the screen.

In this particular situation if I simply scaled the crosshair image you'd see the ends of the crosshair sticking out from where the sides of the scope ought to be.

Blue Shadow: Thanks! That was the function I thought I saw somewhere but couldn't remember the name...

I'm looking at the code for SetClipRect now but I don't see anything indicating what exactly any given SetClipRect call is supposed to clip. I do see, however, some stuff in the source code like "screen->SetClipRect" and whatnot. I take it there's some way to set up some sub-entity for this? Or is this restricted to affecting the entire HUD?

EDIT: Or do I have to call SetClipRect twice, once for this thing and once to set it back to normal to draw other stuff?

Re: ZScript: Status Bar Questions

Tue Sep 19, 2017 9:29 pm

Would studying how it's used in DrawBar help?
https://github.com/coelckers/gzdoom/blo ... r.txt#L977

Re: ZScript: Status Bar Questions

Wed Sep 20, 2017 1:58 am

A general practice which I hopefully think is correct is to always save the previous clipping rectangle first so that it can be restored later when you are done clipping your own graphics.

Re: ZScript: Status Bar Questions

Wed Sep 20, 2017 9:07 am

Yeah, that's what DrawBar does.

Re: ZScript: Status Bar Questions

Mon Oct 02, 2017 11:56 am

Thanks guys! I've finally implemented this and it works exactly as hoped!

Is there any way to colourize an image on the HUD (other than to create a green version of it and mark it as translatable)?