ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


getcvarfixed

This is an old revision of the document!


GetCVarFixed

ZDoom provides GetCVar for ints and GetCVarString for strings, but doesn't provide a way to retrieve the value of float CVars. ACSUtils implements GetCVarFixed by calling GetCVarString to retrieve the value of the CVar as a string, and parsing it with atof.

If the CVar's value is outside the range of fixed-point numbers, the functions return -32768.0.
The functions names begin with a_ because GDCC defines its own broken GetCVarFixed, which causes a compilation error if another function named GetCVarFixed exists.
If you're not using GDCC, you can remove the a_ prefix by adding the following to your code:
function GetCVarFixed(str name)
{
    return a_GetCVarFixed(name);
}

function GetUserCVarFixed(int player, str name)
{
    return a_GetUserCVarFixed(player, name);
}

Functions

GetCVarFixed

fixed a_GetCVarFixed(str name)

Analogous to GetCVar and GetCVarString.

GetUserCVarFixed

fixed a_GetUserCVarFixed(int player, str name)

A version of GetCVarFixed for user CVars. Calls GetCVarString internally instead of GetCVar. Analogous to GetUserCVar and GetUserCVarString.

getcvarfixed.1555962065.txt.gz · Last modified: 2019/04/22 22:41 by korshun