1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
void afficheBase(BITMAP** buffer, BITMAP** sol, BITMAP** barre, BITMAP* perso_base[2], double positionsPersos[2][2], BITMAP* iconesPersos){
int i;
clear_bitmap(*buffer);
show_mouse(screen);
draw_sprite(*buffer, *sol, 0, 0);
draw_sprite(*buffer, perso_base[0], (int)positionsPersos[0][0] - (perso_base[0])->w/2, (int)positionsPersos[0][1] - (perso_base[0])->h/2);
draw_sprite(*buffer, perso_base[1], (int)positionsPersos[1][0] - (perso_base[1])->w/2, (int)positionsPersos[1][1] - (perso_base[1])->h/2);
draw_sprite(*buffer, *barre, 0, SCREEN_H - (*barre)->h);
draw_sprite(*buffer, iconesPersos, 200, 200);
for (i=1; i<10; i++){
line(*buffer, SCREEN_W/10*i, 0, SCREEN_W/10*i, SCREEN_H-(*barre)->h, makecol(0,0,0));
line(*buffer, 0, (SCREEN_H-(*barre)->h)/10*i, SCREEN_W, (SCREEN_H-(*barre)->h)/10*i, makecol(0,0,0));
}
}
void avancerDroite(BITMAP** buffer, BITMAP* perso_base[2], BITMAP** barre, BITMAP ** sol, BITMAP* imagesPersos[2][4][8], double positionsPersos[2][2], int* enCours, clock_t* debut, clock_t* fin, int img_compt_perso[2][4], int choixPerso, BITMAP* iconesPersos){
int i;
if(peutAller(barre, 0, positionsPersos, choixPerso)){
while(*enCours && (positionsPersos[choixPerso][0])!=SCREEN_W/10/2+SCREEN_W/10*9){
afficheBase(buffer, sol, barre, perso_base, positionsPersos, iconesPersos);
draw_sprite(*buffer, imagesPersos[choixPerso][0][img_compt_perso[choixPerso][0]], (int)(positionsPersos[choixPerso][0]) - (imagesPersos[choixPerso][0][img_compt_perso[choixPerso][0]])->w/2, (int)(positionsPersos[choixPerso][1]) - (imagesPersos[choixPerso][0][img_compt_perso[choixPerso][0]])->h/2 );
blit(*buffer, screen, 0, 0, 0, 0, (*buffer)->w, (*buffer)->h);
*fin = clock();
if((double)(*fin - *debut) / CLOCKS_PER_SEC > 0.05){
img_compt_perso[choixPerso][0] = (++img_compt_perso[choixPerso][0])%8;
perso_base[choixPerso] = imagesPersos[choixPerso][0][img_compt_perso[choixPerso][0]];
*debut = clock();
}
(positionsPersos[choixPerso][0])++;
rest(10);
for(i=0; i<10; i++){
if((positionsPersos[choixPerso][0]) == (SCREEN_W/10/2 + i*SCREEN_W/10)) *enCours = 0;
}
}
*enCours = 1;
clear_keybuf();
}
} |
Partager