summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/door.wavbin228766 -> 228766 bytes
-rw-r--r--data/lenin.wavbin0 -> 13846 bytes
-rw-r--r--src/game.c3
-rw-r--r--src/globals.c1
-rw-r--r--src/globals.h1
-rw-r--r--src/main.c26
6 files changed, 19 insertions, 12 deletions
diff --git a/data/door.wav b/data/door.wav
index 9256e0e..4a2a1da 100644
--- a/data/door.wav
+++ b/data/door.wav
Binary files differ
diff --git a/data/lenin.wav b/data/lenin.wav
new file mode 100644
index 0000000..86ce2f0
--- /dev/null
+++ b/data/lenin.wav
Binary files differ
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);