From fe0d5dc2d85167fb8042bcb5157e93728e74e53a Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 18 Feb 2007 12:41:11 +0000 Subject: [PATCH] a cosmetic change as suggested by div0: renamed PRVM_GETEDICTFIELDVALUE to PRVM_EDICTFIELDVALUE renamed PRVM_GETGLOBALFIELDVALUE to PRVM_GLOBALFIELDVALUE git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6851 d7cf8633-e32d-0410-b094-e92efae38249 --- clvm_cmds.c | 22 ++++++++-------- csprogs.c | 16 +++++------ host_cmd.c | 22 ++++++++-------- progs.h | 2 +- progsvm.h | 4 +-- protocol.c | 12 ++++----- prvm_cmds.c | 28 ++++++++++---------- prvm_edict.c | 6 ++--- prvm_exec.c | 4 +-- prvm_execprogram.h | 8 +++--- sv_main.c | 66 +++++++++++++++++++++++----------------------- sv_phys.c | 32 +++++++++++----------- sv_user.c | 48 ++++++++++++++++----------------- svvm_cmds.c | 38 +++++++++++++------------- 14 files changed, 154 insertions(+), 154 deletions(-) diff --git a/clvm_cmds.c b/clvm_cmds.c index d6b17ff8..b0effc63 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1761,11 +1761,11 @@ void VM_CL_setattachment (void) if (tagentity == NULL) tagentity = prog->edicts; - v = PRVM_GETEDICTFIELDVALUE(e, prog->fieldoffsets.tag_entity); + v = PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.tag_entity); if (v) v->edict = PRVM_EDICT_TO_PROG(tagentity); - v = PRVM_GETEDICTFIELDVALUE(e, prog->fieldoffsets.tag_index); + v = PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.tag_index); if (v) v->_float = 0; if (tagentity != NULL && tagentity != prog->edicts && tagname && tagname[0]) @@ -1840,13 +1840,13 @@ int CL_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex) else tagmatrix = identitymatrix; - if ((val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)) && val->edict) + if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)) && val->edict) { // DP_GFX_QUAKE3MODELTAGS, scan all chain and stop on unattached entity attachloop = 0; do { attachent = PRVM_EDICT_NUM(val->edict); // to this it entity our entity is attached - val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.tag_index); + val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_index); model = CSQC_GetModelFromEntity(attachent); @@ -1856,7 +1856,7 @@ int CL_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex) attachmatrix = identitymatrix; // apply transformation by child entity matrix - val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.scale); + val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.scale); if (val->_float == 0) val->_float = 1; Matrix4x4_CreateFromQuakeEntity(&entitymatrix, ent->fields.client->origin[0], ent->fields.client->origin[1], ent->fields.client->origin[2], -ent->fields.client->angles[0], ent->fields.client->angles[1], ent->fields.client->angles[2], val->_float); @@ -1872,22 +1872,22 @@ int CL_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex) if (attachloop > 255) // prevent runaway looping return 5; } - while ((val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)) && val->edict); + while ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)) && val->edict); } // normal or RENDER_VIEWMODEL entity (or main parent entity on attach chain) - val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.scale); + val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.scale); if (val->_float == 0) val->_float = 1; // Alias models have inverse pitch, bmodels can't have tags, so don't check for modeltype... Matrix4x4_CreateFromQuakeEntity(&entitymatrix, ent->fields.client->origin[0], ent->fields.client->origin[1], ent->fields.client->origin[2], -ent->fields.client->angles[0], ent->fields.client->angles[1], ent->fields.client->angles[2], val->_float); Matrix4x4_Concat(out, &entitymatrix, &tagmatrix); - if ((val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.renderflags)) && (RF_VIEWMODEL & (int)val->_float)) + if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.renderflags)) && (RF_VIEWMODEL & (int)val->_float)) {// RENDER_VIEWMODEL magic Matrix4x4_Copy(&tagmatrix, out); - val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.scale); + val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.scale); if (val->_float == 0) val->_float = 1; @@ -2029,7 +2029,7 @@ void VM_CL_select_cube (void) continue; if (maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2]) continue; - PRVM_GETEDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_NUM_FOR_EDICT(chain); + PRVM_EDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_NUM_FOR_EDICT(chain); chain = ent; } @@ -2067,7 +2067,7 @@ void VM_CL_select_super (void) continue; if (maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2]) continue; - PRVM_GETEDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_NUM_FOR_EDICT(chain); + PRVM_EDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_NUM_FOR_EDICT(chain); chain = ent; } diff --git a/csprogs.c b/csprogs.c index 5e15eeb5..a9f78d5e 100644 --- a/csprogs.c +++ b/csprogs.c @@ -157,21 +157,21 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed) // FIXME: renderflags should be in the cl_entvars_t #if 1 renderflags = 0; - if((val = PRVM_GETEDICTFIELDVALUE(ed, prog->fieldoffsets.renderflags)) && val->_float) renderflags = (int)val->_float; + if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.renderflags)) && val->_float) renderflags = (int)val->_float; #else renderflags = (int)ed->fields.client->renderflags; #endif - if((val = PRVM_GETEDICTFIELDVALUE(ed, prog->fieldoffsets.alpha)) && val->_float) e->render.alpha = val->_float; - if((val = PRVM_GETEDICTFIELDVALUE(ed, prog->fieldoffsets.scale)) && val->_float) e->render.scale = scale = val->_float; - if((val = PRVM_GETEDICTFIELDVALUE(ed, prog->fieldoffsets.colormod)) && VectorLength2(val->vector)) VectorCopy(val->vector, e->render.colormod); - if((val = PRVM_GETEDICTFIELDVALUE(ed, prog->fieldoffsets.effects)) && val->_float) e->render.effects = (int)val->_float; - if((val = PRVM_GETEDICTFIELDVALUE(ed, prog->fieldoffsets.tag_entity)) && val->edict) + if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.alpha)) && val->_float) e->render.alpha = val->_float; + if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.scale)) && val->_float) e->render.scale = scale = val->_float; + if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.colormod)) && VectorLength2(val->vector)) VectorCopy(val->vector, e->render.colormod); + if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.effects)) && val->_float) e->render.effects = (int)val->_float; + if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.tag_entity)) && val->edict) { int tagentity; int tagindex = 0; tagentity = val->edict; - if((val = PRVM_GETEDICTFIELDVALUE(ed, prog->fieldoffsets.tag_index)) && val->_float) + if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.tag_index)) && val->_float) tagindex = (int)val->_float; // FIXME: calculate tag matrix Matrix4x4_CreateIdentity(&tagmatrix); @@ -208,7 +208,7 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed) CL_UpdateRenderEntity(&e->render); i = 0; - if((val = PRVM_GETEDICTFIELDVALUE(ed, prog->fieldoffsets.renderflags)) && val->_float) + if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.renderflags)) && val->_float) { i = (int)val->_float; if(i & RF_VIEWMODEL) e->render.flags |= RENDER_VIEWMODEL; diff --git a/host_cmd.c b/host_cmd.c index a4529feb..88e6354c 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -854,7 +854,7 @@ void Host_Playermodel_f (void) // point the string back at updateclient->name to keep it safe strlcpy (host_client->playermodel, newPath, sizeof (host_client->playermodel)); if( prog->fieldoffsets.playermodel >= 0 ) - PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playermodel)->string = PRVM_SetEngineString(host_client->playermodel); + PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playermodel)->string = PRVM_SetEngineString(host_client->playermodel); if (strcmp(host_client->old_model, host_client->playermodel)) { strlcpy(host_client->old_model, host_client->playermodel, sizeof(host_client->old_model)); @@ -912,7 +912,7 @@ void Host_Playerskin_f (void) // point the string back at updateclient->name to keep it safe strlcpy (host_client->playerskin, newPath, sizeof (host_client->playerskin)); if( prog->fieldoffsets.playerskin >= 0 ) - PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playerskin)->string = PRVM_SetEngineString(host_client->playerskin); + PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playerskin)->string = PRVM_SetEngineString(host_client->playerskin); if (strcmp(host_client->old_skin, host_client->playerskin)) { //if (host_client->spawned) @@ -1193,7 +1193,7 @@ void Host_Color(int changetop, int changebottom) prvm_eval_t *val; if (host_client->edict) { - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.clientcolors))) + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.clientcolors))) val->_float = playercolor; host_client->edict->fields.server->team = bottom + 1; } @@ -1346,7 +1346,7 @@ static void Host_PModel_f (void) return; } - if (host_client->edict && (val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.pmodel))) + if (host_client->edict && (val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.pmodel))) val->_float = i; } @@ -1674,7 +1674,7 @@ void Host_Give_f (void) break; case 's': - if (gamemode == GAME_ROGUE && (val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_shells1))) + if (gamemode == GAME_ROGUE && (val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_shells1))) val->_float = v; host_client->edict->fields.server->ammo_shells = v; @@ -1682,7 +1682,7 @@ void Host_Give_f (void) case 'n': if (gamemode == GAME_ROGUE) { - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_nails1))) + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_nails1))) { val->_float = v; if (host_client->edict->fields.server->weapon <= IT_LIGHTNING) @@ -1697,7 +1697,7 @@ void Host_Give_f (void) case 'l': if (gamemode == GAME_ROGUE) { - val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_lava_nails); + val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_lava_nails); if (val) { val->_float = v; @@ -1709,7 +1709,7 @@ void Host_Give_f (void) case 'r': if (gamemode == GAME_ROGUE) { - val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_rockets1); + val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_rockets1); if (val) { val->_float = v; @@ -1725,7 +1725,7 @@ void Host_Give_f (void) case 'm': if (gamemode == GAME_ROGUE) { - val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_multi_rockets); + val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_multi_rockets); if (val) { val->_float = v; @@ -1740,7 +1740,7 @@ void Host_Give_f (void) case 'c': if (gamemode == GAME_ROGUE) { - val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_cells1); + val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_cells1); if (val) { val->_float = v; @@ -1756,7 +1756,7 @@ void Host_Give_f (void) case 'p': if (gamemode == GAME_ROGUE) { - val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_plasma); + val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ammo_plasma); if (val) { val->_float = v; diff --git a/progs.h b/progs.h index 1ef4f55d..2cacafbe 100644 --- a/progs.h +++ b/progs.h @@ -137,7 +137,7 @@ typedef struct edict_s } prvm_edict_t; -#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((unsigned char *)ed->v + fieldoffset) : NULL) +#define PRVM_EDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((unsigned char *)ed->v + fieldoffset) : NULL) //============================================================================ diff --git a/progsvm.h b/progsvm.h index a059b0c5..17f93f2d 100644 --- a/progsvm.h +++ b/progsvm.h @@ -103,8 +103,8 @@ typedef struct prvm_edict_s } fields; } prvm_edict_t; -#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset >= 0 ? (prvm_eval_t *)((unsigned char *)ed->fields.vp + fieldoffset) : NULL) -#define PRVM_GETGLOBALFIELDVALUE(fieldoffset) (fieldoffset >= 0 ? (prvm_eval_t *)((unsigned char *)prog->globals.generic + fieldoffset) : NULL) +#define PRVM_EDICTFIELDVALUE(ed, fieldoffset) (fieldoffset >= 0 ? (prvm_eval_t *)((unsigned char *)ed->fields.vp + fieldoffset) : NULL) +#define PRVM_GLOBALFIELDVALUE(fieldoffset) (fieldoffset >= 0 ? (prvm_eval_t *)((unsigned char *)prog->globals.generic + fieldoffset) : NULL) //============================================================================ #define PRVM_OP_STATE 1 diff --git a/protocol.c b/protocol.c index 5ceeed35..cfa837bf 100644 --- a/protocol.c +++ b/protocol.c @@ -323,10 +323,10 @@ void EntityFrameCSQC_WriteFrame (sizebuf_t *msg, int numstates, const entity_sta // if(!s->active) // continue; - val = PRVM_GETEDICTFIELDVALUE((&prog->edicts[s->number]), prog->fieldoffsets.SendEntity); + val = PRVM_EDICTFIELDVALUE((&prog->edicts[s->number]), prog->fieldoffsets.SendEntity); if(val->function) { - val2 = PRVM_GETEDICTFIELDVALUE((&prog->edicts[s->number]), prog->fieldoffsets.Version); + val2 = PRVM_EDICTFIELDVALUE((&prog->edicts[s->number]), prog->fieldoffsets.Version); if(sv2csqcents_version[csqc_clent][s->number] == (unsigned char)val2->_float) continue; if(!csqcents) @@ -391,7 +391,7 @@ void EntityFrameQuake_WriteFrame(sizebuf_t *msg, int numstates, const entity_sta for (i = 0, s = states;i < numstates;i++, s++) { - val = PRVM_GETEDICTFIELDVALUE((&prog->edicts[s->number]), prog->fieldoffsets.SendEntity); + val = PRVM_EDICTFIELDVALUE((&prog->edicts[s->number]), prog->fieldoffsets.SendEntity); if(val && val->function) continue; @@ -1048,7 +1048,7 @@ void EntityFrame_WriteFrame(sizebuf_t *msg, entityframe_database_t *d, int numst ent = states + i; number = ent->number; - val = PRVM_GETEDICTFIELDVALUE((&prog->edicts[number]), prog->fieldoffsets.SendEntity); + val = PRVM_EDICTFIELDVALUE((&prog->edicts[number]), prog->fieldoffsets.SendEntity); if(val && val->function) continue; for (;onum < o->numentities && o->entitydata[onum].number < number;onum++) @@ -1537,7 +1537,7 @@ void EntityFrame4_WriteFrame(sizebuf_t *msg, entityframe4_database_t *d, int num d->currententitynumber = 1; for (i = 0, n = startnumber;n < prog->max_edicts;n++) { - val = PRVM_GETEDICTFIELDVALUE((&prog->edicts[n]), prog->fieldoffsets.SendEntity); + val = PRVM_EDICTFIELDVALUE((&prog->edicts[n]), prog->fieldoffsets.SendEntity); if(val && val->function) continue; // find the old state to delta from @@ -1691,7 +1691,7 @@ void EntityState5_WriteUpdate(int number, const entity_state_t *s, int changedbi unsigned int bits = 0; prvm_eval_t *val; - val = PRVM_GETEDICTFIELDVALUE((&prog->edicts[s->number]), prog->fieldoffsets.SendEntity); + val = PRVM_EDICTFIELDVALUE((&prog->edicts[s->number]), prog->fieldoffsets.SendEntity); if(val && val->function) return; diff --git a/prvm_cmds.c b/prvm_cmds.c index 8ba51a3b..47e94fe6 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -114,7 +114,7 @@ void VM_error (void) Con_Printf("======%s ERROR in %s:\n%s\n", PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string); if (prog->globaloffsets.self >= 0) { - ed = PRVM_PROG_TO_EDICT(PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.self)->edict); + ed = PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict); PRVM_ED_Print(ed); } @@ -140,7 +140,7 @@ void VM_objerror (void) Con_Printf("======OBJECT ERROR======\n"); // , PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string); // or include them? FIXME if (prog->globaloffsets.self >= 0) { - ed = PRVM_PROG_TO_EDICT(PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.self)->edict); + ed = PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict); PRVM_ED_Print(ed); PRVM_ED_Free (ed); @@ -889,7 +889,7 @@ void VM_findchain (void) if (strcmp(t,s)) continue; - PRVM_GETEDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_NUM_FOR_EDICT(chain); + PRVM_EDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_NUM_FOR_EDICT(chain); chain = ent; } @@ -932,7 +932,7 @@ void VM_findchainfloat (void) if (PRVM_E_FLOAT(ent,f) != s) continue; - PRVM_GETEDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_EDICT_TO_PROG(chain); + PRVM_EDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_EDICT_TO_PROG(chain); chain = ent; } @@ -1015,7 +1015,7 @@ void VM_findchainflags (void) if (!((int)PRVM_E_FLOAT(ent,f) & s)) continue; - PRVM_GETEDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_EDICT_TO_PROG(chain); + PRVM_EDICTFIELDVALUE(ent,prog->fieldoffsets.chain)->edict = PRVM_EDICT_TO_PROG(chain); chain = ent; } @@ -3916,7 +3916,7 @@ void VM_changeyaw (void) prvm_edict_t *ent; float ideal, current, move, speed; - ent = PRVM_PROG_TO_EDICT(PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.self)->edict); + ent = PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict); if (ent == prog->edicts) { VM_Warning("changeyaw: can not modify world entity\n"); @@ -3932,9 +3932,9 @@ void VM_changeyaw (void) VM_Warning("changeyaw: angles, ideal_yaw, or yaw_speed field(s) not found\n"); return; } - current = ANGLEMOD(PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.angles)->vector[1]); - ideal = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.ideal_yaw)->_float; - speed = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.yaw_speed)->_float; + current = ANGLEMOD(PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.angles)->vector[1]); + ideal = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.ideal_yaw)->_float; + speed = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.yaw_speed)->_float; if (current == ideal) return; @@ -3960,7 +3960,7 @@ void VM_changeyaw (void) move = -speed; } - PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.angles)->vector[1] = ANGLEMOD (current + move); + PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.angles)->vector[1] = ANGLEMOD (current + move); } /* @@ -3989,9 +3989,9 @@ void VM_changepitch (void) VM_Warning("changepitch: angles, idealpitch, or pitch_speed field(s) not found\n"); return; } - current = ANGLEMOD(PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.angles)->vector[0]); - ideal = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.idealpitch)->_float; - speed = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.pitch_speed)->_float; + current = ANGLEMOD(PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.angles)->vector[0]); + ideal = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.idealpitch)->_float; + speed = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.pitch_speed)->_float; if (current == ideal) return; @@ -4017,7 +4017,7 @@ void VM_changepitch (void) move = -speed; } - PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.angles)->vector[0] = ANGLEMOD (current + move); + PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.angles)->vector[0] = ANGLEMOD (current + move); } //============= diff --git a/prvm_edict.c b/prvm_edict.c index 7226f0d7..368196df 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -240,7 +240,7 @@ prvm_edict_t *PRVM_ED_Alloc (void) e = PRVM_EDICT_NUM(i); // the first couple seconds of server time can involve a lot of // freeing and allocating, so relax the replacement policy - if (e->priv.required->free && ( e->priv.required->freetime < 2 || prog->globaloffsets.time < 0 || (PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.time)->_float - e->priv.required->freetime) > 0.5 ) ) + if (e->priv.required->free && ( e->priv.required->freetime < 2 || prog->globaloffsets.time < 0 || (PRVM_GLOBALFIELDVALUE(prog->globaloffsets.time)->_float - e->priv.required->freetime) > 0.5 ) ) { PRVM_ED_ClearEdict (e); return e; @@ -277,7 +277,7 @@ void PRVM_ED_Free (prvm_edict_t *ed) PRVM_GCALL(free_edict)(ed); ed->priv.required->free = true; - ed->priv.required->freetime = prog->globaloffsets.time >= 0 ? PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.time)->_float : 0; + ed->priv.required->freetime = prog->globaloffsets.time >= 0 ? PRVM_GLOBALFIELDVALUE(prog->globaloffsets.time)->_float : 0; } //=========================================================================== @@ -1209,7 +1209,7 @@ void PRVM_ED_LoadFromFile (const char *data) } // self = ent - PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.self)->edict = PRVM_EDICT_TO_PROG(ent); + PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict = PRVM_EDICT_TO_PROG(ent); PRVM_ExecuteProgram (func - prog->functions, ""); } diff --git a/prvm_exec.c b/prvm_exec.c index 8a04550e..74811148 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -500,8 +500,8 @@ void PRVM_ExecuteProgram (func_t fnum, const char *errormessage) if (!fnum || fnum >= (unsigned int)prog->progs->numfunctions) { - if (prog->globaloffsets.self >= 0 && PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.self)->edict) - PRVM_ED_Print(PRVM_PROG_TO_EDICT(PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.self)->edict)); + if (prog->globaloffsets.self >= 0 && PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict) + PRVM_ED_Print(PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict)); PRVM_ERROR ("PRVM_ExecuteProgram: %s", errormessage); } diff --git a/prvm_execprogram.h b/prvm_execprogram.h index 10549bcf..6b7018c1 100644 --- a/prvm_execprogram.h +++ b/prvm_execprogram.h @@ -333,10 +333,10 @@ case OP_STATE: if(prog->flag & PRVM_OP_STATE) { - ed = PRVM_PROG_TO_EDICT(PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.self)->edict); - PRVM_GETEDICTFIELDVALUE(ed,prog->fieldoffsets.nextthink)->_float = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.time)->_float + 0.1; - PRVM_GETEDICTFIELDVALUE(ed,prog->fieldoffsets.frame)->_float = OPA->_float; - PRVM_GETEDICTFIELDVALUE(ed,prog->fieldoffsets.think)->function = OPB->function; + ed = PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict); + PRVM_EDICTFIELDVALUE(ed,prog->fieldoffsets.nextthink)->_float = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.time)->_float + 0.1; + PRVM_EDICTFIELDVALUE(ed,prog->fieldoffsets.frame)->_float = OPA->_float; + PRVM_EDICTFIELDVALUE(ed,prog->fieldoffsets.think)->function = OPB->function; } else { diff --git a/sv_main.c b/sv_main.c index 271928e6..d330329f 100644 --- a/sv_main.c +++ b/sv_main.c @@ -382,7 +382,7 @@ void SV_SendServerinfo (client_t *client) MSG_WriteByte (&client->netconnection->message, svc_stufftext); MSG_WriteString (&client->netconnection->message, va("csqc_progcrc %i\n", sv.csqc_progcrc)); //[515]: init stufftext string (it is sent before svc_serverinfo) - val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.SV_InitCmd); + val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.SV_InitCmd); if (val) { MSG_WriteByte (&client->netconnection->message, svc_stufftext); @@ -561,21 +561,21 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int modelindex = (i >= 1 && i < MAX_MODELS && *PRVM_GetString(ent->fields.server->model)) ? i : 0; flags = 0; - i = (int)(PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.glow_size)->_float * 0.25f); + i = (int)(PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.glow_size)->_float * 0.25f); glowsize = (unsigned char)bound(0, i, 255); - if (PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.glow_trail)->_float) + if (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.glow_trail)->_float) flags |= RENDER_GLOWTRAIL; - f = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[0]*256; + f = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[0]*256; light[0] = (unsigned short)bound(0, f, 65535); - f = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[1]*256; + f = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[1]*256; light[1] = (unsigned short)bound(0, f, 65535); - f = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[2]*256; + f = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.color)->vector[2]*256; light[2] = (unsigned short)bound(0, f, 65535); - f = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.light_lev)->_float; + f = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.light_lev)->_float; light[3] = (unsigned short)bound(0, f, 65535); - lightstyle = (unsigned char)PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.style)->_float; - lightpflags = (unsigned char)PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.pflags)->_float; + lightstyle = (unsigned char)PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.style)->_float; + lightpflags = (unsigned char)PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.pflags)->_float; if (gamemode == GAME_TENEBRAE) { @@ -626,7 +626,7 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int // early culling checks // (final culling is done by SV_MarkWriteEntityStateToClient) - customizeentityforclient = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.customizeentityforclient)->function; + customizeentityforclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.customizeentityforclient)->function; if (!customizeentityforclient) { if (e > svs.maxclients && (!modelindex && !specialvisibilityradius)) @@ -649,18 +649,18 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int cs->modelindex = modelindex; cs->skin = (unsigned)ent->fields.server->skin; cs->frame = (unsigned)ent->fields.server->frame; - cs->viewmodelforclient = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.viewmodelforclient)->edict; - cs->exteriormodelforclient = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.exteriormodeltoclient)->edict; - cs->nodrawtoclient = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.nodrawtoclient)->edict; - cs->drawonlytoclient = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.drawonlytoclient)->edict; + cs->viewmodelforclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.viewmodelforclient)->edict; + cs->exteriormodelforclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.exteriormodeltoclient)->edict; + cs->nodrawtoclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.nodrawtoclient)->edict; + cs->drawonlytoclient = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.drawonlytoclient)->edict; cs->customizeentityforclient = customizeentityforclient; - cs->tagentity = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)->edict; - cs->tagindex = (unsigned char)PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.tag_index)->_float; + cs->tagentity = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)->edict; + cs->tagindex = (unsigned char)PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_index)->_float; cs->glowsize = glowsize; // don't need to init cs->colormod because the defaultstate did that for us //cs->colormod[0] = cs->colormod[1] = cs->colormod[2] = 32; - val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.colormod); + val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.colormod); if (val->vector[0] || val->vector[1] || val->vector[2]) { i = (int)(val->vector[0] * 32.0f);cs->colormod[0] = bound(0, i, 255); @@ -671,14 +671,14 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int cs->modelindex = modelindex; cs->alpha = 255; - f = (PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.alpha)->_float * 255.0f); + f = (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.alpha)->_float * 255.0f); if (f) { i = (int)f; cs->alpha = (unsigned char)bound(0, i, 255); } // halflife - f = (PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.renderamt)->_float); + f = (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.renderamt)->_float); if (f) { i = (int)f; @@ -686,7 +686,7 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int } cs->scale = 16; - f = (PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.scale)->_float * 16.0f); + f = (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.scale)->_float * 16.0f); if (f) { i = (int)f; @@ -694,11 +694,11 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int } cs->glowcolor = 254; - f = (PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.glow_color)->_float); + f = (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.glow_color)->_float); if (f) cs->glowcolor = (int)f; - if (PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.fullbright)->_float) + if (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.fullbright)->_float) cs->effects |= EF_FULLBRIGHT; if (ent->fields.server->movetype == MOVETYPE_STEP) @@ -1060,14 +1060,14 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t // stuff the sigil bits into the high bits of items for sbar, or else // mix in items2 - val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.items2); + val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.items2); if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE) items = (int)ent->fields.server->items | ((int)val->_float << 23); else items = (int)ent->fields.server->items | ((int)prog->globals.server->serverflags << 28); VectorClear(punchvector); - if ((val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.punchvector))) + if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.punchvector))) VectorCopy(val->vector, punchvector); // cache weapon model name and index in client struct to save time @@ -1080,7 +1080,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t } viewzoom = 255; - if ((val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.viewzoom))) + if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.viewzoom))) viewzoom = (int)(val->_float * 255.0f); if (viewzoom == 0) viewzoom = 255; @@ -1384,7 +1384,7 @@ void SV_UpdateToReliableMessages (void) // DP_SV_CLIENTCOLORS // this is always found (since it's added by the progs loader) - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.clientcolors))) + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.clientcolors))) host_client->colors = (int)val->_float; if (host_client->old_colors != host_client->colors) { @@ -1397,22 +1397,22 @@ void SV_UpdateToReliableMessages (void) // NEXUIZ_PLAYERMODEL if( prog->fieldoffsets.playermodel >= 0 ) { - model = PRVM_GetString(PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playermodel)->string); + model = PRVM_GetString(PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playermodel)->string); if (model == NULL) model = ""; // always point the string back at host_client->name to keep it safe strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel)); - PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playermodel)->string = PRVM_SetEngineString(host_client->playermodel); + PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playermodel)->string = PRVM_SetEngineString(host_client->playermodel); } // NEXUIZ_PLAYERSKIN if( prog->fieldoffsets.playerskin >= 0 ) { - skin = PRVM_GetString(PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playerskin)->string); + skin = PRVM_GetString(PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playerskin)->string); if (skin == NULL) skin = ""; // always point the string back at host_client->name to keep it safe strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin)); - PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playerskin)->string = PRVM_SetEngineString(host_client->playerskin); + PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.playerskin)->string = PRVM_SetEngineString(host_client->playerskin); } // frags @@ -2191,13 +2191,13 @@ void SV_VM_CB_InitEdict(prvm_edict_t *e) // DP_SV_CLIENTNAME and DP_SV_CLIENTCOLORS will not immediately // reset them e->fields.server->netname = PRVM_SetEngineString(svs.clients[num].name); - if ((val = PRVM_GETEDICTFIELDVALUE(e, prog->fieldoffsets.clientcolors))) + if ((val = PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.clientcolors))) val->_float = svs.clients[num].colors; // NEXUIZ_PLAYERMODEL and NEXUIZ_PLAYERSKIN if( prog->fieldoffsets.playermodel >= 0 ) - PRVM_GETEDICTFIELDVALUE(e, prog->fieldoffsets.playermodel)->string = PRVM_SetEngineString(svs.clients[num].playermodel); + PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.playermodel)->string = PRVM_SetEngineString(svs.clients[num].playermodel); if( prog->fieldoffsets.playerskin >= 0 ) - PRVM_GETEDICTFIELDVALUE(e, prog->fieldoffsets.playerskin)->string = PRVM_SetEngineString(svs.clients[num].playerskin); + PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.playerskin)->string = PRVM_SetEngineString(svs.clients[num].playerskin); } } diff --git a/sv_phys.c b/sv_phys.c index 9cf79ae4..6b2d0207 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -236,7 +236,7 @@ trace_t SV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, const if (passedict) { - val = PRVM_GETEDICTFIELDVALUE(passedict, prog->fieldoffsets.dphitcontentsmask); + val = PRVM_EDICTFIELDVALUE(passedict, prog->fieldoffsets.dphitcontentsmask); if (val && val->_float) hitsupercontentsmask = (int)val->_float; else if (passedict->fields.server->solid == SOLID_SLIDEBOX) @@ -441,13 +441,13 @@ void SV_LinkEdict_TouchAreaGrid(prvm_edict_t *ent) VectorSet (prog->globals.server->trace_plane_normal, 0, 0, 1); prog->globals.server->trace_plane_dist = 0; prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(ent); - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) val->_float = 0; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) val->_float = 0; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) val->_float = 0; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) val->string = 0; PRVM_ExecuteProgram (touch->fields.server->touch, "QC function self.touch is missing"); } @@ -648,7 +648,7 @@ int SV_CheckContentsTransition(prvm_edict_t *ent, const int nContents) if(ent->fields.server->watertype != nContents) { // Changed Contents // Acquire Contents Transition Function from QC - contentstransition = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.contentstransition); + contentstransition = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.contentstransition); if(contentstransition->function) { // Valid Function; Execute @@ -771,13 +771,13 @@ void SV_Impact (prvm_edict_t *e1, trace_t *trace) prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(trace->ent); else prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(prog->edicts); - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) val->_float = trace->startsupercontents; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) val->_float = trace->hitsupercontents; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) val->_float = trace->hitq3surfaceflags; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) { if (trace->hittexture) val->string = PRVM_SetTempString(trace->hittexture->name); @@ -800,13 +800,13 @@ void SV_Impact (prvm_edict_t *e1, trace_t *trace) VectorSet (prog->globals.server->trace_plane_normal, 0, 0, 1); prog->globals.server->trace_plane_dist = 0; prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(e1); - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) val->_float = 0; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) val->_float = 0; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) val->_float = 0; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) val->string = 0; PRVM_ExecuteProgram (e2->fields.server->touch, "QC function self.touch is missing"); } @@ -1095,7 +1095,7 @@ void SV_AddGravity (prvm_edict_t *ent) float ent_gravity; prvm_eval_t *val; - val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.gravity); + val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.gravity); if (val!=0 && val->_float) ent_gravity = val->_float; else @@ -2306,7 +2306,7 @@ trace_t SV_Trace_Toss (prvm_edict_t *tossent, prvm_edict_t *ignore) VectorCopy(tossent->fields.server->angles , original_angles ); VectorCopy(tossent->fields.server->avelocity, original_avelocity); - val = PRVM_GETEDICTFIELDVALUE(tossent, prog->fieldoffsets.gravity); + val = PRVM_EDICTFIELDVALUE(tossent, prog->fieldoffsets.gravity); if (val != NULL && val->_float != 0) gravity = val->_float; else diff --git a/sv_user.c b/sv_user.c index 73cba767..f7d8b884 100644 --- a/sv_user.c +++ b/sv_user.c @@ -208,7 +208,7 @@ void DropPunchAngle (void) len = 0; VectorScale (host_client->edict->fields.server->punchangle, len, host_client->edict->fields.server->punchangle); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.punchvector))) + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.punchvector))) { len = VectorNormalizeLength (val->vector); @@ -660,29 +660,29 @@ void SV_ApplyClientMove (void) // only send the impulse to qc once move->impulse = 0; VectorCopy(move->viewangles, host_client->edict->fields.server->v_angle); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button3))) val->_float = ((move->buttons >> 2) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button4))) val->_float = ((move->buttons >> 3) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button5))) val->_float = ((move->buttons >> 4) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button6))) val->_float = ((move->buttons >> 5) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button7))) val->_float = ((move->buttons >> 6) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button8))) val->_float = ((move->buttons >> 7) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button9))) val->_float = ((move->buttons >> 11) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button10))) val->_float = ((move->buttons >> 12) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button11))) val->_float = ((move->buttons >> 13) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button12))) val->_float = ((move->buttons >> 14) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button13))) val->_float = ((move->buttons >> 15) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button14))) val->_float = ((move->buttons >> 16) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button15))) val->_float = ((move->buttons >> 17) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button16))) val->_float = ((move->buttons >> 18) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.buttonuse))) val->_float = ((move->buttons >> 8) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.buttonchat))) val->_float = ((move->buttons >> 9) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_active))) val->_float = ((move->buttons >> 10) & 1); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.movement))) VectorSet(val->vector, move->forwardmove, move->sidemove, move->upmove); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_screen))) VectorCopy(move->cursor_screen, val->vector); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_trace_start))) VectorCopy(move->cursor_start, val->vector); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_trace_endpos))) VectorCopy(move->cursor_impact, val->vector); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_trace_ent))) val->edict = PRVM_EDICT_TO_PROG(PRVM_EDICT_NUM(move->cursor_entitynumber)); - if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ping))) val->_float = host_client->ping * 1000.0; + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button3))) val->_float = ((move->buttons >> 2) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button4))) val->_float = ((move->buttons >> 3) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button5))) val->_float = ((move->buttons >> 4) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button6))) val->_float = ((move->buttons >> 5) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button7))) val->_float = ((move->buttons >> 6) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button8))) val->_float = ((move->buttons >> 7) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button9))) val->_float = ((move->buttons >> 11) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button10))) val->_float = ((move->buttons >> 12) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button11))) val->_float = ((move->buttons >> 13) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button12))) val->_float = ((move->buttons >> 14) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button13))) val->_float = ((move->buttons >> 15) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button14))) val->_float = ((move->buttons >> 16) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button15))) val->_float = ((move->buttons >> 17) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.button16))) val->_float = ((move->buttons >> 18) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.buttonuse))) val->_float = ((move->buttons >> 8) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.buttonchat))) val->_float = ((move->buttons >> 9) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_active))) val->_float = ((move->buttons >> 10) & 1); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.movement))) VectorSet(val->vector, move->forwardmove, move->sidemove, move->upmove); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_screen))) VectorCopy(move->cursor_screen, val->vector); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_trace_start))) VectorCopy(move->cursor_start, val->vector); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_trace_endpos))) VectorCopy(move->cursor_impact, val->vector); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.cursor_trace_ent))) val->edict = PRVM_EDICT_TO_PROG(PRVM_EDICT_NUM(move->cursor_entitynumber)); + if ((val = PRVM_EDICTFIELDVALUE(host_client->edict, prog->fieldoffsets.ping))) val->_float = host_client->ping * 1000.0; } void SV_FrameLost(int framenum) diff --git a/svvm_cmds.c b/svvm_cmds.c index f70afaac..e58daf81 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -492,13 +492,13 @@ void PF_traceline (void) prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(trace.ent); else prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(prog->edicts); - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) val->_float = trace.startsupercontents; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) val->_float = trace.hitsupercontents; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) val->_float = trace.hitq3surfaceflags; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) { if (trace.hittexture) val->string = PRVM_SetTempString(trace.hittexture->name); @@ -554,13 +554,13 @@ void PF_tracebox (void) prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(trace.ent); else prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(prog->edicts); - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) val->_float = trace.startsupercontents; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) val->_float = trace.hitsupercontents; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) val->_float = trace.hitq3surfaceflags; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) { if (trace.hittexture) val->string = PRVM_SetTempString(trace.hittexture->name); @@ -601,13 +601,13 @@ void PF_tracetoss (void) prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(trace.ent); else prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(prog->edicts); - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dpstartcontents))) val->_float = trace.startsupercontents; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitcontents))) val->_float = trace.hitsupercontents; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphitq3surfaceflags))) val->_float = trace.hitq3surfaceflags; - if ((val = PRVM_GETGLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) + if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_dphittexturename))) { if (trace.hittexture) val->string = PRVM_SetTempString(trace.hittexture->name); @@ -1540,7 +1540,7 @@ void PF_setcolor (void) client = svs.clients + entnum-1; if (client->edict) { - if ((val = PRVM_GETEDICTFIELDVALUE(client->edict, prog->fieldoffsets.clientcolors))) + if ((val = PRVM_EDICTFIELDVALUE(client->edict, prog->fieldoffsets.clientcolors))) val->_float = i; client->edict->fields.server->team = (i & 15) + 1; } @@ -2229,11 +2229,11 @@ void PF_setattachment (void) if (tagentity == NULL) tagentity = prog->edicts; - v = PRVM_GETEDICTFIELDVALUE(e, prog->fieldoffsets.tag_entity); + v = PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.tag_entity); if (v) v->edict = PRVM_EDICT_TO_PROG(tagentity); - v = PRVM_GETEDICTFIELDVALUE(e, prog->fieldoffsets.tag_index); + v = PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.tag_index); if (v) v->_float = 0; if (tagentity != NULL && tagentity != prog->edicts && tagname && tagname[0]) @@ -2268,7 +2268,7 @@ int SV_GetTagIndex (prvm_edict_t *e, const char *tagname) void SV_GetEntityMatrix (prvm_edict_t *ent, matrix4x4_t *out, qboolean viewmatrix) { - float scale = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.scale)->_float; + float scale = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.scale)->_float; if (scale == 0) scale = 1; if (viewmatrix) @@ -2344,9 +2344,9 @@ int SV_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex) SV_GetEntityMatrix(ent, &entitymatrix, false); Matrix4x4_Concat(&tagmatrix, &entitymatrix, out); // next iteration we process the parent entity - if ((val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)) && val->edict) + if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_entity)) && val->edict) { - tagindex = (int)PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.tag_index)->_float; + tagindex = (int)PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.tag_index)->_float; ent = PRVM_EDICT_NUM(val->edict); } else @@ -2355,7 +2355,7 @@ int SV_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex) } // RENDER_VIEWMODEL magic - if ((val = PRVM_GETEDICTFIELDVALUE(ent, prog->fieldoffsets.viewmodelforclient)) && val->edict) + if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.viewmodelforclient)) && val->edict) { Matrix4x4_Copy(&tagmatrix, out); ent = PRVM_EDICT_NUM(val->edict); -- 2.39.2