Mulscale: Difference between revisions
Jump to navigation
Jump to search
Helixhorned (talk | contribs) fix my example. |
Wow, much complicated |
||
Line 1: | Line 1: | ||
'''mulscale | '''mulscale''' <Result> <Value 1> <Value 2> <Value 3> | ||
Equals the following series of commands: | |||
set <Result> <Value 1> | |||
mul <Result> <Value 2> | |||
shiftr <Result> <Value 3> | |||
The | 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. | ||
One example of where this limitation takes places is with rotatesprite scaling, where 320*65536 scaled with [[statusbarscale]] is dangerously close to 31 bits. | |||
[[Category:EDuke32 specific commands]] | [[Category:EDuke32 specific commands]] | ||
[[Category:Gamevar manipulation]] | [[Category:Gamevar manipulation]] |
Revision as of 07:56, 10 November 2019
mulscale <Result> <Value 1> <Value 2> <Value 3>
Equals the following series of commands:
set <Result> <Value 1> mul <Result> <Value 2> shiftr <Result> <Value 3>
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.
One example of where this limitation takes places is with rotatesprite scaling, where 320*65536 scaled with statusbarscale is dangerously close to 31 bits.