thats my code:
Code: Select all
int Question(void)
{
Color dimmedColor = RGB(100, 100, 100);
Color shadowColorD = RGB(55, 55, 55 );
Image* ourImage;
SceCtrlData pad;
char music[200];
char title[200];
char buffer[200];
char filler[200];
int ptr_balken = 1;
int ptr_time = 30;
int ptr_check = 1;
int counter = 1;
quick = 150;
scann = (question * 3)-3;
fseek(file, 1L, 0);
fseek(file, -1L, 1);
while (count < scann)
{
fscanf(file, "%s", &music);
count++;
}
fscanf(file, "%s", &music);
fscanf(file, "%s", &music);
fscanf(file, "%d", &truebutton);
sprintf(buffer, "gfx/questions/question%04d.png", question);
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 480, 272, ourImage, 0, 0);
freeImage(ourImage);
sprintf(buffer, "gfx/balken/balken00.png");
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
freeImage(ourImage);
sprintf(filler, "%d", ptr_time);
printTextScreen(231, 107, filler, shadowColorD);
printTextScreen(230, 107, filler, dimmedColor);
flipScreen();
sprintf(buffer, "gfx/questions/question%04d.png", question);
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 480, 272, ourImage, 0, 0);
freeImage(ourImage);
sprintf(buffer, "gfx/balken/balken00.png");
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
freeImage(ourImage);
sprintf(filler, "%d", ptr_time);
printTextScreen(231, 107, filler, shadowColorD);
printTextScreen(230, 107, filler, dimmedColor);
flipScreen();
ptr_time = ptr_time -1;
sprintf(title, "music/%s.mp3", music);
MP3_Init(1);
MP3_Load(title);
MP3_Play();
CheckButtons();
while (counter < 31)
{
sprintf(buffer, "gfx/balken/balken%02d.png", ptr_balken);
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 442, 21, ourImage, 19, 100);
sprintf(filler, "%d", ptr_time);
printTextScreen(231, 107, filler, shadowColorD);
printTextScreen(230, 107, filler, dimmedColor);
flipScreen();
freeImage(ourImage);
CheckButtons();
ptr_time = ptr_time -1;
if (ptr_check == 2)
{
quick = quick - 10;
if (ptr_balken < 13)
{ptr_balken++;}
ptr_check = 1;
}
else if (ptr_check == 1)
{ptr_check++;}
counter++;
}
MP3_Stop();
MP3_FreeTune();
sprintf(buffer, "gfx/questions/question%04d_w.png", question);
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 480, 272, ourImage, 0, 0);
freeImage(ourImage);
sprintf(buffer, "gfx/points/slow.png");
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 362, 30, ourImage, 59, 90);
freeImage(ourImage);
flipScreen();
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS)
{
sceKernelDelayThread(250000);
break;
}
}
count = 0;
ScoreBoardOne();
return 1;
}
Code: Select all
int CheckButtons(void)
{
int starttime;
Image* ourImage;
SceCtrlData pad;
char buffer[200];
starttime = clock();
while(clock() - starttime < 1000000)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS)
{
pressed = 1;
MP3_Stop();
MP3_FreeTune();
if (truebutton == 1)
{
sprintf(buffer, "gfx/questions/question%04d_r.png", question);
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 480, 272, ourImage, 0, 0);
freeImage(ourImage);
sprintf(buffer, "gfx/points/points%03d.png", quick);
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 362, 30, ourImage, 59, 90);
freeImage(ourImage);
}
else
{
sprintf(buffer, "gfx/questions/question%04d_w.png", question);
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 480, 272, ourImage, 0, 0);
freeImage(ourImage);
sprintf(buffer, "gfx/points/wrong.png");
ourImage = loadImage(buffer);
blitAlphaImageToScreen(0 ,0 , 362, 30, ourImage, 59, 90);
freeImage(ourImage);
quick = 0;
}
flipScreen();
break;
}
}
count = 0;
if (pressed == 1)
{
pressed = 0;
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS)
{
sceKernelDelayThread(250000);
break;
}
}
ScoreBoardOne();
}
return 1;
}
as i said, sometimes the mp3s starting with noise, sometimes they workking properly ...
(besides ive noticed , that small mp3s will be repeated, even if u terminate them imideatly, anyone knows why?)[/code]