mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-27 14:52:04 +00:00
broken scale
This commit is contained in:
parent
84fde2cfe7
commit
129b6ea7f4
11 changed files with 95 additions and 20 deletions
|
@ -198,8 +198,9 @@ CL_AddPacketEntities(frame_t *frame)
|
|||
ent.skin = NULL;
|
||||
ent.model = cl.model_draw[s1->modelindex];
|
||||
}
|
||||
|
||||
/* store scale */
|
||||
ent.scale = s1->scale[0];
|
||||
VectorCopy(s1->scale, ent.scale);
|
||||
}
|
||||
|
||||
/* only used for black hole model right now */
|
||||
|
|
|
@ -145,8 +145,13 @@ CL_ParseDelta(entity_state_t *from, entity_state_t *to, int number, int bits)
|
|||
|
||||
if (cls.serverProtocol != PROTOCOL_VERSION)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Always set scale to 1.0f for old clients */
|
||||
to->scale[0] = 1.0f;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
to->scale[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_QII97_PROTOCOL(cls.serverProtocol))
|
||||
|
@ -219,8 +224,15 @@ CL_ParseDelta(entity_state_t *from, entity_state_t *to, int number, int bits)
|
|||
/* Additional scale with skinnum */
|
||||
if (cls.serverProtocol == PROTOCOL_VERSION)
|
||||
{
|
||||
to->scale[0] = MSG_ReadFloat(&net_message);
|
||||
printf("received scale %f\n", to->scale[0]);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
to->scale[i] = MSG_ReadFloat(&net_message);
|
||||
}
|
||||
|
||||
printf("received scale %.2fx%.2fx%.2f\n",
|
||||
to->scale[0], to->scale[1], to->scale[2]);
|
||||
}
|
||||
}
|
||||
else if (bits & U_SKIN8)
|
||||
|
|
|
@ -95,18 +95,20 @@ void
|
|||
R_LerpVerts(qboolean powerUpEffect, int nverts,
|
||||
const dxtrivertx_t *v, const dxtrivertx_t *ov,
|
||||
float *lerp, const float move[3],
|
||||
const float frontv[3], const float backv[3], float scale)
|
||||
const float frontv[3], const float backv[3], const float *scale)
|
||||
{
|
||||
int i;
|
||||
vec3_t new_scale = {1.0, 1.0, 1.0};
|
||||
scale = new_scale;
|
||||
|
||||
/* If scale is undefined, set scale 1.0f */
|
||||
if (!scale)
|
||||
if (!scale[0] || !scale[1] || !scale[2])
|
||||
{
|
||||
scale = 1.0f;
|
||||
printf("model without scale\n");
|
||||
}
|
||||
|
||||
if (powerUpEffect)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nverts; i++, v++, ov++, lerp += 4)
|
||||
{
|
||||
int n;
|
||||
|
@ -117,18 +119,23 @@ R_LerpVerts(qboolean powerUpEffect, int nverts,
|
|||
|
||||
normal = v->normal[n] / 127.f;
|
||||
|
||||
lerp[n] = scale * (move[n] + ov->v[n] * backv[n] + v->v[n] * frontv[n]) +
|
||||
lerp[n] = scale[n] * (move[n] + ov->v[n] * backv[n] + v->v[n] * frontv[n]) +
|
||||
normal * POWERSUIT_SCALE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nverts; i++, v++, ov++, lerp += 4)
|
||||
{
|
||||
lerp[0] = scale * (move[0] + ov->v[0] * backv[0] + v->v[0] * frontv[0]);
|
||||
lerp[1] = scale * (move[1] + ov->v[1] * backv[1] + v->v[1] * frontv[1]);
|
||||
lerp[2] = scale * (move[2] + ov->v[2] * backv[2] + v->v[2] * frontv[2]);
|
||||
int n;
|
||||
|
||||
for (n = 0; n < 3; n++)
|
||||
{
|
||||
lerp[n] = scale[n] * (move[n] + ov->v[n] * backv[n] + v->v[n] * frontv[n]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -338,6 +338,15 @@ R_DrawAliasModel(entity_t *currententity, const model_t *currentmodel)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
/* fix scale */
|
||||
if (!currententity->scale[i])
|
||||
{
|
||||
currententity->scale[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
paliashdr = (dmdx_t *)currentmodel->extradata;
|
||||
|
||||
/* get lighting information */
|
||||
|
|
|
@ -548,6 +548,15 @@ GL3_DrawAliasModel(entity_t *entity)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
/* fix scale */
|
||||
if (!entity->scale[i])
|
||||
{
|
||||
entity->scale[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
gl3model_t* model = entity->model;
|
||||
paliashdr = (dmdx_t *)model->extradata;
|
||||
|
||||
|
|
|
@ -548,6 +548,15 @@ GL4_DrawAliasModel(entity_t *entity)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
/* fix scale */
|
||||
if (!entity->scale[i])
|
||||
{
|
||||
entity->scale[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
gl4model_t* model = entity->model;
|
||||
paliashdr = (dmdx_t *)model->extradata;
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ extern qboolean R_CullAliasMeshModel(dmdx_t *paliashdr, cplane_t *frustum,
|
|||
extern void R_LerpVerts(qboolean powerUpEffect, int nverts,
|
||||
const dxtrivertx_t *v, const dxtrivertx_t *ov,
|
||||
float *lerp, const float move[3],
|
||||
const float frontv[3], const float backv[3], float scale);
|
||||
const float frontv[3], const float backv[3], const float *scale);
|
||||
extern void R_ConvertNormalMDL(byte in_normal, signed char *normal);
|
||||
extern vec4_t *R_VertBufferRealloc(int num);
|
||||
extern void R_VertBufferInit(void);
|
||||
|
|
|
@ -795,17 +795,21 @@ R_AliasDrawModel
|
|||
void
|
||||
R_AliasDrawModel(entity_t *currententity, const model_t *currentmodel)
|
||||
{
|
||||
int i;
|
||||
|
||||
s_pmdl = (dmdx_t *)currentmodel->extradata;
|
||||
|
||||
if ( r_lerpmodels->value == 0 )
|
||||
{
|
||||
currententity->backlerp = 0;
|
||||
}
|
||||
|
||||
float oldAliasxscale = aliasxscale;
|
||||
float oldAliasyscale = aliasyscale;
|
||||
|
||||
if ( currententity->flags & RF_WEAPONMODEL )
|
||||
if (currententity->flags & RF_WEAPONMODEL)
|
||||
{
|
||||
if ( r_lefthand->value == 2.0F )
|
||||
if (r_lefthand->value == 2.0F)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -821,6 +825,15 @@ R_AliasDrawModel(entity_t *currententity, const model_t *currentmodel)
|
|||
aliasxscale = -aliasxscale;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
/* fix scale */
|
||||
if (!currententity->scale[i])
|
||||
{
|
||||
currententity->scale[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** we have to set our frame pointers and transformations before
|
||||
** doing any real work
|
||||
|
|
|
@ -527,6 +527,15 @@ R_DrawAliasModel(entity_t *currententity, const model_t *currentmodel)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
/* fix scale */
|
||||
if (!currententity->scale[i])
|
||||
{
|
||||
currententity->scale[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
paliashdr = (dmdx_t *)currentmodel->extradata;
|
||||
|
||||
/* get lighting information */
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef struct entity_s {
|
|||
/* misc */
|
||||
float backlerp; /* 0.0 = current, 1.0 = old */
|
||||
int skinnum; /* also used as RF_BEAM's palette index */
|
||||
float scale;
|
||||
vec3_t scale; /* model scale before render */
|
||||
|
||||
int lightstyle; /* for flashing entities */
|
||||
float alpha; /* ignore if RF_TRANSLUCENT isn't set */
|
||||
|
|
|
@ -731,9 +731,15 @@ MSG_WriteDeltaEntity(entity_state_t *from,
|
|||
/* Send scale */
|
||||
if (protocol == PROTOCOL_VERSION)
|
||||
{
|
||||
to->scale[0] = 1.5f;
|
||||
MSG_WriteFloat(msg, to->scale[0]);
|
||||
printf("send scale %f\n", to->scale[0]);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
MSG_WriteFloat(msg, to->scale[i]);
|
||||
}
|
||||
|
||||
printf("send scale %.2fx%.2fx%.2f\n",
|
||||
to->scale[0], to->scale[1], to->scale[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue