diff --git a/engine/common/sys.h b/engine/common/sys.h index 06d6563f4..c794dd6ae 100644 --- a/engine/common/sys.h +++ b/engine/common/sys.h @@ -55,6 +55,7 @@ void VARGS Sys_Printf (char *fmt, ...); void Sys_Quit (void); +unsigned int Sys_Milliseconds (void); double Sys_DoubleTime (void); char *Sys_ConsoleInput (void); diff --git a/engine/common/vm.h b/engine/common/vm.h index 914d19a20..fe28d6bdf 100644 --- a/engine/common/vm.h +++ b/engine/common/vm.h @@ -41,6 +41,7 @@ void Plug_Init(void); void Plug_SBar(void); void Plug_DrawReloadImages(void); +int Plug_ConnectionlessClientPacket(char *buffer, int size); #endif diff --git a/engine/qclib/execloop.h b/engine/qclib/execloop.h index c4ff88f74..37e7464c7 100644 --- a/engine/qclib/execloop.h +++ b/engine/qclib/execloop.h @@ -388,7 +388,7 @@ reeval: //get a pointer to a field var case OP_ADDRESS: - if ((unsigned)OPA->edict >= maxedicts) + if ((unsigned)OPA->edict >= (unsigned)maxedicts) PR_RunError (progfuncs, "OP_ADDRESS references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID @@ -409,7 +409,7 @@ reeval: case OP_LOAD_ENT: case OP_LOAD_S: case OP_LOAD_FNC: - if ((unsigned)OPA->edict >= maxedicts) + if ((unsigned)OPA->edict >= (unsigned)maxedicts) PR_RunError (progfuncs, "OP_LOAD references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID @@ -420,7 +420,7 @@ reeval: break; case OP_LOAD_V: - if ((unsigned)OPA->edict >= maxedicts) + if ((unsigned)OPA->edict >= (unsigned)maxedicts) PR_RunError (progfuncs, "OP_LOAD_V references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID diff --git a/engine/qclib/execloop16d.h b/engine/qclib/execloop16d.h index 3df6b7aa1..37e7464c7 100644 --- a/engine/qclib/execloop16d.h +++ b/engine/qclib/execloop16d.h @@ -388,6 +388,8 @@ reeval: //get a pointer to a field var case OP_ADDRESS: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_ADDRESS references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -407,6 +409,8 @@ reeval: case OP_LOAD_ENT: case OP_LOAD_S: case OP_LOAD_FNC: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_LOAD references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -416,6 +420,8 @@ reeval: break; case OP_LOAD_V: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_LOAD_V references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -518,6 +524,12 @@ reeval: if (newf->first_statement < 0) { // negative statements are built in functions + +if (pr_typecurrent != 0) +{ + PR_MoveParms(progfuncs, 0, pr_typecurrent); + PR_SwitchProgs(progfuncs, 0); +} i = -newf->first_statement; // p = pr_typecurrent; progfuncs->lastcalledbuiltinnumber = i; diff --git a/engine/qclib/execloop32.h b/engine/qclib/execloop32.h index 3df6b7aa1..37e7464c7 100644 --- a/engine/qclib/execloop32.h +++ b/engine/qclib/execloop32.h @@ -388,6 +388,8 @@ reeval: //get a pointer to a field var case OP_ADDRESS: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_ADDRESS references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -407,6 +409,8 @@ reeval: case OP_LOAD_ENT: case OP_LOAD_S: case OP_LOAD_FNC: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_LOAD references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -416,6 +420,8 @@ reeval: break; case OP_LOAD_V: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_LOAD_V references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -518,6 +524,12 @@ reeval: if (newf->first_statement < 0) { // negative statements are built in functions + +if (pr_typecurrent != 0) +{ + PR_MoveParms(progfuncs, 0, pr_typecurrent); + PR_SwitchProgs(progfuncs, 0); +} i = -newf->first_statement; // p = pr_typecurrent; progfuncs->lastcalledbuiltinnumber = i; diff --git a/engine/qclib/execloop32d.h b/engine/qclib/execloop32d.h index 3df6b7aa1..37e7464c7 100644 --- a/engine/qclib/execloop32d.h +++ b/engine/qclib/execloop32d.h @@ -388,6 +388,8 @@ reeval: //get a pointer to a field var case OP_ADDRESS: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_ADDRESS references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -407,6 +409,8 @@ reeval: case OP_LOAD_ENT: case OP_LOAD_S: case OP_LOAD_FNC: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_LOAD references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -416,6 +420,8 @@ reeval: break; case OP_LOAD_V: + if ((unsigned)OPA->edict >= (unsigned)maxedicts) + PR_RunError (progfuncs, "OP_LOAD_V references invalid entity in %s", progfuncs->stringtable + pr_xfunction->s_name); ed = PROG_TO_EDICT(progfuncs, OPA->edict); #ifdef PARANOID NUM_FOR_EDICT(ed); // make sure it's in range @@ -518,6 +524,12 @@ reeval: if (newf->first_statement < 0) { // negative statements are built in functions + +if (pr_typecurrent != 0) +{ + PR_MoveParms(progfuncs, 0, pr_typecurrent); + PR_SwitchProgs(progfuncs, 0); +} i = -newf->first_statement; // p = pr_typecurrent; progfuncs->lastcalledbuiltinnumber = i;