Skip to content

Commit

Permalink
General cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Jun 13, 2022
1 parent 2169d02 commit 1947981
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 203 deletions.
13 changes: 6 additions & 7 deletions common/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ entity_t cl_visedicts[MAX_VISEDICTS];
int
CL_PlayerEntity(const entity_t *e)
{
ptrdiff_t offset;
int i;

/* might be a pointer directly into cl_entities... */
offset = e - cl_entities;
ptrdiff_t offset = e - cl_entities;
if (offset >= 1 && offset <= cl.maxclients)
return offset;

Expand Down Expand Up @@ -422,16 +420,15 @@ CL_RelinkEntities
*/
void CL_RelinkEntities(void)
{
int i;
entity_t *ent;
int i, j;
float frac, f, d;
float f, d;
vec3_t delta;
float bobjrotate;
vec3_t oldorg;
dlight_t *dl;

/* determine partial update time */
frac = CL_LerpPoint();
float frac = CL_LerpPoint();

cl_numvisedicts = 0;

Expand All @@ -442,6 +439,7 @@ void CL_RelinkEntities(void)

if (cls.demoplayback)
{
int j;
/* interpolate the angles */
for (j = 0; j < 3; j++)
{
Expand Down Expand Up @@ -493,6 +491,7 @@ void CL_RelinkEntities(void)
}
else
{
uint8_t j;
f = frac;
for (j = 0; j < 3; j++)
{
Expand Down
43 changes: 18 additions & 25 deletions common/cl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ static int CL_ReadSoundNum(int field_mask)
{
switch (cl.protocol)
{
case PROTOCOL_VERSION_FITZ:
if (field_mask & SND_FITZ_LARGESOUND)
return (unsigned short)MSG_ReadShort();
/* fall-through */
case PROTOCOL_VERSION_NQ:
case PROTOCOL_VERSION_BJP:
return MSG_ReadByte();
case PROTOCOL_VERSION_BJP2:
case PROTOCOL_VERSION_BJP3:
return (unsigned short)MSG_ReadShort();
case PROTOCOL_VERSION_FITZ:
if (field_mask & SND_FITZ_LARGESOUND)
return (unsigned short)MSG_ReadShort();
else
return MSG_ReadByte();
default:
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
cl.protocol);
Expand All @@ -96,20 +95,16 @@ CL_ParseStartSoundPacket(void)
vec3_t pos;
int channel, ent;
int sound_num;
int volume;
float attenuation;
int i;
int field_mask = MSG_ReadByte();
int field_mask = MSG_ReadByte();
int volume = DEFAULT_SOUND_PACKET_VOLUME;
float attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;

if (field_mask & SND_VOLUME)
volume = MSG_ReadByte();
else
volume = DEFAULT_SOUND_PACKET_VOLUME;

if (field_mask & SND_ATTENUATION)
attenuation = MSG_ReadByte() / 64.0;
else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;

if (cl.protocol == PROTOCOL_VERSION_FITZ && (field_mask & SND_FITZ_LARGEENTITY))
{
Expand Down Expand Up @@ -335,16 +330,16 @@ static int CL_ReadModelIndex(unsigned int bits)
{
switch (cl.protocol)
{
case PROTOCOL_VERSION_FITZ:
if (bits & B_FITZ_LARGEMODEL)
return MSG_ReadShort();
/* fall-through */
case PROTOCOL_VERSION_NQ:
return MSG_ReadByte();
case PROTOCOL_VERSION_BJP:
case PROTOCOL_VERSION_BJP2:
case PROTOCOL_VERSION_BJP3:
return MSG_ReadShort();
case PROTOCOL_VERSION_FITZ:
if (bits & B_FITZ_LARGEMODEL)
return MSG_ReadShort();
return MSG_ReadByte();
default:
break;
}
Expand All @@ -358,15 +353,15 @@ static int CL_ReadModelFrame(unsigned int bits)
{
switch (cl.protocol)
{
case PROTOCOL_VERSION_FITZ:
if (bits & B_FITZ_LARGEFRAME)
return MSG_ReadShort();
/* fall-through */
case PROTOCOL_VERSION_NQ:
case PROTOCOL_VERSION_BJP:
case PROTOCOL_VERSION_BJP2:
case PROTOCOL_VERSION_BJP3:
return MSG_ReadByte();
case PROTOCOL_VERSION_FITZ:
if (bits & B_FITZ_LARGEFRAME)
return MSG_ReadShort();
return MSG_ReadByte();
default:
break;
}
Expand Down Expand Up @@ -502,9 +497,6 @@ CL_ParseUpdate(unsigned int bits)
ent->msg_angles[0][2] = ent->baseline.angles[2];

if (cl.protocol == PROTOCOL_VERSION_FITZ) {
if (bits & U_NOLERP) {
// FIXME - TODO (called U_STEP in FQ)
}
if (bits & U_FITZ_ALPHA) {
MSG_ReadByte(); // FIXME - TODO
}
Expand Down Expand Up @@ -744,8 +736,9 @@ CL_NewTranslation(int slot)
top = cl.players[slot].topcolor;
bottom = cl.players[slot].bottomcolor;

for (i = 0; i < VID_GRADES; i++, dest += 256, source += 256) {
if (top < 128) // the artists made some backwards ranges. sigh.
for (i = 0; i < VID_GRADES; i++, dest += 256, source += 256)
{
if (top < 128) // the artists made some backwards ranges. sigh.
memcpy(dest + TOP_RANGE, source + top, 16);
else
for (j = 0; j < 16; j++)
Expand Down
6 changes: 1 addition & 5 deletions common/cl_tent.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ CL_ParseBeam(model_t *m)
return;
}
}
Con_Printf("beam list overflow!\n");
}

/*
Expand All @@ -131,14 +130,11 @@ CL_ParseTEnt
void
CL_ParseTEnt(void)
{
int type;
vec3_t pos;

dlight_t *dl;
int rnd;
int colorStart, colorLength;

type = MSG_ReadByte();
int type = MSG_ReadByte();
switch (type)
{
case TE_WIZSPIKE: // spike hitting wall
Expand Down
Loading

0 comments on commit 1947981

Please sign in to comment.