git » fp-git.git » commit 7547453

Kernel rewritten. Added new actions.

author ecalot
2004-07-23 00:49:04 UTC
committer ecalot
2004-07-23 00:49:04 UTC
parent f86d553ffa4424b9a473d4c4c5d5c89cd725bc7c

Kernel rewritten. Added new actions.

FP/src/Makefile +8 -3
FP/src/include/input.h +9 -1
FP/src/include/kid.h +8 -5
FP/src/include/object.h +8 -5
FP/src/include/resources.h +1 -0
FP/src/ker/kernel.c +50 -71
FP/src/ker/kid.c +127 -36
FP/src/ker/object.c +127 -36
FP/src/out/input.c +1 -1
FP/src/out/output.c +3 -3

diff --git a/FP/src/Makefile b/FP/src/Makefile
index 115bdba..3e22fe7 100644
--- a/FP/src/Makefile
+++ b/FP/src/Makefile
@@ -47,7 +47,8 @@ LINKERRELEASE =
 
 #Binary code files
 OBJFILES      = main.o kernel.o resources.o dat.o disk.o compress.o \
-                output.o maps.o config.o drawscreen.o titles.o input.o
+                output.o maps.o config.o drawscreen.o titles.o \
+								input.o kid.o
 EXEFILE       = bin/freeprince
 
 #Use this to temporary remove an option
@@ -115,11 +116,15 @@ kernel.o: ker/kernel.c include/kernel.h include/resources.h include/output.h
 	$(CC) -c ker/kernel.c $(OPTIONS)
 
 drawscreen.o: ker/drawscreen.c
-	$(INFO) Compiling screen draw module...
+	$(INFO) Compiling kernel screen draw module...
 	$(CC) -c ker/drawscreen.c $(OPTIONS)
 
+kid.o: ker/kid.c
+	$(INFO) Compiling kernel kid object...
+	$(CC) -c ker/kid.c $(OPTIONS)
+
 titles.o: ker/titles.c
-	$(INFO) Compiling titles module...
+	$(INFO) Compiling kernel titles module...
 	$(CC) -c ker/titles.c $(OPTIONS)
 
 compress.o: res/compress.c include/compress.h include/memory.h \
diff --git a/FP/src/include/input.h b/FP/src/include/input.h
index ec51435..a6a3296 100644
--- a/FP/src/include/input.h
+++ b/FP/src/include/input.h
@@ -37,6 +37,15 @@ typedef enum {none=0,quit,load,reload,passLevel,showUp,showLeft,showRight,showDo
 
 /*#define inputIgnoreCtrl(a)  (a&( ~(1<<1) ))*/
 /* TODO: use inputIgnore* for each Set* */
+#define K_Shift (1<<0)
+#define K_Ctrl  (1<<1)
+#define K_Up    (1<<2)
+#define K_Down  (1<<3)
+#define K_Left  (1<<4)
+#define K_Right (1<<5)
+
+#define inputPressed(a,b)  (((a)&(b))==(b))
+
 #define inputSetShift(a,b) a=(a&( ~(1<<0) )) | ((b)<<0)
 #define inputSetCtrl(a,b)  a=(a&( ~(1<<1) )) | ((b)<<1)
 #define inputSetUp(a,b)    a=(a&( ~(1<<2) )) | ((b)<<2)
@@ -44,7 +53,6 @@ typedef enum {none=0,quit,load,reload,passLevel,showUp,showLeft,showRight,showDo
 #define inputSetLeft(a,b)  a=(a&( ~(1<<4) )) | ((b)<<4)
 #define inputSetRight(a,b) a=(a&( ~(1<<5) )) | ((b)<<5)
 
-
 #define inputGetShift(a) ((a)&( (1<<0) )) 
 #define inputGetCtrl(a)  ((a)&( (1<<1) )) 
 #define inputGetUp(a)    ((a)&( (1<<2) ))
diff --git a/FP/src/include/kid.h b/FP/src/include/kid.h
index be7664c..ffd35c4 100644
--- a/FP/src/include/kid.h
+++ b/FP/src/include/kid.h
@@ -41,14 +41,17 @@ typedef struct {
 	int floor;
 	int direction;
 	int frame;
-	int velX;
-	int velY;
+	int velocity;
+	enum {stay,run}nextAction;
 	tData* action;
 } tKid;
 
-void kidInit(tKid* kid);
-void kidDraw(tKid* kid);
-void kidMove(tKid* kid,tKey* key/*,tRoom room*/);
+#define DIR_LEFT  1
+#define DIR_RIGHT 0
+
+tKid kidCreate();
+void kidDraw(tKid kid);
+int  kidMove(tKid* kid,tKey key/*,tRoom room*/);
 
 #endif
 
diff --git a/FP/src/include/object.h b/FP/src/include/object.h
index be7664c..ffd35c4 100644
--- a/FP/src/include/object.h
+++ b/FP/src/include/object.h
@@ -41,14 +41,17 @@ typedef struct {
 	int floor;
 	int direction;
 	int frame;
-	int velX;
-	int velY;
+	int velocity;
+	enum {stay,run}nextAction;
 	tData* action;
 } tKid;
 
-void kidInit(tKid* kid);
-void kidDraw(tKid* kid);
-void kidMove(tKid* kid,tKey* key/*,tRoom room*/);
+#define DIR_LEFT  1
+#define DIR_RIGHT 0
+
+tKid kidCreate();
+void kidDraw(tKid kid);
+int  kidMove(tKid* kid,tKey key/*,tRoom room*/);
 
 #endif
 
diff --git a/FP/src/include/resources.h b/FP/src/include/resources.h
index 7f1a945..a39eb7b 100644
--- a/FP/src/include/resources.h
+++ b/FP/src/include/resources.h
@@ -78,6 +78,7 @@ typedef struct {
 }tData;
 
 #define RES_MOD_RIGHT          0x00010000
+#define RES_MOD_LEFT           0x00000000
 #define res_modIsRight(a) ((a)&0x0001)
 #define res_modGetId(a)   ((a)&0xffff)
 #define res_modGetMask(a) ((a)>>16)
diff --git a/FP/src/ker/kernel.c b/FP/src/ker/kernel.c
index a1a5e8f..d3f753a 100644
--- a/FP/src/ker/kernel.c
+++ b/FP/src/ker/kernel.c
@@ -31,95 +31,74 @@ kernel.c: FreePrince : Main Kernel
   DO NOT remove this copyright notice
 */
 
-#include <SDL/SDL.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include "kernel.h"
 #include "resources.h"
 #include "output.h"
 #include "input.h"
 #include "titles.h"
+#include "kid.h"
+#include "room.h"
+
+/*
+ * Main game control function
+ */
 
 int control(int optionflag,int level) {
-	int i,location,direction,upIsPressed;
-	SDL_Event e;
-	tData* runningAnimation[4];
-	tData* animation;
-	tData* fondo;
-	
-	runningAnimation[0]=resLoad(RES_ANIM_RUN);
+	/*SDL_Event e;*/
+/*	tData* runningAnimation[4];
+	tData* fondo;*/
+	tKey   key=inputCreateKey();
+	tKid   kid=kidCreate();
+
+	/* TODO: send to kid and load static */
+/*	runningAnimation[0]=resLoad(RES_ANIM_RUN);
 	runningAnimation[1]=resLoad(RES_ANIM_RUN|RES_MOD_RIGHT);
 	runningAnimation[2]=resLoad(RES_ANIM_JUMPRUN);
 	runningAnimation[3]=resLoad(RES_ANIM_JUMPRUN|RES_MOD_RIGHT);
+
 	fondo=resLoad(RES_IMG_BACKGROUND);
 	if (!fondo) {
 		printf("The resource couldn't be loaded!\n");
 		return 1;
 	}
-	/*
-	printf("Resource number: %d. Frames: %d. Type: %d.\n",
-		RES_ANIM_RUN_LEFT,
-		runningAnimation->frames,
-		runningAnimation->type
-	);
-	*/
-	i=0;
-	location=160;
-	direction=0;
-	animation=runningAnimation[0];
-	upIsPressed=0;
+*/
+/* Game loop here */
+	drawScreen(4);
+/* Level loop here */
+	outputClearScreen(); /* TODO: send to drawScreen(0) */
+	/*drawScreen(0); TODO: try to optimize what to draw */
 	while (1) {
-		if (SDL_PollEvent(&e)) {
-			switch (e.type) {
-				case SDL_QUIT:
-					return 1;
-				case SDL_KEYDOWN:
-					/*fprintf(stderr, "The %s key was pressed! %d\n",
-					SDL_GetKeyName(e.key.keysym.sym),e.key.keysym.sym);*/
-					switch (e.key.keysym.sym) {
-						case SDLK_LEFT:
-							direction=0;
-							break;
-						case SDLK_RIGHT:
-							direction=1;
-							break;
-						case SDLK_UP:
-							i=0;
-							upIsPressed=1;
-							break;
-						case SDLK_DOWN:
-							i=0;
-							break;
-						case SDLK_q:
-							return 1;
-							break;
-						default:
-							break;
-					}
-					break;
-				case SDL_KEYUP:
-					switch (e.key.keysym.sym) {
-						case SDLK_UP:
-								upIsPressed=0;
-								break;
-						default:
-								break;
-					}
-			}
-		}
-		outputClearScreen();
-		outputDrawBitmap(fondo->pFrames[0], 0, 0);
-		outputDrawBitmap(animation->pFrames[i], location, 141);
-		outputUpdateScreen();
-		i++;
-		SDL_Delay(50);
-		animation=runningAnimation[(upIsPressed<<1)|(direction)];
-		if (direction) {
-			location+=3;
+		if (inputGetEvent(&key)) {
+			/* Time event */
+
+			/* Moving objects */
+			/* keylogIntercept(&key);
+			 * TODO: send to the real place where
+			 * the key is interpreted in kid object
+			 */
+			kidMove(&kid,key);
+			
+			/* Drawing functions */
+			outputClearScreen(); /* TODO: send to drawScreen(0) */
+			drawScreen(0);
+			drawScreen(1);
+			drawScreen(2);
+			kidDraw(kid);
+			drawScreen(3);
+			outputUpdateScreen();
 		} else {
-			location-=3;
+			/* Action event */
+			switch (key.actionPerformed) {
+			case quit:
+				return 1;
+			case gotoTitles:
+				return 0;
+			default:
+				break;
+			}
 		}
-		/*printf("up=%d\n",upIsPressed);*/
-		if (i>animation->frames-1) i =6;
 	}
 
 	return 0;
@@ -140,7 +119,7 @@ int kernel(int optionflag,int level) {
 	int menuOption;
 	int quit=0;
 	if (outputInit()) {
-		fprintf(stderr, "Unable to initialize screen: %s\n", SDL_GetError());
+		fprintf(stderr, "Unable to initialize screen\n");
 		exit(1);
 	}
 
diff --git a/FP/src/ker/kid.c b/FP/src/ker/kid.c
index 9fb6f29..a3e7358 100644
--- a/FP/src/ker/kid.c
+++ b/FP/src/ker/kid.c
@@ -32,54 +32,145 @@ kid.h: Free Prince : Kid object
 
 #include "kid.h"
 #include "output.h"
-/*
-typedef struct {
-	int location;
-	int floor;
-	int direction;
-	int framesLeft;
-	tData* action;
-} tKid;
-*/
-
-#define KID_ACTION_NOTHING  0
-#define KID_ACTION_WALKING  1
-#define KID_ACTION_CLIMBING 2
-#define KID_ACTION_RUNNING  3
-
-#define KID_ACTION_JUMPING  4
-#define KID_ACTION_RIGHT    8
-#define KID_ACTION_STARTING 16
-#define KID_ACTION_ENDING   32
+#include <stdio.h> /* NULL */
+
+static struct {
+	tData* turning[2];
+	tData* normal[2];
+	tData* couch[2];
+	tData* jump[2];
+	tData* walking[2];
+	tData* running[2];
+} kidGfx;
+
+void loadGfx() {
+	kidGfx.turning[DIR_LEFT]=resLoad(RES_ANIM_TURNING|RES_MOD_LEFT);
+	kidGfx.turning[DIR_RIGHT]=resLoad(RES_ANIM_TURNING|RES_MOD_RIGHT);
+	kidGfx.normal[DIR_LEFT]=resLoad(RES_ANIM_NORMAL|RES_MOD_LEFT);
+	kidGfx.normal[DIR_RIGHT]=resLoad(RES_ANIM_NORMAL|RES_MOD_RIGHT);
+	kidGfx.walking[DIR_LEFT]=resLoad(RES_ANIM_WALKING|RES_MOD_LEFT);
+	kidGfx.walking[DIR_RIGHT]=resLoad(RES_ANIM_WALKING|RES_MOD_RIGHT);
+	kidGfx.couch[DIR_LEFT]=resLoad(RES_ANIM_COUCH|RES_MOD_LEFT);
+	kidGfx.couch[DIR_RIGHT]=resLoad(RES_ANIM_COUCH|RES_MOD_RIGHT);
+	kidGfx.jump[DIR_LEFT]=resLoad(RES_ANIM_JUMP|RES_MOD_LEFT);
+	kidGfx.jump[DIR_RIGHT]=resLoad(RES_ANIM_JUMP|RES_MOD_RIGHT);
+	kidGfx.running[DIR_LEFT]=resLoad(RES_ANIM_RUN|RES_MOD_LEFT);
+	kidGfx.running[DIR_RIGHT]=resLoad(RES_ANIM_RUN|RES_MOD_RIGHT);
+}
 
-static tData kidGfx[48];
 
 /* TODO: send this function to maps.c*/
-void kidInit(tKid* kid) {
-	kid->location=100;
-	kid->floor=0;
-	kid->direction=1;
-	kid->framesLeft=0;
-/*	if (kidGfx[0]==NULL) loadGfx();*/
-	action=&(kidGfx[KID_ACTION_NOTHING|KID_ACTION_RIGHT]);
+tKid kidCreate() {
+	tKid kid;
+	kid.location=100;
+	kid.floor=0;
+	kid.direction=DIR_LEFT;
+	kid.frame=0;
+	if (kidGfx.turning[0]==NULL) loadGfx();
+	kid.action=kidGfx.normal[DIR_LEFT];
+	kid.nextAction=stay;
+	kid.velocity=0;
+	return kid;
 }
 
 
-int kidDraw(tKid* kid) {
+void kidDraw(tKid kid) {
+	outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,kid.floor*20);
+}
+
+int kidMove(tKid* kid,tKey key/*,tRoom room*/) {
 	/* Returns 1 if the action is done
 	 * returns 0 if the action needs more time */
 
-	outputDraw(location,floor*20,kid->action->pFrames[frame]);
-	frame++;
-	if (frame==kid->action->frames) {
-		frame=0;
+	kid->frame++;
+	if (kid->frame==kid->action->frames) {
+		kid->frame=0;
+		/* keylogIntercept(&key) --> here is the right place */
+		/* Switch the right action knowing the actual status and set the velocity and action */
+		/* stay context (walk,stay,stand,jump,turn)
+		 * stay --> stay
+		 * stay --> turn 
+		 * stay --> run
+		 * stay --> walk
+		 * stay --> couch
+		 * stay --> jump
+		 * run context 
+		 * run --> turnrun
+		 * run --> run
+		 * run --> jumprun
+		 * run --> couchrun
+		 *
+		 * Note: falling and climbing context are ignored
+		 */
+		printf("next action=%d direction=%d ",kid->nextAction,kid->direction);
+		if (kid->nextAction==stay) {
+			if (key.status==(K_Shift|K_Left)) {
+				if (kid->direction==DIR_LEFT) {
+					/* walk left */
+								printf("WALK! ");
+					kid->action=kidGfx.walking[DIR_LEFT];
+					kid->velocity=-3;
+				} else {
+					/* turn left to right */
+					kid->action=kidGfx.turning[DIR_LEFT]; /* RIGHT to LEFT */
+					kid->velocity=0;
+					kid->direction=DIR_LEFT;
+				}
+			} else if (key.status==(K_Shift|K_Right)) {
+				if (kid->direction==DIR_RIGHT) {
+					/* walk right */
+					kid->action=kidGfx.walking[DIR_RIGHT];
+					kid->velocity=+3;
+				} else {
+					/* turn right to left */
+					kid->action=kidGfx.turning[DIR_RIGHT]; /* LEFT to RIGHT */
+					kid->velocity=0;
+					kid->direction=DIR_RIGHT;
+				}
+			} else if (key.status&K_Down) {
+				/* couch */
+				kid->action=kidGfx.couch[kid->direction];
+				kid->velocity=0;
+			} else if (key.status&K_Up) {
+				/* jump */
+				kid->action=kidGfx.jump[kid->direction];
+				kid->velocity=0;
+			} else if (!key.status) {
+					/* normal */
+					kid->velocity=0;
+					kid->action=kidGfx.normal[kid->direction];
+			} else if (key.status&K_Left) {
+				if (kid->direction==DIR_LEFT) {
+					/* run left */
+					kid->action=kidGfx.running[DIR_LEFT];
+					kid->velocity=-6;
+				} else {
+					/* turn left to right */
+					kid->action=kidGfx.turning[DIR_LEFT]; /* RIGHT to LEFT */
+					kid->velocity=0;
+					kid->direction=DIR_LEFT;
+				}
+			} else if (key.status==K_Right) {
+				if (kid->direction==DIR_RIGHT) {
+					/* run right */
+					kid->action=kidGfx.running[DIR_RIGHT];
+					kid->velocity=+6;
+				} else {
+					/* turn right to left */
+					kid->action=kidGfx.turning[DIR_RIGHT]; /* LEFT to RIGHT */
+					kid->velocity=0;
+					kid->direction=DIR_RIGHT;
+				}
+			}
+			/* TODO: elseif for the K_Left and K_Right to start jumping. Change nextAction */
+		}
+		printf("Velocity=%d\n",kid->velocity);
 		return 1;
 	} else {
+		/* TODO: tile traspassing and validations here
+		 * use roomStep(tRoom room,x,y) roomTouch(tRoom room,x,y) to activate tile events */
+		kid->location+=kid->velocity;
 		return 0;
 	}
 }
 
-void kidMove(tKid* kid,tKey* key/*,tRoom room*/) {
-
-}
-
diff --git a/FP/src/ker/object.c b/FP/src/ker/object.c
index 9fb6f29..a3e7358 100644
--- a/FP/src/ker/object.c
+++ b/FP/src/ker/object.c
@@ -32,54 +32,145 @@ kid.h: Free Prince : Kid object
 
 #include "kid.h"
 #include "output.h"
-/*
-typedef struct {
-	int location;
-	int floor;
-	int direction;
-	int framesLeft;
-	tData* action;
-} tKid;
-*/
-
-#define KID_ACTION_NOTHING  0
-#define KID_ACTION_WALKING  1
-#define KID_ACTION_CLIMBING 2
-#define KID_ACTION_RUNNING  3
-
-#define KID_ACTION_JUMPING  4
-#define KID_ACTION_RIGHT    8
-#define KID_ACTION_STARTING 16
-#define KID_ACTION_ENDING   32
+#include <stdio.h> /* NULL */
+
+static struct {
+	tData* turning[2];
+	tData* normal[2];
+	tData* couch[2];
+	tData* jump[2];
+	tData* walking[2];
+	tData* running[2];
+} kidGfx;
+
+void loadGfx() {
+	kidGfx.turning[DIR_LEFT]=resLoad(RES_ANIM_TURNING|RES_MOD_LEFT);
+	kidGfx.turning[DIR_RIGHT]=resLoad(RES_ANIM_TURNING|RES_MOD_RIGHT);
+	kidGfx.normal[DIR_LEFT]=resLoad(RES_ANIM_NORMAL|RES_MOD_LEFT);
+	kidGfx.normal[DIR_RIGHT]=resLoad(RES_ANIM_NORMAL|RES_MOD_RIGHT);
+	kidGfx.walking[DIR_LEFT]=resLoad(RES_ANIM_WALKING|RES_MOD_LEFT);
+	kidGfx.walking[DIR_RIGHT]=resLoad(RES_ANIM_WALKING|RES_MOD_RIGHT);
+	kidGfx.couch[DIR_LEFT]=resLoad(RES_ANIM_COUCH|RES_MOD_LEFT);
+	kidGfx.couch[DIR_RIGHT]=resLoad(RES_ANIM_COUCH|RES_MOD_RIGHT);
+	kidGfx.jump[DIR_LEFT]=resLoad(RES_ANIM_JUMP|RES_MOD_LEFT);
+	kidGfx.jump[DIR_RIGHT]=resLoad(RES_ANIM_JUMP|RES_MOD_RIGHT);
+	kidGfx.running[DIR_LEFT]=resLoad(RES_ANIM_RUN|RES_MOD_LEFT);
+	kidGfx.running[DIR_RIGHT]=resLoad(RES_ANIM_RUN|RES_MOD_RIGHT);
+}
 
-static tData kidGfx[48];
 
 /* TODO: send this function to maps.c*/
-void kidInit(tKid* kid) {
-	kid->location=100;
-	kid->floor=0;
-	kid->direction=1;
-	kid->framesLeft=0;
-/*	if (kidGfx[0]==NULL) loadGfx();*/
-	action=&(kidGfx[KID_ACTION_NOTHING|KID_ACTION_RIGHT]);
+tKid kidCreate() {
+	tKid kid;
+	kid.location=100;
+	kid.floor=0;
+	kid.direction=DIR_LEFT;
+	kid.frame=0;
+	if (kidGfx.turning[0]==NULL) loadGfx();
+	kid.action=kidGfx.normal[DIR_LEFT];
+	kid.nextAction=stay;
+	kid.velocity=0;
+	return kid;
 }
 
 
-int kidDraw(tKid* kid) {
+void kidDraw(tKid kid) {
+	outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,kid.floor*20);
+}
+
+int kidMove(tKid* kid,tKey key/*,tRoom room*/) {
 	/* Returns 1 if the action is done
 	 * returns 0 if the action needs more time */
 
-	outputDraw(location,floor*20,kid->action->pFrames[frame]);
-	frame++;
-	if (frame==kid->action->frames) {
-		frame=0;
+	kid->frame++;
+	if (kid->frame==kid->action->frames) {
+		kid->frame=0;
+		/* keylogIntercept(&key) --> here is the right place */
+		/* Switch the right action knowing the actual status and set the velocity and action */
+		/* stay context (walk,stay,stand,jump,turn)
+		 * stay --> stay
+		 * stay --> turn 
+		 * stay --> run
+		 * stay --> walk
+		 * stay --> couch
+		 * stay --> jump
+		 * run context 
+		 * run --> turnrun
+		 * run --> run
+		 * run --> jumprun
+		 * run --> couchrun
+		 *
+		 * Note: falling and climbing context are ignored
+		 */
+		printf("next action=%d direction=%d ",kid->nextAction,kid->direction);
+		if (kid->nextAction==stay) {
+			if (key.status==(K_Shift|K_Left)) {
+				if (kid->direction==DIR_LEFT) {
+					/* walk left */
+								printf("WALK! ");
+					kid->action=kidGfx.walking[DIR_LEFT];
+					kid->velocity=-3;
+				} else {
+					/* turn left to right */
+					kid->action=kidGfx.turning[DIR_LEFT]; /* RIGHT to LEFT */
+					kid->velocity=0;
+					kid->direction=DIR_LEFT;
+				}
+			} else if (key.status==(K_Shift|K_Right)) {
+				if (kid->direction==DIR_RIGHT) {
+					/* walk right */
+					kid->action=kidGfx.walking[DIR_RIGHT];
+					kid->velocity=+3;
+				} else {
+					/* turn right to left */
+					kid->action=kidGfx.turning[DIR_RIGHT]; /* LEFT to RIGHT */
+					kid->velocity=0;
+					kid->direction=DIR_RIGHT;
+				}
+			} else if (key.status&K_Down) {
+				/* couch */
+				kid->action=kidGfx.couch[kid->direction];
+				kid->velocity=0;
+			} else if (key.status&K_Up) {
+				/* jump */
+				kid->action=kidGfx.jump[kid->direction];
+				kid->velocity=0;
+			} else if (!key.status) {
+					/* normal */
+					kid->velocity=0;
+					kid->action=kidGfx.normal[kid->direction];
+			} else if (key.status&K_Left) {
+				if (kid->direction==DIR_LEFT) {
+					/* run left */
+					kid->action=kidGfx.running[DIR_LEFT];
+					kid->velocity=-6;
+				} else {
+					/* turn left to right */
+					kid->action=kidGfx.turning[DIR_LEFT]; /* RIGHT to LEFT */
+					kid->velocity=0;
+					kid->direction=DIR_LEFT;
+				}
+			} else if (key.status==K_Right) {
+				if (kid->direction==DIR_RIGHT) {
+					/* run right */
+					kid->action=kidGfx.running[DIR_RIGHT];
+					kid->velocity=+6;
+				} else {
+					/* turn right to left */
+					kid->action=kidGfx.turning[DIR_RIGHT]; /* LEFT to RIGHT */
+					kid->velocity=0;
+					kid->direction=DIR_RIGHT;
+				}
+			}
+			/* TODO: elseif for the K_Left and K_Right to start jumping. Change nextAction */
+		}
+		printf("Velocity=%d\n",kid->velocity);
 		return 1;
 	} else {
+		/* TODO: tile traspassing and validations here
+		 * use roomStep(tRoom room,x,y) roomTouch(tRoom room,x,y) to activate tile events */
+		kid->location+=kid->velocity;
 		return 0;
 	}
 }
 
-void kidMove(tKid* kid,tKey* key/*,tRoom room*/) {
-
-}
-
diff --git a/FP/src/out/input.c b/FP/src/out/input.c
index b3d8d70..ca83945 100644
--- a/FP/src/out/input.c
+++ b/FP/src/out/input.c
@@ -130,7 +130,7 @@ int inputGetEvent(tKey* key) {
 	
 	while(SDL_WaitEvent(&event))
 	{
-		printf("Event dropped: key status=%x action=%d\n",key->status,key->actionPerformed);
+		/*printf("Event dropped: key status=%x action=%d\n",key->status,key->actionPerformed);*/
 		key->actionPerformed=none;
 		switch (event.type) {
 		case SDL_KEYDOWN:
diff --git a/FP/src/out/output.c b/FP/src/out/output.c
index 7baec90..c16fde4 100644
--- a/FP/src/out/output.c
+++ b/FP/src/out/output.c
@@ -100,12 +100,12 @@ outputLoadBitmap(const unsigned char* data, int size,
 		colors[i].b=palette.color[i].b<<2;
 	}
 
-	printf("outputLoadBitmap: I'm creating an SDL structure :p\n");
-	printf("outputLoadBitmap: invert=%d. transparent=%d. size=%d\n", invert, firstColorTransparent, size);
+/*	printf("outputLoadBitmap: I'm creating an SDL structure :p\n");
+	printf("outputLoadBitmap: invert=%d. transparent=%d. size=%d\n", invert, firstColorTransparent, size);*/
 
 	result = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8, 0, 0, 0, 0);
 	SDL_SetColorKey(result, SDL_SRCCOLORKEY, 0);
-	printf("%d\n",firstColorTransparent);
+/*	printf("%d\n",firstColorTransparent);*/
 	if (!result) {
 		fprintf(stderr, "CreateRGBSurface failed: %s\n", SDL_GetError());
 		free(colors);