Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
blarg

Decimal/Fixed Variables?

Recommended Posts

I'm trying to make a bar graph using ACS that displays the player's kill, item, and secret percentages at the end of each level, in place of the default intermission screen.

Here's my code:

SetFont("graphbk");
hudmessagebold(s:"A";
HUDMSG_PLAIN,994,CR_UNTRANSLATED,-0.28,-0.1175,0.0);
SetFont("g_secret");
for(int secrets; secrets<=GetLevelInfo(LEVELINFO_FOUND_SECRETS)*100/GetLevelInfo(LEVELINFO_TOTAL_SECRETS); secrets++)
		{
		hudmessagebold(s:"A";
		HUDMSG_PLAIN,990-secrets,CR_UNTRANSLATED,-0.733,-0.872-secrets/500,0.0);
		delay(2);
		}
And this is what I get:



I think this is because the loop is pasting the bar patch however many times the loop iterates over itself, instead of moving one pixel upward each time to produce a nice bar.

I also think that the culprit argument, "-0.872-secrets/500" isn't working because secrets/500 is being rounded down to 0 each iteration, because secrets is an integer, and thus, making no changes to the patch's position on the screen.

Is there a way to create a decimal/fixed/float-point variable to avoid this problem?

Or is there a way to use pixel coordinates (something like 256,128) in hudmessage? I seem to remember seeing something about that somewhere, but the hudmessage page of the ZDoom wiki doesn't mention pasting by pixels.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×