[qfcc] Fix vector ops after preprocessor changes

I'm not sure what exactly caused vector literals to break, but bailing
out of the vector ops section on conversion to vector or quaternion
fixes game-source.
This commit is contained in:
Bill Currie 2023-10-30 22:46:43 +09:00
parent 05eea82d0d
commit 9a00998d9c
2 changed files with 9 additions and 0 deletions

View file

@ -1369,6 +1369,13 @@ binary_expr (int op, const expr_t *e1, const expr_t *e2)
t2 = pt2;
}
}
// type_width returns 3/4 for vector/quaternion, but their internal
// width is only 1
if (type_width (t1) != t1->width || type_width (t2) != t2->width) {
et1 = low_level_type (t1);
et2 = low_level_type (t2);
goto vector_or_quaternion;
}
int scalar_op = 0;
if (type_width (t1) == 1) {
// scalar op vec
@ -1415,6 +1422,7 @@ binary_expr (int op, const expr_t *e1, const expr_t *e2)
return edag_add_expr (ne);
}
}
vector_or_quaternion:
expr_type = expr_meta[et1][et2];
while (expr_type->op && expr_type->op != op)

View file

@ -849,6 +849,7 @@ DecodeArgs (int argc, char **argv)
}
} else {
options.code.promote_float = false;
options.math.vector_mult = QC_DOT;
}
if (options.code.progsversion == PROG_ID_VERSION) {
options.code.promote_float = false;