A_OverlayPivot Screen Coordinates flag

Sat Sep 04, 2021 2:59 pm

Suggestion to make the WX/WY coordinates arguments of A_OverlayPivot to be interpreted as screen coordinates instead of offsets relative to the sprite being rotated, similar to how with HudMessage, x and y of 0.5 means to display the message to the center of the viewers monitor.

This would be tremendously useful for having multiple sprites of varying sizes that already have their offsets defined without rotation, but need to be overlayed on the hud with rotation. I have an example here: https://imgur.com/a/8NsIL7s where I need multiple overlays, but due to the different sizes between sprites, they look like they're erratically jumping, and quite frankly it's been a tremendous headache trying to solve for the needed pivot points I need this to work. If I could set this flag, and then set the values to (0.5, 0.5), this could tell the engine to pivot them around the center of the screen, instead around the sprites center.

Re: A_OverlayPivot Screen Coordinates flag

Wed Sep 15, 2021 12:29 pm

It's one of the first things I tried to go for, unfortunately, it didn't work out well. There's a number of complications that came up which had me ending my attempt to do so.

There is a way around it though if you're interested in learning about it. But it will have to be done on ZScript's side. Thankfully it's not hard.

First, set the image sprite offsets to 0, then offset the weapon by its four vertices instead. Fun fact: You can adjust the weapon via cvars thanks to ZScript so you can do it real time instead of having to restart the game over and over, to get the effect you want.

I believe the coordinates scale by 320x200, last I checked. It was a while ago. That or 320x240, you'll have to play around with it. That means you'll need to create a scalar for it and disable the percentage, implementing your own on ZScript side that scales up to those values.

Re: A_OverlayPivot Screen Coordinates flag

Sun Sep 19, 2021 12:02 pm

Major Cooke wrote:There is a way around it though if you're interested in learning about it. But it will have to be done on ZScript's side. Thankfully it's not hard.


This would be very much appreciated, because not having these rotations is very frustrating for me. If you can, for the sake of not bloating this thread, could you DM me a more clear explanation? I'm not sure what you mean by offsetting it by it's four vertices?

Re: A_OverlayPivot Screen Coordinates flag

Mon Sep 20, 2021 2:36 pm

Sure, though I prefer Discord. But whichever is most convenient for you.