A_ZoomFactor is weird

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
Post Reply
lemonTasteIceTea
Posts: 2
Joined: Sun Dec 12, 2021 12:29 pm
Graphics Processor: Intel (Modern GZDoom)

A_ZoomFactor is weird

Post by lemonTasteIceTea »

since you can't do something like A_ZoomFactor(zoom-0.1) i made an acs script which when called gets the current zoom factor, subtracts it by 0.1 and gives the new factor over to my decorate script
well instead of the camera zooming out, it zooms in
this is the code

Code: Select all

#library "bzoom"
#include "zcommon.acs"

int zoomf = 1.0;

script "bzoom" (void) {
	zoomf = zoomf - 0.1;
	SetResultValue(zoomf);
	if (GetCVar("tgc_debugging_fun")== true) {
	Log(s:"Zoom factor is now ", f:zoomf, s:".");
	Delay(35);
	zoomf = 1.0;
	Log(s:"Zoom factor is 1 again.");
	}
}
i have no clue if it's from decorate's fault or acs' fault
i've seen from the log that the first zoom factor is 0.900003
might be something from that
also i need it the script to zoom out more and more because one specific weapon i am making can either shoot one shell or 10
do you guys have any idea why this is the case?
User avatar
determin1st
Posts: 57
Joined: Wed Oct 06, 2021 11:23 am
Contact:

Re: A_ZoomFactor is weird

Post by determin1st »

that's probably because of fixed point, you can't return fixed point from ACS in zandronum. what you can is to return integer properly aligned and multiply it in decorate.

ACS: SetResultValue(100 - 10); // 90

DECORATE: A_ZoomFactor(0.01 * CallACS("myzoom")) // 0.01 * 90 = 0.9
lemonTasteIceTea
Posts: 2
Joined: Sun Dec 12, 2021 12:29 pm
Graphics Processor: Intel (Modern GZDoom)

Re: A_ZoomFactor is weird

Post by lemonTasteIceTea »

thank you so much!
it works like a charm now
Post Reply

Return to “Scripting”