• Advertisement

Archived

This topic is now archived and is closed to further replies.

Winning Sound Effects

This topic is 6244 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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... :->

Share this post


Link to post
Share on other sites
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... :->

Share this post


Link to post
Share on other sites

  • Advertisement