git » fp-git.git » commit 23c2d12

fixed absoluteonstop (it was relative!)

author ecalot
2005-02-26 08:46:51 UTC
committer ecalot
2005-02-26 08:46:51 UTC
parent e91a01bb864ca9d0b07f799c27e78871292b9cb7

fixed absoluteonstop (it was relative!)

FP/src/ker/states.c +8 -1

diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c
index 75a88c8..7b2b811 100644
--- a/FP/src/ker/states.c
+++ b/FP/src/ker/states.c
@@ -282,8 +282,15 @@ short stateUpdate(tKey* key, tObject* kid,tRoom* room) {
 			int accumulate=0;
 			int i,j;
 			int from,to;
+			int moveTo=statesActionList[action].moveOffset;
+			
+			if (kid->direction!=DIR_LEFT)
+				moveTo+=STATES_STEPS_PER_TILE-(kid->location%STATES_STEPS_PER_TILE);
+			else
+				moveTo+=kid->location%STATES_STEPS_PER_TILE;
+			
 			/* First iteration: determine i=number of frames not cropped */
-			for (i=0;(i<current->frame)&&(accumulate<statesActionList[action].moveOffset);i++) {
+			for (i=0;(i<current->frame)&&(accumulate<moveTo);i++) {
 				accumulate+=current->steps[alternate(i,current->frame)];
 			}
 			for (j=0;j<i;j++) {