From 19955015839065c16bf60ef239102d6950f0bb3f Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Fri, 23 Dec 2022 00:18:50 -0800 Subject: [PATCH] Save tokens on movemebnt checks I promise this is mathematically equivalent-ish to the original. (0.2 and its multiples are nonterminating decimals in base 2, so there's a little jank when the negative shift right is a shift left.) --- chameleonic.p8 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/chameleonic.p8 b/chameleonic.p8 index a711592..aabe1c0 100644 --- a/chameleonic.p8 +++ b/chameleonic.p8 @@ -544,12 +544,12 @@ function level:can_move( if player.rope then local chk=false local w,h=1.6,0.2 - if (dmx==0) w,h=0.2,1.6 - - if (dmy==-1) rectx,recty=0.4,-0.8 - if (dmy==1) rectx,recty=0.4,0.2 - if (dmx==-1) rectx,recty=-0.8,0.4 - if (dmx==1) rectx,recty=0.2,0.4 + if dmx==0 then + w,h=0.2,1.6 + else + dmy = 0 + end + rectx,recty=dmx*(0.4>>>dmx),dmy*(0.4>>>dmy) if (player.rope:collide_mrect(mx0+rectx,my0+recty,w,h,exclude_src,exclude_dst)) return false end