Skip to content

Commit

Permalink
Revert "SV_Physics_Pusher : Add the edicts created on-the-fly by PR_E…
Browse files Browse the repository at this point in the history
…xecuteProgram to the cache"

Turns out this seems to work much better without, see Rotting Jam map rotj_nickster (?)

This reverts commit 94b34f5.
  • Loading branch information
vsonnier committed Sep 9, 2024
1 parent d8d896e commit 09bb618
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 49 deletions.
21 changes: 0 additions & 21 deletions Quake/pr_edict.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ cvar_t saved2 = {"saved2", "0", CVAR_ARCHIVE};
cvar_t saved3 = {"saved3", "0", CVAR_ARCHIVE};
cvar_t saved4 = {"saved4", "0", CVAR_ARCHIVE};

// the one and only allocation callback, no need for more for now...
static ed_allocation_callback_t THE_ONE_ALLOC_CALLBACK = NULL;

void ED_SetAllocCallback (ed_allocation_callback_t callback)
{
THE_ONE_ALLOC_CALLBACK = callback;
}

ed_allocation_callback_t ED_GetAllocCallback (void)
{
return THE_ONE_ALLOC_CALLBACK;
}

/*
=================
ED_Alloc
Expand Down Expand Up @@ -91,10 +78,6 @@ edict_t *ED_Alloc (void)
if (qcvm->free_list.size == 0)
qcvm->free_list.head_index = 0;

// notify the callback:
if (THE_ONE_ALLOC_CALLBACK)
THE_ONE_ALLOC_CALLBACK (e);

return e;
}

Expand All @@ -107,10 +90,6 @@ edict_t *ED_Alloc (void)

e->baseline = nullentitystate;

// notify the callback:
if (THE_ONE_ALLOC_CALLBACK)
THE_ONE_ALLOC_CALLBACK (e);

return e;
}

Expand Down
7 changes: 0 additions & 7 deletions Quake/progs.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,11 @@ void PR_ClearEngineString (int num);

void PR_Profile_f (void);

// Allocation functions
edict_t *ED_Alloc (void);
void ED_Free (edict_t *ed);
void ED_RemoveFromFreeList (edict_t *ed);
void ED_RebuildFreeList (bool force_free_reuse);

// allocation event callback, triggered on ED_Alloc(void), passing the newly allocated edict
typedef void (*ed_allocation_callback_t) (edict_t *);

void ED_SetAllocCallback (ed_allocation_callback_t callback);
ed_allocation_callback_t ED_GetAllocCallback (void);

void ED_Print (edict_t *ed);
void ED_Write (FILE *f, edict_t *ed);
const char *ED_ParseEdict (const char *data, edict_t *ent);
Expand Down
21 changes: 0 additions & 21 deletions Quake/sv_phys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1233,16 +1233,6 @@ static void SV_Physics_Step (edict_t *ent)

//============================================================================

static void intercept_allocs_in_pr_execute_program (edict_t *e)
{
assert (!e->free);

pushable_ent_cache[num_pushable_ent_cache++] = e;

if (developer.value)
Con_DPrintf ("SV_PushMove(): allocated EDICT %d\n", NUM_FOR_EDICT (e));
}

/*
================
SV_Physics
Expand Down Expand Up @@ -1300,9 +1290,6 @@ void SV_Physics (void)
else
entity_cap = qcvm->num_edicts;

// backup the previous callback before iterating:
ed_allocation_callback_t previous_callback = ED_GetAllocCallback ();

// fill the pushable entities cache
if (sv_fastpushmove.value > 0.f)
{
Expand All @@ -1318,9 +1305,6 @@ void SV_Physics (void)

pushable_ent_cache[num_pushable_ent_cache++] = check;
}

// plug ours:
ED_SetAllocCallback (intercept_allocs_in_pr_execute_program);
}

// for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
Expand Down Expand Up @@ -1364,11 +1348,6 @@ void SV_Physics (void)
}
// johnfitz
}
if (sv_fastpushmove.value > 0.f)
{
// restore previous callback:
ED_SetAllocCallback (previous_callback);
}

if (pr_global_struct->force_retouch)
pr_global_struct->force_retouch--;
Expand Down

0 comments on commit 09bb618

Please sign in to comment.