|
@ -51,11 +51,12 @@ char buf[10000]; |
|
|
char pl1[1000]; |
|
|
char pl1[1000]; |
|
|
char pl2[1000]; |
|
|
char pl2[1000]; |
|
|
char pl3[1000]; |
|
|
char pl3[1000]; |
|
|
|
|
|
char pl4[1000]; |
|
|
char blub[1000]; |
|
|
char blub[1000]; |
|
|
|
|
|
|
|
|
int enp = FALSE; |
|
|
int enp = FALSE; |
|
|
int inp = FALSE; |
|
|
int inp = FALSE; |
|
|
signed int score[3] ={0,0,0}; |
|
|
signed int score[4] ={0,0,0,0}; |
|
|
int scorebuf; |
|
|
int scorebuf; |
|
|
int plselect = 0; |
|
|
int plselect = 0; |
|
|
int lockbz = FALSE; |
|
|
int lockbz = FALSE; |
|
@ -147,7 +148,7 @@ void Quit( int returnCode ) |
|
|
|
|
|
|
|
|
/*fclose(file);*/ |
|
|
/*fclose(file);*/ |
|
|
|
|
|
|
|
|
printf("\033[33mPunktestand:\033[m\n%s: %i\n%s: %i\n%s: %i\n", pl1, score[0], pl2, score[1], pl3, score[2]); |
|
|
printf("\033[33mPunktestand:\033[m\n%s: %i\n%s: %i\n%s: %i\n%s: %i\n", pl1, score[0], pl2, score[1], pl3, score[2], pl4, score[3]); |
|
|
|
|
|
|
|
|
/* and exit appropriately */ |
|
|
/* and exit appropriately */ |
|
|
exit( returnCode ); |
|
|
exit( returnCode ); |
|
@ -344,6 +345,13 @@ void get_buz (void) |
|
|
system("./set_led 0 0 1 0"); |
|
|
system("./set_led 0 0 1 0"); |
|
|
Mix_PlayMusic(buzz_sound, 0); |
|
|
Mix_PlayMusic(buzz_sound, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
if(i == 15) |
|
|
|
|
|
{ |
|
|
|
|
|
plselect = 3; |
|
|
|
|
|
lockbz = TRUE; |
|
|
|
|
|
system("./set_led 0 0 0 1"); |
|
|
|
|
|
Mix_PlayMusic(buzz_sound, 0); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -507,13 +515,13 @@ void draw_sdl (void) |
|
|
drect.h = nfield -> w; |
|
|
drect.h = nfield -> w; |
|
|
drect.y = 650; |
|
|
drect.y = 650; |
|
|
|
|
|
|
|
|
for(countx=0;countx<=2;countx++) |
|
|
for(countx=0;countx<=3;countx++) |
|
|
{ |
|
|
{ |
|
|
drect.x = (countx*365) + 50; |
|
|
drect.x = (countx*250) + 50; |
|
|
SDL_BlitSurface(nfield, NULL, surface, &drect ); |
|
|
SDL_BlitSurface(nfield, NULL, surface, &drect ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
drect.x = (plselect*365) + 50; |
|
|
drect.x = (plselect*250) + 50; |
|
|
SDL_BlitSurface(plac,NULL,surface,&drect); |
|
|
SDL_BlitSurface(plac,NULL,surface,&drect); |
|
|
|
|
|
|
|
|
drect.y = drect.y + 23; |
|
|
drect.y = drect.y + 23; |
|
@ -525,12 +533,17 @@ void draw_sdl (void) |
|
|
|
|
|
|
|
|
SDL_FreeSurface(text); |
|
|
SDL_FreeSurface(text); |
|
|
text = TTF_RenderText_Blended(font, pl2,color); |
|
|
text = TTF_RenderText_Blended(font, pl2,color); |
|
|
drect.x = (365) + 65; |
|
|
drect.x = (250) + 65; |
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
|
|
|
|
|
|
SDL_FreeSurface(text); |
|
|
SDL_FreeSurface(text); |
|
|
text = TTF_RenderText_Blended(font, pl3,color); |
|
|
text = TTF_RenderText_Blended(font, pl3,color); |
|
|
drect.x = (2*365) + 65; |
|
|
drect.x = (2*250) + 65; |
|
|
|
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
|
|
|
|
|
|
|
|
|
SDL_FreeSurface(text); |
|
|
|
|
|
text = TTF_RenderText_Blended(font, pl4,color); |
|
|
|
|
|
drect.x = (3*250) + 65; |
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
|
|
|
|
|
|
drect.y = drect.y + 30; |
|
|
drect.y = drect.y + 30; |
|
@ -546,14 +559,21 @@ void draw_sdl (void) |
|
|
scorebuf = score[1]; |
|
|
scorebuf = score[1]; |
|
|
sprintf(buf,"%i",scorebuf); |
|
|
sprintf(buf,"%i",scorebuf); |
|
|
text = TTF_RenderText_Blended(font,buf,color); |
|
|
text = TTF_RenderText_Blended(font,buf,color); |
|
|
drect.x = (365) + 65; |
|
|
drect.x = (250) + 65; |
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
|
|
|
|
|
|
SDL_FreeSurface(text); |
|
|
SDL_FreeSurface(text); |
|
|
scorebuf = score[2]; |
|
|
scorebuf = score[2]; |
|
|
sprintf(buf,"%i",scorebuf); |
|
|
sprintf(buf,"%i",scorebuf); |
|
|
text = TTF_RenderText_Blended(font,buf,color); |
|
|
text = TTF_RenderText_Blended(font,buf,color); |
|
|
drect.x = (2*365) + 65; |
|
|
drect.x = (2*250) + 65; |
|
|
|
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
|
|
|
|
|
|
|
|
|
SDL_FreeSurface(text); |
|
|
|
|
|
scorebuf = score[3]; |
|
|
|
|
|
sprintf(buf,"%i",scorebuf); |
|
|
|
|
|
text = TTF_RenderText_Blended(font,buf,color); |
|
|
|
|
|
drect.x = (3*250) + 65; |
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
|
|
|
|
|
|
SDL_Flip(surface); |
|
|
SDL_Flip(surface); |
|
@ -591,6 +611,7 @@ int main( int argc, char **argv ) |
|
|
strcpy(pl1,"Jessy"); |
|
|
strcpy(pl1,"Jessy"); |
|
|
strcpy(pl2,"Micha"); |
|
|
strcpy(pl2,"Micha"); |
|
|
strcpy(pl3,"Pierre"); |
|
|
strcpy(pl3,"Pierre"); |
|
|
|
|
|
strcpy(pl4,"Player4"); |
|
|
|
|
|
|
|
|
strcpy(xpfp,"level.txt"); |
|
|
strcpy(xpfp,"level.txt"); |
|
|
|
|
|
|
|
@ -682,7 +703,7 @@ int main( int argc, char **argv ) |
|
|
|
|
|
|
|
|
printf ( "%s\n", SDL_JoystickName ( 0 ) ); |
|
|
printf ( "%s\n", SDL_JoystickName ( 0 ) ); |
|
|
|
|
|
|
|
|
system("./set_led 1 1 1 0"); |
|
|
system("./set_led 1 1 1 1"); |
|
|
|
|
|
|
|
|
SDL_WM_SetCaption(wmcapt, NULL); |
|
|
SDL_WM_SetCaption(wmcapt, NULL); |
|
|
/*SDL_WM_SetIcon(SDL_LoadBMP("glpong.bmp"),NULL);*/ |
|
|
/*SDL_WM_SetIcon(SDL_LoadBMP("glpong.bmp"),NULL);*/ |
|
@ -770,7 +791,7 @@ int main( int argc, char **argv ) |
|
|
|
|
|
|
|
|
/* Player right */ |
|
|
/* Player right */ |
|
|
case SDLK_d: |
|
|
case SDLK_d: |
|
|
if(plselect <2){ |
|
|
if(plselect <3){ |
|
|
plselect ++;} |
|
|
plselect ++;} |
|
|
enp = FALSE; |
|
|
enp = FALSE; |
|
|
inp = FALSE; |
|
|
inp = FALSE; |
|
@ -793,7 +814,7 @@ int main( int argc, char **argv ) |
|
|
case SDLK_RETURN: |
|
|
case SDLK_RETURN: |
|
|
lockbz = FALSE; |
|
|
lockbz = FALSE; |
|
|
enp = TRUE; |
|
|
enp = TRUE; |
|
|
system("./set_led 1 1 1 0"); |
|
|
system("./set_led 1 1 1 1"); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case SDLK_LEFT: |
|
|
case SDLK_LEFT: |
|
@ -846,7 +867,7 @@ int main( int argc, char **argv ) |
|
|
case SDLK_DELETE: |
|
|
case SDLK_DELETE: |
|
|
score[plselect]=score[plselect]-pkt[ypos]; |
|
|
score[plselect]=score[plselect]-pkt[ypos]; |
|
|
lockbz = FALSE; |
|
|
lockbz = FALSE; |
|
|
system("./set_led 1 1 1 0"); |
|
|
system("./set_led 1 1 1 1"); |
|
|
inp = FALSE; |
|
|
inp = FALSE; |
|
|
enp = TRUE; |
|
|
enp = TRUE; |
|
|
break; |
|
|
break; |
|
@ -869,13 +890,13 @@ int main( int argc, char **argv ) |
|
|
/* Unlock Buzzers */ |
|
|
/* Unlock Buzzers */ |
|
|
case SDLK_u: |
|
|
case SDLK_u: |
|
|
lockbz = FALSE; |
|
|
lockbz = FALSE; |
|
|
system("./set_led 1 1 1 0"); |
|
|
system("./set_led 1 1 1 1"); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
/* Reset playing field */ |
|
|
/* Reset playing field */ |
|
|
case SDLK_r: |
|
|
case SDLK_r: |
|
|
lockbz = FALSE; |
|
|
lockbz = FALSE; |
|
|
system("./set_led 1 1 1 0"); |
|
|
system("./set_led 1 1 1 1"); |
|
|
inp = FALSE; |
|
|
inp = FALSE; |
|
|
enp = FALSE; |
|
|
enp = FALSE; |
|
|
break; |
|
|
break; |
|
|