|
|
@ -51,11 +51,12 @@ char buf[10000]; |
|
|
|
char pl1[1000]; |
|
|
|
char pl2[1000]; |
|
|
|
char pl3[1000]; |
|
|
|
char pl4[1000]; |
|
|
|
char blub[1000]; |
|
|
|
|
|
|
|
int enp = FALSE; |
|
|
|
int inp = FALSE; |
|
|
|
signed int score[3] ={0,0,0}; |
|
|
|
signed int score[4] ={0,0,0,0}; |
|
|
|
int scorebuf; |
|
|
|
int plselect = 0; |
|
|
|
int lockbz = FALSE; |
|
|
@ -147,7 +148,7 @@ void Quit( int returnCode ) |
|
|
|
|
|
|
|
/*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 */ |
|
|
|
exit( returnCode ); |
|
|
@ -344,6 +345,13 @@ void get_buz (void) |
|
|
|
system("./set_led 0 0 1 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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -482,7 +490,7 @@ void draw_sdl (void) |
|
|
|
} |
|
|
|
if ( n < 10) n = 45; |
|
|
|
drect.y = drect.y + 23; |
|
|
|
strncpy(buf,myblock[xpos][ypos].antwort+i,45); |
|
|
|
strncpy(buf,myblock[xpos][ypos].antwort+i,n); |
|
|
|
SDL_FreeSurface(text); |
|
|
|
text = TTF_RenderText_Blended(font, buf , color); |
|
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
@ -507,13 +515,13 @@ void draw_sdl (void) |
|
|
|
drect.h = nfield -> w; |
|
|
|
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 ); |
|
|
|
} |
|
|
|
|
|
|
|
drect.x = (plselect*365) + 50; |
|
|
|
drect.x = (plselect*250) + 50; |
|
|
|
SDL_BlitSurface(plac,NULL,surface,&drect); |
|
|
|
|
|
|
|
drect.y = drect.y + 23; |
|
|
@ -525,12 +533,17 @@ void draw_sdl (void) |
|
|
|
|
|
|
|
SDL_FreeSurface(text); |
|
|
|
text = TTF_RenderText_Blended(font, pl2,color); |
|
|
|
drect.x = (365) + 65; |
|
|
|
drect.x = (250) + 65; |
|
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
|
|
|
|
|
SDL_FreeSurface(text); |
|
|
|
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); |
|
|
|
|
|
|
|
drect.y = drect.y + 30; |
|
|
@ -556,6 +569,13 @@ void draw_sdl (void) |
|
|
|
drect.x = (2*365) + 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*365) + 65; |
|
|
|
SDL_BlitSurface(text,NULL,surface,&drect); |
|
|
|
|
|
|
|
SDL_Flip(surface); |
|
|
|
} |
|
|
|
|
|
|
@ -591,6 +611,7 @@ int main( int argc, char **argv ) |
|
|
|
strcpy(pl1,"Jessy"); |
|
|
|
strcpy(pl2,"Micha"); |
|
|
|
strcpy(pl3,"Pierre"); |
|
|
|
strcpy(pl4,"Player4"); |
|
|
|
|
|
|
|
strcpy(xpfp,"level.txt"); |
|
|
|
|
|
|
@ -682,7 +703,7 @@ int main( int argc, char **argv ) |
|
|
|
|
|
|
|
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_SetIcon(SDL_LoadBMP("glpong.bmp"),NULL);*/ |
|
|
@ -770,7 +791,7 @@ int main( int argc, char **argv ) |
|
|
|
|
|
|
|
/* Player right */ |
|
|
|
case SDLK_d: |
|
|
|
if(plselect <2){ |
|
|
|
if(plselect <3){ |
|
|
|
plselect ++;} |
|
|
|
enp = FALSE; |
|
|
|
inp = FALSE; |
|
|
@ -793,7 +814,7 @@ int main( int argc, char **argv ) |
|
|
|
case SDLK_RETURN: |
|
|
|
lockbz = FALSE; |
|
|
|
enp = TRUE; |
|
|
|
system("./set_led 1 1 1 0"); |
|
|
|
system("./set_led 1 1 1 1"); |
|
|
|
break; |
|
|
|
|
|
|
|
case SDLK_LEFT: |
|
|
@ -846,7 +867,7 @@ int main( int argc, char **argv ) |
|
|
|
case SDLK_DELETE: |
|
|
|
score[plselect]=score[plselect]-pkt[ypos]; |
|
|
|
lockbz = FALSE; |
|
|
|
system("./set_led 1 1 1 0"); |
|
|
|
system("./set_led 1 1 1 1"); |
|
|
|
inp = FALSE; |
|
|
|
enp = TRUE; |
|
|
|
break; |
|
|
@ -869,13 +890,13 @@ int main( int argc, char **argv ) |
|
|
|
/* Unlock Buzzers */ |
|
|
|
case SDLK_u: |
|
|
|
lockbz = FALSE; |
|
|
|
system("./set_led 1 1 1 0"); |
|
|
|
system("./set_led 1 1 1 1"); |
|
|
|
break; |
|
|
|
|
|
|
|
/* Reset playing field */ |
|
|
|
case SDLK_r: |
|
|
|
lockbz = FALSE; |
|
|
|
system("./set_led 1 1 1 0"); |
|
|
|
system("./set_led 1 1 1 1"); |
|
|
|
inp = FALSE; |
|
|
|
enp = FALSE; |
|
|
|
break; |
|
|
|