don't swallow multimedia keys unless they're actually bound to something.
fix possible out-of-range issue with qc ent references. shader parsing is now a little more strict. lua code support updated to bring it more in line with hifi's efforts, still not enabled by default. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5233 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
67c68b2c43
commit
e44d8a85d8
34 changed files with 1834 additions and 679 deletions
|
@ -2764,7 +2764,7 @@ void CLQ1_AddVisibleBBoxes(void)
|
|||
"}\n");
|
||||
for (i = 1; i < w->num_edicts; i++)
|
||||
{
|
||||
e = WEDICT_NUM(w->progs, i);
|
||||
e = WEDICT_NUM_PB(w->progs, i);
|
||||
if (ED_ISFREE(e))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -2405,31 +2405,34 @@ void INS_TranslateKeyEvent(WPARAM wParam, LPARAM lParam, qboolean down, int qdev
|
|||
|
||||
int INS_AppCommand(LPARAM lParam)
|
||||
{
|
||||
const char *b;
|
||||
int qkey = 0;
|
||||
switch(HIWORD(lParam)&0xfff)
|
||||
{
|
||||
case APPCOMMAND_BROWSER_BACKWARD: qkey = K_MM_BACK; break;
|
||||
case APPCOMMAND_BROWSER_FAVORITES: qkey = K_MM_FAVORITES; break;
|
||||
case APPCOMMAND_BROWSER_FORWARD: qkey = K_MM_FORWARD; break;
|
||||
case APPCOMMAND_BROWSER_HOME: qkey = K_MM_HOME; break;
|
||||
case APPCOMMAND_BROWSER_REFRESH: qkey = K_MM_REFRESH; break;
|
||||
case APPCOMMAND_BROWSER_SEARCH: qkey = K_SEARCH; break;
|
||||
case APPCOMMAND_BROWSER_STOP: qkey = K_MM_STOP; break;
|
||||
// case APPCOMMAND_VOLUME_MUTE: qkey = K_MM_MUTE; break;
|
||||
case APPCOMMAND_VOLUME_UP: qkey = K_VOLUP; break;
|
||||
case APPCOMMAND_VOLUME_DOWN: qkey = K_VOLDOWN; break;
|
||||
|
||||
// I want to use these, but that would fuck up external music players.
|
||||
// case APPCOMMAND_MEDIA_NEXTTRACK:
|
||||
// case APPCOMMAND_MEDIA_PREVIOUSTRACK:
|
||||
// case APPCOMMAND_MEDIA_STOP:
|
||||
// case APPCOMMAND_MEDIA_PLAY_PAUSE:
|
||||
case APPCOMMAND_BROWSER_BACKWARD: qkey = K_MM_BROWSER_BACK; break;
|
||||
case APPCOMMAND_BROWSER_FAVORITES: qkey = K_MM_BROWSER_FAVORITES; break;
|
||||
case APPCOMMAND_BROWSER_FORWARD: qkey = K_MM_BROWSER_FORWARD; break;
|
||||
case APPCOMMAND_BROWSER_HOME: qkey = K_MM_BROWSER_HOME; break;
|
||||
case APPCOMMAND_BROWSER_REFRESH: qkey = K_MM_BROWSER_REFRESH; break;
|
||||
case APPCOMMAND_BROWSER_SEARCH: qkey = K_SEARCH; break;
|
||||
case APPCOMMAND_BROWSER_STOP: qkey = K_MM_BROWSER_STOP; break;
|
||||
case APPCOMMAND_VOLUME_MUTE: qkey = K_MM_VOLUME_MUTE; break;
|
||||
case APPCOMMAND_VOLUME_UP: qkey = K_VOLUP; break;
|
||||
case APPCOMMAND_VOLUME_DOWN: qkey = K_VOLDOWN; break;
|
||||
case APPCOMMAND_MEDIA_NEXTTRACK: qkey = K_MM_TRACK_NEXT; break;
|
||||
case APPCOMMAND_MEDIA_PREVIOUSTRACK:qkey = K_MM_TRACK_PREV; break;
|
||||
case APPCOMMAND_MEDIA_STOP: qkey = K_MM_TRACK_STOP; break;
|
||||
case APPCOMMAND_MEDIA_PLAY_PAUSE: qkey = K_MM_TRACK_PLAYPAUSE; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
IN_KeyEvent(0, true, qkey, 0);
|
||||
IN_KeyEvent(0, false, qkey, 0);
|
||||
return true;
|
||||
b = Key_GetBinding(qkey, 0, 0);
|
||||
if (b && *b)
|
||||
{ //only take the key if its actually bound to something, otherwise let the system handle it normally.
|
||||
IN_KeyEvent(0, true, qkey, 0);
|
||||
IN_KeyEvent(0, false, qkey, 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -51,7 +51,6 @@ int key_bindmaps[2];
|
|||
char *keybindings[K_MAX][KEY_MODIFIERSTATES];
|
||||
qbyte bindcmdlevel[K_MAX][KEY_MODIFIERSTATES];
|
||||
qboolean consolekeys[K_MAX]; // if true, can't be rebound while in console
|
||||
qboolean menubound[K_MAX]; // if true, can't be rebound while in menu
|
||||
int keyshift[K_MAX]; // key to map to if shift held down in console
|
||||
int key_repeats[K_MAX]; // if > 1, it is autorepeating
|
||||
qboolean keydown[K_MAX];
|
||||
|
@ -2304,10 +2303,6 @@ void Key_Init (void)
|
|||
keyshift['`'] = '~';
|
||||
keyshift['\\'] = '|';
|
||||
|
||||
menubound[K_ESCAPE] = true;
|
||||
for (i=0 ; i<12 ; i++)
|
||||
menubound[K_F1+i] = true;
|
||||
|
||||
//
|
||||
// register our functions
|
||||
//
|
||||
|
|
|
@ -202,12 +202,17 @@ K_GP_DPAD_LEFT = 253,
|
|||
K_GP_DPAD_RIGHT = 254,
|
||||
K_GP_UNKNOWN = 255,
|
||||
|
||||
K_MM_BACK,
|
||||
K_MM_FAVORITES,
|
||||
K_MM_FORWARD,
|
||||
K_MM_HOME,
|
||||
K_MM_REFRESH,
|
||||
K_MM_STOP,
|
||||
K_MM_BROWSER_BACK,
|
||||
K_MM_BROWSER_FAVORITES,
|
||||
K_MM_BROWSER_FORWARD,
|
||||
K_MM_BROWSER_HOME,
|
||||
K_MM_BROWSER_REFRESH,
|
||||
K_MM_BROWSER_STOP,
|
||||
K_MM_VOLUME_MUTE,
|
||||
K_MM_TRACK_NEXT,
|
||||
K_MM_TRACK_PREV,
|
||||
K_MM_TRACK_STOP,
|
||||
K_MM_TRACK_PLAYPAUSE,
|
||||
|
||||
K_MAX
|
||||
};
|
||||
|
|
|
@ -39,11 +39,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
extern usercmd_t cl_pendingcmd[MAX_SPLITS];
|
||||
|
||||
|
||||
#ifndef TEXTEDITOR
|
||||
//client only builds don't have a qc debugger
|
||||
#define QCEditor NULL
|
||||
#endif
|
||||
|
||||
static pubprogfuncs_t *csqcprogs;
|
||||
|
||||
typedef struct csqctreadstate_s {
|
||||
|
@ -1373,7 +1368,7 @@ static void QCBUILTIN PF_R_AddEntityMask(pubprogfuncs_t *prinst, struct globalva
|
|||
maxe = *prinst->parms->sv_num_edicts;
|
||||
for (e=1; e < maxe; e++)
|
||||
{
|
||||
ent = (void*)EDICT_NUM(prinst, e);
|
||||
ent = (void*)EDICT_NUM_PB(prinst, e);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
if (ent->v->think)
|
||||
|
@ -1404,7 +1399,7 @@ static void QCBUILTIN PF_R_AddEntityMask(pubprogfuncs_t *prinst, struct globalva
|
|||
maxe = *prinst->parms->sv_num_edicts;
|
||||
for (e=1; e < maxe; e++)
|
||||
{
|
||||
ent = (void*)EDICT_NUM(prinst, e);
|
||||
ent = (void*)EDICT_NUM_PB(prinst, e);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
|
||||
|
@ -3185,7 +3180,7 @@ void CSQC_ResetTrails(void)
|
|||
|
||||
for (i = 0; i < *prinst->parms->sv_num_edicts; i++)
|
||||
{
|
||||
ent = (csqcedict_t*)EDICT_NUM(prinst, i);
|
||||
ent = (csqcedict_t*)EDICT_NUM_PB(prinst, i);
|
||||
ent->trailstate = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -4577,8 +4572,8 @@ void CSQC_RunThreads(void)
|
|||
{ //call it and forget it ever happened. The Sleep biltin will recreate if needed.
|
||||
|
||||
|
||||
*csqcg.self = EDICT_TO_PROG(csqcprogs, EDICT_NUM(csqcprogs, state->self));
|
||||
*csqcg.other = EDICT_TO_PROG(csqcprogs, EDICT_NUM(csqcprogs, state->other));
|
||||
*csqcg.self = EDICT_TO_PROG(csqcprogs, EDICT_NUM_UB(csqcprogs, state->self));
|
||||
*csqcg.other = EDICT_TO_PROG(csqcprogs, EDICT_NUM_UB(csqcprogs, state->other));
|
||||
|
||||
csqcprogs->RunThread(csqcprogs, state->thread);
|
||||
csqcprogs->parms->memfree(state->thread);
|
||||
|
@ -7331,7 +7326,7 @@ qboolean CSQC_Init (qboolean anycsqc, qboolean csdatenabled, unsigned int checks
|
|||
csqcentsize = PR_InitEnts(csqcprogs, pr_csqc_maxedicts.value);
|
||||
|
||||
//world edict becomes readonly
|
||||
worldent = (csqcedict_t *)EDICT_NUM(csqcprogs, 0);
|
||||
worldent = (csqcedict_t *)EDICT_NUM_PB(csqcprogs, 0);
|
||||
worldent->ereftype = ER_ENTITY;
|
||||
|
||||
for (i = 0; i < csqcprogs->numprogs; i++)
|
||||
|
@ -7450,7 +7445,7 @@ void CSQC_WorldLoaded(void)
|
|||
csqc_world.worldmodel = cl.worldmodel;
|
||||
World_RBE_Start(&csqc_world);
|
||||
|
||||
worldent = (csqcedict_t *)EDICT_NUM(csqcprogs, 0);
|
||||
worldent = (csqcedict_t *)EDICT_NUM_PB(csqcprogs, 0);
|
||||
worldent->v->solid = SOLID_BSP;
|
||||
wmodelindex = CS_FindModel(cl.worldmodel?cl.worldmodel->name:"", &tmp);
|
||||
tmp = csqc_worldchanged;
|
||||
|
@ -7710,7 +7705,7 @@ qboolean CSQC_SetupToRenderPortal(int entkeynum)
|
|||
|
||||
if (csqcprogs && entkeynum < 0)
|
||||
{
|
||||
csqcedict_t *e = (void*)EDICT_NUM(csqcprogs, -entkeynum);
|
||||
csqcedict_t *e = (void*)EDICT_NUM_UB(csqcprogs, -entkeynum);
|
||||
if (e->xv->camera_transform)
|
||||
{
|
||||
int oself = *csqcg.self;
|
||||
|
@ -8483,7 +8478,7 @@ void CSQC_GetEntityOrigin(unsigned int csqcent, float *out)
|
|||
wedict_t *ent;
|
||||
if (!csqcprogs)
|
||||
return;
|
||||
ent = WEDICT_NUM(csqcprogs, csqcent);
|
||||
ent = WEDICT_NUM_UB(csqcprogs, csqcent);
|
||||
VectorCopy(ent->v->origin, out);
|
||||
}
|
||||
|
||||
|
@ -8631,7 +8626,7 @@ void CSQC_ParseEntities(void)
|
|||
#ifndef CLIENTONLY
|
||||
if (sv.state)
|
||||
{
|
||||
Con_Printf("Server classname: \"%s\"\n", PR_GetString(svprogfuncs, EDICT_NUM(svprogfuncs, entnum)->v->classname));
|
||||
Con_Printf("Server classname: \"%s\"\n", PR_GetString(svprogfuncs, EDICT_NUM_UB(svprogfuncs, entnum)->v->classname));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1512,7 +1512,7 @@ void QCBUILTIN PF_menu_findchain (pubprogfuncs_t *prinst, struct globalvars_s *p
|
|||
|
||||
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
|
||||
{
|
||||
ent = (menuedict_t *)EDICT_NUM(prinst, i);
|
||||
ent = (menuedict_t *)EDICT_NUM_PB(prinst, i);
|
||||
if (ent->ereftype == ER_FREE)
|
||||
continue;
|
||||
t = *(string_t *)&((float*)ent->fields)[f];
|
||||
|
@ -1544,7 +1544,7 @@ void QCBUILTIN PF_menu_findchainfloat (pubprogfuncs_t *prinst, struct globalvars
|
|||
|
||||
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
|
||||
{
|
||||
ent = (menuedict_t*)EDICT_NUM(prinst, i);
|
||||
ent = (menuedict_t*)EDICT_NUM_PB(prinst, i);
|
||||
if (ent->ereftype == ER_FREE)
|
||||
continue;
|
||||
if (((float *)ent->fields)[f] != s)
|
||||
|
@ -1573,7 +1573,7 @@ void QCBUILTIN PF_menu_findchainflags (pubprogfuncs_t *prinst, struct globalvars
|
|||
|
||||
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
|
||||
{
|
||||
ent = (menuedict_t*)EDICT_NUM(prinst, i);
|
||||
ent = (menuedict_t*)EDICT_NUM_PB(prinst, i);
|
||||
if (ent->ereftype == ER_FREE)
|
||||
continue;
|
||||
if ((int)((float *)ent->fields)[f] & s)
|
||||
|
@ -1596,7 +1596,7 @@ void QCBUILTIN PF_ftoe(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
{
|
||||
int entnum = G_FLOAT(OFS_PARM0);
|
||||
|
||||
RETURN_EDICT(prinst, EDICT_NUM(prinst, entnum));
|
||||
RETURN_EDICT(prinst, EDICT_NUM_UB(prinst, entnum));
|
||||
}
|
||||
|
||||
void QCBUILTIN PF_IsNotNull(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
|
@ -2623,8 +2623,8 @@ qboolean MP_Init (void)
|
|||
|
||||
|
||||
//'world' edict
|
||||
// EDICT_NUM(menu_world.progs, 0)->readonly = true;
|
||||
EDICT_NUM(menu_world.progs, 0)->ereftype = ER_ENTITY;
|
||||
// EDICT_NUM_PB(menu_world.progs, 0)->readonly = true;
|
||||
EDICT_NUM_PB(menu_world.progs, 0)->ereftype = ER_ENTITY;
|
||||
|
||||
|
||||
mp_init_function = PR_FindFunction(menu_world.progs, "m_init", PR_ANY);
|
||||
|
@ -2640,7 +2640,7 @@ qboolean MP_Init (void)
|
|||
PR_ExecuteProgram(menu_world.progs, mp_init_function);
|
||||
inmenuprogs--;
|
||||
|
||||
EDICT_NUM(menu_world.progs, 0)->readonly = true;
|
||||
EDICT_NUM_PB(menu_world.progs, 0)->readonly = true;
|
||||
|
||||
Con_DPrintf("Initialized menu.dat\n");
|
||||
return true;
|
||||
|
|
|
@ -2646,7 +2646,7 @@ static void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
|
|||
#ifdef CSQC_DAT
|
||||
if (ch->entnum < 0 && -ch->entnum < csqc_world.num_edicts)
|
||||
{
|
||||
wedict_t *ed = WEDICT_NUM(csqc_world.progs, -ch->entnum);
|
||||
wedict_t *ed = WEDICT_NUM_PB(csqc_world.progs, -ch->entnum);
|
||||
if (ed->ereftype == ER_ENTITY)
|
||||
{
|
||||
VectorCopy(ed->v->origin, ch->origin);
|
||||
|
|
|
@ -1934,7 +1934,7 @@ void R_DrawNameTags(void)
|
|||
float bestscore = 0, score = 0;
|
||||
for (i = 1; i < w->num_edicts; i++)
|
||||
{
|
||||
e = WEDICT_NUM(w->progs, i);
|
||||
e = WEDICT_NUM_PB(w->progs, i);
|
||||
if (ED_ISFREE(e))
|
||||
continue;
|
||||
VectorInterpolate(e->v->mins, 0.5, e->v->maxs, org);
|
||||
|
@ -1957,7 +1957,7 @@ void R_DrawNameTags(void)
|
|||
}
|
||||
if (best)
|
||||
{
|
||||
e = WEDICT_NUM(w->progs, best);
|
||||
e = WEDICT_NUM_PB(w->progs, best);
|
||||
VectorInterpolate(e->v->mins, 0.5, e->v->maxs, org);
|
||||
VectorAdd(org, e->v->origin, org);
|
||||
if (Matrix4x4_CM_Project(org, screenspace, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y))
|
||||
|
|
|
@ -1627,9 +1627,9 @@ static void World_ODE_Frame_JointFromEntity(world_t *world, wedict_t *ed)
|
|||
//Con_Printf("made new joint %i\n", (int) (ed - prog->edicts));
|
||||
dJointSetData(j, (void *) ed);
|
||||
if(enemy)
|
||||
b1 = (dBodyID)((WEDICT_NUM(world->progs, enemy))->ode.ode_body);
|
||||
b1 = (dBodyID)((WEDICT_NUM_UB(world->progs, enemy))->ode.ode_body);
|
||||
if(aiment)
|
||||
b2 = (dBodyID)((WEDICT_NUM(world->progs, aiment))->ode.ode_body);
|
||||
b2 = (dBodyID)((WEDICT_NUM_UB(world->progs, aiment))->ode.ode_body);
|
||||
dJointAttach(j, b1, b2);
|
||||
|
||||
switch(jointtype)
|
||||
|
@ -2641,14 +2641,14 @@ static void QDECL World_ODE_Frame(world_t *world, double frametime, double gravi
|
|||
// copy physics properties from entities to physics engine
|
||||
for (i = 0;i < world->num_edicts;i++)
|
||||
{
|
||||
ed = (wedict_t*)EDICT_NUM(world->progs, i);
|
||||
ed = (wedict_t*)EDICT_NUM_PB(world->progs, i);
|
||||
if (!ED_ISFREE(ed))
|
||||
World_ODE_Frame_BodyFromEntity(world, ed);
|
||||
}
|
||||
// oh, and it must be called after all bodies were created
|
||||
for (i = 0;i < world->num_edicts;i++)
|
||||
{
|
||||
ed = (wedict_t*)EDICT_NUM(world->progs, i);
|
||||
ed = (wedict_t*)EDICT_NUM_PB(world->progs, i);
|
||||
if (!ED_ISFREE(ed))
|
||||
World_ODE_Frame_JointFromEntity(world, ed);
|
||||
}
|
||||
|
@ -2691,7 +2691,7 @@ static void QDECL World_ODE_Frame(world_t *world, double frametime, double gravi
|
|||
// copy physics properties from physics engine to entities
|
||||
for (i = 1;i < world->num_edicts;i++)
|
||||
{
|
||||
ed = (wedict_t*)EDICT_NUM(world->progs, i);
|
||||
ed = (wedict_t*)EDICT_NUM_PB(world->progs, i);
|
||||
if (!ED_ISFREE(ed))
|
||||
World_ODE_Frame_BodyToEntity(world, ed);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ static qboolean PM_PortalTransform(world_t *w, int portalnum, vec3_t org, vec3_t
|
|||
{
|
||||
vec3_t rounded;
|
||||
qboolean okay = true;
|
||||
wedict_t *portal = WEDICT_NUM(w->progs, portalnum);
|
||||
wedict_t *portal = WEDICT_NUM_UB(w->progs, portalnum);
|
||||
int oself = *w->g.self;
|
||||
void *pr_globals = PR_globals(w->progs, PR_CURRENT);
|
||||
int i;
|
||||
|
|
|
@ -1227,7 +1227,7 @@ void QCBUILTIN PF_findchainflags (pubprogfuncs_t *prinst, struct globalvars_s *p
|
|||
|
||||
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
|
||||
{
|
||||
ent = WEDICT_NUM(prinst, i);
|
||||
ent = WEDICT_NUM_PB(prinst, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
if (!((int)((float *)ent->v)[ff] & s))
|
||||
|
@ -1258,7 +1258,7 @@ void QCBUILTIN PF_findchainfloat (pubprogfuncs_t *prinst, struct globalvars_s *p
|
|||
|
||||
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
|
||||
{
|
||||
ent = WEDICT_NUM(prinst, i);
|
||||
ent = WEDICT_NUM_PB(prinst, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
if (((float *)ent->v)[ff] != s)
|
||||
|
@ -1291,7 +1291,7 @@ void QCBUILTIN PF_findchain (pubprogfuncs_t *prinst, struct globalvars_s *pr_glo
|
|||
|
||||
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
|
||||
{
|
||||
ent = WEDICT_NUM(prinst, i);
|
||||
ent = WEDICT_NUM_PB(prinst, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
t = *(string_t *)&((float*)ent->v)[ff];
|
||||
|
@ -1321,7 +1321,7 @@ void QCBUILTIN PF_FindFlags (pubprogfuncs_t *prinst, struct globalvars_s *pr_glo
|
|||
|
||||
for (e++; e < *prinst->parms->sv_num_edicts; e++)
|
||||
{
|
||||
ed = WEDICT_NUM(prinst, e);
|
||||
ed = WEDICT_NUM_PB(prinst, e);
|
||||
if (ED_ISFREE(ed))
|
||||
continue;
|
||||
if ((int)((float *)ed->v)[f] & s)
|
||||
|
@ -1353,7 +1353,7 @@ void QCBUILTIN PF_FindFloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_glo
|
|||
|
||||
for (e++; e < *prinst->parms->sv_num_edicts; e++)
|
||||
{
|
||||
ed = WEDICT_NUM(prinst, e);
|
||||
ed = WEDICT_NUM_PB(prinst, e);
|
||||
if (ED_ISFREE(ed))
|
||||
continue;
|
||||
if (((int *)ed->v)[f] == s)
|
||||
|
@ -1386,7 +1386,7 @@ void QCBUILTIN PF_FindString (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
|
||||
for (e++ ; e < *prinst->parms->sv_num_edicts ; e++)
|
||||
{
|
||||
ed = WEDICT_NUM(prinst, e);
|
||||
ed = WEDICT_NUM_PB(prinst, e);
|
||||
if (ED_ISFREE(ed))
|
||||
continue;
|
||||
t = ((string_t *)ed->v)[f];
|
||||
|
@ -2925,7 +2925,7 @@ void QCBUILTIN PF_edict_for_num(pubprogfuncs_t *prinst, struct globalvars_s *pr_
|
|||
if (num >= w->num_edicts)
|
||||
RETURN_EDICT(prinst, w->edicts);
|
||||
|
||||
ent = (edict_t*)EDICT_NUM(prinst, num);
|
||||
ent = (edict_t*)EDICT_NUM_PB(prinst, num);
|
||||
RETURN_EDICT(prinst, ent);
|
||||
}
|
||||
|
||||
|
@ -2998,7 +2998,7 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
rad = rad*rad;
|
||||
for (i=1 ; i<w->num_edicts ; i++)
|
||||
{
|
||||
ent = WEDICT_NUM(prinst, i);
|
||||
ent = WEDICT_NUM_PB(prinst, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
if (ent->v->solid == SOLID_NOT && (!((int)ent->v->flags & FL_FINDABLE_NONSOLID)) && !sv_gameplayfix_blowupfallenzombies.value)
|
||||
|
@ -3031,7 +3031,7 @@ void QCBUILTIN PF_nextent (pubprogfuncs_t *prinst, struct globalvars_s *pr_globa
|
|||
RETURN_EDICT(prinst, *prinst->parms->sv_edicts);
|
||||
return;
|
||||
}
|
||||
ent = WEDICT_NUM(prinst, i);
|
||||
ent = WEDICT_NUM_PB(prinst, i);
|
||||
if (!ED_ISFREE(ent))
|
||||
{
|
||||
RETURN_EDICT(prinst, ent);
|
||||
|
|
|
@ -165,7 +165,8 @@ typedef struct areanode_s
|
|||
|
||||
typedef struct wedict_s wedict_t;
|
||||
#define PROG_TO_WEDICT (wedict_t*)PROG_TO_EDICT
|
||||
#define WEDICT_NUM (wedict_t *)EDICT_NUM
|
||||
#define WEDICT_NUM_UB (wedict_t *)EDICT_NUM_UB //ent number isn't bounded
|
||||
#define WEDICT_NUM_PB (wedict_t *)EDICT_NUM_PB //pre-bound
|
||||
#define G_WEDICT (wedict_t *)G_EDICT
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -2592,11 +2592,6 @@ static shaderkey_t shaderkeys[] =
|
|||
{"clutter", Shader_ClutterParms, "fte"},
|
||||
{"deferredlight", Shader_Deferredlight, "fte"}, //(sort = prelight)
|
||||
// {"lpp_light", Shader_Deferredlight, "fte"}, //(sort = prelight)
|
||||
{"glslprogram", Shader_GLSLProgramName, "fte"},
|
||||
{"program", Shader_ProgramName, "fte"}, //gl or d3d
|
||||
{"hlslprogram", Shader_HLSL9ProgramName, "fte"}, //for d3d
|
||||
{"hlsl11program", Shader_HLSL11ProgramName, "fte"}, //for d3d
|
||||
{"param", Shader_ProgramParam, "fte"}, //legacy
|
||||
{"affine", Shader_Affine, "fte"}, //some hardware is horribly slow, and can benefit from certain hints.
|
||||
|
||||
{"bemode", Shader_BEMode, "fte"},
|
||||
|
@ -2609,9 +2604,14 @@ static shaderkey_t shaderkeys[] =
|
|||
{"lowermap", Shader_LowerMap, "fte"},
|
||||
{"reflectmask", Shader_ReflectMask, "fte"},
|
||||
|
||||
/*simpler parsing for fte shaders*/
|
||||
{"progblendfunc", Shader_ProgBlendFunc, "fte"},
|
||||
{"progmap", Shader_ProgMap, "fte"},
|
||||
/*program stuff at the material level is an outdated practise.*/
|
||||
{"program", Shader_ProgramName, "fte"}, //usable with any renderer that has a usable shader language...
|
||||
{"glslprogram", Shader_GLSLProgramName, "fte"}, //for renderers that accept embedded glsl
|
||||
{"hlslprogram", Shader_HLSL9ProgramName, "fte"}, //for d3d with embedded hlsl
|
||||
{"hlsl11program", Shader_HLSL11ProgramName, "fte"}, //for d3d with embedded hlsl
|
||||
{"param", Shader_ProgramParam, "fte"}, //legacy
|
||||
{"progblendfunc", Shader_ProgBlendFunc, "fte"}, //specifies the blend mode (actually just overrides the first subpasses' blendmode.
|
||||
{"progmap", Shader_ProgMap, "fte"}, //avoids needing extra subpasses (actually just inserts an extra pass).
|
||||
|
||||
//dp compat
|
||||
{"reflectcube", Shader_ReflectCube, "dp"},
|
||||
|
@ -4364,6 +4364,8 @@ void Shader_Readpass (shader_t *shader, char **ptr)
|
|||
{
|
||||
if ( token[0] == '}' )
|
||||
break;
|
||||
else if (token[0] == '{')
|
||||
Con_Printf("unexpected indentation in %s\n", shader->name);
|
||||
else if ( Shader_Parsetok (shader, pass, shaderpasskeys, token, ptr) )
|
||||
break;
|
||||
}
|
||||
|
@ -4471,6 +4473,12 @@ static qboolean Shader_Parsetok (shader_t *shader, shaderpass_t *pass, shaderkey
|
|||
char *prefix;
|
||||
qboolean toolchainprefix = false;
|
||||
|
||||
if (*token == '_')
|
||||
{ //forward compat: make sure there's a way to shut stuff up if you're using future extensions in an outdated engine.
|
||||
token++;
|
||||
toolchainprefix = true;
|
||||
}
|
||||
|
||||
//handle known prefixes.
|
||||
if (!Q_strncasecmp(token, "fte", 3)) {prefix = token; token += 3; }
|
||||
else if (!Q_strncasecmp(token, "dp", 2)) {prefix = token; token += 2; }
|
||||
|
|
|
@ -2908,7 +2908,8 @@ static LONG WINAPI GLMainWndProc (
|
|||
break;
|
||||
|
||||
case WM_APPCOMMAND:
|
||||
lRet = INS_AppCommand(lParam);
|
||||
if (!INS_AppCommand(lParam))
|
||||
lRet = DefWindowProc(hWnd, uMsg, wParam, lParam); //otherwise it won't get handled by background apps, like media players.
|
||||
break;
|
||||
|
||||
case WM_MOUSEACTIVATE:
|
||||
|
|
|
@ -430,7 +430,7 @@ reeval:
|
|||
return pr_xstatement;
|
||||
break;
|
||||
}
|
||||
ed = PROG_TO_EDICT(progfuncs, OPA->edict);
|
||||
ed = PROG_TO_EDICT_PB(progfuncs, OPA->edict);
|
||||
#ifdef PARANOID
|
||||
NUM_FOR_EDICT(ed); // make sure it's in range
|
||||
#endif
|
||||
|
@ -491,7 +491,7 @@ reeval:
|
|||
OPC->_int = 0;
|
||||
break;
|
||||
}
|
||||
ed = PROG_TO_EDICT(progfuncs, OPA->edict);
|
||||
ed = PROG_TO_EDICT_PB(progfuncs, OPA->edict);
|
||||
#ifdef PARANOID
|
||||
NUM_FOR_EDICT(ed); // make sure it's in range
|
||||
#endif
|
||||
|
@ -528,7 +528,7 @@ reeval:
|
|||
OPC->_vector[2] = 0;
|
||||
break;
|
||||
}
|
||||
ed = PROG_TO_EDICT(progfuncs, OPA->edict);
|
||||
ed = PROG_TO_EDICT_PB(progfuncs, OPA->edict);
|
||||
#ifdef PARANOID
|
||||
NUM_FOR_EDICT(ed); // make sure it's in range
|
||||
#endif
|
||||
|
@ -967,7 +967,7 @@ reeval:
|
|||
break;
|
||||
|
||||
case OP_THINKTIME:
|
||||
externs->thinktimeop(&progfuncs->funcs, (struct edict_s *)PROG_TO_EDICT(progfuncs, OPA->edict), OPB->_float);
|
||||
externs->thinktimeop(&progfuncs->funcs, (struct edict_s *)PROG_TO_EDICT_UB(progfuncs, OPA->edict), OPB->_float);
|
||||
break;
|
||||
|
||||
case OP_MULSTORE_F:
|
||||
|
|
|
@ -498,6 +498,7 @@ int PDECL PR_InitEnts(pubprogfuncs_t *ppf, int max_ents)
|
|||
prinst.max_fields_size = prinst.fields_size;
|
||||
|
||||
prinst.edicttable = (struct edictrun_s**)(progfuncs->funcs.edicttable = PRHunkAlloc(progfuncs, prinst.maxedicts*sizeof(struct edicts_s *), "edicttable"));
|
||||
progfuncs->funcs.edicttable_length = prinst.maxedicts;
|
||||
e = PRHunkAlloc(progfuncs, externs->edictsize, "edict0");
|
||||
e->fieldsize = prinst.fields_size;
|
||||
e->entnum = 0;
|
||||
|
@ -571,6 +572,7 @@ static void PDECL PR_Configure (pubprogfuncs_t *ppf, size_t addressable_size, in
|
|||
prinst.profilingalert = Sys_GetClockRate();
|
||||
prinst.maxedicts = 1;
|
||||
prinst.edicttable = (edictrun_t**)(progfuncs->funcs.edicttable = &sv_edicts);
|
||||
progfuncs->funcs.edicttable_length = 1;
|
||||
sv_num_edicts = 1; //set up a safty buffer so things won't go horribly wrong too often
|
||||
sv_edicts=(struct edict_s *)&tempedict;
|
||||
tempedict.readonly = true;
|
||||
|
@ -874,7 +876,7 @@ struct edict_s *PDECL ProgsToEdict (pubprogfuncs_t *ppf, int progs)
|
|||
}
|
||||
progs = 0;
|
||||
}
|
||||
return (struct edict_s *)PROG_TO_EDICT(progfuncs.inst, progs);
|
||||
return (struct edict_s *)PROG_TO_EDICT_PB(progfuncs.inst, progs);
|
||||
}
|
||||
int PDECL EdictToProgs (pubprogfuncs_t *ppf, struct edict_s *ed)
|
||||
{
|
||||
|
|
|
@ -802,7 +802,7 @@ char *PR_UglyOldValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
|||
QC_snprintfz (line, sizeof(line), "%s", PR_StringToNative(&progfuncs->funcs, val->string));
|
||||
break;
|
||||
case ev_entity:
|
||||
QC_snprintfz (line, sizeof(line), "%i", NUM_FOR_EDICT(progfuncs, (struct edict_s *)PROG_TO_EDICT(progfuncs, val->edict)));
|
||||
QC_snprintfz (line, sizeof(line), "%i", val->edict);
|
||||
break;
|
||||
case ev_function:
|
||||
f = pr_progstate[(val->function & 0xff000000)>>24].functions + (val->function & ~0xff000000);
|
||||
|
@ -2143,7 +2143,7 @@ int PDECL PR_LoadEnts(pubprogfuncs_t *ppf, const char *file, void *ctx, void (PD
|
|||
sv_num_edicts = 1; //set up a safty buffer so things won't go horribly wrong too often
|
||||
sv_edicts=(struct edict_s *)&tempedict;
|
||||
prinst.edicttable = (struct edictrun_s**)(progfuncs->funcs.edicttable = &sv_edicts);
|
||||
|
||||
progfuncs->funcs.edicttable_length = numents;
|
||||
|
||||
sv_num_edicts = numents; //should be fine
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ static void PDECL PR_PrintRelevantLocals(progfuncs_t *progfuncs)
|
|||
}
|
||||
else
|
||||
{
|
||||
ed = PROG_TO_EDICT(progfuncs, entnum);
|
||||
ed = PROG_TO_EDICT_PB(progfuncs, entnum);
|
||||
if ((unsigned int)((eval_t *)&pr_globals[st16[st].b])->_int*4u >= ed->fieldsize)
|
||||
continue;
|
||||
else
|
||||
|
@ -751,8 +751,10 @@ pbool LocateDebugTerm(progfuncs_t *progfuncs, char *key, eval_t **result, etype_
|
|||
fofs = fdef->ofs;
|
||||
type = fdef->type;
|
||||
|
||||
|
||||
ed = PROG_TO_EDICT(progfuncs, val->_int);
|
||||
if ((unsigned int)val->_int >= prinst.maxedicts)
|
||||
ed = NULL;
|
||||
else
|
||||
ed = PROG_TO_EDICT_PB(progfuncs, val->_int);
|
||||
if (!ed)
|
||||
return false;
|
||||
if (fofs < 0 || fofs >= (int)prinst.max_fields_size)
|
||||
|
@ -1492,7 +1494,7 @@ const char *PR_GetEdictClassname(progfuncs_t *progfuncs, unsigned int edict)
|
|||
fdef_t *cnfd = ED_FindField(progfuncs, "classname");
|
||||
if (cnfd && edict < prinst.maxedicts)
|
||||
{
|
||||
string_t *v = (string_t *)((char *)edvars(PROG_TO_EDICT(progfuncs, edict)) + cnfd->ofs*4);
|
||||
string_t *v = (string_t *)((char *)edvars(PROG_TO_EDICT_PB(progfuncs, edict)) + cnfd->ofs*4);
|
||||
return PR_StringToNative(&progfuncs->funcs, *v);
|
||||
}
|
||||
return "";
|
||||
|
|
|
@ -147,9 +147,6 @@ typedef struct prinst_s
|
|||
#define pr_xstatement prinst.pr_xstatement
|
||||
|
||||
//pr_edict.c
|
||||
|
||||
unsigned int maxedicts;
|
||||
|
||||
evalc_t spawnflagscache;
|
||||
unsigned int fields_size; // in bytes
|
||||
unsigned int max_fields_size;
|
||||
|
@ -161,6 +158,7 @@ typedef struct prinst_s
|
|||
size_t addressableused;
|
||||
size_t addressablesize;
|
||||
|
||||
unsigned int maxedicts;
|
||||
struct edictrun_s **edicttable;
|
||||
} prinst_t;
|
||||
|
||||
|
@ -413,7 +411,8 @@ unsigned int PDECL QC_NUM_FOR_EDICT(pubprogfuncs_t *progfuncs, struct edict_s *e
|
|||
//#define NEXT_EDICT(e) ((edictrun_t *)( (byte *)e + pr_edict_size))
|
||||
|
||||
#define EDICT_TO_PROG(pf, e) (((edictrun_t*)e)->entnum)
|
||||
#define PROG_TO_EDICT(pf, e) ((struct edictrun_s *)prinst.edicttable[e])
|
||||
#define PROG_TO_EDICT_PB(pf, e) ((struct edictrun_s *)prinst.edicttable[e]) //index already validated
|
||||
#define PROG_TO_EDICT_UB(pf, e) ((struct edictrun_s *)prinst.edicttable[((unsigned int)(e)<prinst.maxedicts)?e:0]) //(safely) pokes world if the index is otherwise invalid
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
|
|
@ -105,8 +105,8 @@ struct pubprogfuncs_s
|
|||
struct edict_s *(PDECL *EntAlloc) (pubprogfuncs_t *prinst, pbool object, size_t extrasize);
|
||||
void (PDECL *EntFree) (pubprogfuncs_t *prinst, struct edict_s *ed);
|
||||
|
||||
struct edict_s *(PDECL *EDICT_NUM) (pubprogfuncs_t *prinst, unsigned int n); //get the nth edict
|
||||
unsigned int (PDECL *NUM_FOR_EDICT) (pubprogfuncs_t *prinst, struct edict_s *e); //so you can find out what that 'n' will be
|
||||
struct edict_s *(PDECL *EdictNum) (pubprogfuncs_t *prinst, unsigned int n); //get the nth edict
|
||||
unsigned int (PDECL *NumForEdict) (pubprogfuncs_t *prinst, struct edict_s *e); //so you can find out what that 'n' will be
|
||||
|
||||
char *(PDECL *VarString) (pubprogfuncs_t *prinst, int first); //returns a string made up of multiple arguments
|
||||
|
||||
|
@ -195,6 +195,7 @@ struct pubprogfuncs_s
|
|||
void (PDECL *SetStringField) (pubprogfuncs_t *progfuncs, struct edict_s *ed, string_t *fld, const char *str, pbool str_is_static); //if ed is null, fld points to a global. if str_is_static, then s doesn't need its own memory allocated.
|
||||
pbool (PDECL *DumpProfile) (pubprogfuncs_t *progfuncs, pbool resetprofiles);
|
||||
|
||||
unsigned int edicttable_length;
|
||||
struct edict_s **edicttable;
|
||||
};
|
||||
|
||||
|
@ -285,9 +286,10 @@ typedef union eval_s
|
|||
#if 0//def _DEBUG
|
||||
#define EDICT_NUM(pf, num) (*pf->EDICT_NUM) (pf, num)
|
||||
#else
|
||||
#define EDICT_NUM(pf, num) (pf->edicttable[num])
|
||||
#define EDICT_NUM_PB(pf, num) (pf->edicttable[num])
|
||||
#define EDICT_NUM_UB(pf, num) EDICT_NUM_PB(pf,(((unsigned int)(num))>=pf->edicttable_length)?0:num)
|
||||
#endif
|
||||
#define NUM_FOR_EDICT(pf, e) (*pf->NUM_FOR_EDICT) (pf, (struct edict_s*)(e))
|
||||
#define NUM_FOR_EDICT(pf, e) (*pf->NumForEdict) (pf, (struct edict_s*)(e))
|
||||
#define SetGlobalEdict(pf, ed, ofs) (*pf->SetGlobalEdict) (pf, ed, ofs)
|
||||
#define PR_VarString(pf,first) (*pf->VarString) (pf,first)
|
||||
|
||||
|
|
|
@ -1826,7 +1826,7 @@ void NPP_QWFlush(void)
|
|||
{
|
||||
short data;
|
||||
float org[3];
|
||||
edict_t *ent = EDICT_NUM(svprogfuncs, LittleShort((*(short*)&buffer[1])));
|
||||
edict_t *ent = EDICT_NUM_UB(svprogfuncs, LittleShort((*(short*)&buffer[1])));
|
||||
ent->muzzletime = sv.world.physicstime+host_frametime; //flag the entity as needing an EF_MUZZLEFLASH
|
||||
VectorCopy(ent->v->origin, org);
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ static void PDECL PR_SSQC_Relocated(pubprogfuncs_t *pr, char *oldb, char *newb,
|
|||
#ifdef VM_Q1
|
||||
for (i = 0; i < sv.world.num_edicts; i++)
|
||||
{
|
||||
ent = EDICT_NUM(pr, i);
|
||||
ent = EDICT_NUM_PB(pr, i);
|
||||
if ((char*)ent->xv >= oldb && (char*)ent->xv < oldb+oldlen)
|
||||
ent->xv = (extentvars_t*)((char*)ent->xv - oldb + newb);
|
||||
}
|
||||
|
@ -1273,7 +1273,7 @@ static void PR_ApplyCompilation_f (void)
|
|||
|
||||
for (i=0 ; i<sv.allocated_client_slots ; i++)
|
||||
{
|
||||
ent = EDICT_NUM(svprogfuncs, i+1);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, i+1);
|
||||
|
||||
svs.clients[i].edict = ent;
|
||||
}
|
||||
|
@ -3096,7 +3096,7 @@ PF_particle
|
|||
particle(origin, color, count)
|
||||
=================
|
||||
*/
|
||||
static void QCBUILTIN PF_particle (pubprogfuncs_t *prinst, globalvars_t *pr_globals) //I said it was for compatability only.
|
||||
void QCBUILTIN PF_particle (pubprogfuncs_t *prinst, globalvars_t *pr_globals) //I said it was for compatability only.
|
||||
{
|
||||
float *org, *dir;
|
||||
int color;
|
||||
|
@ -3686,7 +3686,7 @@ void PF_newcheckclient (pubprogfuncs_t *prinst, world_t *w)
|
|||
if (i >= sv.allocated_client_slots+1)
|
||||
i = 1;
|
||||
|
||||
ent = EDICT_NUM(prinst, i);
|
||||
ent = EDICT_NUM_UB(prinst, i);
|
||||
|
||||
if (i == w->lastcheck)
|
||||
break; // didn't find anything else
|
||||
|
@ -3747,7 +3747,7 @@ int PF_checkclient_Internal (pubprogfuncs_t *prinst)
|
|||
}
|
||||
|
||||
// return check if it might be visible
|
||||
ent = EDICT_NUM(prinst, w->lastcheck);
|
||||
ent = EDICT_NUM_PB(prinst, w->lastcheck);
|
||||
if (ED_ISFREE(ent) || ent->v->health <= 0)
|
||||
{
|
||||
return 0;
|
||||
|
@ -3776,7 +3776,7 @@ int PF_checkclient_Internal (pubprogfuncs_t *prinst)
|
|||
|
||||
static void QCBUILTIN PF_checkclient (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
RETURN_EDICT(prinst, EDICT_NUM(prinst, PF_checkclient_Internal(prinst)));
|
||||
RETURN_EDICT(prinst, EDICT_NUM_PB(prinst, PF_checkclient_Internal(prinst)));
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -3961,7 +3961,7 @@ static void QCBUILTIN PF_spawnclient (pubprogfuncs_t *prinst, struct globalvars_
|
|||
svs.clients[i].datagram.allowoverflow = true;
|
||||
svs.clients[i].datagram.maxsize = 0;
|
||||
|
||||
svs.clients[i].edict = EDICT_NUM(prinst, i+1);
|
||||
svs.clients[i].edict = EDICT_NUM_PB(prinst, i+1);
|
||||
|
||||
SV_SetUpClientEdict (&svs.clients[i], svs.clients[i].edict);
|
||||
|
||||
|
@ -4700,7 +4700,7 @@ vector aim(entity, missilespeed)
|
|||
*/
|
||||
//cvar_t sv_aim = {"sv_aim", "0.93"};
|
||||
cvar_t sv_aim = CVAR("sv_aim", "2");
|
||||
static void QCBUILTIN PF_aim (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
void QCBUILTIN PF_aim (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
edict_t *ent, *check, *bestent;
|
||||
vec3_t start, dir, end, bestdir;
|
||||
|
@ -4754,7 +4754,7 @@ static void QCBUILTIN PF_aim (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
|
||||
for (i=1 ; i<sv.world.num_edicts ; i++ )
|
||||
{
|
||||
check = EDICT_NUM(prinst, i);
|
||||
check = EDICT_NUM_PB(prinst, i);
|
||||
if (check->v->takedamage != DAMAGE_AIM)
|
||||
continue;
|
||||
if (check == ent)
|
||||
|
@ -8449,8 +8449,8 @@ void PRSV_RunThreads(void)
|
|||
{ //call it and forget it ever happened. The Sleep biltin will recreate if needed.
|
||||
pr_globals = PR_globals(svprogfuncs, PR_CURRENT);
|
||||
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, EDICT_NUM(svprogfuncs, state->self));
|
||||
pr_global_struct->other = EDICT_TO_PROG(svprogfuncs, EDICT_NUM(svprogfuncs, state->other));
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, EDICT_NUM_UB(svprogfuncs, state->self));
|
||||
pr_global_struct->other = EDICT_TO_PROG(svprogfuncs, EDICT_NUM_UB(svprogfuncs, state->other));
|
||||
G_FLOAT(OFS_RETURN) = state->returnval;
|
||||
|
||||
svprogfuncs->RunThread(svprogfuncs, state->thread);
|
||||
|
@ -9256,7 +9256,7 @@ static void QCBUILTIN PF_ShowPic(pubprogfuncs_t *prinst, struct globalvars_s *pr
|
|||
prinst->callargc = 6;
|
||||
for (entnum = 0; entnum < sv.allocated_client_slots; entnum++)
|
||||
{
|
||||
G_INT(OFS_PARM5) = EDICT_TO_PROG(prinst, EDICT_NUM(prinst, entnum+1));
|
||||
G_INT(OFS_PARM5) = EDICT_TO_PROG(prinst, EDICT_NUM_PB(prinst, entnum+1));
|
||||
PF_ShowPic(prinst, pr_globals);
|
||||
}
|
||||
}
|
||||
|
@ -9285,7 +9285,7 @@ static void QCBUILTIN PF_HidePic(pubprogfuncs_t *prinst, struct globalvars_s *pr
|
|||
prinst->callargc = 2;
|
||||
for (entnum = 0; entnum < sv.allocated_client_slots; entnum++)
|
||||
{
|
||||
G_INT(OFS_PARM1) = EDICT_TO_PROG(prinst, EDICT_NUM(prinst, entnum+1));
|
||||
G_INT(OFS_PARM1) = EDICT_TO_PROG(prinst, EDICT_NUM_PB(prinst, entnum+1));
|
||||
PF_HidePic(prinst, pr_globals);
|
||||
}
|
||||
}
|
||||
|
@ -9323,7 +9323,7 @@ static void QCBUILTIN PF_MovePic(pubprogfuncs_t *prinst, struct globalvars_s *pr
|
|||
prinst->callargc = 5;
|
||||
for (entnum = 0; entnum < sv.allocated_client_slots; entnum++)
|
||||
{
|
||||
G_INT(OFS_PARM4) = EDICT_TO_PROG(prinst, EDICT_NUM(prinst, entnum+1));
|
||||
G_INT(OFS_PARM4) = EDICT_TO_PROG(prinst, EDICT_NUM_PB(prinst, entnum+1));
|
||||
PF_MovePic(prinst, pr_globals);
|
||||
}
|
||||
}
|
||||
|
@ -9354,7 +9354,7 @@ static void QCBUILTIN PF_ChangePic(pubprogfuncs_t *prinst, struct globalvars_s *
|
|||
prinst->callargc = 3;
|
||||
for (entnum = 0; entnum < sv.allocated_client_slots; entnum++)
|
||||
{
|
||||
G_INT(OFS_PARM2) = EDICT_TO_PROG(prinst, EDICT_NUM(prinst, entnum+1));
|
||||
G_INT(OFS_PARM2) = EDICT_TO_PROG(prinst, EDICT_NUM_PB(prinst, entnum+1));
|
||||
PF_ChangePic(prinst, pr_globals);
|
||||
}
|
||||
}
|
||||
|
@ -9531,7 +9531,7 @@ static void QCBUILTIN PF_runclientphys(pubprogfuncs_t *prinst, struct globalvars
|
|||
if (pmove.onground)
|
||||
{
|
||||
ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
|
||||
ent->v->groundentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM(svprogfuncs, pmove.physents[pmove.groundent].info));
|
||||
ent->v->groundentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM_PB(svprogfuncs, pmove.physents[pmove.groundent].info));
|
||||
}
|
||||
else
|
||||
ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
|
||||
|
@ -9544,7 +9544,7 @@ static void QCBUILTIN PF_runclientphys(pubprogfuncs_t *prinst, struct globalvars
|
|||
if (pmove.physents[pmove.touchindex[i]].notouch)
|
||||
continue;
|
||||
n = pmove.physents[pmove.touchindex[i]].info;
|
||||
touched = EDICT_NUM(svprogfuncs, n);
|
||||
touched = EDICT_NUM_PB(svprogfuncs, n);
|
||||
if (!touched->v->touch || n >= playertouchmax || (playertouch[n/8]&(1<<(n%8))))
|
||||
continue;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -472,7 +472,7 @@ static edict_t *QDECL Q1QVMPF_EntAlloc(pubprogfuncs_t *pf, pbool object, size_t
|
|||
edict_t *e;
|
||||
for ( i=0 ; i<sv.world.num_edicts ; i++)
|
||||
{
|
||||
e = (edict_t*)EDICT_NUM(pf, i);
|
||||
e = (edict_t*)EDICT_NUM_PB(pf, i);
|
||||
// the first couple seconds of server time can involve a lot of
|
||||
// freeing and allocating, so relax the replacement policy
|
||||
if (!e || (ED_ISFREE(e) && ( e->freetime < 2 || sv.time - e->freetime > 0.5 ) ))
|
||||
|
@ -488,7 +488,7 @@ static edict_t *QDECL Q1QVMPF_EntAlloc(pubprogfuncs_t *pf, pbool object, size_t
|
|||
{
|
||||
for ( i=0 ; i<sv.world.num_edicts ; i++)
|
||||
{
|
||||
e = (edict_t*)EDICT_NUM(pf, i);
|
||||
e = (edict_t*)EDICT_NUM_PB(pf, i);
|
||||
// the first couple seconds of server time can involve a lot of
|
||||
// freeing and allocating, so relax the replacement policy
|
||||
if (!e || ED_ISFREE(e))
|
||||
|
@ -868,7 +868,7 @@ static qintptr_t QVM_BPrint (void *offset, quintptr_t mask, const qintptr_t *arg
|
|||
}
|
||||
static qintptr_t QVM_SPrint (void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
if ((unsigned)VM_LONG(arg[0]) > sv.allocated_client_slots)
|
||||
if ((unsigned)VM_LONG(arg[0])-1u >= sv.allocated_client_slots)
|
||||
return 0;
|
||||
SV_ClientPrintf(&svs.clients[VM_LONG(arg[0])-1], VM_LONG(arg[1]), "%s", (char*)VM_POINTER(arg[2]));
|
||||
return 0;
|
||||
|
@ -951,7 +951,7 @@ static qintptr_t QVM_FindRadius (void *offset, quintptr_t mask, const qintptr_t
|
|||
rad *= rad;
|
||||
for(start++; start < sv.world.num_edicts; start++)
|
||||
{
|
||||
ed = EDICT_NUM(svprogfuncs, start);
|
||||
ed = EDICT_NUM_PB(svprogfuncs, start);
|
||||
if (ED_ISFREE(ed))
|
||||
continue;
|
||||
VectorSubtract(ed->v->origin, org, diff);
|
||||
|
@ -962,7 +962,7 @@ static qintptr_t QVM_FindRadius (void *offset, quintptr_t mask, const qintptr_t
|
|||
}
|
||||
static qintptr_t QVM_WalkMove (void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
wedict_t *ed = WEDICT_NUM(svprogfuncs, arg[0]);
|
||||
wedict_t *ed = WEDICT_NUM_UB(svprogfuncs, arg[0]);
|
||||
float yaw = VM_FLOAT(arg[1]);
|
||||
float dist = VM_FLOAT(arg[2]);
|
||||
vec3_t move;
|
||||
|
@ -985,7 +985,7 @@ static qintptr_t QVM_DropToFloor (void *offset, quintptr_t mask, const qintptr_t
|
|||
trace_t trace;
|
||||
extern cvar_t pr_droptofloorunits;
|
||||
|
||||
ent = EDICT_NUM(svprogfuncs, arg[0]);
|
||||
ent = EDICT_NUM_UB(svprogfuncs, arg[0]);
|
||||
|
||||
VectorCopy (ent->v->origin, end);
|
||||
if (pr_droptofloorunits.value > 0)
|
||||
|
@ -1010,7 +1010,7 @@ static qintptr_t QVM_DropToFloor (void *offset, quintptr_t mask, const qintptr_t
|
|||
static qintptr_t QVM_CheckBottom (void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
vec3_t up = {0,0,1};
|
||||
return World_CheckBottom(&sv.world, (wedict_t*)EDICT_NUM(svprogfuncs, VM_LONG(arg[0])), up);
|
||||
return World_CheckBottom(&sv.world, (wedict_t*)EDICT_NUM_UB(svprogfuncs, VM_LONG(arg[0])), up);
|
||||
}
|
||||
static qintptr_t QVM_PointContents (void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
|
@ -1033,7 +1033,7 @@ static qintptr_t QVM_NextEnt (void *offset, quintptr_t mask, const qintptr_t *ar
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
ent = EDICT_NUM(svprogfuncs, i);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, i);
|
||||
if (!ED_ISFREE(ent))
|
||||
{
|
||||
return i;
|
||||
|
@ -1530,7 +1530,7 @@ static qintptr_t QVM_Add_Bot (void *offset, quintptr_t mask, const qintptr_t *ar
|
|||
cl->datagram.allowoverflow = true;
|
||||
cl->datagram.maxsize = 0;
|
||||
|
||||
cl->edict = EDICT_NUM(sv.world.progs, i+1);
|
||||
cl->edict = EDICT_NUM_PB(sv.world.progs, i+1);
|
||||
|
||||
Info_SetValueForKey(cl->userinfo, "name", name, sizeof(cl->userinfo));
|
||||
Info_SetValueForKey(cl->userinfo, "topcolor", va("%i", top), sizeof(cl->userinfo));
|
||||
|
@ -2167,8 +2167,8 @@ qboolean PR_LoadQ1QVM(void)
|
|||
|
||||
|
||||
// q1qvmprogfuncs.AddString = Q1QVMPF_AddString; //using this breaks 64bit support, and is a 'bad plan' elsewhere too,
|
||||
q1qvmprogfuncs.EDICT_NUM = Q1QVMPF_EdictNum;
|
||||
q1qvmprogfuncs.NUM_FOR_EDICT = Q1QVMPF_NumForEdict;
|
||||
q1qvmprogfuncs.EdictNum = Q1QVMPF_EdictNum;
|
||||
q1qvmprogfuncs.NumForEdict = Q1QVMPF_NumForEdict;
|
||||
q1qvmprogfuncs.EdictToProgs = Q1QVMPF_EdictToProgs;
|
||||
q1qvmprogfuncs.ProgsToEdict = Q1QVMPF_ProgsToEdict;
|
||||
q1qvmprogfuncs.EntAlloc = Q1QVMPF_EntAlloc;
|
||||
|
@ -2262,6 +2262,7 @@ qboolean PR_LoadQ1QVM(void)
|
|||
sv.world.num_edicts = 1;
|
||||
sv.world.max_edicts = bound(64, gd.maxedicts, MAX_EDICTS);
|
||||
q1qvmprogfuncs.edicttable = Z_Malloc(sizeof(*q1qvmprogfuncs.edicttable) * sv.world.max_edicts);
|
||||
q1qvmprogfuncs.edicttable_length = sv.world.max_edicts;
|
||||
|
||||
limit = VM_MemoryMask(q1qvm);
|
||||
if (gd.sizeofent < 0 || gd.sizeofent > 0xffffffff / gd.maxedicts)
|
||||
|
|
|
@ -341,7 +341,7 @@ void SV_Loadgame_Legacy(char *filename, vfsfile_t *f, int version)
|
|||
{
|
||||
if (cl->state)
|
||||
sv.spawned_client_slots += 1;
|
||||
ent = EDICT_NUM(svprogfuncs, i+1);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, i+1);
|
||||
}
|
||||
else
|
||||
ent = NULL;
|
||||
|
@ -824,7 +824,7 @@ qboolean SV_LoadLevelCache(const char *savename, const char *level, const char *
|
|||
for (i=0 ; i<svs.allocated_client_slots ; i++)
|
||||
{
|
||||
if (i < sv.allocated_client_slots)
|
||||
ent = EDICT_NUM(svprogfuncs, i+1);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, i+1);
|
||||
else
|
||||
ent = NULL;
|
||||
svs.clients[i].edict = ent;
|
||||
|
@ -881,7 +881,7 @@ qboolean SV_LoadLevelCache(const char *savename, const char *level, const char *
|
|||
|
||||
for (i=0 ; i<sv.world.num_edicts ; i++)
|
||||
{
|
||||
ent = EDICT_NUM(svprogfuncs, i);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
|
||||
|
@ -1162,7 +1162,7 @@ void SV_SaveLevelCache(const char *savedir, qboolean dontharmgame)
|
|||
{
|
||||
for (clnum=0; clnum < sv.allocated_client_slots; clnum++)
|
||||
{
|
||||
edict_t *ed = EDICT_NUM(svprogfuncs, clnum+1);
|
||||
edict_t *ed = EDICT_NUM_PB(svprogfuncs, clnum+1);
|
||||
ed->ereftype = ER_ENTITY;
|
||||
}
|
||||
}
|
||||
|
@ -1210,6 +1210,20 @@ void SV_Savegame (const char *savename, qboolean mapchange)
|
|||
return;
|
||||
}
|
||||
|
||||
switch(svs.gametype)
|
||||
{
|
||||
default:
|
||||
case GT_Q1QVM:
|
||||
#ifdef VM_LUA
|
||||
case GT_LUA:
|
||||
#endif
|
||||
Con_Printf("gamecode doesn't support saving\n");
|
||||
return;
|
||||
case GT_PROGS:
|
||||
case GT_QUAKE2:
|
||||
break;
|
||||
}
|
||||
|
||||
if (sv.allocated_client_slots == 1 && svs.gametype == GT_PROGS)
|
||||
{
|
||||
if (svs.clients->state > cs_connected && svs.clients[0].edict->v->health <= 0)
|
||||
|
@ -1444,9 +1458,6 @@ void SV_AutoSave(void)
|
|||
default: //probably broken. don't ever try.
|
||||
return;
|
||||
|
||||
#ifdef VM_LUA
|
||||
case GT_LUA:
|
||||
#endif
|
||||
case GT_Q1QVM:
|
||||
case GT_PROGS:
|
||||
//don't bother to autosave multiplayer games.
|
||||
|
|
|
@ -328,7 +328,7 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg, qbyte svcnumber)
|
|||
{
|
||||
if (!(client->pendingcsqcbits[entnum] & SENDFLAGS_REMOVED))
|
||||
{ //while the entity has NOREMOVE, only remove it if the remove is a resend
|
||||
if ((int)EDICT_NUM(svprogfuncs, en)->xv->pvsflags & PVSF_NOREMOVE)
|
||||
if ((int)EDICT_NUM_PB(svprogfuncs, en)->xv->pvsflags & PVSF_NOREMOVE)
|
||||
continue;
|
||||
}
|
||||
if (msg->cursize + 5 >= msg->maxsize)
|
||||
|
@ -451,7 +451,7 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg, qbyte svcnumber)
|
|||
{
|
||||
if (!(client->pendingcsqcbits[entnum] & SENDFLAGS_REMOVED))
|
||||
{ //while the entity has NOREMOVE, only remove it if the remove is a resend
|
||||
if ((int)EDICT_NUM(svprogfuncs, en)->xv->pvsflags & PVSF_NOREMOVE)
|
||||
if ((int)EDICT_NUM_PB(svprogfuncs, entnum)->xv->pvsflags & PVSF_NOREMOVE)
|
||||
continue;
|
||||
}
|
||||
if (msg->cursize + 5 >= msg->maxsize)
|
||||
|
@ -1387,7 +1387,7 @@ qboolean SVFTE_EmitPacketEntities(client_t *client, packet_entities_t *to, sizeb
|
|||
o = &client->sentents.entities[j];
|
||||
if (o->number)
|
||||
{
|
||||
e = EDICT_NUM(svprogfuncs, o->number);
|
||||
e = EDICT_NUM_PB(svprogfuncs, o->number);
|
||||
if (!((int)e->xv->pvsflags & PVSF_NOREMOVE))
|
||||
{
|
||||
client->pendingdeltabits[j] = UF_REMOVE;
|
||||
|
@ -1446,7 +1446,7 @@ qboolean SVFTE_EmitPacketEntities(client_t *client, packet_entities_t *to, sizeb
|
|||
o = &client->sentents.entities[j];
|
||||
if (o->number)
|
||||
{
|
||||
e = EDICT_NUM(svprogfuncs, o->number);
|
||||
e = EDICT_NUM_PB(svprogfuncs, o->number);
|
||||
if (!((int)e->xv->pvsflags & PVSF_NOREMOVE))
|
||||
{
|
||||
client->pendingdeltabits[j] = UF_REMOVE;
|
||||
|
@ -1527,14 +1527,14 @@ qboolean SVFTE_EmitPacketEntities(client_t *client, packet_entities_t *to, sizeb
|
|||
{
|
||||
/*if reset2, then this is the second packet sent to the client and should have a forced reset (but which isn't tracked)*/
|
||||
resend[outno].bits = bits & ~UF_RESET2;
|
||||
bits = UF_RESET | SVFTE_DeltaCalcBits(&EDICT_NUM(svprogfuncs, j)->baseline, NULL, &client->sentents.entities[j], client->sentents.bonedata);
|
||||
bits = UF_RESET | SVFTE_DeltaCalcBits(&EDICT_NUM_PB(svprogfuncs, j)->baseline, NULL, &client->sentents.entities[j], client->sentents.bonedata);
|
||||
// Con_Printf("RESET2 %i @ %i\n", j, sequence);
|
||||
}
|
||||
else if (bits & UF_RESET)
|
||||
{
|
||||
/*flag the entity for the next packet, so we always get two resets when it appears, to reduce the effects of packetloss on seeing rockets etc*/
|
||||
client->pendingdeltabits[j] = UF_RESET2;
|
||||
bits = UF_RESET | SVFTE_DeltaCalcBits(&EDICT_NUM(svprogfuncs, j)->baseline, NULL, &client->sentents.entities[j], client->sentents.bonedata);
|
||||
bits = UF_RESET | SVFTE_DeltaCalcBits(&EDICT_NUM_PB(svprogfuncs, j)->baseline, NULL, &client->sentents.entities[j], client->sentents.bonedata);
|
||||
resend[outno].bits = UF_RESET;
|
||||
// Con_Printf("RESET %i @ %i\n", j, sequence);
|
||||
}
|
||||
|
@ -1623,7 +1623,7 @@ void SVQW_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t
|
|||
if (newnum < oldnum)
|
||||
{ // this is a new entity, send it from the baseline
|
||||
if (svprogfuncs)
|
||||
ent = EDICT_NUM(svprogfuncs, newnum);
|
||||
ent = EDICT_NUM_UB(svprogfuncs, newnum);
|
||||
else
|
||||
ent = NULL;
|
||||
//Con_Printf ("baseline %i\n", newnum);
|
||||
|
@ -2593,7 +2593,7 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *
|
|||
ent = cl->edict;
|
||||
if (cl->viewent && ent == clent)
|
||||
{
|
||||
vent = EDICT_NUM(svprogfuncs, cl->viewent);
|
||||
vent = EDICT_NUM_UB(svprogfuncs, cl->viewent);
|
||||
if (!vent)
|
||||
vent = ent;
|
||||
}
|
||||
|
@ -2704,7 +2704,7 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *
|
|||
{
|
||||
if (client->spec_track > 0)
|
||||
{
|
||||
edict_t *s = EDICT_NUM(svprogfuncs, client->spec_track);
|
||||
edict_t *s = EDICT_NUM_UB(svprogfuncs, client->spec_track);
|
||||
|
||||
clst.spectator = 2;
|
||||
clst.mins = s->v->mins;
|
||||
|
@ -2766,7 +2766,7 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *
|
|||
#ifdef NQPROT
|
||||
void SVNQ_EmitEntityState(sizebuf_t *msg, entity_state_t *ent)
|
||||
{
|
||||
edict_t *ed = EDICT_NUM(svprogfuncs, ent->number);
|
||||
edict_t *ed = EDICT_NUM_PB(svprogfuncs, ent->number);
|
||||
entity_state_t *baseline = &ed->baseline;
|
||||
|
||||
int i, eff;
|
||||
|
@ -3536,7 +3536,7 @@ void SV_Snapshot_BuildQ1(client_t *client, packet_entities_t *pack, pvscamera_t
|
|||
|
||||
for ( ; e<limit ; e++)
|
||||
{
|
||||
ent = EDICT_NUM(svprogfuncs, e);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, e);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
|
||||
|
@ -3599,7 +3599,7 @@ void SV_Snapshot_BuildQ1(client_t *client, packet_entities_t *pack, pvscamera_t
|
|||
tracecullent = ent;
|
||||
while(tracecullent->xv->tag_entity&&c-->0)
|
||||
{
|
||||
tracecullent = EDICT_NUM(svprogfuncs, tracecullent->xv->tag_entity);
|
||||
tracecullent = EDICT_NUM_UB(svprogfuncs, tracecullent->xv->tag_entity);
|
||||
}
|
||||
if (tracecullent == clent)
|
||||
tracecullent = NULL;
|
||||
|
@ -3800,13 +3800,13 @@ void SV_Snapshot_SetupPVS(client_t *client, pvscamera_t *camera)
|
|||
for (; client; client = client->controlled)
|
||||
{
|
||||
if (client->viewent) //svc_viewentity hack
|
||||
SV_AddCameraEntity(camera, EDICT_NUM(svprogfuncs, client->viewent), client->edict->v->view_ofs);
|
||||
SV_AddCameraEntity(camera, EDICT_NUM_UB(svprogfuncs, client->viewent), client->edict->v->view_ofs);
|
||||
else
|
||||
SV_AddCameraEntity(camera, client->edict, client->edict->v->view_ofs);
|
||||
|
||||
//spectators should always see their targetted player
|
||||
if (client->spec_track)
|
||||
SV_AddCameraEntity(camera, EDICT_NUM(svprogfuncs, client->spec_track), client->edict->v->view_ofs);
|
||||
SV_AddCameraEntity(camera, EDICT_NUM_UB(svprogfuncs, client->spec_track), client->edict->v->view_ofs);
|
||||
|
||||
//view2 support should always see the extra entity
|
||||
if (client->edict->xv->view2)
|
||||
|
@ -4031,7 +4031,7 @@ void SV_ProcessSendFlags(client_t *c)
|
|||
return;
|
||||
for (e=1 ; e<sv.world.num_edicts && e < c->max_net_ents; e++)
|
||||
{
|
||||
ent = EDICT_NUM(svprogfuncs, e);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, e);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
if (ent->xv->SendFlags)
|
||||
|
@ -4052,7 +4052,7 @@ void SV_CleanupEnts(void)
|
|||
|
||||
for (e=1 ; e<=needcleanup ; e++)
|
||||
{
|
||||
ent = EDICT_NUM(svprogfuncs, e);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, e);
|
||||
ent->xv->SendFlags = 0;
|
||||
|
||||
#ifndef NOLEGACY
|
||||
|
|
|
@ -232,7 +232,7 @@ void SVQ1_CreateBaseline (void)
|
|||
|
||||
for (entnum = 0; entnum < sv.world.num_edicts ; entnum++)
|
||||
{
|
||||
svent = EDICT_NUM(svprogfuncs, entnum);
|
||||
svent = EDICT_NUM_PB(svprogfuncs, entnum);
|
||||
|
||||
memcpy(&svent->baseline, &nullentitystate, sizeof(entity_state_t));
|
||||
svent->baseline.number = entnum;
|
||||
|
@ -304,6 +304,7 @@ void SV_SpawnParmsToClient(client_t *client)
|
|||
void SV_SaveSpawnparmsClient(client_t *client, float *transferparms)
|
||||
{
|
||||
int j;
|
||||
eval_t *eval;
|
||||
SV_SpawnParmsToQC(client);
|
||||
|
||||
#ifdef VM_Q1
|
||||
|
@ -344,7 +345,8 @@ void SV_SaveSpawnparmsClient(client_t *client, float *transferparms)
|
|||
}
|
||||
|
||||
// call the progs to get default spawn parms for the new client
|
||||
if (PR_FindGlobal(svprogfuncs, "ClientReEnter", 0, NULL))
|
||||
eval = PR_FindGlobal(svprogfuncs, "ClientReEnter", 0, NULL);
|
||||
if (eval && eval->function)
|
||||
{//oooh, evil.
|
||||
char buffer[65536*4];
|
||||
size_t bufsize = 0;
|
||||
|
@ -1280,7 +1282,7 @@ void SV_SpawnServer (const char *server, const char *startspot, qboolean noents,
|
|||
#endif
|
||||
case GT_Q1QVM:
|
||||
case GT_PROGS:
|
||||
ent = EDICT_NUM(svprogfuncs, 0);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, 0);
|
||||
ent->ereftype = ER_ENTITY;
|
||||
|
||||
#ifndef SERVERONLY
|
||||
|
@ -1386,7 +1388,7 @@ void SV_SpawnServer (const char *server, const char *startspot, qboolean noents,
|
|||
{
|
||||
//world entity is hackily spawned
|
||||
extern cvar_t coop, pr_imitatemvdsv;
|
||||
ent = EDICT_NUM(svprogfuncs, 0);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, 0);
|
||||
ent->ereftype = ER_ENTITY;
|
||||
#ifdef VM_Q1
|
||||
if (svs.gametype != GT_Q1QVM) //we cannot do this with qvm
|
||||
|
@ -1518,7 +1520,7 @@ void SV_SpawnServer (const char *server, const char *startspot, qboolean noents,
|
|||
if (svprogfuncs)
|
||||
{
|
||||
eval_t *val;
|
||||
ent = EDICT_NUM(svprogfuncs, 0);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, 0);
|
||||
ent->v->angles[0] = ent->v->angles[1] = ent->v->angles[2] = 0;
|
||||
if ((val = svprogfuncs->GetEdictFieldValue(svprogfuncs, ent, "message", ev_string, NULL)))
|
||||
snprintf(sv.mapname, sizeof(sv.mapname), "%s", PR_GetString(svprogfuncs, val->string));
|
||||
|
@ -1614,7 +1616,8 @@ void SV_SpawnServer (const char *server, const char *startspot, qboolean noents,
|
|||
{
|
||||
eval_t *eval;
|
||||
eval = PR_FindGlobal(svprogfuncs, "startspot", 0, NULL);
|
||||
if (eval) eval->string = PR_NewString(svprogfuncs, startspot);
|
||||
if (eval && svs.gametype != GT_Q1QVM) //we cannot do this with qvm
|
||||
svprogfuncs->SetStringField(svprogfuncs, NULL, &eval->string, startspot, false);
|
||||
}
|
||||
|
||||
if (Cmd_AliasExist("f_svnewmap", RESTRICT_LOCAL))
|
||||
|
@ -1633,7 +1636,7 @@ void SV_SpawnServer (const char *server, const char *startspot, qboolean noents,
|
|||
//fixme: go off bsp extents instead?
|
||||
for(i = 1; i < sv.world.num_edicts; i++)
|
||||
{
|
||||
ent = EDICT_NUM(svprogfuncs, i);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, i);
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
ne = fabs(ent->v->origin[j]);
|
||||
|
|
|
@ -2242,7 +2242,7 @@ client_t *SV_AddSplit(client_t *controller, char *info, int id)
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
cl->edict = EDICT_NUM(svprogfuncs, i+1);
|
||||
cl->edict = EDICT_NUM_PB(svprogfuncs, i+1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3006,7 +3006,7 @@ client_t *SVC_DirectConnect(void)
|
|||
}
|
||||
|
||||
if (svprogfuncs)
|
||||
ent = EDICT_NUM(svprogfuncs, edictnum);
|
||||
ent = EDICT_NUM_UB(svprogfuncs, edictnum);
|
||||
else
|
||||
ent = NULL;
|
||||
#ifdef Q2SERVER
|
||||
|
|
|
@ -701,7 +701,7 @@ static qboolean WPhys_PushAngles (world_t *w, wedict_t *pusher, vec3_t move, vec
|
|||
if (pusher->v->movetype != MOVETYPE_H2PUSHPULL)
|
||||
for (e = 1; e < w->num_edicts; e++)
|
||||
{
|
||||
check = WEDICT_NUM(w->progs, e);
|
||||
check = WEDICT_NUM_PB(w->progs, e);
|
||||
if (ED_ISFREE(check))
|
||||
continue;
|
||||
|
||||
|
@ -902,7 +902,7 @@ qboolean WPhys_Push (world_t *w, wedict_t *pusher, vec3_t move, vec3_t amove)
|
|||
num_moved = 0;
|
||||
for (e=1 ; e<w->num_edicts ; e++)
|
||||
{
|
||||
check = WEDICT_NUM(w->progs, e);
|
||||
check = WEDICT_NUM_PB(w->progs, e);
|
||||
if (ED_ISFREE(check))
|
||||
continue;
|
||||
if (check->v->movetype == MOVETYPE_PUSH
|
||||
|
@ -2368,7 +2368,7 @@ void World_Physics_Frame(world_t *w)
|
|||
/*physics mode 1 = thinks only*/
|
||||
for (i=0 ; i<w->num_edicts ; i++)
|
||||
{
|
||||
ent = (wedict_t*)EDICT_NUM(w->progs, i);
|
||||
ent = (wedict_t*)EDICT_NUM_PB(w->progs, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
|
||||
|
@ -2386,7 +2386,7 @@ void World_Physics_Frame(world_t *w)
|
|||
//
|
||||
for (i=0 ; i<w->num_edicts ; i++)
|
||||
{
|
||||
ent = (wedict_t*)EDICT_NUM(w->progs, i);
|
||||
ent = (wedict_t*)EDICT_NUM_PB(w->progs, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1710,7 +1710,7 @@ void SV_WriteEntityDataToMessage (client_t *client, sizebuf_t *msg, int pnum)
|
|||
// a fixangle might get lost in a dropped packet. Oh well.
|
||||
if (client->spectator && ISNQCLIENT(client) && client->spec_track > 0)
|
||||
{
|
||||
edict_t *ed = EDICT_NUM(svprogfuncs, client->spec_track);
|
||||
edict_t *ed = EDICT_NUM_UB(svprogfuncs, client->spec_track);
|
||||
MSG_WriteByte(msg, svc_setangle);
|
||||
MSG_WriteAngle(msg, ed->v->v_angle[0]);
|
||||
MSG_WriteAngle(msg, ed->v->v_angle[1]);
|
||||
|
@ -1841,7 +1841,7 @@ void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg)
|
|||
#ifdef NQPROT
|
||||
ent = client->edict;
|
||||
if (client->spectator && client->spec_track)
|
||||
ent = EDICT_NUM(svprogfuncs, client->spec_track);
|
||||
ent = EDICT_NUM_UB(svprogfuncs, client->spec_track);
|
||||
if (progstype != PROG_QW)
|
||||
{
|
||||
if (ISQWCLIENT(client) && !(client->fteprotocolextensions2 & PEXT2_PREDINFO))
|
||||
|
@ -2250,7 +2250,7 @@ void SV_CalcClientStats(client_t *client, int statsi[MAX_CL_STATS], float statsf
|
|||
// if we are a spectator and we are tracking a player, we get his stats
|
||||
// so our status bar reflects his
|
||||
if (client->spectator && client->spec_track > 0)
|
||||
ent = EDICT_NUM(svprogfuncs, client->spec_track);
|
||||
ent = EDICT_NUM_UB(svprogfuncs, client->spec_track);
|
||||
|
||||
#ifdef HLSERVER
|
||||
if (svs.gametype == GT_HALFLIFE)
|
||||
|
|
|
@ -1536,7 +1536,7 @@ void SV_SendClientPrespawnInfo(client_t *client)
|
|||
break;
|
||||
}
|
||||
|
||||
ent = EDICT_NUM(svprogfuncs, client->prespawn_idx);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, client->prespawn_idx);
|
||||
|
||||
if (!ent)
|
||||
state = &nullentitystate;
|
||||
|
@ -1918,7 +1918,7 @@ void SV_SpawnSpectator (void)
|
|||
|
||||
for (i=svs.allocated_client_slots+1 ; i<sv.world.num_edicts ; i++)
|
||||
{
|
||||
e = EDICT_NUM(svprogfuncs, i);
|
||||
e = EDICT_NUM_PB(svprogfuncs, i);
|
||||
if (!strcmp(PR_GetString(svprogfuncs, e->v->classname), "info_player_start"))
|
||||
{
|
||||
VectorCopy (e->v->origin, sv_player->v->origin);
|
||||
|
@ -2000,7 +2000,7 @@ void SV_Begin_Core(client_t *split)
|
|||
{
|
||||
//keep the spectator tracking the player from the previous map
|
||||
if (split->spec_track > 0)
|
||||
split->edict->v->goalentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM(svprogfuncs, split->spec_track));
|
||||
split->edict->v->goalentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM_UB(svprogfuncs, split->spec_track));
|
||||
else
|
||||
split->edict->v->goalentity = 0;
|
||||
|
||||
|
@ -4144,8 +4144,8 @@ void SV_PTrack_f (void)
|
|||
{
|
||||
// turn off tracking
|
||||
host_client->spec_track = 0;
|
||||
ent = EDICT_NUM(svprogfuncs, host_client - svs.clients + 1);
|
||||
tent = EDICT_NUM(svprogfuncs, 0);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, host_client - svs.clients + 1);
|
||||
tent = EDICT_NUM_PB(svprogfuncs, 0);
|
||||
ent->v->goalentity = EDICT_TO_PROG(svprogfuncs, tent);
|
||||
|
||||
if (ISNQCLIENT(host_client))
|
||||
|
@ -4169,8 +4169,8 @@ void SV_PTrack_f (void)
|
|||
{
|
||||
SV_ClientTPrintf (host_client, PRINT_HIGH, "invalid player to track\n");
|
||||
host_client->spec_track = 0;
|
||||
ent = EDICT_NUM(svprogfuncs, host_client - svs.clients + 1);
|
||||
tent = EDICT_NUM(svprogfuncs, 0);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, host_client - svs.clients + 1);
|
||||
tent = EDICT_NUM_PB(svprogfuncs, 0);
|
||||
ent->v->goalentity = EDICT_TO_PROG(svprogfuncs, tent);
|
||||
|
||||
if (ISNQCLIENT(host_client))
|
||||
|
@ -4182,8 +4182,8 @@ void SV_PTrack_f (void)
|
|||
}
|
||||
host_client->spec_track = i + 1; // now tracking
|
||||
|
||||
ent = EDICT_NUM(svprogfuncs, host_client - svs.clients + 1);
|
||||
tent = EDICT_NUM(svprogfuncs, i + 1);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, host_client - svs.clients + 1);
|
||||
tent = EDICT_NUM_PB(svprogfuncs, i + 1);
|
||||
ent->v->goalentity = EDICT_TO_PROG(svprogfuncs, tent);
|
||||
|
||||
if (ISNQCLIENT(host_client))
|
||||
|
@ -7223,7 +7223,7 @@ if (sv_player->v->health > 0 && before && !after )
|
|||
if (pmove.onground)
|
||||
{
|
||||
sv_player->v->flags = (int)sv_player->v->flags | FL_ONGROUND;
|
||||
sv_player->v->groundentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM(svprogfuncs, pmove.physents[pmove.groundent].info));
|
||||
sv_player->v->groundentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM_PB(svprogfuncs, pmove.physents[pmove.groundent].info));
|
||||
}
|
||||
else
|
||||
sv_player->v->flags = (int)sv_player->v->flags & ~FL_ONGROUND;
|
||||
|
@ -7305,7 +7305,7 @@ if (sv_player->v->health > 0 && before && !after )
|
|||
float vel;
|
||||
vec3_t dir;
|
||||
vec3_t svel;
|
||||
ent = EDICT_NUM(svprogfuncs, n);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, n);
|
||||
VectorSubtract(ent->v->origin, sv_player->v->origin, dir);
|
||||
VectorNormalize(dir);
|
||||
VectorCopy(sv_player->v->velocity, svel);
|
||||
|
@ -7319,7 +7319,7 @@ if (sv_player->v->health > 0 && before && !after )
|
|||
if (pmove.physents[pmove.touchindex[i]].notouch)
|
||||
continue;
|
||||
n = pmove.physents[pmove.touchindex[i]].info;
|
||||
ent = EDICT_NUM(svprogfuncs, n);
|
||||
ent = EDICT_NUM_PB(svprogfuncs, n);
|
||||
|
||||
if (n >= playertouchmax || playertouch[n>>3]&(1<<(n&7)))
|
||||
continue;
|
||||
|
@ -7437,7 +7437,7 @@ void SV_ReadPrydonCursor(void)
|
|||
}
|
||||
// as requested by FrikaC, cursor_trace_ent is reset to world if the
|
||||
// entity is free at time of receipt
|
||||
if (!svprogfuncs || ED_ISFREE(EDICT_NUM(svprogfuncs, entnum)))
|
||||
if (!svprogfuncs || ED_ISFREE(EDICT_NUM_UB(svprogfuncs, entnum)))
|
||||
entnum = 0;
|
||||
if (msg_badread) Con_Printf("SV_ReadPrydonCursor: badread at %s:%i\n", __FILE__, __LINE__);
|
||||
|
||||
|
@ -7512,7 +7512,7 @@ void SV_ReadQCRequest(void)
|
|||
e = MSGSV_ReadEntity(host_client);
|
||||
if (e < 0 || e >= sv.world.num_edicts)
|
||||
e = 0;
|
||||
G_INT(OFS_PARM0+i*3) = EDICT_TO_PROG(svprogfuncs, EDICT_NUM(svprogfuncs, e));
|
||||
G_INT(OFS_PARM0+i*3) = EDICT_TO_PROG(svprogfuncs, EDICT_NUM_PB(svprogfuncs, e));
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
@ -8164,7 +8164,7 @@ void SVNQ_ReadClientMove (usercmd_t *move, qboolean forceangle16)
|
|||
if (host_client->spec_track)
|
||||
{ //disable tracking
|
||||
host_client->spec_track = 0;
|
||||
host_client->edict->v->goalentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM(svprogfuncs, 0));
|
||||
host_client->edict->v->goalentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM_PB(svprogfuncs, 0));
|
||||
ClientReliableWrite_Begin(host_client, svc_setview, 4);
|
||||
ClientReliableWrite_Entity(host_client, host_client - svs.clients + 1);
|
||||
}
|
||||
|
@ -8194,7 +8194,7 @@ void SVNQ_ReadClientMove (usercmd_t *move, qboolean forceangle16)
|
|||
}
|
||||
|
||||
host_client->spec_track = i;
|
||||
host_client->edict->v->goalentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM(svprogfuncs, i));
|
||||
host_client->edict->v->goalentity = EDICT_TO_PROG(svprogfuncs, EDICT_NUM_PB(svprogfuncs, i));
|
||||
ClientReliableWrite_Begin(host_client, svc_setview, 4);
|
||||
ClientReliableWrite_Entity(host_client, i?i:(host_client - svs.clients + 1));
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ void World_ClearWorld_Nodes (world_t *w, qboolean relink)
|
|||
{
|
||||
for (i=0 ; i<w->num_edicts ; i++)
|
||||
{
|
||||
ent = WEDICT_NUM(w->progs, i);
|
||||
ent = WEDICT_NUM_PB(w->progs, i);
|
||||
if (!ent)
|
||||
continue;
|
||||
ent->area.prev = ent->area.next = NULL;
|
||||
|
@ -369,7 +369,7 @@ static void World_ClearWorld_AreaGrid (world_t *w, qboolean relink)
|
|||
{
|
||||
for (i=0 ; i<w->num_edicts ; i++)
|
||||
{
|
||||
ent = WEDICT_NUM(w->progs, i);
|
||||
ent = WEDICT_NUM_PB(w->progs, i);
|
||||
if (!ent)
|
||||
continue;
|
||||
for (j = 0; j < countof(ent->gridareas); j++)
|
||||
|
@ -1802,7 +1802,7 @@ static void World_ClipToEverything (world_t *w, moveclip_t *clip)
|
|||
wedict_t *touch;
|
||||
for (e=1 ; e<w->num_edicts ; e++)
|
||||
{
|
||||
touch = (wedict_t*)EDICT_NUM(w->progs, e);
|
||||
touch = (wedict_t*)EDICT_NUM_PB(w->progs, e);
|
||||
|
||||
if (ED_ISFREE(touch))
|
||||
continue;
|
||||
|
@ -2414,7 +2414,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
|
||||
if (type & MOVE_OTHERONLY)
|
||||
{
|
||||
wedict_t *other = WEDICT_NUM(w->progs, *w->g.other);
|
||||
wedict_t *other = WEDICT_NUM_UB(w->progs, *w->g.other);
|
||||
return World_ClipMoveToEntity (w, other, other->v->origin, start, mins, maxs, end, hullnum, type & MOVE_HITMODEL, clip.capsule, clip.hitcontentsmask);
|
||||
}
|
||||
|
||||
|
@ -2502,7 +2502,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
if (clip.trace.allsolid)
|
||||
break;
|
||||
|
||||
touch = (wedict_t*)EDICT_NUM(w->progs, i+1);
|
||||
touch = (wedict_t*)EDICT_NUM_PB(w->progs, i+1);
|
||||
if (touch->v->solid == SOLID_NOT)
|
||||
continue;
|
||||
if (touch == clip.passedict)
|
||||
|
@ -2647,7 +2647,7 @@ void World_RBE_Shutdown(world_t *world)
|
|||
{
|
||||
for (u = 0; u < world->num_edicts; u++)
|
||||
{
|
||||
ed = WEDICT_NUM(world->progs, u);
|
||||
ed = WEDICT_NUM_PB(world->progs, u);
|
||||
world->rbe->RemoveJointFromEntity(world, ed);
|
||||
world->rbe->RemoveFromEntity(world, ed);
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ static qboolean QDECL S_LoadAVSound (sfx_t *s, qbyte *data, size_t datalen, int
|
|||
const int iBufSize = 4 * 1024;
|
||||
|
||||
if (!ffmpeg_audiodecoder)
|
||||
ffmpeg_audiodecoder = pCvar_GetNVFDG("ffmpeg_audiodecoder_wip", "0", 0, "Enables the use of ffmpeg's decoder for pure audio files.", "ffmpeg");
|
||||
return false;
|
||||
if (!ffmpeg_audiodecoder->value /* && *ffmpeg_audiodecoder.string */)
|
||||
return false;
|
||||
|
||||
|
@ -358,6 +358,8 @@ static qboolean AVAudio_Init(void)
|
|||
{
|
||||
if (!pPlug_ExportNative("S_LoadSound", S_LoadAVSound))
|
||||
{
|
||||
ffmpeg_audiodecoder = pCvar_GetNVFDG("ffmpeg_audiodecoder_wip", "0", 0, "Enables the use of ffmpeg's decoder for pure audio files.", "ffmpeg");
|
||||
|
||||
Con_Printf("avplug: Engine doesn't support audio decoder plugins\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1572,14 +1572,14 @@ static void QDECL World_Bullet_Frame(world_t *world, double frametime, double gr
|
|||
// copy physics properties from entities to physics engine
|
||||
for (i = 0;i < world->num_edicts;i++)
|
||||
{
|
||||
ed = (wedict_t*)EDICT_NUM(world->progs, i);
|
||||
ed = (wedict_t*)EDICT_NUM_PB(world->progs, i);
|
||||
if (!ED_ISFREE(ed))
|
||||
World_Bullet_Frame_BodyFromEntity(world, ed);
|
||||
}
|
||||
// oh, and it must be called after all bodies were created
|
||||
for (i = 0;i < world->num_edicts;i++)
|
||||
{
|
||||
ed = (wedict_t*)EDICT_NUM(world->progs, i);
|
||||
ed = (wedict_t*)EDICT_NUM_PB(world->progs, i);
|
||||
if (!ED_ISFREE(ed))
|
||||
World_Bullet_Frame_JointFromEntity(world, ed);
|
||||
}
|
||||
|
@ -1620,7 +1620,7 @@ static void QDECL World_Bullet_Frame(world_t *world, double frametime, double gr
|
|||
// copy physics properties from physics engine to entities
|
||||
for (i = 1;i < world->num_edicts;i++)
|
||||
{
|
||||
ed = (wedict_t*)EDICT_NUM(world->progs, i);
|
||||
ed = (wedict_t*)EDICT_NUM_PB(world->progs, i);
|
||||
if (!ED_ISFREE(ed))
|
||||
World_Bullet_Frame_BodyToEntity(world, ed);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue