git » fp-git.git » commit 47d7ac1

added mirrored images by flag

author ecalot
2005-02-07 17:46:37 UTC
committer ecalot
2005-02-07 17:46:37 UTC
parent db0ec3f4444e5f1cba1803d87fa1ac37098ea68a

added mirrored images by flag

FP/src/conf/flags.conf +1 -0
FP/src/include/states.h +1 -0
FP/src/include/types.h +1 -0
FP/src/ker/object.c +1 -1
FP/src/ker/states.c +1 -0

diff --git a/FP/src/conf/flags.conf b/FP/src/conf/flags.conf
index 46d518a..dca5397 100644
--- a/FP/src/conf/flags.conf
+++ b/FP/src/conf/flags.conf
@@ -9,5 +9,6 @@ g you hit the guard/kid
 f fall down
 u go up one floor
 t turn
+m mirror
 
 heightoffset internal flag to detect frames with height
diff --git a/FP/src/include/states.h b/FP/src/include/states.h
index 32451b2..fb0f5b6 100644
--- a/FP/src/include/states.h
+++ b/FP/src/include/states.h
@@ -29,6 +29,7 @@ typedef struct {
 
 #define stateGetImage(a) (((a).action.image))
 #define stateGetBottom(a) (((a).action.imgoffx))
+#define stateGetMirror(a) (((a).action.mirror))
 
 /* public functions interface */
 
diff --git a/FP/src/include/types.h b/FP/src/include/types.h
index eda4bba..e133dcf 100644
--- a/FP/src/include/types.h
+++ b/FP/src/include/types.h
@@ -55,6 +55,7 @@ typedef struct { /* The state object: only struct that is not static to the stat
 	short  imgoffx;    /* the height the current image has to be raised */
 	short  image; /* the next image to be shown */
 	float  step; /* the number of pixels a frame has to move */
+	int    mirror; /* the image has to be inverted */
 	float  acumLocation; /* the kid location in float (will be casted to int in the kid object) */
 } tState;
 
diff --git a/FP/src/ker/object.c b/FP/src/ker/object.c
index 1cd154e..5d5e989 100644
--- a/FP/src/ker/object.c
+++ b/FP/src/ker/object.c
@@ -66,7 +66,7 @@ tObject objectCreate(int location, int floor, int direction, int stateId, unsign
 }
 
 void objectDraw(tObject object) {
-	void* image=object.gfxCache[object.direction]->pFrames[stateGetImage(object)-1];
+	void* image=object.gfxCache[object.direction ^ stateGetMirror(object)]->pFrames[stateGetImage(object)-1];
 	/* TODO: move this -1 to each script frame */
 	outputDrawBitmap(
 		image, 
diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c
index 4ee368a..ac3d46f 100644
--- a/FP/src/ker/states.c
+++ b/FP/src/ker/states.c
@@ -201,6 +201,7 @@ short stateUpdate(tKey* key, tObject* kid,tRoom* room) {
 	flags         =current->flags    [current->frame];
 	steps         =current->steps    [current->frame];
 	current->imgoffx=current->offsx    [current->frame];
+	current->mirror=flags&STATES_FLAG_M?1:0;
 	
 	/* BEGIN DEBUGSTATES */
 #ifdef DEBUGSTATES