Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect format specifier usage in obj_examine_func() #187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dje4321
Copy link

@dje4321 dje4321 commented May 21, 2024

Fixes #162

obj_examine_func():408-424 has a redundant format specifier. v66 provides a "%s %s" format specifier for objects v63 && hpMessageListItem, however v63 already provides a format specifier in the form of "GENDER looks: %s" for use by hpMessageListItem. Technically the most correct fix is to use v63 to create a secondary format specifier like how src/game/protinst.cc:314 does it, However it is my belief that this will cause a regression if the target is not crippled because MSG_ID 521 is "%s %s." which will append a secondary period onto the end of the string.

Modifed obj_examine_func() comments for added clarity

obj_examine_func():408-424 has a redundant format specifier. v66 provides a "%s %s" format specifier for objects v63 && hpMessageListItem,
however v63 already provides a format specifier in the form of "GENDER looks: %s" for use by hpMessageListItem. Technically the most correct
fix is to use v63 to create a secondary format specifier like how src/game/protinst.cc:314 does it, However it is my belief that this will
cause a regression if the target is not crippled because MSG_ID 521 is "%s %s." which will append a secondary period onto the end of the string.

Modifed obj_examine_func() comments for added clarity
@dje4321 dje4321 changed the title Fixes issue #162 Fix incorrect format specifier usage in obj_examine_func() May 21, 2024
MessageListItem v63;
// 522: He looks: %s.
// 523: She looks: %s.
// 524: It looks: %s.
v63.num = 522 + stat_level(target, STAT_GENDER);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add a check here for critter_body_type(target) != BODY_TYPE_BIPED and then set num to 524 - "It looks: %s." See example above at line 280 of unmodified file.

@@ -406,21 +418,17 @@ int obj_examine_func(Object* critter, Object* target, void (*fn)(char* string))

snprintf(formattedText, sizeof(formattedText), v66.text, hpMessageListItem.text);
} else {
// %s %s
v66.num = 521 + v12;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found no correct way to use messages 521 - %s %s. and 519 - %s %s .
Seems like the first %s is for He/She/It looks: and the second %s is for examine text hpMessageListItem, but the messages file doesn't have separate messages for the first one - only with format parameter and a dot.
So, I think, without changing messages file it is not possible to correctly format the text taking into account if the critter is crippled or not.

The version of Fallout that is delivered through Xbox app has the same functionality as your fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[linux] Combat messages show %s character
2 participants