ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:a_getcvarfixed

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
functions:a_getcvarfixed [2017/03/17 17:10] korshunfunctions:a_getcvarfixed [2017/06/13 15:13] korshun
Line 3: Line 3:
 ''fixed a_GetCVarFixed(str name)'' ''fixed a_GetCVarFixed(str name)''
  
-<note important>The function is called ''a_GetCVarFixed()'' because it conflicts with [[:GDCC]]'s unrelated ''GetCVarFixed()''.</note>+<note important>This function is called ''a_GetCVarFixed()'' because it conflicts with [[:GDCC]]'s unrelated ''GetCVarFixed()''.</note>
  
 ===== Description ===== ===== Description =====
 Returns the value of an int or float CVar as a fixed-point number. Returns the value of an int or float CVar as a fixed-point number.
  
-Returns 0 if+Returns 0 if the CVar doesn't exist or is not a number.
-  * the CVar doesn't exist+
-  * the CVar is a string that doesn't look like a decimal number+
-  * the CVar is not an integer, a float or a string.+
  
-The function works by calling [[zdoom>GetCVarString]] and parsing the text with [[ParseFixed]].+The function works by calling [[zdoom>GetCVarString]] and parsing the text with [[atof]].
  
 ===== Examples ===== ===== Examples =====
 <code> <code>
-int mul = GetCVarFixed("mymod_multiplier"); // declared as float in CVARINFO+int mul = a_GetCVarFixed("mymod_multiplier"); // declared as float in CVARINFO
 int value = FixedMul(x, mul); int value = FixedMul(x, mul);
 </code> </code>
functions/a_getcvarfixed.txt · Last modified: 2017/06/16 13:25 by korshun