ZScript: Status Bar Questions

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: ZScript: Status Bar Questions

Post by Matt »

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?
Blue Shadow
Posts: 5019
Joined: Sun Nov 14, 2010 12:59 am

Re: ZScript: Status Bar Questions

Post by Blue Shadow »

User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: ZScript: Status Bar Questions

Post by ZZYZX »

Are you trying to scale? Why not actually scale then?
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: ZScript: Status Bar Questions

Post by Matt »

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?
Blue Shadow
Posts: 5019
Joined: Sun Nov 14, 2010 12:59 am

Re: ZScript: Status Bar Questions

Post by Blue Shadow »

Would studying how it's used in DrawBar help?
https://github.com/coelckers/gzdoom/blo ... r.txt#L977
User avatar
Nash
 
 
Posts: 17454
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: ZScript: Status Bar Questions

Post by Nash »

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.
Blue Shadow
Posts: 5019
Joined: Sun Nov 14, 2010 12:59 am

Re: ZScript: Status Bar Questions

Post by Blue Shadow »

Yeah, that's what DrawBar does.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: ZScript: Status Bar Questions

Post by Matt »

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)?

Return to “Scripting”