| author | ecalot
<ecalot> 2005-01-10 01:46:55 UTC |
| committer | ecalot
<ecalot> 2005-01-10 01:46:55 UTC |
| parent | f8523a6d8e93eae4396b1a0bdc549e6149e0f6b9 |
| FP/src/conf/anims.conf | +8 | -4 |
| FP/src/conf/awk/anims_conf.awk | +6 | -1 |
| FP/src/conf/resources.conf | +7 | -2 |
| FP/src/include/anims.h | +1 | -1 |
| FP/src/ker/titles.c | +31 | -20 |
| FP/src/res/anims.c | +5 | -3 |
diff --git a/FP/src/conf/anims.conf b/FP/src/conf/anims.conf index f525a0d..764d519 100644 --- a/FP/src/conf/anims.conf +++ b/FP/src/conf/anims.conf @@ -6,11 +6,13 @@ ANIMATION presentation 1000 #frame type res Duration Layer x y - 0 FIXEDIMG img_princess_room infinite bottom #princess room - 0 FIXEDIMG img_princess_bed infinite bottom 98 124 #bed - 0 FIXEDIMG img_princess_pillar infinite top 98 124 #pillar + 0 FIXEDIMG img_main_background 9 bottom 10 10 + 3 FIXEDIMG img_main_copyright 3 bottom 10 10 + 9 FIXEDIMG img_princess_room infinite bottom left bottom #princess room + 9 FIXEDIMG img_princess_bed infinite bottom 98 124 #bed + 9 FIXEDIMG img_princess_pillar infinite top 98 124 #pillar #frame type res state Location Floor Mirror - 0 STATE img_jaffar jaffar 100 center no + #0 STATE img_jaffar jaffar 100 center no #frame type res #0 MIDI #0 WAV @@ -19,3 +21,5 @@ ANIMATION presentation 1000 ANIMATION level1 200 + 0 STATE img_jaffar jaffar 100 center no + diff --git a/FP/src/conf/awk/anims_conf.awk b/FP/src/conf/awk/anims_conf.awk index 976d6d6..49a0c40 100644 --- a/FP/src/conf/awk/anims_conf.awk +++ b/FP/src/conf/awk/anims_conf.awk @@ -62,7 +62,11 @@ BEGIN { if (toupper($4)=="INFINITE") $4=0 f["duration" totalfixedimg]=$4/1 f["layer" totalfixedimg]=toupper($5) + if (tolower($6)=="right") $6=320 #here will be the screen width size + if (tolower($6)=="left") $6=0 f["x" totalfixedimg]=$6/1 + if (tolower($7)=="bottom") $7=200 #here will be the screen height size + if (tolower($7)=="top") $7=0 f["y" totalfixedimg]=$7/1 animation["sizef" animcount]++ halt @@ -81,6 +85,7 @@ BEGIN { if ($6=="up") $6=1 if ($6=="middle") $6=2 if ($6=="center") $6=2 + if ($6=="centre") $6=2 if ($6=="down") $6=3 t["floor" totalstate]=$6/1 if ($7=="no") $7=0 @@ -130,7 +135,7 @@ END { coma="" printf("#define ANIMS_FIXEDIMG {") for (i=1;i<=totalfixedimg;i++) { - printf("%s\\\n\t{/*frame*/ (unsigned short)%d,/*res*/ (unsigned long)RES_%s, /*layer*/ (unsigned char)ANIMS_LAYERTYPE_%s, /*x,y*/ (unsigned short)%d,(unsigned short)%d}",coma,f["frame" i],f["res" i],f["layer" i],f["x" i],f["y" i]) + printf("%s\\\n\t{/*frame*/ (unsigned short)%d,/*res*/ (unsigned long)RES_%s, /*duration*/ %d, /*layer*/ (unsigned char)ANIMS_LAYERTYPE_%s, /*x,y*/ (unsigned short)%d,(unsigned short)%d}",coma,f["frame" i],f["res" i],f["duration" i],f["layer" i],f["x" i],f["y" i]) coma="," } printf("\\\n}\n\n") diff --git a/FP/src/conf/resources.conf b/FP/src/conf/resources.conf index a083262..c551b9a 100644 --- a/FP/src/conf/resources.conf +++ b/FP/src/conf/resources.conf @@ -58,6 +58,13 @@ IMG_PRINCESS_PILLAR IMG PV 950 952 IMG_PRINCESS_CLOCK IMG PV 950 953-962 IMG_PRINCESS_BED IMG PV 980 981 IMG_JAFFAR IMG PV 850-888 +IMG_MAIN_BACKGROUND IMG TITLES 50-51 +IMG_MAIN_PRESENTS IMG TITLES 50 52 +IMG_MAIN_AUTHOR IMG TITLES 50 53 +IMG_MAIN_GAME_NAME IMG TITLES 50 54 +IMG_MAIN_COPYRIGHT IMG TITLES 50 55 +IMG_TEXT_BACKGROUND IMG TITLES 40-45 + #our kid IMG_ALL_KID IMG KID 400-619 @@ -75,8 +82,6 @@ IMG_ENV_DUNGEON IMG DUNGEON 200 232 233 234 235 236 237 238 239 240 241 242 IMG_ENV_PALACE IMG PALACE 200 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 269 270 271 272 273 274 285 292 293 294 295 296 297 298 299 300 324 325 326 344 346 347 348 349 350 351 351 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 1230 1231 1286 1287 1288 1289 1290 1291 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 -IMG_MAIN_BACKGROUND IMG TITLES 50-55 -IMG_TEXT_BACKGROUND IMG TITLES 40-45 #sounds diff --git a/FP/src/include/anims.h b/FP/src/include/anims.h index b48f60d..1d23b0a 100644 --- a/FP/src/include/anims.h +++ b/FP/src/include/anims.h @@ -41,8 +41,8 @@ anims.h: FreePrince : Animation functions typedef struct { unsigned short frame; unsigned long res; - unsigned char layer; unsigned short duration; + unsigned char layer; unsigned short x; unsigned short y; } animFixedimg; diff --git a/FP/src/ker/titles.c b/FP/src/ker/titles.c index 3a81b13..1934472 100644 --- a/FP/src/ker/titles.c +++ b/FP/src/ker/titles.c @@ -50,30 +50,29 @@ typedef struct { /* New source */ tMenuOption playAnimation(int id) { - int qf,qt,qo,i; - animFixedimg* f; - animState* t; - animSound* o; - titleFixedimg* fa; - tObject* ta; - animSound* oa; + /* Declare variables */ + int qf, qt, qo, i; + animFixedimg* f; animState* t; animSound* o; + titleFixedimg* fa; tObject* ta; /*animSound* oa;*/ + int activef=0; int activet=0; /*int activeo=0;*/ + int totalf, totalt, totalo; + tKey key=inputCreateKey(); tKey nullKey=inputCreateKey(); - int activef=0; - int activet=0; - /*int activeo=0;*/ - int totalf,totalt,totalo; - tObject* object; - + + /* Initialize animation and allocate memory */ animStart(id,&totalf,&totalt,&totalo); fa=(titleFixedimg*)malloc(totalf*sizeof(titleFixedimg)); ta=(tObject*)malloc(totalt*sizeof(tObject)); - oa=(animSound*)malloc(totalo*sizeof(animSound)); - + /*oa=(animSound*)malloc(totalo*sizeof(animSound));*/ + + /* main animation kernel loop */ while (animGetFrame(&qf,&qt,&qo,f,t,o)) { - if (inputGetEvent(&key)) { + printf("f%d t%d o%d ",qf,qt,qo); + if (!inputGetEvent(&key)) { /* key pressed */ printf("key pressed\n"); + return menuQuit; } else { /* create new images/objects/sounds */ for (i=0;i<qf;i++) { /*images*/ @@ -104,7 +103,7 @@ tMenuOption playAnimation(int id) { for (i=0;i<activet;i++) { /*TODO: detect exits */ objectMove(ta+i,nullKey,NULL); - /*objectDraw(ta+i);*/ + objectDraw(ta[i]); } /* The top layer */ for (i=0;i<activef;i++) { @@ -115,11 +114,13 @@ tMenuOption playAnimation(int id) { /* exited states and caducied backgrounds destruction */ for (i=0;i<activef;i++) { + printf("checking img=%d duration=%d\n",i,fa[i].duration); if (fa[i].duration) { /* if not 0 (infinite) */ fa[i].duration--; if (!fa[i].duration) { /* time is over for this images */ activef--; resFree(fa[i].img); + printf("salio %d\n",i); fa[i]=fa[activef]; } } @@ -127,8 +128,10 @@ tMenuOption playAnimation(int id) { } } /*void objectDraw(tObject kid);*/ - for (i=0;i<activef;i++) objectFree(object[i]); - free(object); + for (i=0;i<activef;i++) objectFree(ta[i]); + free(fa); + free(ta); + /*free(oa);*/ return menuQuit; } @@ -171,7 +174,14 @@ tMenuOption showTitles() { * returns 1 if the user has selected to load a saved game * returns 2 if the user has selected to start the game */ - +/*#define testing*/ +#ifdef testing + printf("Starting animation testing\n"); + + playAnimation(ANIMS_ID_PRESENTATION); + printf("Finishing animation testing\n"); + return menuQuit; +#else tData *main_title; /*tData *main_text;*/ tMenuOption result; @@ -229,5 +239,6 @@ tMenuOption showTitles() { } while (result==menuNone); goodBye; +#endif } diff --git a/FP/src/res/anims.c b/FP/src/res/anims.c index 2f6b384..a71af4c 100644 --- a/FP/src/res/anims.c +++ b/FP/src/res/anims.c @@ -72,19 +72,21 @@ int animGetFrame(int* qf,int* qt,int* qo, animFixedimg* f,animState* t, animSoun while (rec.fixedimgSize&&fixedimg[rec.fixedimgStart].frame==frame) { rec.fixedimgSize--; rec.fixedimgStart++; - *qf++; + (*qf)++; + printf("entro %d\n",*qf); } while (rec.stateSize&&state[rec.stateStart].frame==frame) { rec.stateSize--; rec.stateStart++; - *qf++; + (*qf)++; } while (rec.soundSize&&sound[rec.soundStart].frame==frame) { rec.soundSize--; rec.soundStart++; - *qf++; + (*qf)++; } frame++; + printf("frame=%d\n",frame); return frame!=rec.animSize; }