Quote:
Originally Posted by buzzybee
See, the purpose of the code is to compare x-acceleration and y-acceleration of an object, and init animation frames which show y-axis-orientation or x-axis-orientation accordingly.
|
If you don't actually need the absolute values once the comparison is done (and assuming the acceleration values are always less than half the range of a word), you could both add and subtract the values; if the absolute value of the second operand is larger than the first, then at least one of the two calculations will cross zero and set the carry flag. (untested, so beware of typos - but the logic should be sound.)
Edit: corrected typos - changed "scc" to "scs"!
Code:
move.l objectListAcc(a2),d7 ; get x- and y-acceleration
move.w d7,d0 ; fetch y-acceleration in world
move.w viewPosition+vPyAccConvertWorldToView(pc),d6
sub.w d6,d0 ; convert to y-acceleration in view
swap d7
move.w d7,d6
add.w d0,d6
scs d6
sub.w d0,d7
scs d7
or.w d7,d6 ; D6 is set if either the add or sub generated a carry.