Print data being loaded from an entity.

This commit is contained in:
Bill Currie 2010-11-20 00:31:34 +09:00
parent 232d2f7e18
commit 2f504709dd
2 changed files with 30 additions and 10 deletions

View file

@ -882,6 +882,24 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
case 'O':
str = va ("%04x", addr + (short) opval);
break;
case 'E':
{
edict_t *ed;
opval = pr->pr_globals[s->a].entity_var;
parm_ind = pr->pr_globals[s->b].uinteger_var;
if (parm_ind < pr->progs->entityfields
&& opval >= 0
&& opval < pr->pr_edictareasize) {
ed = PROG_TO_EDICT (pr, opval);
opval = &ed->v[parm_ind] - pr->pr_globals;
} else {
str = "bad entity.field";
break;
}
str = global_string (pr, opval, optype, contents & 1);
str = va ("%d %d %s", s->a, s->b, str);
}
break;
default:
goto err;
}

View file

@ -98,6 +98,7 @@ VISIBLE const char *pr_type_name[ev_type_count] = {
// P function parameter
// F function (must come before any P)
// R return value
// E entity + field (%Eab)
//
// a operand a
// b operand b
@ -266,52 +267,52 @@ VISIBLE opcode_t pr_opcodes[] = {
{".", "load.f", OP_LOAD_F, false,
ev_entity, ev_field, ev_float,
PROG_ID_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",//FIXME %E more flexible?
},
{".", "load.v", OP_LOAD_V, false,
ev_entity, ev_field, ev_vector,
PROG_ID_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "load.q", OP_LOAD_Q, false,
ev_entity, ev_field, ev_quat,
PROG_ID_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "load.s", OP_LOAD_S, false,
ev_entity, ev_field, ev_string,
PROG_ID_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "load.ent", OP_LOAD_ENT, false,
ev_entity, ev_field, ev_entity,
PROG_ID_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "load.fld", OP_LOAD_FLD, false,
ev_entity, ev_field, ev_field,
PROG_ID_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "load.fn", OP_LOAD_FN, false,
ev_entity, ev_field, ev_func,
PROG_ID_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "load.i", OP_LOAD_I, false,
ev_entity, ev_field, ev_integer,
PROG_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "load.u", OP_LOAD_U, false,
ev_entity, ev_field, ev_uinteger,
PROG_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "load.p", OP_LOAD_P, false,
ev_entity, ev_field, ev_pointer,
PROG_VERSION,
"%Ga.%Gb, %gc",
"%Ga.%Gb(%Ec), %gc",
},
{".", "loadb.f", OP_LOADB_F, false,
@ -419,6 +420,7 @@ VISIBLE opcode_t pr_opcodes[] = {
{"&", "address", OP_ADDRESS, false,
ev_entity, ev_field, ev_pointer,
PROG_ID_VERSION,
"%Ga.%Gb, %gc",
},
{"&", "address.f", OP_ADDRESS_F, false,