From f532fbc6dfce64bc339f15633ff15a4d5eae73b4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 27 Jan 2011 09:00:11 +0900 Subject: [PATCH] Convert all integer operands to float for v6 progs. Converting only opc is no longer enough. --- tools/qfcc/source/opcodes.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/qfcc/source/opcodes.c b/tools/qfcc/source/opcodes.c index 79ff8672d..95a1e5f32 100644 --- a/tools/qfcc/source/opcodes.c +++ b/tools/qfcc/source/opcodes.c @@ -116,9 +116,18 @@ opcode_init (void) for (op = pr_opcodes; op->name; op++) { if (op->min_version > options.code.progsversion) continue; - if (options.code.progsversion == PROG_ID_VERSION - && op->type_c == ev_integer) - op->type_c = ev_float; + if (options.code.progsversion == PROG_ID_VERSION) { + // v6 progs have no concept of integer, but the QF engine + // treats the operands of certain operands as integers + // irrespective the progs version, so convert the engine's + // view of the operands to the prog's view. + if (op->type_a == ev_integer) + op->type_a = ev_float; + if (op->type_b == ev_integer) + op->type_b = ev_float; + if (op->type_c == ev_integer) + op->type_c = ev_float; + } Hash_AddElement (opcode_type_table, op); if (!strcmp (op->name, "")) { op_done = op;