reverted the model scale patch :

see https://github.com/sezero/quakespasm/pull/32 for the issues
associated with it.
This commit is contained in:
Ozkan Sezer 2022-08-11 01:32:00 +03:00
parent b7122a882d
commit e4e914c8a6
11 changed files with 17 additions and 91 deletions

View File

@ -586,9 +586,7 @@ void CL_ParseUpdate (int bits)
else
ent->alpha = ent->baseline.alpha;
if (bits & U_SCALE)
ent->scale = MSG_ReadByte();
else
ent->scale = ent->baseline.scale;
MSG_ReadByte(); // PROTOCOL_RMQ: currently ignored
if (bits & U_FRAME2)
ent->frame = (ent->frame & 0x00FF) | (MSG_ReadByte() << 8);
if (bits & U_MODEL2)
@ -622,7 +620,6 @@ void CL_ParseUpdate (int bits)
}
else
ent->alpha = ent->baseline.alpha;
ent->scale = ENTSCALE_DEFAULT;
}
//johnfitz
@ -684,7 +681,6 @@ void CL_ParseBaseline (entity_t *ent, int version) //johnfitz -- added argument
}
ent->baseline.alpha = (bits & B_ALPHA) ? MSG_ReadByte() : ENTALPHA_DEFAULT; //johnfitz -- PROTOCOL_FITZQUAKE
ent->baseline.scale = (bits & B_SCALE) ? MSG_ReadByte() : ENTSCALE_DEFAULT;
}
@ -924,7 +920,7 @@ void CL_ParseStatic (int version) //johnfitz -- added a parameter
ent->skinnum = ent->baseline.skin;
ent->effects = ent->baseline.effects;
ent->alpha = ent->baseline.alpha; //johnfitz -- alpha
ent->scale = ent->baseline.scale;
VectorCopy (ent->baseline.origin, ent->origin);
VectorCopy (ent->baseline.angles, ent->angles);
R_AddEfrags (ent);

View File

@ -278,7 +278,7 @@ entity_t *CL_NewTempEntity (void)
num_temp_entities++;
cl_visedicts[cl_numvisedicts] = ent;
cl_numvisedicts++;
ent->scale = ENTSCALE_DEFAULT;
ent->colormap = vid.colormap;
return ent;
}

View File

@ -169,7 +169,7 @@ R_AddEfrags
void R_AddEfrags (entity_t *ent)
{
qmodel_t *entmodel;
vec_t scalefactor;
int i;
if (!ent->model)
return;
@ -179,16 +179,11 @@ void R_AddEfrags (entity_t *ent)
r_pefragtopnode = NULL;
entmodel = ent->model;
scalefactor = ENTSCALE_DECODE(ent->scale);
if (scalefactor != 1.0f)
for (i=0 ; i<3 ; i++)
{
VectorMA (ent->origin, scalefactor, entmodel->mins, r_emins);
VectorMA (ent->origin, scalefactor, entmodel->maxs, r_emaxs);
}
else
{
VectorAdd (ent->origin, entmodel->mins, r_emins);
VectorAdd (ent->origin, entmodel->maxs, r_emaxs);
r_emins[i] = ent->origin[i] + entmodel->mins[i];
r_emaxs[i] = ent->origin[i] + entmodel->maxs[i];
}
R_SplitEntityOnNode (cl.worldmodel->nodes);

View File

@ -294,34 +294,21 @@ R_CullModelForEntity -- johnfitz -- uses correct bounds based on rotation
qboolean R_CullModelForEntity (entity_t *e)
{
vec3_t mins, maxs;
vec_t scalefactor, *minbounds, *maxbounds;
if (e->angles[0] || e->angles[2]) //pitch or roll
{
minbounds = e->model->rmins;
maxbounds = e->model->rmaxs;
VectorAdd (e->origin, e->model->rmins, mins);
VectorAdd (e->origin, e->model->rmaxs, maxs);
}
else if (e->angles[1]) //yaw
{
minbounds = e->model->ymins;
maxbounds = e->model->ymaxs;
VectorAdd (e->origin, e->model->ymins, mins);
VectorAdd (e->origin, e->model->ymaxs, maxs);
}
else //no rotation
{
minbounds = e->model->mins;
maxbounds = e->model->maxs;
}
scalefactor = ENTSCALE_DECODE(e->scale);
if (scalefactor != 1.0f)
{
VectorMA (e->origin, scalefactor, minbounds, mins);
VectorMA (e->origin, scalefactor, maxbounds, maxs);
}
else
{
VectorAdd (e->origin, minbounds, mins);
VectorAdd (e->origin, maxbounds, maxs);
VectorAdd (e->origin, e->model->mins, mins);
VectorAdd (e->origin, e->model->maxs, maxs);
}
return R_CullBox (mins, maxs);

View File

@ -1601,23 +1601,12 @@ static void PF_makestatic (void)
}
else
{
eval_t *val;
if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00)
bits |= B_LARGEMODEL;
if ((int)(ent->v.frame) & 0xFF00)
bits |= B_LARGEFRAME;
if (ent->alpha != ENTALPHA_DEFAULT)
bits |= B_ALPHA;
val = GetEdictFieldValue(ent, "scale");
if (val)
ent->scale = ENTSCALE_ENCODE(val->_float);
else
ent->scale = ENTSCALE_DEFAULT;
if (ent->scale != ENTSCALE_DEFAULT)
bits |= B_SCALE;
}
if (bits)
@ -1652,9 +1641,6 @@ static void PF_makestatic (void)
MSG_WriteByte (&sv.signon, ent->alpha);
//johnfitz
if (bits & B_SCALE)
MSG_WriteByte (&sv.signon, ent->scale);
// throw the entity away now
ED_Free (ent);
}

View File

@ -47,7 +47,6 @@ typedef struct edict_s
entity_state_t baseline;
unsigned char alpha; /* johnfitz -- hack to support alpha since it's not part of entvars_t */
unsigned char scale;
qboolean sendinterval; /* johnfitz -- send time until nextthink to client for better lerp timing */
float freetime; /* sv.time when the object was freed */

View File

@ -125,7 +125,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define B_LARGEMODEL (1<<0) // modelindex is short instead of byte
#define B_LARGEFRAME (1<<1) // frame is short instead of byte
#define B_ALPHA (1<<2) // 1 byte, uses ENTALPHA_ENCODE, not sent if ENTALPHA_DEFAULT
#define B_SCALE (1<<3)
//johnfitz
//johnfitz -- PROTOCOL_FITZQUAKE -- alpha encoding
@ -137,10 +136,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ENTALPHA_TOSAVE(a) (((a)==ENTALPHA_DEFAULT)?0.0f:(((a)==ENTALPHA_ZERO)?-1.0f:((float)(a)-1)/(254))) //server convert to float for savegame
//johnfitz
#define ENTSCALE_DEFAULT 16 // Equivalent to float 1.0f due to byte packing.
#define ENTSCALE_ENCODE(a) ((a) ? ((a) * ENTSCALE_DEFAULT) : ENTSCALE_DEFAULT) // Convert to byte
#define ENTSCALE_DECODE(a) ((float)(a) / ENTSCALE_DEFAULT) // Convert to float for rendering
// defaults for clientinfo messages
#define DEFAULT_VIEWHEIGHT 22
@ -262,7 +257,6 @@ typedef struct
unsigned char colormap; //johnfitz -- was int
unsigned char skin; //johnfitz -- was int
unsigned char alpha; //johnfitz -- added
unsigned char scale;
int effects;
} entity_state_t;

View File

@ -637,7 +637,6 @@ void R_DrawAliasModel (entity_t *e)
lerpdata_t lerpdata;
qboolean alphatest = !!(e->model->flags & MF_HOLEY);
float fovscale = 1.0f;
float scalefactor = 1.0f;
//
// setup pose/lerp data -- do it first so we don't miss updates due to culling
@ -660,11 +659,6 @@ void R_DrawAliasModel (entity_t *e)
glPushMatrix ();
R_RotateForEntity (lerpdata.origin, lerpdata.angles);
scalefactor = ENTSCALE_DECODE(e->scale);
if (scalefactor != 1.0f)
{
glScalef (scalefactor, scalefactor, scalefactor);
}
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1] * fovscale, paliashdr->scale_origin[2] * fovscale);
glScalef (paliashdr->scale[0], paliashdr->scale[1] * fovscale, paliashdr->scale[2] * fovscale);
@ -986,7 +980,6 @@ void R_DrawAliasModel_ShowTris (entity_t *e)
{
aliashdr_t *paliashdr;
lerpdata_t lerpdata;
float scalefactor;
if (R_CullModelForEntity(e))
return;
@ -997,11 +990,6 @@ void R_DrawAliasModel_ShowTris (entity_t *e)
glPushMatrix ();
R_RotateForEntity (lerpdata.origin,lerpdata.angles);
scalefactor = ENTSCALE_DECODE(e->scale);
if (scalefactor != 1.0f)
{
glScalef (scalefactor, scalefactor, scalefactor);
}
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2]);
glScalef (paliashdr->scale[0], paliashdr->scale[1], paliashdr->scale[2]);

View File

@ -79,7 +79,6 @@ typedef struct entity_s
// not split
byte alpha; //johnfitz -- alpha
byte scale;
byte lerpflags; //johnfitz -- lerping
float lerpstart; //johnfitz -- animation lerping
float lerptime; //johnfitz -- animation lerping

View File

@ -603,7 +603,6 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
vec3_t org;
float miss;
edict_t *ent;
eval_t *val;
// find the client's PVS
VectorAdd (clent->v.origin, clent->v.view_ofs, org);
@ -641,9 +640,9 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
// johnfitz -- max size for protocol 15 is 18 bytes, not 16 as originally
// assumed here. And, for protocol 85 the max size is actually 24 bytes.
// For float coords and angles the limit is 40.
// For float coords and angles the limit is 39.
// FIXME: Use tighter limit according to protocol flags and send bits.
if (msg->cursize + 40 > msg->maxsize)
if (msg->cursize + 39 > msg->maxsize)
{
//johnfitz -- less spammy overflow message
if (!dev_overflows.packetsize || dev_overflows.packetsize + CONSOLE_RESPAM_TIME < realtime )
@ -696,6 +695,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
if (pr_alpha_supported)
{
// TODO: find a cleaner place to put this code
eval_t *val;
val = GetEdictFieldValue(ent, "alpha");
if (val)
ent->alpha = ENTALPHA_ENCODE(val->_float);
@ -706,18 +706,11 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
continue;
//johnfitz
val = GetEdictFieldValue(ent, "scale");
if (val)
ent->scale = ENTSCALE_ENCODE(val->_float);
else
ent->scale = ENTSCALE_DEFAULT;
//johnfitz -- PROTOCOL_FITZQUAKE
if (sv.protocol != PROTOCOL_NETQUAKE)
{
if (ent->baseline.alpha != ent->alpha) bits |= U_ALPHA;
if (ent->baseline.scale != ent->scale) bits |= U_SCALE;
if (bits & U_FRAME && (int)ent->v.frame & 0xFF00) bits |= U_FRAME2;
if (bits & U_MODEL && (int)ent->v.modelindex & 0xFF00) bits |= U_MODEL2;
if (ent->sendinterval) bits |= U_LERPFINISH;
@ -778,8 +771,6 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
//johnfitz -- PROTOCOL_FITZQUAKE
if (bits & U_ALPHA)
MSG_WriteByte(msg, ent->alpha);
if (bits & U_SCALE)
MSG_WriteByte(msg, ent->scale);
if (bits & U_FRAME2)
MSG_WriteByte(msg, (int)ent->v.frame >> 8);
if (bits & U_MODEL2)
@ -1240,14 +1231,12 @@ void SV_CreateBaseline (void)
svent->baseline.colormap = entnum;
svent->baseline.modelindex = SV_ModelIndex("progs/player.mdl");
svent->baseline.alpha = ENTALPHA_DEFAULT; //johnfitz -- alpha support
svent->baseline.scale = ENTSCALE_DEFAULT;
}
else
{
svent->baseline.colormap = 0;
svent->baseline.modelindex = SV_ModelIndex(PR_GetString(svent->v.model));
svent->baseline.alpha = svent->alpha; //johnfitz -- alpha support
svent->baseline.scale = svent->scale;
}
//johnfitz -- PROTOCOL_FITZQUAKE
@ -1259,7 +1248,6 @@ void SV_CreateBaseline (void)
if (svent->baseline.frame & 0xFF00)
svent->baseline.frame = 0;
svent->baseline.alpha = ENTALPHA_DEFAULT;
svent->baseline.scale = ENTSCALE_DEFAULT;
}
else //decide which extra data needs to be sent
{
@ -1269,8 +1257,6 @@ void SV_CreateBaseline (void)
bits |= B_LARGEFRAME;
if (svent->baseline.alpha != ENTALPHA_DEFAULT)
bits |= B_ALPHA;
if (svent->baseline.scale != ENTSCALE_DEFAULT)
bits |= B_SCALE;
}
//johnfitz
@ -1313,9 +1299,6 @@ void SV_CreateBaseline (void)
if (bits & B_ALPHA)
MSG_WriteByte (&sv.signon, svent->baseline.alpha);
//johnfitz
if (bits & B_SCALE)
MSG_WriteByte (&sv.signon, svent->baseline.scale);
}
}

View File

@ -822,7 +822,6 @@ void V_CalcRefdef (void)
view->model = cl.model_precache[cl.stats[STAT_WEAPON]];
view->frame = cl.stats[STAT_WEAPONFRAME];
view->colormap = vid.colormap;
view->scale = ENTSCALE_DEFAULT;
//johnfitz -- v_gunkick
if (v_gunkick.value == 1) //original quake kick