From 00b2a45ecd14100f9501c130b63713d43832d769 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 8 Dec 2001 20:17:20 +0000 Subject: [PATCH] change the operator for "address" from "." to "&" so load.p can be implement. this makes it so pointers in entities work. --- include/QF/pr_comp.h | 2 ++ libs/gamecode/engine/pr_exec.c | 1 + libs/gamecode/engine/pr_opcode.c | 3 ++- tools/qfcc/source/expr.c | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/QF/pr_comp.h b/include/QF/pr_comp.h index d2047ed8c..96fa5a955 100644 --- a/include/QF/pr_comp.h +++ b/include/QF/pr_comp.h @@ -239,6 +239,8 @@ typedef enum { OP_STOREBI_P, OP_LEAI, + + OP_LOAD_P, } pr_opcode_e; typedef struct diff --git a/libs/gamecode/engine/pr_exec.c b/libs/gamecode/engine/pr_exec.c index 63dc2ef3e..e462904ac 100644 --- a/libs/gamecode/engine/pr_exec.c +++ b/libs/gamecode/engine/pr_exec.c @@ -517,6 +517,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum) case OP_LOAD_S: case OP_LOAD_FNC: case OP_LOAD_I: + case OP_LOAD_P: if (pr_boundscheck->int_val && (OPA.entity_var < 0 || OPA.entity_var >= pr->pr_edictareasize)) { diff --git a/libs/gamecode/engine/pr_opcode.c b/libs/gamecode/engine/pr_opcode.c index e6a233ea0..af856bf18 100644 --- a/libs/gamecode/engine/pr_opcode.c +++ b/libs/gamecode/engine/pr_opcode.c @@ -91,6 +91,7 @@ opcode_t pr_opcodes[] = { {".", "load.fld", OP_LOAD_FLD, false, ev_entity, ev_field, ev_field, PROG_ID_VERSION}, {".", "load.fnc", OP_LOAD_FNC, false, ev_entity, ev_field, ev_func, PROG_ID_VERSION}, {".", "load.i", OP_LOAD_I, false, ev_entity, ev_field, ev_integer, PROG_VERSION}, + {".", "load.p", OP_LOAD_P, false, ev_entity, ev_field, ev_pointer, PROG_VERSION}, {".", "loadb.f", OP_LOADB_F, false, ev_pointer, ev_integer, ev_float, PROG_VERSION}, {".", "loadb.v", OP_LOADB_V, false, ev_pointer, ev_integer, ev_vector, PROG_VERSION}, @@ -110,7 +111,7 @@ opcode_t pr_opcodes[] = { {".", "loadbi.i", OP_LOADBI_I, false, ev_pointer, ev_short, ev_integer, PROG_VERSION}, {".", "loadbi.p", OP_LOADBI_P, false, ev_pointer, ev_short, ev_pointer, PROG_VERSION}, - {".", "address", OP_ADDRESS, false, ev_entity, ev_field, ev_pointer, PROG_ID_VERSION}, + {"&", "address", OP_ADDRESS, false, ev_entity, ev_field, ev_pointer, PROG_ID_VERSION}, {"&", "address.f", OP_ADDRESS_F, false, ev_float, ev_void, ev_pointer, PROG_VERSION}, {"&", "address.v", OP_ADDRESS_V, false, ev_vector, ev_void, ev_pointer, PROG_VERSION}, diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 8eb0c64e3..19fe2efe1 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -1060,6 +1060,7 @@ binary_expr (int op, expr_t *e1, expr_t *e2) new.type = ev_pointer; type = new.aux_type = e1->e.expr.type; e1->e.expr.type = PR_FindType (&new); + e1->e.expr.op = '&'; } } if (!type)