From 928791b5d334a25ac3ee3195bca446e6c6076841 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Tue, 2 Mar 2021 22:20:50 +0300 Subject: The SoUnDs! ~_~ --- src/game.c | 3 +++ src/globals.c | 2 ++ src/globals.h | 2 ++ src/main.c | 3 +++ 4 files changed, 10 insertions(+) (limited to 'src') 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(); -- cgit v1.2.3