Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
text: fix calculating text height
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Sep 24, 2024
1 parent 446170d commit 4c983db
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/game/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <string.h>

#define MAX_TEXTSTRINGS 128
#define TEXT_HEIGHT 24
#define TEXT_HEIGHT 15
#define TEXT_Y_SPACING 3
#define CHAR_SECRET_1 0x7Fu
#define CHAR_SECRET_2 0x80u
Expand Down Expand Up @@ -296,15 +296,12 @@ int32_t Text_GetHeight(const TEXTSTRING *const string)
}
int32_t height = TEXT_HEIGHT;
char *ptr = string->text;
if (!*ptr) {
return 0;
}
for (char letter = *ptr; *ptr; letter = *ptr++) {
if (string->flags.multiline && *ptr == '\n') {
height += TEXT_HEIGHT + TEXT_Y_SPACING;
}
}
return height * string->scale.v / PHD_ONE;
return height * Text_GetScaleV(string->scale.v) / PHD_ONE;
}

void __cdecl Text_Draw(void)
Expand Down

0 comments on commit 4c983db

Please sign in to comment.