summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-03-03 11:55:51 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-03-03 11:55:51 +0300
commitd907f8c991221315b6ce615454bff895281870b6 (patch)
treee05fd2a60bead87b24bcbd7280dc5ff5083d6a30
parent1c211087b9215bc5108eab368926a1d9c4d5ae41 (diff)
downloadtakethis-d907f8c991221315b6ce615454bff895281870b6.tar
takethis-d907f8c991221315b6ce615454bff895281870b6.tar.xz
takethis-d907f8c991221315b6ce615454bff895281870b6.zip
Ultimate CODE for this game is DONE!!!
-rw-r--r--data/txr.bmpbin245898 -> 229514 bytes
-rw-r--r--src/game.c81
-rw-r--r--src/map.c20
-rw-r--r--src/player.c91
4 files changed, 117 insertions, 75 deletions
diff --git a/data/txr.bmp b/data/txr.bmp
index 830f858..e01f125 100644
--- a/data/txr.bmp
+++ b/data/txr.bmp
Binary files differ
diff --git a/src/game.c b/src/game.c
index 1b4d3cc..ffde400 100644
--- a/src/game.c
+++ b/src/game.c
@@ -292,7 +292,6 @@ static void directly_gulag(tt_body *b)
gulagmsg = " Communism is Indestructable";
magic = tt_gotogulag;
Mix_PlayMusic(ussr, -1);
- curmus = ussr;
}
static void togulag(tt_body *b)
@@ -335,7 +334,7 @@ static void keytake(tt_body *b)
static void doorcol(tt_body *b)
{
- if (ttplayer.keys[b->txrrow - 4]) {
+ if (ttplayer.keys[b->txrcol / 8]) {
int i;
tt_room *r = ttplayer.room;
tt_body *part = 0;
@@ -353,7 +352,7 @@ static void doorcol(tt_body *b)
r->walls[b->y / 32][b->x / 32] = 0;
free(r->walls[part->y / 32][part->x / 32]);
r->walls[part->y / 32][part->x / 32] = 0;
- ttplayer.keys[b->txrrow - 4]--;
+ ttplayer.keys[b->txrcol / 8]--;
b->collision_act = 0;
b->txrrow = 0;
b->txrcol = 15;
@@ -402,7 +401,7 @@ static void step(int d)
b->msg = 0;
b->msglen = 0;
if (!lenin_until_hadouken) {
- b->txrrow = 7;
+ b->txrrow = 6;
b->txrcol = 2 + rand() % 2;
b->rate = 75 + (rand() % 50 - 25);
b->yvel = rand() % 50 - 25;
@@ -412,7 +411,7 @@ static void step(int d)
Mix_PlayChannel(-1, tthadouken, 0);
lenin_until_hadouken = 3;
} else {
- b->txrrow = 8;
+ b->txrrow = 7;
b->txrcol = rand() % 4;
b->rate = 150 + (rand() % 50 - 25);
b->yvel = rand() % 100 - 50;
@@ -569,7 +568,7 @@ static void gotofirstroom()
SDL_Rect d = { 14, 14, 32 * 20, 32 * 16 };
SDL_RenderFillRect(ttrdr, &d);
{
- SDL_Rect src = { 0, 16 * 6, 16, 16 };
+ SDL_Rect src = { 0, 16 * 5, 16, 16 };
SDL_Rect dst = { 14 + ttplayer.x - delta + rand() % delta,
14 + ttplayer.y - delta + rand() % delta,
32 + delta / 2 + (rand() % delta),
@@ -646,6 +645,7 @@ static void gotogulag()
ttplayer.lenin_zhiv = 0;
ttplayer.x = 32 * 13;
ttplayer.y = 32 * 11;
+ curmus = ussr;
}
tt_player_draw();
if (delta < 4200)
@@ -967,7 +967,7 @@ void changeroom(int out)
dir = 4;
SDL_Rect s = { 16 * (8 * ttplayer.variant + dir +
(ttplayer.rem / 100 % 2)),
- 16 * 6, 16, 16 };
+ 16 * 5, 16, 16 };
SDL_RenderCopy(ttrdr, tttxr, &s, &d);
{
@@ -976,27 +976,30 @@ void changeroom(int out)
SDL_SetTextureBlendMode(tttxr, SDL_BLENDMODE_ADD);
SDL_SetTextureAlphaMod(tttxr, 64);
SDL_SetRenderTarget(ttrdr, lighttxr);
- SDL_SetRenderDrawColor(ttrdr, 192, 192, 192, 255);
+ if (ttplayer.room == ttmap + 'G')
+ SDL_SetRenderDrawColor(ttrdr, 96, 96, 96, 255);
+ else
+ SDL_SetRenderDrawColor(ttrdr, 192, 192, 192, 255);
SDL_RenderClear(ttrdr);
r = ttplayer.room->neighbours[out];
int i;
for (i = 0; i != r->bodies_count; ++i) {
tt_body *b = r->bodies + i;
- if ((7 == b->txrrow && b->txrcol <= 1) ||
+ if ((6 == b->txrrow && b->txrcol <= 1) ||
b->txrrow == 11) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + fullx + transx - 32,
b->y + fully + transy - 32, 128, 128 };
SDL_SetTextureColorMod(tttxr, 255, 255, 255);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (7 == b->txrrow && b->txrcol >= 1) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ } else if (6 == b->txrrow && b->txrcol >= 1) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + fullx + transx - 32,
b->y + fully + transy - 32, 128, 128 };
SDL_SetTextureColorMod(tttxr, 255, 0, 0);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (8 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ } else if (7 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + fullx + transx - 32,
b->y + fully + transy - 32, 128, 128 };
double color = (unsigned)b->rem * b->rate % 360000;
@@ -1036,15 +1039,15 @@ void changeroom(int out)
for (j = 0; j != TT_ROOM_W; ++j) {
tt_body *b = r->walls[i][j];
if (!b) continue;
- if (9 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ if (8 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + fullx + transx - 32,
b->y + fully + transy - 32, 128,
128 };
SDL_SetTextureColorMod(tttxr, 255, 215, 0);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (8 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ } else if (7 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + fullx + transx - 32,
b->y + fully + transy - 32, 128,
128 };
@@ -1085,21 +1088,21 @@ void changeroom(int out)
r = ttplayer.room;
for (i = 0; i != r->bodies_count; ++i) {
tt_body *b = r->bodies + i;
- if ((7 == b->txrrow && b->txrcol <= 1) ||
+ if ((6 == b->txrrow && b->txrcol <= 1) ||
b->txrrow == 11) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + transx - 32, b->y + transy - 32,
128, 128 };
SDL_SetTextureColorMod(tttxr, 255, 255, 255);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (7 == b->txrrow && b->txrcol >= 1) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ } else if (6 == b->txrrow && b->txrcol >= 1) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + transx - 32, b->y + transy - 32,
128, 128 };
SDL_SetTextureColorMod(tttxr, 255, 0, 0);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (8 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ } else if (7 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + transx - 32, b->y + transy - 32,
128, 128 };
double color = (unsigned)b->rem * b->rate % 360000;
@@ -1138,14 +1141,14 @@ void changeroom(int out)
for (j = 0; j != TT_ROOM_W; ++j) {
tt_body *b = r->walls[i][j];
if (!b) continue;
- if (9 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ if (8 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + transx - 32,
b->y + transy - 32, 128, 128 };
SDL_SetTextureColorMod(tttxr, 255, 215, 0);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (8 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ } else if (7 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x + transx - 32,
b->y + transy - 32, 128, 128 };
double color =
@@ -1182,6 +1185,24 @@ void changeroom(int out)
}
}
}
+ if (ttplayer.until_gulag > 0) {
+ double ro = ttplayer.until_gulag / 10;
+ double f = (double)(ttplayer.until_gulag) / 3000 * 2 *
+ 3.14159265358979323846;
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
+ SDL_Rect d = { ttplayer.x - 16 + ro * cos(f) - 64,
+ ttplayer.y - 32 + ro * sin(f) - 48, 192,
+ 192 };
+ SDL_SetTextureColorMod(tttxr, 255, 0, 0);
+ SDL_RenderCopy(ttrdr, tttxr, &src, &d);
+ }
+ if (ttplayer.room == ttmap + 'G') {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
+ SDL_Rect d = { ttplayer.x - 32, ttplayer.y - 21, 128,
+ 128 };
+ SDL_SetTextureColorMod(tttxr, 255, 255, 255);
+ SDL_RenderCopy(ttrdr, tttxr, &src, &d);
+ }
SDL_SetTextureColorMod(tttxr, 255, 255, 255);
SDL_SetTextureAlphaMod(tttxr, 255);
SDL_SetRenderTarget(ttrdr, 0);
@@ -1209,7 +1230,7 @@ void changeroom(int out)
}
{
- SDL_Rect src = { 0, 16 * 11, 16, 16 };
+ SDL_Rect src = { 0, 16 * 10, 16, 16 };
SDL_Rect d = { 20 + TT_ROOM_W * 32 + 32, 12 + 32, 64, 64 };
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
int count = ttplayer.keys[0];
@@ -1238,7 +1259,7 @@ void changeroom(int out)
SDL_FreeSurface(s);
}
{
- SDL_Rect src = { 16, 16 * 11, 16, 16 };
+ SDL_Rect src = { 16, 16 * 10, 16, 16 };
SDL_Rect d = { 20 + TT_ROOM_W * 32 + 32, 12 + 96, 64, 64 };
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
int count = ttplayer.keys[1];
diff --git a/src/map.c b/src/map.c
index 557a6f5..2b35c51 100644
--- a/src/map.c
+++ b/src/map.c
@@ -135,7 +135,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);
@@ -154,7 +154,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);
@@ -173,7 +173,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;
@@ -193,7 +193,7 @@ 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);
@@ -218,7 +218,7 @@ static void loadroom(tt_room *r, FILE *f)
b->rate = 100;
b->collision_act = 0;
b->isdoor = 0;
- } else if (type == 'k') {
+ } else if (type == 'k' || type == 'K') {
r->floor[i][j] = newtile(0, default_floor_id);
r->bodies_count++;
r->bodies =
@@ -229,8 +229,8 @@ static void loadroom(tt_room *r, FILE *f)
b->xrem = 0;
b->yrem = 0;
b->rem = 0;
- b->txrrow = 11;
- b->txrcol = id;
+ b->txrrow = 10;
+ b->txrcol = id + (type == 'K');
b->anim = 1;
b->rate = 100;
b->collision_act = colact_key;
@@ -246,8 +246,8 @@ static void loadroom(tt_room *r, FILE *f)
b->xrem = 0;
b->yrem = 0;
b->rem = 0;
- b->txrrow = 4 + (type == 'D');
- b->txrcol = id;
+ b->txrrow = 4;
+ b->txrcol = id + 8 * (type == 'D');
b->anim = 1;
b->rate = 100;
b->collision_act = colact_door;
@@ -280,7 +280,7 @@ 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);
diff --git a/src/player.c b/src/player.c
index cf300c6..02703ec 100644
--- a/src/player.c
+++ b/src/player.c
@@ -26,14 +26,14 @@ void tt_player_draw()
if (ttplayer.lenin_zhiv) {
{
SDL_Rect src = { 32 + 32 * (ttplayer.lenin_rem / 200 % 2),
- 16 * 12 + 4, 32, 38 };
+ 16 * 11 + 4, 32, 38 };
SDL_Rect dst = { 14 + ttplayer.lenin_pos,
14 + 32 + 96 - 8 - 38 * 2, 64, 38 * 2 };
SDL_RenderCopy(ttrdr, tttxr, &src, &dst);
}
{
SDL_Rect src = { 96 + 64 * (ttplayer.lenin_rem / 200 % 2),
- 16 * 12, 64, 48 };
+ 16 * 11, 64, 48 };
SDL_Rect dst = { 14 + ttplayer.lenin_pos - 32, 110, 128, 96 };
SDL_RenderCopy(ttrdr, tttxr, &src, &dst);
}
@@ -51,15 +51,6 @@ void tt_player_draw()
SDL_Rect d = { 14 + b->x, 14 + b->y, 32, 32 };
SDL_RenderCopy(ttrdr, tttxr, &s, &d);
}
- if (b->msg) {
- SDL_Color c = { 255, 255, 255, 255 };
- SDL_Surface *s = TTF_RenderText_Blended(ttfont, b->msg, c);
- SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, s);
- SDL_Rect dst = { 50 + b->x, 20 + b->y, s->w, s->h };
- SDL_RenderCopy(ttrdr, t, 0, &dst);
- SDL_DestroyTexture(t);
- SDL_FreeSurface(s);
- }
}
SDL_Rect d = { 14 + ttplayer.x, 14 + ttplayer.y, 32, 32 };
@@ -71,14 +62,14 @@ void tt_player_draw()
dir = 4;
SDL_Rect s = { 16 * (8 * ttplayer.variant + dir +
(ttplayer.rem / 100 % 2)),
- 16 * 6, 16, 16 };
+ 16 * 5, 16, 16 };
SDL_RenderCopy(ttrdr, tttxr, &s, &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 * 12, 32, 48 };
+ SDL_Rect s = { 0, 16 * 11, 32, 48 };
SDL_Rect d = { ttplayer.x - 16 + r * cos(f),
ttplayer.y - 32 + r * sin(f), 64, 96 };
SDL_RenderCopy(ttrdr, tttxr, &s, &d);
@@ -86,14 +77,14 @@ void tt_player_draw()
if (!ttplayer.lenin_zhiv && curmus == lenin) {
{
- SDL_Rect src = { 32, 16 * 12 + 4, 32, lenin_size };
+ 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 * 12, 64, 48 };
+ 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);
}
@@ -103,29 +94,30 @@ void tt_player_draw()
SDL_BlendMode bm;
SDL_GetTextureBlendMode(tttxr, &bm);
SDL_SetTextureBlendMode(tttxr, SDL_BLENDMODE_ADD);
- SDL_SetTextureAlphaMod(tttxr, 64);
SDL_SetRenderTarget(ttrdr, lighttxr);
- if (!ttplayer.lenin_zhiv && curmus == lenin) {
- SDL_SetRenderDrawColor(ttrdr, 64, 64, 64, 255);
- SDL_SetTextureAlphaMod(tttxr, 32);
- } else
+ SDL_SetTextureAlphaMod(tttxr, 64);
+ if (curmus == lenin || ttplayer.room == ttmap + 'G')
+ SDL_SetRenderDrawColor(ttrdr, 96, 96, 96, 255);
+ else
SDL_SetRenderDrawColor(ttrdr, 192, 192, 192, 255);
SDL_RenderClear(ttrdr);
int i;
for (i = 0; i != r->bodies_count; ++i) {
tt_body *b = r->bodies + i;
- if ((7 == b->txrrow && b->txrcol <= 1) || b->txrrow == 11) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ if ((6 == b->txrrow && b->txrcol <= 1) || b->txrrow == 11) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x - 32, b->y - 32, 128, 128 };
SDL_SetTextureColorMod(tttxr, 255, 255, 255);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (7 == b->txrrow && b->txrcol >= 1) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ } else if (6 == b->txrrow && b->txrcol >= 1) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x - 32, b->y - 32, 128, 128 };
SDL_SetTextureColorMod(tttxr, 255, 0, 0);
+ SDL_SetTextureAlphaMod(tttxr, 128);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (8 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ SDL_SetTextureAlphaMod(tttxr, 64);
+ } else if (7 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x - 32, b->y - 32, 128, 128 };
double color = (unsigned)b->rem * b->rate % 360000;
color /= 1000;
@@ -159,18 +151,35 @@ void tt_player_draw()
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
}
}
+ if (ttplayer.until_gulag > 0) {
+ double ro = ttplayer.until_gulag / 10;
+ double f = (double)(ttplayer.until_gulag) / 3000 * 2 *
+ 3.14159265358979323846;
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
+ SDL_Rect d = { ttplayer.x - 16 + ro * cos(f) - 64,
+ ttplayer.y - 32 + ro * sin(f) - 48, 192, 192 };
+ SDL_SetTextureColorMod(tttxr, 255, 0, 0);
+ SDL_RenderCopy(ttrdr, tttxr, &src, &d);
+ }
+ if (curmus == lenin || ttplayer.room == ttmap + 'G') {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
+ SDL_Rect d = { ttplayer.x - 32, ttplayer.y - 32, 128, 128 };
+ SDL_SetTextureColorMod(tttxr, 255, 255, 255);
+ SDL_RenderCopy(ttrdr, tttxr, &src, &d);
+ if (curmus == lenin) SDL_SetTextureAlphaMod(tttxr, 16);
+ }
int j;
for (i = 0; i != TT_ROOM_H; ++i) {
for (j = 0; j != TT_ROOM_W; ++j) {
tt_body *b = r->walls[i][j];
if (!b) continue;
- if (9 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ if (8 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x - 32, b->y - 32, 128, 128 };
SDL_SetTextureColorMod(tttxr, 255, 215, 0);
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
- } else if (8 == b->txrrow) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ } else if (7 == b->txrrow) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect d = { b->x - 32, b->y - 32, 128, 128 };
double color = (unsigned)b->rem * b->rate % 360000;
color /= 1000;
@@ -205,12 +214,12 @@ void tt_player_draw()
}
}
}
- if (ttplayer.lenin_zhiv || curmus == lenin) {
- SDL_Rect src = { 16 * 14, 16 * 12, 32, 32 };
+ if (curmus == lenin) {
+ SDL_Rect src = { 16 * 14, 16 * 11, 32, 32 };
SDL_Rect dst = { 14 + ttplayer.lenin_pos - 96,
14 + 32 + 96 - 8 - 38 * 4, 256, 256 };
+ SDL_SetTextureAlphaMod(tttxr, 196);
SDL_SetTextureColorMod(tttxr, 255, 0, 0);
- if (!ttplayer.lenin_zhiv) { SDL_SetTextureAlphaMod(tttxr, 196); }
SDL_RenderCopy(ttrdr, tttxr, &src, &dst);
}
SDL_SetTextureColorMod(tttxr, 255, 255, 255);
@@ -222,8 +231,20 @@ void tt_player_draw()
SDL_SetRenderDrawColor(ttrdr, 0, 0, 0, 255);
}
+ for (i = 0; i != r->bodies_count; ++i) {
+ tt_body *b = r->bodies + i;
+ if (b->msg) {
+ SDL_Color c = { 255, 255, 255, 255 };
+ SDL_Surface *s = TTF_RenderText_Blended(ttfont, b->msg, c);
+ SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, s);
+ SDL_Rect dst = { 50 + b->x, 20 + b->y, s->w, s->h };
+ SDL_RenderCopy(ttrdr, t, 0, &dst);
+ SDL_DestroyTexture(t);
+ SDL_FreeSurface(s);
+ }
+ }
{
- SDL_Rect src = { 0, 16 * 11, 16, 16 };
+ SDL_Rect src = { 0, 16 * 10, 16, 16 };
SDL_Rect d = { 20 + TT_ROOM_W * 32 + 32, 12 + 32, 64, 64 };
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
int count = ttplayer.keys[0];
@@ -252,7 +273,7 @@ void tt_player_draw()
SDL_FreeSurface(s);
}
{
- SDL_Rect src = { 16, 16 * 11, 16, 16 };
+ SDL_Rect src = { 16, 16 * 10, 16, 16 };
SDL_Rect d = { 20 + TT_ROOM_W * 32 + 32, 12 + 96, 64, 64 };
SDL_RenderCopy(ttrdr, tttxr, &src, &d);
int count = ttplayer.keys[1];