Scalevar

From EDukeWiki
Revision as of 12:42, 14 November 2019 by Fox (talk | contribs) (Created page with "'''mulscale''' <Result> <Factor 1> <Factor 2> <Divisor> In C terms, this command performs roughly the expression <code><Result> = (<Factor 1> * <Factor 2>) / <Divisor></code>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

mulscale <Result> <Factor 1> <Factor 2> <Divisor>

In C terms, this command performs roughly the expression <Result> = (<Factor 1> * <Factor 2>) / <Divisor>.

In CON terms, it is very similar to the following series of commands:

set <Result> <Factor 1>
mul <Result> <Factor 2>
div <Result> <Divisor>

The main difference is that the calculation uses 64 bits to prevent overflow, while using gamevars for intermediate values would limit it to 31 bits.