summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-03-02 22:20:50 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-03-02 22:20:50 +0300
commit928791b5d334a25ac3ee3195bca446e6c6076841 (patch)
tree5617fb72162fe34afa373edaa5acdafc7af8ce51
parentbaeb28e714b477f0fb09ad0cbe70c8b8af39d312 (diff)
downloadtakethis-928791b5d334a25ac3ee3195bca446e6c6076841.tar
takethis-928791b5d334a25ac3ee3195bca446e6c6076841.tar.xz
takethis-928791b5d334a25ac3ee3195bca446e6c6076841.zip
The SoUnDs! ~_~
-rw-r--r--data/coin.wavbin0 -> 39824 bytes
-rw-r--r--data/door.wavbin0 -> 228766 bytes
-rw-r--r--src/game.c3
-rw-r--r--src/globals.c2
-rw-r--r--src/globals.h2
-rw-r--r--src/main.c3
6 files changed, 10 insertions, 0 deletions
diff --git a/data/coin.wav b/data/coin.wav
new file mode 100644
index 0000000..c0dc31c
--- /dev/null
+++ b/data/coin.wav
Binary files differ
diff --git a/data/door.wav b/data/door.wav
new file mode 100644
index 0000000..9256e0e
--- /dev/null
+++ b/data/door.wav
Binary files differ
diff --git a/src/game.c b/src/game.c
index 601a71f..704ce27 100644
--- a/src/game.c
+++ b/src/game.c
@@ -297,6 +297,7 @@ static void togulag(tt_body *b)
b->txrcol = 15;
b->msg = 0;
b->msglen = 0;
+ Mix_PlayChannel(-1, ttcoin, 0);
ttplayer.money++;
}
@@ -322,6 +323,7 @@ static void keytake(tt_body *b)
b->txrcol = 15;
b->msg = 0;
b->msglen = 0;
+ Mix_PlayChannel(-1, ttcoin, 0);
}
static void doorcol(tt_body *b)
@@ -355,6 +357,7 @@ static void doorcol(tt_body *b)
part->txrcol = 15;
part->msg = 0;
part->msglen = 0;
+ Mix_PlayChannel(-1, ttdoor, 0);
}
}
diff --git a/src/globals.c b/src/globals.c
index 7577c41..dbc322c 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -8,6 +8,8 @@ SDL_Texture *tttxr;
SDL_Renderer *ttrdr;
+Mix_Chunk *ttcoin;
+Mix_Chunk *ttdoor;
Mix_Music *grib;
Mix_Music *ussr;
Mix_Music *stalin;
diff --git a/src/globals.h b/src/globals.h
index bfd6c5e..05584a2 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -15,6 +15,8 @@ extern SDL_Texture *tttxr;
extern SDL_Renderer *ttrdr;
+extern Mix_Chunk *ttcoin;
+extern Mix_Chunk *ttdoor;
extern Mix_Music *grib;
extern Mix_Music *ussr;
extern Mix_Music *stalin;
diff --git a/src/main.c b/src/main.c
index 5fe37fc..26693b8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -22,6 +22,7 @@ int main(int argc, char **argv)
TTF_Init();
Mix_Init(MIX_INIT_OGG);
Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 4096);
+ Mix_AllocateChannels(4);
ttwdw = SDL_CreateWindow("T A K E T H I S", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, 950, 540, 0);
ttrdr = SDL_CreateRenderer(ttwdw, -1, SDL_RENDERER_ACCELERATED);
@@ -31,6 +32,8 @@ int main(int argc, char **argv)
ussr = Mix_LoadMUS("data/ussr.ogg");
stalin = Mix_LoadMUS("data/stalin.ogg");
lenin = Mix_LoadMUS("data/lenin.ogg");
+ ttcoin = Mix_LoadWAV("data/coin.wav");
+ ttdoor = Mix_LoadWAV("data/door.wav");
curmus = 0;
tt_map_load();