Closed neauoire closed 1 year ago
I think it's worth taking that out of the loop, I edited the PR.
I think you could use the 0x10 bit from the sprite variable to directly determine the sign, without needing to do a ? conditional. (Same for flipy/fy.) Maybe not worth it?
I've tried that but I couldn't get it to work, you mean like shifting it to 0x80 and using Uint8 cast to do the multiplication, or ORing the negative bit? It doesn't work I think, but I couldn't figure out why, any idea?
I've tried that but I couldn't get it to work, you mean like shifting it to 0x80 and using Uint8 cast to do the multiplication, or ORing the negative bit? It doesn't work I think, but I couldn't figure out why, any idea?
Dunno, I'd have to spend some more time thinking about it. I think we can worry about it later (or never) since it's good enough as it is now. Thanks :) I'll merge this when I boot up my PC tomorrow.
fx = flipx ? -1 : 1;
🤔 I think you could use the
0x10
bit from thesprite
variable to directly determine the sign, without needing to do a?
conditional. (Same for flipy/fy.) Maybe not worth it?For Uxn32, since it's often built with unsophisticated compilers, I think it's a good idea to hoist constant operations like
dy * fx
out of the loop, so that the code to repeatedly calculate them won't be included in the body of the loop. A good compiler will do this automatically, but Uxn32 works with older/blunter compilers. Maybe it's not a big deal in this case, since it's not in an innermost loop. I think it would add a couple more lines to the program. Maybe not worth it? Hmm.