Winning Sound Effects
Well i compiled the source and my game ran fine so i cloased it to tweak the coed some more and i left it along to play a game that i dled form NeHe''s site. I ran the game and it stareted good but when i went to fullscreen the damn thing crashed my computer.
I couldn''t revive it without doing a hard boot, and because i couldn''t i lost some of the code.
well i trying to get two sound effect to play at it own certain time. for example s1.wav is for if player1 wins s2.wav is for if player2 wins.
The code that i''m using is like this.
if (score_home_team | options.sound == true) PlaySound("Data/s1.wav", NULL, SND_ASYNC | SND_FILENAME); if (score_road_team | options.sound == true) PlaySound("Data/s2.wav", NULL, SND_ASYNC | SND_FILENAME);
Now when player1 wins it plays s1 but if player2 wins it still plays s2.
I also tryed this code
if (score_home_team | options.sound == true) PlaySound("Data/s1.wav", NULL, SND_ASYNC | SND_FILENAME); else if (score_road_team | options.sound == true) PlaySound("Data/s2.wav", NULL, SND_ASYNC | SND_FILENAME);
and i also tryed this one.
if (score_home_team> score_road_team | options.sound == true) PlaySound("Data/s1.wav", NULL, SND_ASYNC | SND_FILENAME); else PlaySound("Data/s2.wav", NULL, SND_ASYNC | SND_FILENAME);
How do i get it to play each soundfor the corect situation. like i want player1 to have s1 if he win and player2 to have s2 if he wins.
--------------------------I shall thrash his bloody head in, cut it from upon his shoulders, and as his blood flows effortlessly down my blade, I shall taste it's sweetness. Blade Runner’s Entertainment Nothing much right now...
In your if statements your using the "bitwise inclusive or operator" (|), not the "logical or operator" (||). You need to use || not |.
ex. if (score_home_team == true || options.sound == true)
BTW, you only use this to combine multiple conditions. The | in the playsound parameters are fine.
Digital Radiation
Edited by - +AA_970+ on January 15, 2001 1:35:31 PM
ex. if (score_home_team == true || options.sound == true)
BTW, you only use this to combine multiple conditions. The | in the playsound parameters are fine.
Digital Radiation
Edited by - +AA_970+ on January 15, 2001 1:35:31 PM
That didn''t help, it still didn''t do what i wanted it to do. Maybe i need to rewrite the whole wining game code.
--------------------------I shall thrash his bloody head in, cut it from upon his shoulders, and as his blood flows effortlessly down my blade, I shall taste it's sweetness. Blade Runner’s Entertainment Nothing much right now...
Make sure your not setting both score_home_team and score_road_team to true and when you set one to true you set the other to false.
Digital Radiation
Digital Radiation
We''ll my advice will proberbly be totally wrong but anywayz...
Try replacing the or (||) operators with an and (&&) operator...it appears to me that it is guna play the sound only on the condition sound is enabled, weather or not its the right team
eh?
Try replacing the or (||) operators with an and (&&) operator...it appears to me that it is guna play the sound only on the condition sound is enabled, weather or not its the right team
eh?
eh?
hehe... couldn''t help but notice that forgotton_associator is right... you''re using the wrong logical operator... you do need an AND rather than an OR... any of those code fragments will then work correctly
![](smile.gif)
Well i'm using Visual C++ 6.0 and heres the source to the game/demo.
/***************************************************************************/}
else if (score_home_team == score_road_team)
{
Font_Char(" LAST GOAL WINS!! ", -2800, 1950, 300, 0, typed, typed_mask, R_5, G_5, B_5);
}
else
{
keys[VK_ESCAPE] = false;
keys[VK_RETURN] = false;
while ((keys[VK_ESCAPE] == false) && (keys[VK_RETURN] == false))
{
Process_Messages();
Draw_Items_3D();
/*if (screen_resolution == 1)
*menu.get_1 = "DISABLED.";
else if (screen_resolution == 2)
*menu.get_1 = "DISABLED.";
else if (screen_resolution == 3)
*menu.get_1 = "DISABLED.";
else if (screen_resolution == 4)
*menu.get_1 = "DISABLED.";
else if (screen_resolution == 5)
*menu.get_1 = "DISABLED.";*/
if (score_home_team > score_road_team)// was never this change to (score_home_team > score_road_team)
Font_Char(" PLAYER 1 WINS", -2500, 600, 250, 0, typed, typed_mask, R_5, G_5, B_5);
else
Font_Char(" PLAYER 2 WINS", -2500, 600, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Font_Char("PRESS ENTER FOR REMATCH", -2500, 200, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Font_Char(" PRESS ESCAPE FOR MENU", -2500, -200, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Draw_Scoreboard(-2500, -1500, 350, 1, score_home_team);
Draw_Scoreboard(2500, 1500, 350, 2, score_road_team);//2500, 1500, 350,
Draw_FPS(1 / scale);
SwapBuffers(hDC);
}
if (score_home_team && options.sound == true)
PlaySound("Data/Crowd.wav", NULL, SND_ASYNC | SND_FILENAME);
else if (score_road_team && options.sound == true)
PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);
/* if (score_road_team || options.sound == true)
PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);*/
reset_game = true;
if (keys[VK_ESCAPE] == true)
Menu_Sphere();
}
}
else
{
Font_Char("SCORE UP TO", -3100, 2200, 180, 0, typed, typed_mask, R_6, G_6, B_6);
Font_Int(options.competition_value, -1200, 2200, 180, 0, typed, typed_mask, R_6, G_6, B_6);
if ((score_home_team == options.competition_value) || (score_road_team == options.competition_value))
{
keys[VK_ESCAPE] = false;
keys[VK_RETURN] = false;
while ((keys[VK_ESCAPE] == false) && (keys[VK_RETURN] == false))
{
Process_Messages();
Draw_Items_3D();
if (score_home_team > score_road_team)
Font_Char(" PLAYER 1 WINS", -2500, 600, 250, 0, typed, typed_mask, R_5, G_5, B_5);
else
Font_Char(" PLAYER 2 WINS", -2500, 600, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Font_Char("PRESS ENTER FOR REMATCH", -2500, 200, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Font_Char(" PRESS ESCAPE FOR MENU", -2500, -200, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Draw_Scoreboard(-2500, -1500, 350, 1, score_home_team);
Draw_Scoreboard(2500, 1500, 350, 2, score_road_team);//2500, 1500, 350,
Draw_FPS(1 / scale);
SwapBuffers(hDC);
}
if (score_home_team && options.sound == true)
PlaySound("Data/Crowd.wav", NULL, SND_ASYNC | SND_FILENAME);
else if score_road_team && options.sound == true) PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);
reset_game = true;
if (keys[VK_ESCAPE] == true)
Menu_Sphere();
}
}
Draw_Scoreboard(-2500, -1500, 350, 1, score_home_team);
Draw_Scoreboard(2500, 1500, 350, 2, score_road_team);//2500, 1500, 350,
Draw_FPS(1 / scale);
SwapBuffers(hDC);
if (keys[VK_ESCAPE])
Menu_Sphere();
}
// Shutdown
Show_End_Sphere();
KillGLWindow();
return (msg.wParam);
}
The cut and paste didn't really go like i thought but hopefully you all can read and understand it.
Edited by - Blade Runner on January 18, 2001 10:09:48 PM
/***************************************************************************/}
else if (score_home_team == score_road_team)
{
Font_Char(" LAST GOAL WINS!! ", -2800, 1950, 300, 0, typed, typed_mask, R_5, G_5, B_5);
}
else
{
keys[VK_ESCAPE] = false;
keys[VK_RETURN] = false;
while ((keys[VK_ESCAPE] == false) && (keys[VK_RETURN] == false))
{
Process_Messages();
Draw_Items_3D();
/*if (screen_resolution == 1)
*menu.get_1 = "DISABLED.";
else if (screen_resolution == 2)
*menu.get_1 = "DISABLED.";
else if (screen_resolution == 3)
*menu.get_1 = "DISABLED.";
else if (screen_resolution == 4)
*menu.get_1 = "DISABLED.";
else if (screen_resolution == 5)
*menu.get_1 = "DISABLED.";*/
if (score_home_team > score_road_team)// was never this change to (score_home_team > score_road_team)
Font_Char(" PLAYER 1 WINS", -2500, 600, 250, 0, typed, typed_mask, R_5, G_5, B_5);
else
Font_Char(" PLAYER 2 WINS", -2500, 600, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Font_Char("PRESS ENTER FOR REMATCH", -2500, 200, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Font_Char(" PRESS ESCAPE FOR MENU", -2500, -200, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Draw_Scoreboard(-2500, -1500, 350, 1, score_home_team);
Draw_Scoreboard(2500, 1500, 350, 2, score_road_team);//2500, 1500, 350,
Draw_FPS(1 / scale);
SwapBuffers(hDC);
}
if (score_home_team && options.sound == true)
PlaySound("Data/Crowd.wav", NULL, SND_ASYNC | SND_FILENAME);
else if (score_road_team && options.sound == true)
PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);
/* if (score_road_team || options.sound == true)
PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);*/
reset_game = true;
if (keys[VK_ESCAPE] == true)
Menu_Sphere();
}
}
else
{
Font_Char("SCORE UP TO", -3100, 2200, 180, 0, typed, typed_mask, R_6, G_6, B_6);
Font_Int(options.competition_value, -1200, 2200, 180, 0, typed, typed_mask, R_6, G_6, B_6);
if ((score_home_team == options.competition_value) || (score_road_team == options.competition_value))
{
keys[VK_ESCAPE] = false;
keys[VK_RETURN] = false;
while ((keys[VK_ESCAPE] == false) && (keys[VK_RETURN] == false))
{
Process_Messages();
Draw_Items_3D();
if (score_home_team > score_road_team)
Font_Char(" PLAYER 1 WINS", -2500, 600, 250, 0, typed, typed_mask, R_5, G_5, B_5);
else
Font_Char(" PLAYER 2 WINS", -2500, 600, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Font_Char("PRESS ENTER FOR REMATCH", -2500, 200, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Font_Char(" PRESS ESCAPE FOR MENU", -2500, -200, 250, 0, typed, typed_mask, R_5, G_5, B_5);
Draw_Scoreboard(-2500, -1500, 350, 1, score_home_team);
Draw_Scoreboard(2500, 1500, 350, 2, score_road_team);//2500, 1500, 350,
Draw_FPS(1 / scale);
SwapBuffers(hDC);
}
if (score_home_team && options.sound == true)
PlaySound("Data/Crowd.wav", NULL, SND_ASYNC | SND_FILENAME);
else if score_road_team && options.sound == true) PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);
reset_game = true;
if (keys[VK_ESCAPE] == true)
Menu_Sphere();
}
}
Draw_Scoreboard(-2500, -1500, 350, 1, score_home_team);
Draw_Scoreboard(2500, 1500, 350, 2, score_road_team);//2500, 1500, 350,
Draw_FPS(1 / scale);
SwapBuffers(hDC);
if (keys[VK_ESCAPE])
Menu_Sphere();
}
// Shutdown
Show_End_Sphere();
KillGLWindow();
return (msg.wParam);
}
The cut and paste didn't really go like i thought but hopefully you all can read and understand it.
Edited by - Blade Runner on January 18, 2001 10:09:48 PM
--------------------------I shall thrash his bloody head in, cut it from upon his shoulders, and as his blood flows effortlessly down my blade, I shall taste it's sweetness. Blade Runner’s Entertainment Nothing much right now...
Holly shit i figured it out and now it time for me to go to bed . But thanks for the help guies/gals this is how it goes just incaseyou wanted to know.
if (score_home_team > score_road_team && options.sound == true)
PlaySound("Data/Crowd.wav", NULL, SND_ASYNC | SND_FILENAME);
else PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);
bye... :->
if (score_home_team > score_road_team && options.sound == true)
PlaySound("Data/Crowd.wav", NULL, SND_ASYNC | SND_FILENAME);
else PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);
bye... :->
--------------------------I shall thrash his bloody head in, cut it from upon his shoulders, and as his blood flows effortlessly down my blade, I shall taste it's sweetness. Blade Runner’s Entertainment Nothing much right now...
Holly shit i figured it out and now it time for me to go to bed . But thanks for the help guies/gals this is how it goes just incaseyou wanted to know.
if (score_home_team > score_road_team && options.sound == true)
PlaySound("Data/Crowd.wav", NULL, SND_ASYNC | SND_FILENAME);
else PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);
bye... :->
if (score_home_team > score_road_team && options.sound == true)
PlaySound("Data/Crowd.wav", NULL, SND_ASYNC | SND_FILENAME);
else PlaySound("Data/Help.wav", NULL, SND_ASYNC | SND_FILENAME);
bye... :->
--------------------------I shall thrash his bloody head in, cut it from upon his shoulders, and as his blood flows effortlessly down my blade, I shall taste it's sweetness. Blade Runner’s Entertainment Nothing much right now...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement