Skip to content

Commit

Permalink
ANTILAG: Reki's CSQC antilag.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsvensson committed Nov 16, 2024
1 parent 0f1b012 commit 3683b20
Show file tree
Hide file tree
Showing 12 changed files with 1,553 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ set(client_headers
${SOURCE_DIR}/ez_scrollpane.h
${SOURCE_DIR}/ez_slider.h
${SOURCE_DIR}/ez_window.h
${SOURCE_DIR}/ezcsqc.h
${SOURCE_DIR}/fchecks.h
${SOURCE_DIR}/fmod.h
${SOURCE_DIR}/fonts.h
Expand Down Expand Up @@ -642,6 +643,7 @@ set(client
${SOURCE_DIR}/cl_cmd.c
${SOURCE_DIR}/cl_demo.c
${SOURCE_DIR}/cl_ents.c
${SOURCE_DIR}/cl_ezcsqc.c
${SOURCE_DIR}/cl_input.c
${SOURCE_DIR}/cl_main.c
${SOURCE_DIR}/cl_multiview.c
Expand Down
60 changes: 60 additions & 0 deletions src/cl_ents.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "qmb_particles.h"
#include "rulesets.h"
#include "teamplay.h"
#ifdef MVD_PEXT1_EZCSQC
#include "ezcsqc.h"
#endif

static int MVD_TranslateFlags(int src);
void TP_ParsePlayerInfo(player_state_t *, player_state_t *, player_info_t *info);
Expand Down Expand Up @@ -1635,6 +1638,60 @@ void CL_ParsePlayerinfo (void)
SetupPlayerEntity(num + 1, state);
}

// #ifdef MVD_PEXT1_EZCSQC
void CL_EZCSQC_ParseEntities(void)
{
ezcsqc_entity_t *ent;
unsigned int entnum;
qbool removeflag;
qbool is_new;
int amt = 0;

Check warning on line 1648 in src/cl_ents.c

View workflow job for this annotation

GitHub Actions / macos-build (arm64)

variable 'amt' set but not used [-Wunused-but-set-variable]

Check warning on line 1648 in src/cl_ents.c

View workflow job for this annotation

GitHub Actions / macos-build (x64)

variable 'amt' set but not used [-Wunused-but-set-variable]

ezcsqc.active = true;

for(;;)
{
entnum = (unsigned short)MSG_ReadShort();
removeflag = !!(entnum & 0x8000);
entnum &= ~0x8000;

if ((!entnum && !removeflag) || msg_badread)
break;

amt++;

is_new = false;
if (removeflag)
{ //remove
ent = ezcsqc_networkedents[entnum];
ezcsqc_networkedents[entnum] = NULL;

if (!ent) //wtf, server is gaslighting us or something catastophic happened
continue;

CL_EZCSQC_Ent_Remove(ent);
// traditionally we would leave the cleanup to CSQC, but since we're faking all this
// we just kinda call one function. any further cleanup behavior can be jammed into that function.
}
else
{
ent = ezcsqc_networkedents[entnum];
if (ent == NULL)
{
ent = CL_EZCSQC_Ent_Spawn();
ezcsqc_networkedents[entnum] = ent;

ent->entnum = entnum;
is_new = true;
}

CL_EZCSQC_Ent_Update(ent, is_new);
}
}
}
// #endif


// Called when the CTF flags are set
void CL_AddFlagModels (entity_t *ent, int team)
{
Expand Down Expand Up @@ -2237,6 +2294,9 @@ void CL_EmitEntities (void)
}

CL_UpdateTEnts();
#ifdef MVD_PEXT1_EZCSQC
CL_EZCSQC_UpdateView();
#endif
}

int mvd_fixangle;
Expand Down
Loading

0 comments on commit 3683b20

Please sign in to comment.