summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-03-02 22:32:31 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-03-02 22:32:31 +0300
commit75c4749d444921135de90960244d493bd0ddeb64 (patch)
tree02814705cb131d31cf1ffddb8a17fc952f79f8a3 /src
parent928791b5d334a25ac3ee3195bca446e6c6076841 (diff)
downloadtakethis-75c4749d444921135de90960244d493bd0ddeb64.tar
takethis-75c4749d444921135de90960244d493bd0ddeb64.tar.xz
takethis-75c4749d444921135de90960244d493bd0ddeb64.zip
More SOUNDS!
Diffstat (limited to 'src')
-rw-r--r--src/game.c3
-rw-r--r--src/globals.c1
-rw-r--r--src/globals.h1
-rw-r--r--src/main.c26
4 files changed, 19 insertions, 12 deletions
diff --git a/src/game.c b/src/game.c
index 704ce27..9ecb6da 100644
--- a/src/game.c
+++ b/src/game.c
@@ -160,7 +160,7 @@ static void save()
static void load()
{
- FILE *f = fopen("save", "r");
+ FILE *f = fopen("save", "r");
if (!f) return;
first_gulag = readnum(f);
int c = fgetc(f);
@@ -402,6 +402,7 @@ static void step(int d)
b->yvel = b->yvel < 0 ? b->yvel - 50 : b->yvel + 50;
b->xvel = rand() % 100 - 50;
b->xvel = b->yvel < 0 ? b->yvel - 50 : b->yvel + 50;
+ Mix_PlayChannel(-1, ttlenin, 0);
}
} else if (lenin_grib)
lenin_grib = 0;
diff --git a/src/globals.c b/src/globals.c
index dbc322c..800ece3 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -8,6 +8,7 @@ SDL_Texture *tttxr;
SDL_Renderer *ttrdr;
+Mix_Chunk *ttlenin;
Mix_Chunk *ttcoin;
Mix_Chunk *ttdoor;
Mix_Music *grib;
diff --git a/src/globals.h b/src/globals.h
index 05584a2..a3189da 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -15,6 +15,7 @@ extern SDL_Texture *tttxr;
extern SDL_Renderer *ttrdr;
+extern Mix_Chunk *ttlenin;
extern Mix_Chunk *ttcoin;
extern Mix_Chunk *ttdoor;
extern Mix_Music *grib;
diff --git a/src/main.c b/src/main.c
index 26693b8..65a2850 100644
--- a/src/main.c
+++ b/src/main.c
@@ -23,18 +23,19 @@ int main(int argc, char **argv)
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,
+ 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);
- tttxr = loadtxr("data/txr.bmp");
- ttfont = TTF_OpenFont("data/font.otf", 24);
- grib = Mix_LoadMUS("data/grib.ogg");
- 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;
+ ttrdr = SDL_CreateRenderer(ttwdw, -1, SDL_RENDERER_ACCELERATED);
+ tttxr = loadtxr("data/txr.bmp");
+ ttfont = TTF_OpenFont("data/font.otf", 24);
+ grib = Mix_LoadMUS("data/grib.ogg");
+ 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");
+ ttlenin = Mix_LoadWAV("data/lenin.wav");
+ curmus = 0;
tt_map_load();
srand(time(0));
@@ -48,6 +49,9 @@ int main(int argc, char **argv)
SDL_DestroyRenderer(ttrdr);
SDL_DestroyWindow(ttwdw);
Mix_HaltMusic();
+ Mix_FreeChunk(ttlenin);
+ Mix_FreeChunk(ttcoin);
+ Mix_FreeChunk(ttdoor);
Mix_FreeMusic(lenin);
Mix_FreeMusic(stalin);
Mix_FreeMusic(ussr);