Avoid doing OpenDevice on a handler.
[AROS-Contrib.git] / Games / Bomber / BomberBonus.c
blob042a76f53145aeb14cd5f857774c48b56b409dfb
1 //Clear the bonuses
2 void ClearBonus ()
4 int x, y;
5 for (y = 0; y < 17; y++) for (x = 0; x < 17; x++)
6 BonusGrid [x][y] = 0;
9 //Draw all bonuses
10 void DrawBonus ()
12 int x, y;
13 for (y = 0; y < 17; y++) for (x = 0; x < 17; x++)
14 if (BonusGrid [x][y]) DrawBlock (x, y, BonusGrid [x][y] + (Frame & 2), 4);
17 //Check whether a player receives a bonus
18 void CheckBonus ()
20 int p, x, y;
22 for (p = 0; p < Players; p++) {
23 //Calculate coordinates
24 x = PlayerX [p] >> 4;
25 y = PlayerY [p] >> 4;
27 //If there is a bonus
28 if (BonusGrid [x][y]) {
29 //Take appropriate action
30 if (BonusGrid [x][y] == 1) if (MaxRange [p] < 15) MaxRange [p]++;
31 if (BonusGrid [x][y] == 2) if (MaxBombs [p] < 8) MaxBombs [p]++;
32 //Play sound
33 #if !NO_SOUND
34 PlaySound ((LPCSTR)Bonus, NULL, SND_ASYNC | SND_MEMORY);
35 #endif
36 //Remove the bonus
37 BonusGrid [x][y] = 0;
38 DrawBlock (x, y, 0, 0);