From ec583c67456efbfdb07bb2df43b0d0eee4f7b3e2 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Mon, 1 Mar 2021 17:45:24 +0300 Subject: LENIN ZHIV!!! --- src/game.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index b39a140..4c6d0a6 100644 --- a/src/game.c +++ b/src/game.c @@ -52,6 +52,7 @@ static void step(int d) if (ttplayer.room == ttmap + 'L') { ttplayer.y -= 32; Mix_PlayMusic(lenin, -1); + magic = tt_mausoleum; } } } @@ -179,6 +180,7 @@ static void gotogulag() if (!roomchanged) { roomchanged = 1; ttplayer.room = ttmap + 'G'; + ttplayer.zhiv_lenin = 0; } SDL_SetRenderDrawColor(ttrdr, 0, 0, 0, 255 - (delta - 4200) * 256 / 800); @@ -216,6 +218,60 @@ static void gotogulag() ticks = SDL_GetTicks(); } +static void mausoleum() +{ + int newticks = SDL_GetTicks(); + while (!q && newticks < ticks + 14300) { + int delta = newticks - ticks; + SDL_Event e; + while (SDL_PollEvent(&e)) { + if (e.type == SDL_QUIT) q = 1; + else if (e.type == SDL_KEYDOWN) { + int code = e.key.keysym.scancode; + if (code == SDL_SCANCODE_W) keyw = 1; + else if (code == SDL_SCANCODE_S) keys = 1; + else if (code == SDL_SCANCODE_A) keya = 1; + else if (code == SDL_SCANCODE_D) keyd = 1; + else if (code == SDL_SCANCODE_UP) arru = 1; + else if (code == SDL_SCANCODE_RIGHT) arrr = 1; + else if (code == SDL_SCANCODE_DOWN) arrd = 1; + else if (code == SDL_SCANCODE_LEFT) arrl = 1; + } else if (e.type == SDL_KEYUP) { + int code = e.key.keysym.scancode; + if (code == SDL_SCANCODE_W) keyw = 0; + else if (code == SDL_SCANCODE_S) keys = 0; + else if (code == SDL_SCANCODE_A) keya = 0; + else if (code == SDL_SCANCODE_D) keyd = 0; + else if (code == SDL_SCANCODE_UP) arru = 0; + else if (code == SDL_SCANCODE_RIGHT) arrr = 0; + else if (code == SDL_SCANCODE_DOWN) arrd = 0; + else if (code == SDL_SCANCODE_LEFT) arrl = 0; + } + } + SDL_RenderClear(ttrdr); + tt_player_draw(); + { + int lenin_size = delta * (48 - 4 - 6) / 14300; + SDL_Rect src = { 32, 16 * 11 + 4, 32, lenin_size }; + SDL_Rect dst = { 14 + ttplayer.lenin_pos, + 14 + 32 + 96 - 8 - lenin_size * 2, + 64, lenin_size * 2 }; + SDL_RenderCopy(ttrdr, tttxr, &src, &dst); + } + { + SDL_Rect src = { 96, 16 * 11, 64, 48 }; + SDL_Rect dst = { 14 + ttplayer.lenin_pos - 32, + 110, 128, 96 }; + SDL_RenderCopy(ttrdr, tttxr, &src, &dst); + } + SDL_RenderPresent(ttrdr); + newticks = SDL_GetTicks(); + } + ttplayer.zhiv_lenin = 1; + magic = 0; + ticks = SDL_GetTicks(); +} + void tt_mainloop() { keyw = keya = keys = keyd = arru = arrr = arrd = arrl = 0; @@ -258,6 +314,8 @@ void tt_mainloop() gotofirstroom(); } else if (magic == tt_gotogulag) { gotogulag(); + } else if (magic == tt_mausoleum) { + mausoleum(); } } } -- cgit v1.2.3