diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game.c | 3 | ||||
-rw-r--r-- | src/globals.c | 1 | ||||
-rw-r--r-- | src/globals.h | 1 | ||||
-rw-r--r-- | src/main.c | 26 |
4 files changed, 19 insertions, 12 deletions
@@ -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; @@ -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); |