From: havoc Date: Sun, 8 May 2011 13:16:54 +0000 (+0000) Subject: fix bug in last patch, fix RF_USEAXIS handling X-Git-Tag: xonotic-v0.5.0~194 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9e18c7b93a698a6f88c6af9e18894007f2e4b12a;p=xonotic%2Fdarkplaces.git fix bug in last patch, fix RF_USEAXIS handling git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11122 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=6ca878eac347c3d744ac078de95fcb17a2af5d34 --- diff --git a/clvm_cmds.c b/clvm_cmds.c index ffcff83f..2d81062c 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -2203,6 +2203,18 @@ void CL_GetEntityMatrix (prvm_edict_t *ent, matrix4x4_t *out, qboolean viewmatri // TODO do we need the same weird angle inverting logic here as in the server side case? if(viewmatrix) Matrix4x4_CreateFromQuakeEntity(out, cl.csqc_origin[0], cl.csqc_origin[1], cl.csqc_origin[2], cl.csqc_angles[0], cl.csqc_angles[1], cl.csqc_angles[2], scale * cl_viewmodel_scale.value); + else if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.renderflags)) && ((int)val->_float & RF_USEAXIS)) + { + vec3_t forward; + vec3_t left; + vec3_t up; + vec3_t origin; + VectorScale(prog->globals.client->v_forward, scale, forward); + VectorScale(prog->globals.client->v_right, -scale, left); + VectorScale(prog->globals.client->v_up, scale, up); + VectorCopy(ent->fields.client->origin, origin); + Matrix4x4_FromVectors(out, forward, left, up, origin); + } else { pitchsign = CL_GetPitchSign(ent); diff --git a/csprogs.c b/csprogs.c index 88600c39..a9f56175 100644 --- a/csprogs.c +++ b/csprogs.c @@ -166,7 +166,6 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum) prvm_eval_t *val; entity_render_t *entrender; dp_model_t *model; - matrix4x4_t tagmatrix, matrix2; model = CL_GetModelFromEdict(ed); if (!model) @@ -216,25 +215,7 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum) VectorSet(entrender->glowmod, 1, 1, 1); // LordHavoc: use the CL_GetTagMatrix function on self to ensure consistent behavior (duplicate code would be bad) - CL_GetTagMatrix(&tagmatrix, ed, 0); - if (renderflags & RF_USEAXIS) - { - vec3_t left; - VectorNegate(prog->globals.client->v_right, left); - Matrix4x4_FromVectors(&matrix2, prog->globals.client->v_forward, left, prog->globals.client->v_up, ed->fields.client->origin); - Matrix4x4_Scale(&matrix2, scale, 1); - } - else - { - vec3_t angles; - VectorCopy(ed->fields.client->angles, angles); - // if model is alias, reverse pitch direction - if (entrender->model->type == mod_alias) - angles[0] = -angles[0]; - - // set up the render matrix - Matrix4x4_CreateFromQuakeEntity(&matrix2, ed->fields.client->origin[0], ed->fields.client->origin[1], ed->fields.client->origin[2], angles[0], angles[1], angles[2], scale); - } + CL_GetTagMatrix(&entrender->matrix, ed, 0); // set up the animation data VM_GenerateFrameGroupBlend(ed->priv.server->framegroupblend, ed); @@ -242,9 +223,6 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum) VM_UpdateEdictSkeleton(ed, model, ed->priv.server->frameblend); if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.shadertime))) entrender->shadertime = val->_float; - // concat the matrices to make the entity relative to its tag - Matrix4x4_Concat(&entrender->matrix, &tagmatrix, &matrix2); - // transparent offset if ((renderflags & RF_USETRANSPARENTOFFSET) && (val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.transparent_offset))) entrender->transparent_offset = val->_float;