Add Scale support.

This commit is contained in:
Steam Deck User 2022-12-22 17:52:45 -05:00
parent e5513fb25e
commit 77488595d1
6 changed files with 39 additions and 8 deletions

View file

@ -617,6 +617,12 @@ void CL_ParseUpdate (int bits)
ent->msg_angles[0][2] = MSG_ReadAngle();
else
ent->msg_angles[0][2] = ent->baseline.angles[2];
if (bits & U_SCALE)
ent->scale = MSG_ReadFloat();
else
ent->scale = 1;
// Tomaz - QC Alpha Scale Glow Begin
if (bits & U_RENDERAMT)
ent->renderamt = MSG_ReadFloat();
@ -669,6 +675,7 @@ void CL_ParseBaseline (entity_t *ent)
ent->baseline.frame = MSG_ReadByte ();
ent->baseline.colormap = MSG_ReadByte();
ent->baseline.skin = MSG_ReadByte();
ent->baseline.scale = MSG_ReadFloat();
for (i=0 ; i<3 ; i++)
{
ent->baseline.origin[i] = MSG_ReadCoord ();
@ -1036,6 +1043,7 @@ void CL_ParseStatic (void)
ent->colormap = vid.colormap;
ent->skinnum = ent->baseline.skin;
ent->effects = ent->baseline.effects;
ent->scale = ent->baseline.scale;
VectorCopy (ent->baseline.origin, ent->origin);
VectorCopy (ent->baseline.angles, ent->angles);

View file

@ -51,6 +51,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define U_EXTEND2 (1<<21) // another byte to follow
#define U_FRAMETIME (1<<22) // another byte to follow
// Tomaz - QC Alpha Scale Glow Control End
#define U_SCALE (1<<23)
#define SU_VIEWHEIGHT (1<<0)

View file

@ -373,14 +373,6 @@ void R_RotateForEntity (entity_t *e, int shadow)
e->origin[0], e->origin[1], e->origin[2]
};
sceGumTranslate(&translation);
/*
// Scale.
const ScePspFVector3 scale =
{
e->scale, e->scale, e->scale
};
sceGumScale(&scale);
*/
// Rotate.
sceGumRotateZ(e->angles[YAW] * (GU_PI / 180.0f));
@ -390,6 +382,15 @@ void R_RotateForEntity (entity_t *e, int shadow)
sceGumRotateX (e->angles[ROLL] * (GU_PI / 180.0f));
}
// Scale.
if (e != &cl.viewent && e != &cl.viewent2) {
const ScePspFVector3 scale =
{
e->scale, e->scale, e->scale
};
sceGumScale(&scale);
}
sceGumUpdateMatrix();
}

View file

@ -211,6 +211,7 @@ typedef struct
int colormap;
int skin;
int effects;
float scale;
// dr_mabuse1981: HalfLife rendermodes fixed START
unsigned short renderamt;
unsigned short rendermode;

View file

@ -61,6 +61,10 @@ typedef struct entity_s
float rendercolor[3];
//Crow_bar
// motolegacy -- scale shit from FTE
float scale; /* Multiplier that resizes the entity. 1 is normal sized, 2 is double sized. scale 0 is remapped to 1. In SSQC, this is limited to 1/16th precision, with a maximum just shy of 16.*/
// motolegacy -- end scale
struct model_s *model; // NULL = no model
char old_model[128]; // NULL = no model
struct efrag_s *efrag; // linked list of efrags

View file

@ -514,6 +514,17 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg, qboolean nomap)
if (ent->baseline.modelindex != ent->v.modelindex)
bits |= U_MODEL;
if (ent->baseline.scale != ent->v.scale) {
if (ent->v.scale == 0)
ent->v.scale = 1;
if (ent->v.scale > 16)
ent->v.scale = 16;
bits |= U_SCALE;
}
// Tomaz - QC Alpha Scale Glow Begin
{
@ -611,6 +622,8 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg, qboolean nomap)
MSG_WriteCoord (msg, ent->v.origin[2]);
if (bits & U_ANGLE3)
MSG_WriteAngle(msg, ent->v.angles[2]);
if (bits & U_SCALE)
MSG_WriteFloat(msg, ent->v.scale);
// Tomaz - QC Alpha Scale Glow Begin
if (bits & U_RENDERAMT)
MSG_WriteFloat(msg, renderamt);
@ -1034,11 +1047,13 @@ void SV_CreateBaseline (void)
if (entnum > 0 && entnum <= svs.maxclients)
{
svent->baseline.colormap = entnum;
svent->baseline.scale = 1;
svent->baseline.modelindex = SV_ModelIndex("models/player.mdl");
}
else
{
svent->baseline.colormap = 0;
svent->baseline.scale = 1;
svent->baseline.modelindex =
SV_ModelIndex(pr_strings + svent->v.model);
}
@ -1053,6 +1068,7 @@ void SV_CreateBaseline (void)
MSG_WriteByte (&sv.signon, svent->baseline.frame);
MSG_WriteByte (&sv.signon, svent->baseline.colormap);
MSG_WriteByte (&sv.signon, svent->baseline.skin);
MSG_WriteFloat (&sv.signon, svent->baseline.scale);
for (i=0 ; i<3 ; i++)
{
MSG_WriteCoord(&sv.signon, svent->baseline.origin[i]);