more sound effects
This commit is contained in:
parent
2404910870
commit
010c493b90
@ -60,22 +60,27 @@ void buttonsExec(void *handle) {
|
||||
|
||||
if (buttonsMoveLeftPressed()) {
|
||||
stoneMoveLeft();
|
||||
soundCtrl(e_SOUND_STONE_MOVE_LEFT);
|
||||
buttonPressed = 1;
|
||||
}
|
||||
if (buttonsMoveRightPressed()) {
|
||||
stoneMoveRight();
|
||||
soundCtrl(e_SOUND_STONE_MOVE_RIGHT);
|
||||
buttonPressed = 1;
|
||||
}
|
||||
if (buttonsRotateLeftPressed()) {
|
||||
stoneRotateLeft();
|
||||
soundCtrl(e_SOUND_STONE_ROTATE_LEFT);
|
||||
buttonPressed = 1;
|
||||
}
|
||||
if (buttonsRotateRightPressed()) {
|
||||
stoneRotateRight();
|
||||
soundCtrl(e_SOUND_STONE_ROTATE_RIGHT);
|
||||
buttonPressed = 1;
|
||||
}
|
||||
if (buttonsMoveDownPressed()) {
|
||||
stoneMoveDown();
|
||||
soundCtrl(e_SOUND_STONE_MOVE_DOWN);
|
||||
buttonPressed = 1;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "canvas.h"
|
||||
#include "../rgb-driver/colors.h"
|
||||
#include "display.h"
|
||||
#include "sound.h"
|
||||
|
||||
|
||||
#define GAME_CYCLE_TIME 100
|
||||
@ -40,6 +41,7 @@ void gameExec(void *handle) {
|
||||
// --- phase: game --------------------------------------------------------
|
||||
case e_Start:
|
||||
canvasClear();
|
||||
soundCtrl(e_SOUND_START_BACKGROUND);
|
||||
level = 1;
|
||||
score = 0;
|
||||
displaySetValue(score);
|
||||
@ -71,6 +73,7 @@ void gameExec(void *handle) {
|
||||
|
||||
case e_Down:
|
||||
if (! stoneMoveDown()) {
|
||||
soundCtrl(e_SOUND_STONE_LOCKED);
|
||||
state = e_NewStone;
|
||||
} else {
|
||||
proceedDelay = delayFactor(level);
|
||||
@ -80,6 +83,8 @@ void gameExec(void *handle) {
|
||||
|
||||
// --- phase: game over ---------------------------------------------------
|
||||
case e_GameOver:
|
||||
soundCtrl(e_SOUND_STOP_BACKGROUND);
|
||||
soundCtrl(e_SOUND_START_GAMEOVER);
|
||||
rowIndex = CANVAS_HEIGHT;
|
||||
phase = e_Phase_GameOver;
|
||||
state = e_GameOverFill;
|
||||
@ -105,6 +110,7 @@ void gameExec(void *handle) {
|
||||
case e_GameOverDelay:
|
||||
gameOverDelay--;
|
||||
if (gameOverDelay == 0) {
|
||||
soundCtrl(e_SOUND_STOP_GAMEOVER);
|
||||
state = e_Start;
|
||||
}
|
||||
break;
|
||||
@ -113,14 +119,17 @@ void gameExec(void *handle) {
|
||||
|
||||
canvasShow();
|
||||
if (phase == e_Phase_Game) {
|
||||
uint8_t wipeCnt = 0;
|
||||
for (uint8_t r = 0; r < CANVAS_HEIGHT; r++) {
|
||||
if (canvasIsRowFilled(r)) {
|
||||
score += level;
|
||||
displaySetValue(score);
|
||||
canvasWipeRow(r);
|
||||
canvasShow();
|
||||
wipeCnt += 1;
|
||||
}
|
||||
}
|
||||
soundCtrl(e_SOUND_FANFARE_BASE + wipeCnt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,23 +6,23 @@
|
||||
typedef enum {
|
||||
e_SOUND_IDLE = 0,
|
||||
e_SOUND_MUTE = 1,
|
||||
e_SOUND_UNMUTE = 2,
|
||||
e_SOUND_START_BACKGROUND = 3,
|
||||
e_SOUND_STOP_BACKGROUND = 4,
|
||||
e_SOUND_START_GAMEOVER = 5,
|
||||
e_SOUND_STOP GAMEOVER = 6,
|
||||
e_SOUND_SPEED_UP = 7,
|
||||
e_SOUND_FANFARE_1 = 8,
|
||||
e_SOUND_FANFARE_2 = 9,
|
||||
e_SOUND_FANFARE_3 = 10,
|
||||
e_SOUND_FANFARE_4 = 11,
|
||||
e_SOUND_STONE_LOCKED = 12,
|
||||
e_SOUND_STONE_MOVE_LEFT = 13,
|
||||
e_SOUND_STONE_MOVE_RIGHT = 14,
|
||||
e_SOUND_STONE_ROTATE_LEFT = 15,
|
||||
e_SOUND_STONE_ROTATE_RIGHT = 16,
|
||||
e_SOUND_DROPPING_START = 17,
|
||||
e_SOUND_DROPPING_STOP = 18,
|
||||
e_SOUND_UNMUTE,
|
||||
e_SOUND_START_BACKGROUND,
|
||||
e_SOUND_STOP_BACKGROUND,
|
||||
e_SOUND_START_GAMEOVER,
|
||||
e_SOUND_STOP GAMEOVER,
|
||||
e_SOUND_SPEED_UP,
|
||||
e_SOUND_FANFARE_BASE,
|
||||
e_SOUND_FANFARE_1,
|
||||
e_SOUND_FANFARE_2,
|
||||
e_SOUND_FANFARE_3,
|
||||
e_SOUND_FANFARE_4,
|
||||
e_SOUND_STONE_LOCKED,
|
||||
e_SOUND_STONE_MOVE_LEFT,
|
||||
e_SOUND_STONE_MOVE_RIGHT,
|
||||
e_SOUND_STONE_ROTATE_LEFT,
|
||||
e_SOUND_STONE_ROTATE_RIGHT,
|
||||
e_SOUND_STONE_MOVE_DOWN,
|
||||
} t_SoundCmd;
|
||||
|
||||
void soundInit();
|
||||
|
Loading…
x
Reference in New Issue
Block a user