summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-03-01 19:23:56 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-03-01 19:23:56 +0300
commit9ebdc06b82e2c60cfcfd21f634b8b96c6b2e1c39 (patch)
treedfb3a972eb323592aef4bd47689b52622d62386b /src
parent5d973f7851d8bfbbbc57b339948995ae44fc2112 (diff)
downloadtakethis-9ebdc06b82e2c60cfcfd21f634b8b96c6b2e1c39.tar
takethis-9ebdc06b82e2c60cfcfd21f634b8b96c6b2e1c39.tar.xz
takethis-9ebdc06b82e2c60cfcfd21f634b8b96c6b2e1c39.zip
Lenin is now really ALIVE.
Diffstat (limited to 'src')
-rw-r--r--src/game.c46
-rw-r--r--src/map.c2
2 files changed, 43 insertions, 5 deletions
diff --git a/src/game.c b/src/game.c
index e6fec03..e3fedbf 100644
--- a/src/game.c
+++ b/src/game.c
@@ -8,6 +8,15 @@ int magic = 0;
static int ticks;
+static const char *gulagmsg = " GULAG HAS YOU";
+
+static void directly_gulag(tt_body *b)
+{
+ gulagmsg = " Communism is Indestructable";
+ magic = tt_gotogulag;
+ Mix_PlayMusic(ussr, -1);
+}
+
static void step(int d)
{
int xw = ttplayer.xwalk * 200;
@@ -25,6 +34,35 @@ static void step(int d)
ttplayer.lenin_pos = oldpos;
ttplayer.lenin_vel *= -1;
}
+ static int lenin_grib = 0;
+ if (ttplayer.lenin_rem % 1000 > 500) {
+ if (!lenin_grib) {
+ lenin_grib = 1;
+ ttplayer.room->bodies_count++;
+ ttplayer.room->bodies = realloc(
+ ttplayer.room->bodies,
+ sizeof(tt_body) * ttplayer.room->bodies_count
+ );
+ tt_body *b = ttplayer.room->bodies +
+ ttplayer.room->bodies_count - 1;
+ b->x = ttplayer.lenin_pos;
+ b->y = 32;
+ b->xrem = 0;
+ b->yrem = 0;
+ b->rem = 0;
+ b->txrrow = 7;
+ b->txrcol = rand() % 4;
+ b->anim = 4;
+ b->rate = 150 + (rand() % 50 - 25);
+ b->collision_act = directly_gulag;
+ b->msg = 0;
+ b->msglen = 0;
+ b->yvel = rand() % 100 - 50;
+ 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;
+ }
+ } else if (lenin_grib) lenin_grib = 0;
}
static int first_gulag = 1;
if (ttplayer.tobein_gulag && ttplayer.until_gulag > 0) {
@@ -202,9 +240,9 @@ static void gotogulag()
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);
+ ttfont, gulagmsg, c);
SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, surf);
- SDL_Rect dst = { 14 + 32 * 5, 14 + 32 * 7,
+ SDL_Rect dst = { 14, 14 + 32 * 7,
surf->w * 2, surf->h * 2 };
SDL_RenderCopy(ttrdr, t, 0, &dst);
SDL_DestroyTexture(t);
@@ -212,9 +250,9 @@ static void gotogulag()
} else {
SDL_Color c = { 128, 20, 20, 255 - (delta - 4200) * 256 / 800 };
SDL_Surface *surf = TTF_RenderText_Blended(
- ttfont, "GULAG HAS YOU", c);
+ ttfont, gulagmsg, c);
SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, surf);
- SDL_Rect dst = { 14 + 32 * 5, 14 + 32 * 7,
+ SDL_Rect dst = { 14, 14 + 32 * 7,
surf->w * 2, surf->h * 2 };
SDL_RenderCopy(ttrdr, t, 0, &dst);
SDL_DestroyTexture(t);
diff --git a/src/map.c b/src/map.c
index f05e2c0..6c52e24 100644
--- a/src/map.c
+++ b/src/map.c
@@ -90,7 +90,7 @@ static void loadroom(tt_room *r, FILE *f)
ttplayer.lenin_pos_rem = 0;
ttplayer.zhiv_lenin = 0;
ttplayer.lenin_rem = 0;
- ttplayer.lenin_vel = -50;
+ ttplayer.lenin_vel = -53;
ttplayer.variant = 0;
ttplayer.tobein_gulag = 0;
ttplayer.until_gulag = 5300;