author | ecalot
<ecalot> 2005-02-07 17:06:26 UTC |
committer | ecalot
<ecalot> 2005-02-07 17:06:26 UTC |
parent | 5f8c067e2cb1ea9adb19e5a194f0e2970e63b6b3 |
FP/src/conf/awk/states_conf_static.awk | +2 | -3 |
FP/src/include/output.h | +1 | -0 |
FP/src/include/states.h | +1 | -0 |
FP/src/include/types.h | +2 | -0 |
FP/src/ker/object.c | +1 | -1 |
FP/src/ker/states.c | +6 | -2 |
FP/src/out/output.c | +5 | -0 |
diff --git a/FP/src/conf/awk/states_conf_static.awk b/FP/src/conf/awk/states_conf_static.awk index e6339dc..5ebf949 100644 --- a/FP/src/conf/awk/states_conf_static.awk +++ b/FP/src/conf/awk/states_conf_static.awk @@ -261,7 +261,7 @@ END { flags=arrayAnimation[i,"flags"] b=match(flags,/\$[ ]*([+-]?[0-9]+)/) - steps=substr(flags,b+1,RLENGTH) + steps=substr(flags,b+1,RLENGTH)/1 c=match(flags,/\@[ ]*([+-]?[0-9]+)/) offxs=substr(flags,c+1,RLENGTH)/1 @@ -280,8 +280,7 @@ END { flagmask="" } if (offxs) flagmask=sprintf("%sSTATES_FLAG_HEIGHTOFFSET|",flagmask) - printf "%s%d,%s0,%d",coma,arrayAnimation[i,"frame"],flagmask,steps -# if (offxs) printf ",/* h= */%d",offxs + printf "%s%d,%s0,%d,/* h= */%d",coma,arrayAnimation[i,"frame"],flagmask,steps,offxs if (i%10==9) printf("\\\n\t") coma="," } diff --git a/FP/src/include/output.h b/FP/src/include/output.h index fb28fc1..175d00e 100644 --- a/FP/src/include/output.h +++ b/FP/src/include/output.h @@ -101,6 +101,7 @@ void outputStop(); int outputGetHeight(void* image); int outputGetWidth(void* image); +void outputRaiseBitmap(void* image, int h); #endif diff --git a/FP/src/include/states.h b/FP/src/include/states.h index 33c091f..32451b2 100644 --- a/FP/src/include/states.h +++ b/FP/src/include/states.h @@ -28,6 +28,7 @@ typedef struct { } tsAction; #define stateGetImage(a) (((a).action.image)) +#define stateGetBottom(a) (((a).action.imgoffx)) /* public functions interface */ diff --git a/FP/src/include/types.h b/FP/src/include/types.h index 8569d32..eda4bba 100644 --- a/FP/src/include/types.h +++ b/FP/src/include/types.h @@ -50,7 +50,9 @@ typedef struct { /* The state object: only struct that is not static to the stat short* animOffset; /* position of those frames */ short* flags; /* actions to be performed by each frame (make sound, press floor, etc) */ short* steps; /* the number of steps each frame has to move */ + short* offsx; /* the height the images has to be raised */ short currentState; /* the Id of the state the kid is */ + 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 */ float acumLocation; /* the kid location in float (will be casted to int in the kid object) */ diff --git a/FP/src/ker/object.c b/FP/src/ker/object.c index 02c36c5..38a2145 100644 --- a/FP/src/ker/object.c +++ b/FP/src/ker/object.c @@ -71,7 +71,7 @@ void objectDraw(tObject object) { outputDrawBitmap( image, object_getLocation(object,image), - 58+object.floor*TILE_H + stateGetBottom(object)+58+object.floor*TILE_H ); } diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c index 9de1254..4ee368a 100644 --- a/FP/src/ker/states.c +++ b/FP/src/ker/states.c @@ -56,13 +56,14 @@ static tsCondition statesConditionList[]=STATES_CONDITIONS; void stateGetAnimation(int action,tState *state/*short *frames,short** flags,float* offsets*/) { tsAction* a=statesActionList+action; short i=a->animSize; - short* j=statesAnimationList+(a->animStart*3); + short* j=statesAnimationList+(a->animStart*4); short totaloffset=a->moveOffset; - /* TODO: depending on relative and absolute crop the middle frames */ + state->frame=i; state->animation=(short*)malloc(sizeof(short)*i); state->steps=(short*)malloc(sizeof(short)*i); state->flags=(short*)malloc(sizeof(short)*i); + state->offsx=(short*)malloc(sizeof(short)*i); #ifdef DEBUGSTATES printf("* Animsize=%d Animstart=%d. (new animation allocated) Next:\n",i,a->animStart); #endif @@ -71,6 +72,7 @@ void stateGetAnimation(int action,tState *state/*short *frames,short** flags,flo (state->animation)[i]=*(j++); /* the first short is the frame */ ((state->flags)[i])=*(j++); /* the second short is the flag */ ((state->steps)[i])=*(j++); /* the third short is the frame step */ + ((state->offsx)[i])=*(j++); /* the fourth short is the height */ } } @@ -198,6 +200,7 @@ short stateUpdate(tKey* key, tObject* kid,tRoom* room) { current->image=current->animation[current->frame]; flags =current->flags [current->frame]; steps =current->steps [current->frame]; + current->imgoffx=current->offsx [current->frame]; /* BEGIN DEBUGSTATES */ #ifdef DEBUGSTATES @@ -211,6 +214,7 @@ short stateUpdate(tKey* key, tObject* kid,tRoom* room) { free(current->animation); free(current->flags); free(current->steps); + free(current->offsx); /* Find matching action */ action=evaluateState(current->currentState,key,kid,room); diff --git a/FP/src/out/output.c b/FP/src/out/output.c index 18cdea2..43dca56 100644 --- a/FP/src/out/output.c +++ b/FP/src/out/output.c @@ -334,6 +334,11 @@ void outputDrawBitmap(void* image, int x, int y) { if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); } +void outputRaiseBitmap(void* image, int h) { + register tSurface* img=(tSurface*)image; + img->bottom+=h; +} + void outputClearScreen() { SDL_FillRect(screen, NULL, 0);