mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
fix a couple of branch offset bugs
This commit is contained in:
parent
4291f9c711
commit
7888f1cb93
2 changed files with 7 additions and 5 deletions
|
@ -70,11 +70,13 @@ PR_PrintStatement (progs_t * pr, dstatement_t *s)
|
|||
Sys_Printf ("%-9s ", op->opname);
|
||||
|
||||
if (s->op == OP_IF || s->op == OP_IFNOT || s->op == OP_IFBE
|
||||
|| s->op == OP_IFB || s->op == OP_IFAE || s->op == OP_IFA)
|
||||
|| s->op == OP_IFB || s->op == OP_IFAE || s->op == OP_IFA) {
|
||||
int ofs = (short) s->b;
|
||||
Sys_Printf ("%sbranch %i (%i)",
|
||||
PR_GlobalString (pr, s->a, ev_integer), s->b, addr + s->b);
|
||||
else if (s->op == OP_GOTO) {
|
||||
Sys_Printf ("branch %i (%i)", s->a, addr + s->a);
|
||||
PR_GlobalString (pr, s->a, ev_integer), ofs, addr + ofs);
|
||||
} else if (s->op == OP_GOTO) {
|
||||
int ofs = (short) s->a;
|
||||
Sys_Printf ("branch %i (%i)", ofs, addr + ofs);
|
||||
} else if (s->op == OP_RETURN || s->op == OP_DONE) {
|
||||
Sys_Printf ("%s", PR_GlobalString (pr, s->a, ev_void));
|
||||
} else {
|
||||
|
|
|
@ -257,7 +257,7 @@ check_branch (progs_t *pr, dstatement_t *st, opcode_t *op, short offset)
|
|||
{
|
||||
int address = st - pr->pr_statements;
|
||||
|
||||
address += offset - 1;
|
||||
address += offset;
|
||||
if (address < 0 || address >= pr->progs->numstatements)
|
||||
PR_Error (pr, "PR_Check_Opcodes: invalid branch (statement %d: %s)\n",
|
||||
st - pr->pr_statements, op->opname);
|
||||
|
|
Loading…
Reference in a new issue