summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-03-01 12:47:01 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-03-01 12:47:01 +0300
commit7fbb9c444057fe3f30da0bac4d52fd8c6e8ba59b (patch)
treefc407dc77b1464300e400135df97855123ed9535
parenta365de1b0ab91f9c057196a601d96d2aed6e48fb (diff)
downloadtakethis-7fbb9c444057fe3f30da0bac4d52fd8c6e8ba59b.tar
takethis-7fbb9c444057fe3f30da0bac4d52fd8c6e8ba59b.tar.xz
takethis-7fbb9c444057fe3f30da0bac4d52fd8c6e8ba59b.zip
O_o
-rw-r--r--Makefile2
-rw-r--r--data/map/08
-rw-r--r--data/map/150
-rw-r--r--data/map/@32
-rw-r--r--data/map/G19
-rw-r--r--data/txr.bmpbin196746 -> 213130 bytes
-rw-r--r--src/game.c10
-rw-r--r--src/map.c37
-rw-r--r--src/player.c21
-rw-r--r--src/player.h2
-rw-r--r--src/room.h1
11 files changed, 112 insertions, 70 deletions
diff --git a/Makefile b/Makefile
index 977ea63..69c10cb 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ else
CFLAGS += -O3
endif
# Use SDL:
-LFLAGS = -lSDL2 -lSDL2_ttf -lSDL2_mixer
+LFLAGS = -lSDL2 -lSDL2_ttf -lSDL2_mixer -lm
# Directories definitions:
BUILD = build
diff --git a/data/map/0 b/data/map/0
index 719c8ff..5d16e33 100644
--- a/data/map/0
+++ b/data/map/0
@@ -6,10 +6,10 @@
#7. . ^1. . . . . . . . . . . . . . . #5
#7. . . . . . . . . . . . . . . . . . #5
#7. . . . . . . . . . . . . . . $ . . #5
-#7. . . . . . . . . . . . . . . . . . #5
-#7. . . $1. . . . . . . . . . . . . . X2
-#7. . . . . . . . . . . . . . . . . . X3
-#7. . . . . . . . . . . . . . . . . . #5
+#7. . . . . . . . . . . . . . . . . . #a
+#7. . . $1. . . . . . . . . . . . . . .0
+#7. . . . . . . . . . . . . . . . . . .0
+#7. . . . . . . . . . . . . . . . . . #8
#7. . . . . . . . . . . . . . . . . . #5
#7. . $ . . . . . . . . . . . . . . . #5
#7. . . . . . . . . ^2. . . ^1. . . . #5
diff --git a/data/map/1 b/data/map/1
index 93ee8bd..0963d94 100644
--- a/data/map/1
+++ b/data/map/1
@@ -1,27 +1,25 @@
-0
+5
.230
-#0#4#4#4#4#4#4#4#4#4#4#4#4#4#4#4#4#4#4#1
-#7. . . . . . . . . . . . . . . . . . #5
-#7. . $ . . . . . ^ . . . . . . . $ . #5
-#7. . . . . . . . . . . . . . ^ . . . #5
-#7. . . . . $ . . . . . . $ . . . . . #5
-#7. . . . . . . . . . . . . . . . . . #5
-#7. . . $ . . ^3^ ^1^ ^2^ . . . . . . #5
-X7. . . . . . . . . . . ^3. . . . . . X2
-X6. . . . . . . . . . . ^1. . . ^2. . X3
-#7. . . . ^ . $ . . . . ^ . . . . . . #5
-#7. . . . ^2. . . . . . . . $ . . . . #5
-#7. . $ . ^3. . . . . . . . . . . . . #5
-#7. . . . . . . . . $ . . . ^1. . . . #5
-#7. . . . . . . . . . . . . . . ^ . . #5
-#7. . . . . . . . . . . . . . . . . . #5
-#2#6#6#6#6#6#6#6#6X4X5#6#6#6#6#6#6#6#6#3
-+030+050
--050+100
-+065-054
-+052-045
--098+034
-+000+000
-+040-023
--047-073
--034-078
+.3.3.3#0#4#4#4#4#4#4#4#4#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. . $1. . #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
++094-097
++000+000= USSR ZHIVI
++000+000= FOREVER!
++000+000= -- some GRIB on this
++000+000= MXII syezd of KPSS
+-094+097
++094+097
diff --git a/data/map/@ b/data/map/@
index 4ae3c97..2a22f05 100644
--- a/data/map/@
+++ b/data/map/@
@@ -1,21 +1,21 @@
5
....
-#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>
-#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>
-#>#>#0#4#4#4#4#4#4#4#4#4#4#4#4#4#1#>#>#>
-#>#>#7.6. . . . . . . . . . . .6#5#>#>#>
-#>#>#7.6= . . . . . . . . . . .6#5#>#>#>
-#>#>#7.6. . . = . . . . . . . .6#5#>#>#>
-#>#>#7.6. . * . . &6. . * . . .6#5#>#>#>
-#>#>#7.6. . . . . . . . . . . .6#5#>#>#>
-#>#>#7.6. . . . . M . . . . . .6#5#>#>#>
-#>#>#7.6. . . . . . . . . . . .6#5#>#>#>
-#>#>#7.6. . . . . . . . . . . .6#5#>#>#>
-#>#>#7.6. . . . . @ . . . . . .6#5#>#>#>
-#>#>#7.6. . . . . . . . . . . .6#5#>#>#>
-#>#>#2#6#6#6#6#6#6#6#6#6#6#6#6#6#3#>#>#>
-#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>
-#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>
+#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f
+#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f
+#f#f#0#4#4#4#4#4#4#4#4#4#4#4#4#4#1#f#f#f
+#f#f#7.6. . . . . . . . . . . .6#5#f#f#f
+#f#f#7.6= . . . . . . . . . . .6#5#f#f#f
+#f#f#7.6. . . = . . . . . . . .6#5#f#f#f
+#f#f#7.6. . * . . &6. . * . . .6#5#f#f#f
+#f#f#7.6. . . . . . . . . . . .6#5#f#f#f
+#f#f#7.6. . . . . M . . . . . .6#5#f#f#f
+#f#f#7.6. . . . . . . . . . . .6#5#f#f#f
+#f#f#7.6. . . . . . . . . . . .6#5#f#f#f
+#f#f#7.6. . . . . @ . . . . . .6#5#f#f#f
+#f#f#7.6. . . . . . . . . . . .6#5#f#f#f
+#f#f#2#6#6#6#6#6#6#6#6#6#6#6#6#6#3#f#f#f
+#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f
+#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f
+000+000=IT'S DANGEROUS TO GO ALONE!
+000+000=TAKE THIS.
+000+000
diff --git a/data/map/G b/data/map/G
new file mode 100644
index 0000000..0dbd7bf
--- /dev/null
+++ b/data/map/G
@@ -0,0 +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
diff --git a/data/txr.bmp b/data/txr.bmp
index 8864f88..67972ff 100644
--- a/data/txr.bmp
+++ b/data/txr.bmp
Binary files differ
diff --git a/src/game.c b/src/game.c
index 444f9ff..a4b4924 100644
--- a/src/game.c
+++ b/src/game.c
@@ -10,11 +10,17 @@ static int ticks;
static void step(int d)
{
- int xw = ttplayer.xwalk * 137;
- int yw = ttplayer.ywalk * 137;
+ int xw = ttplayer.xwalk * 200;
+ int yw = ttplayer.ywalk * 200;
if (xw || yw) {
ttplayer.rem += d;
}
+ if (ttplayer.tobein_gulag && ttplayer.until_gulag > 0) {
+ ttplayer.until_gulag -= d;
+ if (ttplayer.until_gulag <= 0) {
+ ttplayer.room = ttmap + 'G';
+ }
+ }
if (xw && yw) {
ttplayer.xrem += (double)(xw * d) / sqrt(2);
ttplayer.yrem += (double)(yw * d) / sqrt(2);
diff --git a/src/map.c b/src/map.c
index 13894d6..d0575fb 100644
--- a/src/map.c
+++ b/src/map.c
@@ -31,6 +31,17 @@ static SDL_Rect *newtile(int row, int col)
static void do_nothing(tt_body *b)
{}
+static void togulag(tt_body *b)
+{
+ ttplayer.tobein_gulag = 1;
+ b->collision_act = do_nothing;
+ b->anim = 1;
+ b->txrrow = 0;
+ b->txrcol = 15;
+ b->msg = 0;
+ b->msglen = 0;
+}
+
static void gribtake(tt_body *b)
{
Mix_PlayMusic(ponpon, -1);
@@ -38,6 +49,9 @@ static void gribtake(tt_body *b)
b->anim = 1;
b->txrrow = 0;
b->txrcol = 15;
+ b->msg = 0;
+ b->msglen = 0;
+ ttplayer.variant = 1;
magic = tt_gotofirstroom;
}
@@ -56,10 +70,10 @@ static void loadroom(tt_room *r, FILE *f)
int id = fgetc(f);
int c = id;
if (id == ' ') id = '0';
- id -= '0';
+ if (id < 'a') id -= '0';
+ else id = id - 'a' + 10;
r->floor[i][j] = 0;
r->walls[i][j] = 0;
- r->roof[i][j] = 0;
if (type == '@') {
ttplayer.room = r;
ttplayer.x = j * 32;
@@ -72,7 +86,9 @@ static void loadroom(tt_room *r, FILE *f)
ttplayer.money = 0;
ttplayer.keys = 0;
ttplayer.the_key = 0;
- ttplayer.variant = 1;
+ ttplayer.variant = 0;
+ ttplayer.tobein_gulag = 0;
+ ttplayer.until_gulag = 5300;
r->floor[i][j] = newtile(0, default_floor_id);
} else if (type == '#') {
r->walls[i][j] = malloc(sizeof(tt_body));
@@ -104,7 +120,7 @@ static void loadroom(tt_room *r, FILE *f)
b->xvel = 0;
b->yvel = 0;
b->rem = 0;
- b->txrrow = 8;
+ b->txrrow = 7;
b->txrcol = id;
b->anim = 4;
b->rate = 150 + (rand() % 50 - 25);
@@ -122,7 +138,7 @@ static void loadroom(tt_room *r, FILE *f)
b->xvel = 0;
b->yvel = 0;
b->rem = 0;
- b->txrrow = 8;
+ b->txrrow = 7;
b->txrcol = id;
b->anim = 4;
b->rate = 150 + (rand() % 50 - 25);
@@ -140,7 +156,7 @@ static void loadroom(tt_room *r, FILE *f)
b->xvel = 0;
b->yvel = 0;
b->rem = 0;
- b->txrrow = 10;
+ b->txrrow = 9;
b->txrcol = id;
b->anim = 1;
b->rate = 100;
@@ -159,16 +175,13 @@ static void loadroom(tt_room *r, FILE *f)
b->xvel = 0;
b->yvel = 0;
b->rem = 0;
- b->txrrow = 9;
+ b->txrrow = 8;
b->txrcol = id;
b->anim = 4;
b->rate = 150 + (rand() % 50 - 25);
b->collision_act = do_nothing;
b->msg = 0;
b->msglen = 0;
- } else if (type == 'X') {
- r->floor[i][j] = newtile(0, default_floor_id);
- r->roof[i][j] = newtile(5, id);
} else if (type == '=') {
r->floor[i][j] = newtile(0, default_floor_id);
r->bodies_count++;
@@ -196,11 +209,11 @@ static void loadroom(tt_room *r, FILE *f)
b->xrem = 0;
b->yrem = 0;
b->rem = 0;
- b->txrrow = 7;
+ b->txrrow = 6;
b->txrcol = id;
b->anim = 4;
b->rate = 100 + (rand() % 50 - 25);
- b->collision_act = 0; /* todo: kill */
+ b->collision_act = togulag;
}
}
fgetc(f);
diff --git a/src/player.c b/src/player.c
index 10d5c5f..daf4a96 100644
--- a/src/player.c
+++ b/src/player.c
@@ -1,5 +1,6 @@
#include "player.h"
+#include <math.h>
#include "globals.h"
@@ -46,16 +47,20 @@ void tt_player_draw()
if (ttplayer.xwalk == 1) dir = 6;
else if (ttplayer.xwalk == -1) dir = 2;
else if (ttplayer.ywalk == -1) dir = 4;
- SDL_Rect s = { 16 * (dir + (ttplayer.rem / 100 % 2)),
- 16 * (5 + ttplayer.variant),
+ SDL_Rect s = { 16 * (8 * ttplayer.variant +
+ dir + (ttplayer.rem / 100 % 2)),
+ 16 * 5,
16, 16 };
SDL_RenderCopy(ttrdr, tttxr, &s, &d);
- for (i = 0; i != TT_ROOM_H; ++i) {
- for (j = 0; j != TT_ROOM_W; ++j) {
- SDL_Rect d = { 14 + j * 32, 14 + i * 32, 32, 32 };
- SDL_Rect *roof = r->roof[i][j];
- if (roof) SDL_RenderCopy(ttrdr, tttxr, roof, &d);
- }
+ if (ttplayer.until_gulag > 0) {
+ double r = ttplayer.until_gulag / 10;
+ double f = (double)(ttplayer.until_gulag) / 3000 *
+ 2 * 3.14159265358979323846;
+ SDL_Rect s = { 0, 16 * 11, 16, 32 };
+ SDL_Rect d = { ttplayer.x + r * cos(f),
+ ttplayer.y - 16 + r * sin(f),
+ 32, 64 };
+ SDL_RenderCopy(ttrdr, tttxr, &s, &d);
}
}
diff --git a/src/player.h b/src/player.h
index cc224ba..8504046 100644
--- a/src/player.h
+++ b/src/player.h
@@ -18,6 +18,8 @@ typedef struct tt_player {
int money;
int keys;
int the_key;
+ int tobein_gulag;
+ int until_gulag;
} tt_player;
diff --git a/src/room.h b/src/room.h
index b4567f2..f1f9ba2 100644
--- a/src/room.h
+++ b/src/room.h
@@ -12,7 +12,6 @@
typedef struct tt_room {
SDL_Rect *floor[TT_ROOM_H][TT_ROOM_W];
tt_body *walls[TT_ROOM_H][TT_ROOM_W];
- SDL_Rect *roof[TT_ROOM_H][TT_ROOM_W];
tt_body *bodies;
int bodies_count;
struct tt_room *neighbours[4];