Skip to content

Commit

Permalink
Add dialog options numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbatalov committed Dec 8, 2022
1 parent 9ade107 commit 897ff2b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
42 changes: 36 additions & 6 deletions src/game_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ static void gameDialogRedButtonsInit();
static void gameDialogRedButtonsExit();

static bool gGameDialogFix;
static bool gNumberOptions;

// gdialog_init
// 0x444D1C
Expand All @@ -631,6 +632,10 @@ int gameDialogInit()
gGameDialogFix = true;
configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_GAME_DIALOG_FIX_KEY, &gGameDialogFix);

// SFALL: Use numbers for replies (instead of default knobs).
gNumberOptions = false;
configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_NUMBERS_IS_DIALOG_KEY, &gNumberOptions);

return 0;
}

Expand Down Expand Up @@ -1274,7 +1279,13 @@ int gameDialogAddTextOption(int messageListId, const char* text, int reaction)
optionEntry->messageId = -4;
optionEntry->reaction = reaction;
optionEntry->btn = -1;
sprintf(optionEntry->text, "%c %s", '\x95', text);

// SFALL
if (gNumberOptions) {
snprintf(optionEntry->text, sizeof(optionEntry->text), "%d. %s", gGameDialogOptionEntriesLength + 1, text);
} else {
snprintf(optionEntry->text, sizeof(optionEntry->text), "%c %s", '\x95', text);
}

gGameDialogOptionEntriesLength++;

Expand Down Expand Up @@ -2270,29 +2281,48 @@ void _gdProcessUpdate()
exit(1);
}

sprintf(dialogOptionEntry->text, "%c ", '\x95');
strncat(dialogOptionEntry->text, text, 897);
// SFALL
if (gNumberOptions) {
snprintf(dialogOptionEntry->text, sizeof(dialogOptionEntry->text), "%d. %s", index + 1, text);
} else {
snprintf(dialogOptionEntry->text, sizeof(dialogOptionEntry->text), "%c %s", '\x95', text);
}
} else if (dialogOptionEntry->messageListId == -1) {
if (index == 0) {
// Go on
messageListItem.num = 655;
if (critterGetStat(gDude, STAT_INTELLIGENCE) < 4) {
if (messageListGetItem(&gProtoMessageList, &messageListItem)) {
strcpy(dialogOptionEntry->text, messageListItem.text);
// SFALL
if (gNumberOptions) {
snprintf(dialogOptionEntry->text, sizeof(dialogOptionEntry->text), "%d. %s", index + 1, messageListItem.text);
} else {
snprintf(dialogOptionEntry->text, sizeof(dialogOptionEntry->text), "%s", messageListItem.text);
}
} else {
debugPrint("\nError...can't find message!");
return;
}
}
} else {
// TODO: Why only space?
strcpy(dialogOptionEntry->text, " ");
// SFALL
if (gNumberOptions) {
snprintf(dialogOptionEntry->text, sizeof(dialogOptionEntry->text), "%d. %s", index + 1, " ");
} else {
strcpy(dialogOptionEntry->text, " ");
}
}
} else if (dialogOptionEntry->messageListId == -2) {
// [Done]
messageListItem.num = 650;
if (messageListGetItem(&gProtoMessageList, &messageListItem)) {
sprintf(dialogOptionEntry->text, "%c %s", '\x95', messageListItem.text);
// SFALL
if (gNumberOptions) {
snprintf(dialogOptionEntry->text, sizeof(dialogOptionEntry->text), "%d. %s", index + 1, messageListItem.text);
} else {
snprintf(dialogOptionEntry->text, sizeof(dialogOptionEntry->text), "%c %s", '\x95', messageListItem.text);
}
} else {
debugPrint("\nError...can't find message!");
return;
Expand Down
1 change: 1 addition & 0 deletions src/sfall_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace fallout {
#define SFALL_CONFIG_GAME_DIALOG_GENDER_WORDS_KEY "DialogGenderWords"
#define SFALL_CONFIG_TOWN_MAP_HOTKEYS_FIX_KEY "TownMapHotkeysFix"
#define SFALL_CONFIG_EXTRA_MESSAGE_LISTS_KEY "ExtraGameMsgFileList"
#define SFALL_CONFIG_NUMBERS_IS_DIALOG_KEY "NumbersInDialogue"

#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3
Expand Down

0 comments on commit 897ff2b

Please sign in to comment.