summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-03-02 19:18:35 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-03-02 19:18:35 +0300
commitc618f87f2f00f94e02411eb2d5f0007a54a8b14e (patch)
tree4ae745df9d31209211ec5a91b0f1d445afcc0d35 /src
parenta027f747c7256b6a0d31be05862b084c4637de9b (diff)
downloadtakethis-c618f87f2f00f94e02411eb2d5f0007a54a8b14e.tar
takethis-c618f87f2f00f94e02411eb2d5f0007a54a8b14e.tar.xz
takethis-c618f87f2f00f94e02411eb2d5f0007a54a8b14e.zip
Fix of fix of fix.
Diffstat (limited to 'src')
-rw-r--r--src/game.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/game.c b/src/game.c
index 068dbc7..09b7316 100644
--- a/src/game.c
+++ b/src/game.c
@@ -979,6 +979,7 @@ void changeroom(int out)
SDL_Rect d = { 0, 14 + TT_ROOM_H * 32, 950, 540 };
SDL_RenderFillRect(ttrdr, &d);
}
+
{
SDL_Rect src = { 0, 16 * 11, 16, 16 };
SDL_Rect d = { 20 + TT_ROOM_W * 32 + 32, 12 + 32, 64, 64 };
@@ -1008,6 +1009,93 @@ void changeroom(int out)
SDL_DestroyTexture(t);
SDL_FreeSurface(s);
}
+ {
+ SDL_Rect src = { 16, 16 * 11, 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];
+ int digits = 1;
+ while (count / 10) {
+ ++digits;
+ count /= 10;
+ }
+ char *text = malloc(3 + digits);
+ text[0] = 'x';
+ text[1] = ' ';
+ int i;
+ count = ttplayer.keys[1];
+ for (i = digits + 1; i != 1; --i) {
+ text[i] = count % 10 + '0';
+ count /= 10;
+ }
+ text[digits + 2] = 0;
+ SDL_Color c = { 255, 255, 255, 255 };
+ SDL_Surface *s = TTF_RenderText_Blended(ttfont, text, c);
+ SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, s);
+ SDL_Rect dst = { 50 + 32 * TT_ROOM_W + 64, 20 + 96, s->w * 2,
+ s->h * 2 };
+ SDL_RenderCopy(ttrdr, t, 0, &dst);
+ SDL_DestroyTexture(t);
+ SDL_FreeSurface(s);
+ }
+ {
+ int count = ttplayer.money;
+ int digits = 1;
+ while (count / 10) {
+ ++digits;
+ count /= 10;
+ }
+ char *text = malloc(4 + digits);
+ text[0] = '$';
+ text[1] = ' ';
+ text[2] = ttplayer.money < 0 ? '-' : ' ';
+ int i;
+ count = ttplayer.money * (ttplayer.money < 0 ? -1 : 1);
+ for (i = digits + 2; i != 2; --i) {
+ text[i] = count % 10 + '0';
+ count /= 10;
+ }
+ text[digits + 3] = 0;
+ SDL_Color c = { 255, 255, 255, 255 };
+ SDL_Surface *s = TTF_RenderText_Blended(ttfont, text, c);
+ SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, s);
+ SDL_Rect dst = { 50 + 32 * TT_ROOM_W + 16, 20 + 96 + 96, s->w * 2,
+ s->h * 2 };
+ SDL_RenderCopy(ttrdr, t, 0, &dst);
+ SDL_DestroyTexture(t);
+ SDL_FreeSurface(s);
+ }
+ if (ttplayer.lenin_rem) {
+ int count = ttplayer.lenin_rem / 1000;
+ int digits = 1;
+ while (count / 10) {
+ ++digits;
+ count /= 10;
+ }
+ char *text = malloc(7 + digits);
+ text[0] = 'T';
+ text[1] = 'i';
+ text[2] = 'm';
+ text[3] = 'e';
+ text[4] = ':';
+ text[5] = ' ';
+ int i;
+ count = ttplayer.lenin_rem / 1000;
+ for (i = digits + 5; i != 5; --i) {
+ text[i] = count % 10 + '0';
+ count /= 10;
+ }
+ text[digits + 6] = 0;
+ SDL_Color c = { 255, 255, 255, 255 };
+ SDL_Surface *s = TTF_RenderText_Blended(ttfont, text, c);
+ SDL_Texture *t = SDL_CreateTextureFromSurface(ttrdr, s);
+ SDL_Rect dst = { 50 + 32 * TT_ROOM_W + 16, 20 + 96 + 96 + 96,
+ s->w * 2, s->h * 2 };
+ SDL_RenderCopy(ttrdr, t, 0, &dst);
+ SDL_DestroyTexture(t);
+ SDL_FreeSurface(s);
+ }
+
SDL_RenderPresent(ttrdr);
newticks = SDL_GetTicks();
}