[qwaq] Update bi_printf to work with Ruamoko's va_list

Same deal as for test_bi in qfcc's test harness.  I really need to
consolidate all these little functions.
This commit is contained in:
Bill Currie 2022-01-31 23:44:09 +09:00
parent e3f88b2b9c
commit 175cc408d8

View file

@ -152,6 +152,19 @@ bi_printf (progs_t *pr)
pr_type_t **args = pr->pr_params + 1;
dstring_t *dstr = dstring_new ();
if (pr->progs->version == PROG_VERSION) {
__auto_type va_list = &P_PACKED (pr, pr_va_list_t, 1);
count = va_list->count;
if (count) {
args = alloca (count * sizeof (pr_type_t *));
for (int i = 0; i < count; i++) {
args[i] = &pr->pr_globals[va_list->list + i * 4];
}
} else {
args = 0;
}
}
PR_Sprintf (pr, dstr, "bi_printf", fmt, count, args);
if (dstr->str) {
Sys_Printf ("%s", dstr->str);