diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2021-03-01 16:12:29 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2021-03-01 16:12:29 +0300 |
commit | 0e2480485a2353609dc070fbda8649bef884afb0 (patch) | |
tree | ec5155f67e07bed16da40cef0dd2b8ed4ebd17b2 | |
parent | 3cd7f63de831f1e28776aeb0a1c10c52899d549f (diff) | |
download | takethis-0e2480485a2353609dc070fbda8649bef884afb0.tar takethis-0e2480485a2353609dc070fbda8649bef884afb0.tar.xz takethis-0e2480485a2353609dc070fbda8649bef884afb0.zip |
GULAG HAS YOU
-rw-r--r-- | data/map/G | 34 | ||||
-rw-r--r-- | src/game.c | 82 | ||||
-rw-r--r-- | src/game.h | 2 |
3 files changed, 99 insertions, 19 deletions
@@ -1,19 +1,19 @@ 5 GGGG -.3.3.3#0#4#4#4#4#b.6.6#a#4#4#4#4#1.3.3.3 -.3.7.3#7^3^1^0. . . . . . . ^2^1#5.3.7.3 -.3.3.3#7. . . . . . . . . . . ^0#5.3.3.3 -#0#4#4#b. . . . . . . . . . . . #a#4#4#1 -#7^0^3. . . . . . . . . . . . . . . ^2#5 -#7. . . . . #8#6#6#6#6#6#6#9. . . . ^0#5 -#b. . . . #8#3.3.3.3.3.3.3#2#9. . . . #a -.6. . . = #5.3.3.3.3.3.3.3.3#7. . . . .6 -.6. . . . #5.3.3.3.3.3.3.3.3#7. . . . .6 -#9. . . . #a#1.3.3.3.3.3.3#0#b. . . . #8 -#7^1. . . . #a#4#4#4#4#4#4#b. . . . . #5 -#7^2. . . . . . . . . . . . . . . . ^2#5 -#2#6#6#9. . . . . . . . . . . . #8#6#6#3 -.3.3.3#7^1. . . . . . . . . . ^2#5.3.3.3 -.3.7.3#7^0^3^0. . . . . . . . ^2#5.3.7.3 -.3.3.3#2#6#6#6#6#9.6.6#8#6#6#6#6#3.3.3.3 -+000+000= GULAG HAS YOU +.3.3.3r0r4r4r4r4rb.6.6rar4r4r4r4r1.3.3.3 +.3.7.3r7^3^1^0. . . . . . . ^2^1r5.3.7.3 +.3.3.3r7. . . . . . . . . . . ^0r5.3.3.3 +r0r4r4rb. . . . . . . . . . . . rar4r4r1 +r7^0^3. . . . . . . . . . . . . . . ^2r5 +r7. . . . . r8r6r6r6r6r6r6r9. . . . ^0r5 +rb. . . . r8r3.3.3.3.3.3.3r2r9. . . . ra +.6. . . = r5.3.3.3.3.3.3.3.3r7. . . . .6 +.6. . . . r5.3.3.3.3.3.3.3.3r7. . . . .6 +r9. . . . rar1.3.3.3.3.3.3r0rb. . . . r8 +r7^1. . . . rar4r4r4r4r4r4rb. . . . . r5 +r7^2. . . . . . . . . . . . . . . . ^2r5 +r2r6r6r9. . . . . . . . . . . . r8r6r6r3 +.3.3.3r7^1. . . . . . . . . . ^2r5.3.3.3 +.3.7.3r7^0^3^0. . . . . . . . ^2r5.3.7.3 +.3.3.3r2r6r6r6r6r9.6.6r8r6r6r6r6r3.3.3.3 ++000+000= Lenin -- grib @@ -23,7 +23,7 @@ static void step(int d) } ttplayer.until_gulag -= d; if (ttplayer.until_gulag <= 0) { - ttplayer.room = ttmap + 'G'; + magic = tt_gotogulag; Mix_PlayMusic(ussr, -1); } } @@ -132,6 +132,84 @@ static void gotofirstroom() ticks = SDL_GetTicks(); } +static void gotogulag() +{ + SDL_BlendMode mode; + SDL_GetRenderDrawBlendMode(ttrdr, &mode); + int newticks = SDL_GetTicks(); + SDL_SetRenderDrawBlendMode(ttrdr, SDL_BLENDMODE_BLEND); + while (!q && newticks < ticks + 5000) { + 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; + } + } + static int roomchanged = 0; + SDL_RenderClear(ttrdr); + if (delta < 4200) SDL_SetRenderDrawColor(ttrdr, 0, 0, 0, + min(255, delta * 256 / 800)); + else { + if (!roomchanged) { + roomchanged = 1; + ttplayer.room = ttmap + 'G'; + } + SDL_SetRenderDrawColor(ttrdr, 0, 0, 0, + 255 - (delta - 4200) * 256 / 800); + } + tt_player_draw(); + SDL_Rect d = { 14, 14, 32 * 20, 32 * 16 }; + SDL_RenderFillRect(ttrdr, &d); + if (delta < 4200) { + SDL_Color c = { 128, 20, 20, min(255, delta * 256 / 800) }; + SDL_Surface *surf = TTF_RenderText_Blended( + ttfont, "GULAG HAS YOU", c); + SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, surf); + SDL_Rect dst = { 14 + 32 * 5, 14 + 32 * 7, + surf->w * 2, surf->h * 2 }; + SDL_RenderCopy(ttrdr, t, 0, &dst); + SDL_DestroyTexture(t); + SDL_FreeSurface(surf); + } else { + SDL_Color c = { 128, 20, 20, 255 - (delta - 4200) * 256 / 800 }; + SDL_Surface *surf = TTF_RenderText_Blended( + ttfont, "GULAG HAS YOU", c); + SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, surf); + SDL_Rect dst = { 14 + 32 * 5, 14 + 32 * 7, + surf->w * 2, surf->h * 2 }; + SDL_RenderCopy(ttrdr, t, 0, &dst); + SDL_DestroyTexture(t); + SDL_FreeSurface(surf); + } + SDL_RenderPresent(ttrdr); + newticks = SDL_GetTicks(); + SDL_SetRenderDrawColor(ttrdr, 0, 0, 0, 255); + } + SDL_SetRenderDrawBlendMode(ttrdr, mode); + magic = 0; + ticks = SDL_GetTicks(); +} + void tt_mainloop() { keyw = keya = keys = keyd = arru = arrr = arrd = arrl = 0; @@ -172,6 +250,8 @@ void tt_mainloop() SDL_RenderPresent(ttrdr); if (magic == tt_gotofirstroom) { gotofirstroom(); + } else if (magic == tt_gotogulag) { + gotogulag(); } } } @@ -2,7 +2,7 @@ #define TT_INCLUDED_GAME -enum { tt_gotofirstroom = 1 }; +enum { tt_gotofirstroom = 1, tt_gotogulag }; extern int magic; |