summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/map/G34
-rw-r--r--src/game.c82
-rw-r--r--src/game.h2
3 files changed, 99 insertions, 19 deletions
diff --git a/data/map/G b/data/map/G
index 0dbd7bf..67502c6 100644
--- a/data/map/G
+++ b/data/map/G
@@ -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
diff --git a/src/game.c b/src/game.c
index b1ef341..300f750 100644
--- a/src/game.c
+++ b/src/game.c
@@ -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();
}
}
}
diff --git a/src/game.h b/src/game.h
index 6f84f24..7bccfad 100644
--- a/src/game.h
+++ b/src/game.h
@@ -2,7 +2,7 @@
#define TT_INCLUDED_GAME
-enum { tt_gotofirstroom = 1 };
+enum { tt_gotofirstroom = 1, tt_gotogulag };
extern int magic;