mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-30 08:20:40 +00:00
new opcode: state.f. same as state, but takes a 3rd float operand to
specify the step for calculating nextthink. accessed using [frame, think, step] (state is [frame, think])
This commit is contained in:
parent
1fc517f7db
commit
c3f41e3e69
9 changed files with 94 additions and 23 deletions
|
@ -733,6 +733,13 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
ed->v[pr->fields.frame].float_var = OPA.float_var;
|
||||
ed->v[pr->fields.think].func_var = OPB.func_var;
|
||||
break;
|
||||
case OP_STATE_F:
|
||||
ed = PROG_TO_EDICT (pr, *pr->globals.self);
|
||||
ed->v[pr->fields.nextthink].float_var = *pr->globals.time +
|
||||
OPC.float_var;
|
||||
ed->v[pr->fields.frame].float_var = OPA.float_var;
|
||||
ed->v[pr->fields.think].func_var = OPB.func_var;
|
||||
break;
|
||||
case OP_ADD_I:
|
||||
OPC.integer_var = OPA.integer_var + OPB.integer_var;
|
||||
break;
|
||||
|
|
|
@ -746,11 +746,17 @@ opcode_t pr_opcodes[] = {
|
|||
},
|
||||
|
||||
{"<STATE>", "state", OP_STATE, false,
|
||||
ev_float, ev_float, ev_void,
|
||||
ev_float, ev_func, ev_void,
|
||||
PROG_ID_VERSION,
|
||||
"%Ga, %Gb",
|
||||
},
|
||||
|
||||
{"<STATE>", "state.f", OP_STATE_F, false,
|
||||
ev_float, ev_func, ev_float,
|
||||
PROG_ID_VERSION,
|
||||
"%Ga, %Gb, %Gc",
|
||||
},
|
||||
|
||||
{"<GOTO>", "goto", OP_GOTO, false,
|
||||
ev_integer, ev_void, ev_void,
|
||||
PROG_ID_VERSION,
|
||||
|
@ -1118,7 +1124,7 @@ PR_Check_Opcodes (progs_t *pr)
|
|||
"statement %ld", st->op,
|
||||
(long)(st - pr->pr_statements));
|
||||
}
|
||||
if (st->op == OP_STATE && !state_ok) {
|
||||
if ((st->op == OP_STATE || st->op == OP_STATE_F) && !state_ok) {
|
||||
PR_Error (pr, "PR_Check_Opcodes: %s used with missing fields "
|
||||
"or globals", op->opname);
|
||||
}
|
||||
|
@ -1148,12 +1154,14 @@ PR_Check_Opcodes (progs_t *pr)
|
|||
check_global (pr, st, op, ev_void, st->c);
|
||||
break;
|
||||
case OP_STATE:
|
||||
case OP_STATE_F:
|
||||
if (!state_ok) {
|
||||
PR_Error (pr, "PR_Check_Opcodes: %s used with missing "
|
||||
"fields or globals", op->opname);
|
||||
}
|
||||
check_global (pr, st, op, op->type_a, st->a);
|
||||
check_global (pr, st, op, op->type_b, st->b);
|
||||
check_global (pr, st, op, op->type_c, st->c);
|
||||
break;
|
||||
default:
|
||||
check_global (pr, st, op, op->type_a, st->a);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue