mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-24 05:21:09 +00:00
initial scale
This commit is contained in:
parent
ddda42244d
commit
84fde2cfe7
15 changed files with 64 additions and 18 deletions
|
@ -198,6 +198,8 @@ CL_AddPacketEntities(frame_t *frame)
|
||||||
ent.skin = NULL;
|
ent.skin = NULL;
|
||||||
ent.model = cl.model_draw[s1->modelindex];
|
ent.model = cl.model_draw[s1->modelindex];
|
||||||
}
|
}
|
||||||
|
/* store scale */
|
||||||
|
ent.scale = s1->scale[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only used for black hole model right now */
|
/* only used for black hole model right now */
|
||||||
|
|
|
@ -143,6 +143,12 @@ CL_ParseDelta(entity_state_t *from, entity_state_t *to, int number, int bits)
|
||||||
VectorCopy(from->origin, to->old_origin);
|
VectorCopy(from->origin, to->old_origin);
|
||||||
to->number = number;
|
to->number = number;
|
||||||
|
|
||||||
|
if (cls.serverProtocol != PROTOCOL_VERSION)
|
||||||
|
{
|
||||||
|
/* Always set scale to 1.0f for old clients */
|
||||||
|
to->scale[0] = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if (IS_QII97_PROTOCOL(cls.serverProtocol))
|
if (IS_QII97_PROTOCOL(cls.serverProtocol))
|
||||||
{
|
{
|
||||||
if (bits & U_MODEL)
|
if (bits & U_MODEL)
|
||||||
|
@ -210,6 +216,12 @@ CL_ParseDelta(entity_state_t *from, entity_state_t *to, int number, int bits)
|
||||||
if ((bits & U_SKIN8) && (bits & U_SKIN16))
|
if ((bits & U_SKIN8) && (bits & U_SKIN16))
|
||||||
{
|
{
|
||||||
to->skinnum = MSG_ReadLong(&net_message);
|
to->skinnum = MSG_ReadLong(&net_message);
|
||||||
|
/* Additional scale with skinnum */
|
||||||
|
if (cls.serverProtocol == PROTOCOL_VERSION)
|
||||||
|
{
|
||||||
|
to->scale[0] = MSG_ReadFloat(&net_message);
|
||||||
|
printf("received scale %f\n", to->scale[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (bits & U_SKIN8)
|
else if (bits & U_SKIN8)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,10 +95,16 @@ void
|
||||||
R_LerpVerts(qboolean powerUpEffect, int nverts,
|
R_LerpVerts(qboolean powerUpEffect, int nverts,
|
||||||
const dxtrivertx_t *v, const dxtrivertx_t *ov,
|
const dxtrivertx_t *v, const dxtrivertx_t *ov,
|
||||||
float *lerp, const float move[3],
|
float *lerp, const float move[3],
|
||||||
const float frontv[3], const float backv[3])
|
const float frontv[3], const float backv[3], float scale)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* If scale is undefined, set scale 1.0f */
|
||||||
|
if (!scale)
|
||||||
|
{
|
||||||
|
scale = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if (powerUpEffect)
|
if (powerUpEffect)
|
||||||
{
|
{
|
||||||
for (i = 0; i < nverts; i++, v++, ov++, lerp += 4)
|
for (i = 0; i < nverts; i++, v++, ov++, lerp += 4)
|
||||||
|
@ -111,7 +117,7 @@ R_LerpVerts(qboolean powerUpEffect, int nverts,
|
||||||
|
|
||||||
normal = v->normal[n] / 127.f;
|
normal = v->normal[n] / 127.f;
|
||||||
|
|
||||||
lerp[n] = move[n] + ov->v[n] * backv[n] + v->v[n] * frontv[n] +
|
lerp[n] = scale * (move[n] + ov->v[n] * backv[n] + v->v[n] * frontv[n]) +
|
||||||
normal * POWERSUIT_SCALE;
|
normal * POWERSUIT_SCALE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,9 +126,9 @@ R_LerpVerts(qboolean powerUpEffect, int nverts,
|
||||||
{
|
{
|
||||||
for (i = 0; i < nverts; i++, v++, ov++, lerp += 4)
|
for (i = 0; i < nverts; i++, v++, ov++, lerp += 4)
|
||||||
{
|
{
|
||||||
lerp[0] = move[0] + ov->v[0] * backv[0] + v->v[0] * frontv[0];
|
lerp[0] = scale * (move[0] + ov->v[0] * backv[0] + v->v[0] * frontv[0]);
|
||||||
lerp[1] = move[1] + ov->v[1] * backv[1] + v->v[1] * frontv[1];
|
lerp[1] = scale * (move[1] + ov->v[1] * backv[1] + v->v[1] * frontv[1]);
|
||||||
lerp[2] = move[2] + ov->v[2] * backv[2] + v->v[2] * frontv[2];
|
lerp[2] = scale * (move[2] + ov->v[2] * backv[2] + v->v[2] * frontv[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ R_DrawAliasFrameLerp(entity_t *currententity, dmdx_t *paliashdr, float backlerp,
|
||||||
lerp = s_lerped[0];
|
lerp = s_lerped[0];
|
||||||
|
|
||||||
R_LerpVerts(colorOnly, paliashdr->num_xyz, verts, ov, lerp,
|
R_LerpVerts(colorOnly, paliashdr->num_xyz, verts, ov, lerp,
|
||||||
move, frontv, backv);
|
move, frontv, backv, currententity->scale);
|
||||||
|
|
||||||
num_mesh_nodes = paliashdr->num_meshes;
|
num_mesh_nodes = paliashdr->num_meshes;
|
||||||
mesh_nodes = (dmdxmesh_t *)((char*)paliashdr + paliashdr->ofs_meshes);
|
mesh_nodes = (dmdxmesh_t *)((char*)paliashdr + paliashdr->ofs_meshes);
|
||||||
|
|
|
@ -289,7 +289,8 @@ DrawAliasFrameLerp(dmdx_t *paliashdr, entity_t* entity, vec3_t shadelight,
|
||||||
|
|
||||||
lerp = s_lerped[0];
|
lerp = s_lerped[0];
|
||||||
|
|
||||||
R_LerpVerts(colorOnly, paliashdr->num_xyz, verts, ov, lerp, move, frontv, backv);
|
R_LerpVerts(colorOnly, paliashdr->num_xyz, verts, ov, lerp,
|
||||||
|
move, frontv, backv, entity->scale);
|
||||||
|
|
||||||
YQ2_STATIC_ASSERT(sizeof(gl3_alias_vtx_t) == 9 * sizeof(GLfloat), "invalid gl3_alias_vtx_t size");
|
YQ2_STATIC_ASSERT(sizeof(gl3_alias_vtx_t) == 9 * sizeof(GLfloat), "invalid gl3_alias_vtx_t size");
|
||||||
|
|
||||||
|
@ -469,7 +470,8 @@ DrawAliasShadow(gl3_shadowinfo_t* shadowInfo)
|
||||||
|
|
||||||
// false: don't extrude vertices for powerup - this means the powerup shell
|
// false: don't extrude vertices for powerup - this means the powerup shell
|
||||||
// is not seen in the shadow, only the underlying model..
|
// is not seen in the shadow, only the underlying model..
|
||||||
R_LerpVerts(false, paliashdr->num_xyz, verts, ov, s_lerped[0], move, frontv, backv);
|
R_LerpVerts(false, paliashdr->num_xyz, verts, ov, s_lerped[0],
|
||||||
|
move, frontv, backv, entity->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
lheight = entity->origin[2] - shadowInfo->lightspot[2];
|
lheight = entity->origin[2] - shadowInfo->lightspot[2];
|
||||||
|
|
|
@ -289,7 +289,8 @@ DrawAliasFrameLerp(dmdx_t *paliashdr, entity_t* entity, vec3_t shadelight,
|
||||||
|
|
||||||
lerp = s_lerped[0];
|
lerp = s_lerped[0];
|
||||||
|
|
||||||
R_LerpVerts(colorOnly, paliashdr->num_xyz, verts, ov, lerp, move, frontv, backv);
|
R_LerpVerts(colorOnly, paliashdr->num_xyz, verts, ov, lerp,
|
||||||
|
move, frontv, backv, entity->scale);
|
||||||
|
|
||||||
YQ2_STATIC_ASSERT(sizeof(gl4_alias_vtx_t) == 9 * sizeof(GLfloat), "invalid gl4_alias_vtx_t size");
|
YQ2_STATIC_ASSERT(sizeof(gl4_alias_vtx_t) == 9 * sizeof(GLfloat), "invalid gl4_alias_vtx_t size");
|
||||||
|
|
||||||
|
@ -469,7 +470,8 @@ DrawAliasShadow(gl4_shadowinfo_t* shadowInfo)
|
||||||
|
|
||||||
// false: don't extrude vertices for powerup - this means the powerup shell
|
// false: don't extrude vertices for powerup - this means the powerup shell
|
||||||
// is not seen in the shadow, only the underlying model..
|
// is not seen in the shadow, only the underlying model..
|
||||||
R_LerpVerts(false, paliashdr->num_xyz, verts, ov, s_lerped[0], move, frontv, backv);
|
R_LerpVerts(false, paliashdr->num_xyz, verts, ov, s_lerped[0],
|
||||||
|
move, frontv, backv, entity->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
lheight = entity->origin[2] - shadowInfo->lightspot[2];
|
lheight = entity->origin[2] - shadowInfo->lightspot[2];
|
||||||
|
|
|
@ -382,7 +382,7 @@ extern qboolean R_CullAliasMeshModel(dmdx_t *paliashdr, cplane_t *frustum,
|
||||||
extern void R_LerpVerts(qboolean powerUpEffect, int nverts,
|
extern void R_LerpVerts(qboolean powerUpEffect, int nverts,
|
||||||
const dxtrivertx_t *v, const dxtrivertx_t *ov,
|
const dxtrivertx_t *v, const dxtrivertx_t *ov,
|
||||||
float *lerp, const float move[3],
|
float *lerp, const float move[3],
|
||||||
const float frontv[3], const float backv[3]);
|
const float frontv[3], const float backv[3], float scale);
|
||||||
extern void R_ConvertNormalMDL(byte in_normal, signed char *normal);
|
extern void R_ConvertNormalMDL(byte in_normal, signed char *normal);
|
||||||
extern vec4_t *R_VertBufferRealloc(int num);
|
extern vec4_t *R_VertBufferRealloc(int num);
|
||||||
extern void R_VertBufferInit(void);
|
extern void R_VertBufferInit(void);
|
||||||
|
|
|
@ -457,7 +457,7 @@ R_AliasPreparePoints(const entity_t *currententity, finalvert_t *verts, const fi
|
||||||
RF_SHELL_HALF_DAM));
|
RF_SHELL_HALF_DAM));
|
||||||
|
|
||||||
R_LerpVerts(colorOnly, s_pmdl->num_xyz, r_thisframe->verts, r_lastframe->verts,
|
R_LerpVerts(colorOnly, s_pmdl->num_xyz, r_thisframe->verts, r_lastframe->verts,
|
||||||
s_lerped[0], r_lerp_move, r_lerp_frontv, r_lerp_backv);
|
s_lerped[0], r_lerp_move, r_lerp_frontv, r_lerp_backv, currententity->scale);
|
||||||
|
|
||||||
R_AliasTransformFinalVerts(s_pmdl->num_xyz,
|
R_AliasTransformFinalVerts(s_pmdl->num_xyz,
|
||||||
verts, /* destination for transformed verts */
|
verts, /* destination for transformed verts */
|
||||||
|
|
|
@ -979,7 +979,7 @@ RE_RenderView(refdef_t *fd)
|
||||||
|
|
||||||
R_DrawAlphaSurfaces();
|
R_DrawAlphaSurfaces();
|
||||||
|
|
||||||
R_Flash();
|
R_Flash(); /* citadel error */
|
||||||
|
|
||||||
if (r_speeds->value)
|
if (r_speeds->value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -359,7 +359,7 @@ Vk_DrawAliasFrameLerp(entity_t *currententity, dmdx_t *paliashdr, float backlerp
|
||||||
}
|
}
|
||||||
|
|
||||||
R_LerpVerts(colorOnly, paliashdr->num_xyz, verts, ov, (float*)s_lerped,
|
R_LerpVerts(colorOnly, paliashdr->num_xyz, verts, ov, (float*)s_lerped,
|
||||||
move, frontv, backv);
|
move, frontv, backv, currententity->scale);
|
||||||
|
|
||||||
VkDescriptorSet descriptorSets[] = {
|
VkDescriptorSet descriptorSets[] = {
|
||||||
skin->vk_texture.descriptorSet,
|
skin->vk_texture.descriptorSet,
|
||||||
|
|
|
@ -68,6 +68,7 @@ typedef struct entity_s {
|
||||||
/* misc */
|
/* misc */
|
||||||
float backlerp; /* 0.0 = current, 1.0 = old */
|
float backlerp; /* 0.0 = current, 1.0 = old */
|
||||||
int skinnum; /* also used as RF_BEAM's palette index */
|
int skinnum; /* also used as RF_BEAM's palette index */
|
||||||
|
float scale;
|
||||||
|
|
||||||
int lightstyle; /* for flashing entities */
|
int lightstyle; /* for flashing entities */
|
||||||
float alpha; /* ignore if RF_TRANSLUCENT isn't set */
|
float alpha; /* ignore if RF_TRANSLUCENT isn't set */
|
||||||
|
|
|
@ -69,6 +69,7 @@ Mod_LoadVisibility(const char *name, dvis_t **vis, int *numvisibility,
|
||||||
|
|
||||||
if (!l->filelen)
|
if (!l->filelen)
|
||||||
{
|
{
|
||||||
|
/* n64jam_chnuckierdbeer */
|
||||||
Com_Printf("%s: Map %s has too small visibility lump\n",
|
Com_Printf("%s: Map %s has too small visibility lump\n",
|
||||||
__func__, name);
|
__func__, name);
|
||||||
*vis = NULL;
|
*vis = NULL;
|
||||||
|
|
|
@ -1222,6 +1222,7 @@ typedef struct entity_state_s
|
||||||
int event; /* impulse events -- muzzle flashes, footsteps, etc */
|
int event; /* impulse events -- muzzle flashes, footsteps, etc */
|
||||||
/* events only go out for a single frame, they */
|
/* events only go out for a single frame, they */
|
||||||
/* are automatically cleared each frame */
|
/* are automatically cleared each frame */
|
||||||
|
/* New protocol fields */
|
||||||
vec3_t scale;
|
vec3_t scale;
|
||||||
} entity_state_t;
|
} entity_state_t;
|
||||||
|
|
||||||
|
|
|
@ -505,6 +505,13 @@ MSG_WriteDeltaEntity(entity_state_t *from,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Scale with skins if force or different */
|
||||||
|
if ((protocol == PROTOCOL_VERSION) &&
|
||||||
|
((to->scale != from->scale) || force))
|
||||||
|
{
|
||||||
|
bits |= (U_SKIN8 | U_SKIN16);
|
||||||
|
}
|
||||||
|
|
||||||
if (to->frame != from->frame)
|
if (to->frame != from->frame)
|
||||||
{
|
{
|
||||||
if (to->frame < 256)
|
if (to->frame < 256)
|
||||||
|
@ -720,6 +727,14 @@ MSG_WriteDeltaEntity(entity_state_t *from,
|
||||||
if ((bits & U_SKIN8) && (bits & U_SKIN16)) /*used for laser colors */
|
if ((bits & U_SKIN8) && (bits & U_SKIN16)) /*used for laser colors */
|
||||||
{
|
{
|
||||||
MSG_WriteLong(msg, to->skinnum);
|
MSG_WriteLong(msg, to->skinnum);
|
||||||
|
|
||||||
|
/* 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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (bits & U_SKIN8)
|
else if (bits & U_SKIN8)
|
||||||
|
|
|
@ -3297,13 +3297,17 @@ misc_flare_use(edict_t *ent, edict_t *other, edict_t *activator)
|
||||||
void
|
void
|
||||||
SP_misc_flare(edict_t* ent)
|
SP_misc_flare(edict_t* ent)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
ent->s.modelindex = 0;
|
ent->s.modelindex = 0;
|
||||||
ent->s.renderfx = RF_FLARE;
|
ent->s.renderfx = RF_FLARE;
|
||||||
ent->solid = SOLID_NOT;
|
ent->solid = SOLID_NOT;
|
||||||
/*
|
|
||||||
* TODO: Add scale field
|
/* Radius saved to scale */
|
||||||
* ent->s.scale = st.radius;
|
for (i = 0; i < 3; i++)
|
||||||
*/
|
{
|
||||||
|
ent->s.scale[i] = st.radius;
|
||||||
|
}
|
||||||
|
|
||||||
if (ent->spawnflags & SPAWNFLAG_FLARE_RED)
|
if (ent->spawnflags & SPAWNFLAG_FLARE_RED)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue