Skip to content

Commit 59a33b4

Browse files
committed
Clean up arena, vs, and newsroom stripping
1 parent e284afe commit 59a33b4

File tree

3 files changed

+14
-31
lines changed

3 files changed

+14
-31
lines changed

src/game/scenes/arena.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,11 +1149,9 @@ void arena_render_overlay(scene *scene) {
11491149

11501150
if(player[1]->pilot) {
11511151
// when quitting, this can go null
1152-
int p2len = (strlen(player2_name) - 1) * font_small.w;
1153-
// XXX TODO: Magnus: Hardcoded - 1 for trailing newlines in localization strings
1154-
int h2len = (strlen(lang_get_offset(LangRobot, player[1]->pilot->har_id)) - 1) * font_small.w;
1155-
text_render(&tconf_players, TEXT_DEFAULT, 315 - p2len, 19, 100, 6, player2_name);
1156-
text_render(&tconf_players, TEXT_DEFAULT, 315 - h2len, 26, 100, 6,
1152+
tconf_players.halign = TEXT_RIGHT;
1153+
text_render(&tconf_players, TEXT_DEFAULT, 215, 19, 100, 6, player2_name);
1154+
text_render(&tconf_players, TEXT_DEFAULT, 215, 26, 100, 6,
11571155
lang_get_offset(LangRobot, player[1]->pilot->har_id));
11581156
}
11591157

src/game/scenes/newsroom.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ const char *subject_pronoun(int sex) {
4444
return lang_get_offset(LangPronoun, 4 + sex);
4545
}
4646

47-
char const *pronoun_strip(char const *pronoun, char *buf, size_t buf_size) {
48-
size_t pronoun_len = strlen(pronoun);
49-
while(pronoun_len && pronoun[pronoun_len - 1] == '\n') {
50-
pronoun_len--;
51-
}
52-
if(pronoun_len >= buf_size)
53-
pronoun_len = buf_size - 1;
54-
memcpy(buf, pronoun, pronoun_len);
55-
buf[pronoun_len] = '\0';
56-
return buf;
57-
}
58-
5947
static void newsroom_fixup_capitalization(str *tmp) {
6048
// XXX non-const str_c variant?
6149
char *it = (char *)str_c(tmp);
@@ -99,18 +87,17 @@ void newsroom_fixup_str(newsroom_local *local) {
9987
raw_translation = lang_get_offset(LangNewsroomReport, local->news_id + min2(local->screen, 1));
10088
}
10189

102-
char scratch[9];
10390
str tmp;
10491
str_from_c(&tmp, raw_translation);
105-
str_replace(&tmp, "~11", pronoun_strip(subject_pronoun(local->sex2), scratch, sizeof scratch), -1);
106-
str_replace(&tmp, "~10", pronoun_strip(object_pronoun(local->sex2), scratch, sizeof scratch), -1);
107-
str_replace(&tmp, "~9", pronoun_strip(possessive_pronoun(local->sex2), scratch, sizeof scratch), -1);
108-
str_replace(&tmp, "~8", pronoun_strip(subject_pronoun(local->sex1), scratch, sizeof scratch), -1);
109-
str_replace(&tmp, "~7", pronoun_strip(object_pronoun(local->sex1), scratch, sizeof scratch), -1);
110-
str_replace(&tmp, "~6", pronoun_strip(possessive_pronoun(local->sex1), scratch, sizeof scratch), -1);
92+
str_replace(&tmp, "~11", subject_pronoun(local->sex2), -1);
93+
str_replace(&tmp, "~10", object_pronoun(local->sex2), -1);
94+
str_replace(&tmp, "~9", possessive_pronoun(local->sex2), -1);
95+
str_replace(&tmp, "~8", subject_pronoun(local->sex1), -1);
96+
str_replace(&tmp, "~7", object_pronoun(local->sex1), -1);
97+
str_replace(&tmp, "~6", possessive_pronoun(local->sex1), -1);
11198
str_replace(&tmp, "~5", "Stadium", -1);
112-
str_replace(&tmp, "~4", pronoun_strip(lang_get_offset(LangRobot, local->har2), scratch, sizeof scratch), -1);
113-
str_replace(&tmp, "~3", pronoun_strip(lang_get_offset(LangRobot, local->har1), scratch, sizeof scratch), -1);
99+
str_replace(&tmp, "~4", lang_get_offset(LangRobot, local->har2), -1);
100+
str_replace(&tmp, "~3", lang_get_offset(LangRobot, local->har1), -1);
114101
str_replace(&tmp, "~2", str_c(&local->pilot2), -1);
115102
str_replace(&tmp, "~1", str_c(&local->pilot1), -1);
116103

@@ -123,6 +110,7 @@ void newsroom_fixup_str(newsroom_local *local) {
123110
void newsroom_set_names(newsroom_local *local, const char *pilot1, const char *pilot2, int har1, int har2, int sex1,
124111
int sex2) {
125112

113+
// XXX TODO: Magnus: put pilot names in title case
126114
str_from_c(&local->pilot1, pilot1);
127115
str_from_c(&local->pilot2, pilot2);
128116
local->har1 = har1;

src/game/scenes/vs.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,8 @@ int vs_create(scene *scene) {
457457
} else {
458458
const char *pilot1 = lang_get_offset(LangPilot, player1->pilot->pilot_id);
459459
const char *pilot2 = lang_get_offset(LangPilot, player2->pilot->pilot_id);
460-
// XXX TODO: Magnus: hardcoded -1's to compensate for OMF 2097 lang trailing newlines
461-
snprintf(local->vs_str, 128, "%*.*s VS. %*.*s", (int)strlen(pilot1) - 1, (int)strlen(pilot1) - 1, pilot1,
462-
(int)strlen(pilot2) - 1, (int)strlen(pilot2) - 1, pilot2);
460+
snprintf(local->vs_str, 128, "%*.*s VS. %*.*s", (int)strlen(pilot1), (int)strlen(pilot1), pilot1,
461+
(int)strlen(pilot2), (int)strlen(pilot2), pilot2);
463462
}
464463

465464
// Set player palettes
@@ -649,8 +648,6 @@ int vs_create(scene *scene) {
649648
str_from_c(&insult, lang_get(LangTooPatheticDialog));
650649
str_replace(&insult, "%s", lang_get_offset(LangCpuDifficulty, VETERAN), 1);
651650
str_replace(&insult, "%s", lang_get_offset(LangPilot, PILOT_KREISSACK), 1);
652-
// XXX HACK: Remove newline after kreissack's name until we clean up our string tables
653-
str_replace(&insult, "\n.", ".", -1);
654651
dialog_create(&local->too_pathetic_dialog, DIALOG_STYLE_OK, str_c(&insult), 40, 40);
655652
str_free(&insult);
656653
local->too_pathetic_dialog.userdata = scene;

0 commit comments

Comments
 (0)