From b72492afd305de0823d04ad2a5642b778e4b87eb Mon Sep 17 00:00:00 2001 From: Maddes Buecher Date: Sun, 20 Aug 2000 19:47:37 +0000 Subject: [PATCH] EndFrame function by FrikaC/Maddes --- include/progs.h | 2 ++ source/pr_edict.c | 9 +++++++++ source/sv_phys.c | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/include/progs.h b/include/progs.h index a832042..c79b5e9 100644 --- a/include/progs.h +++ b/include/progs.h @@ -139,6 +139,8 @@ extern qboolean pr_trace; extern dfunction_t *pr_xfunction; extern int pr_xstatement; +extern func_t EndFrame; // 2000-01-02 EndFrame function by Maddes/FrikaC + extern func_t SpectatorConnect; extern func_t SpectatorThink; extern func_t SpectatorDisconnect; diff --git a/source/pr_edict.c b/source/pr_edict.c index 08b0231..bfea914 100644 --- a/source/pr_edict.c +++ b/source/pr_edict.c @@ -76,6 +76,8 @@ typedef struct { static gefv_cache gefvCache[GEFV_CACHESIZE] = {{NULL, ""}, {NULL, ""}}; +func_t EndFrame; // 2000-01-02 EndFrame function by Maddes/FrikaC + func_t SpectatorConnect; func_t SpectatorThink; func_t SpectatorDisconnect; @@ -1090,6 +1092,13 @@ void PR_LoadProgs (void) if ((f = ED_FindFunction ("SpectatorDisconnect")) != NULL) SpectatorDisconnect = (func_t)(f - pr_functions); +// 2000-01-02 EndFrame function by Maddes/FrikaC start + EndFrame = 0; + + if ((f = ED_FindFunction ("EndFrame")) != NULL) + EndFrame = (func_t)(f - pr_functions); +// 2000-01-02 EndFrame function by Maddes/FrikaC end + // LordHavoc: Ender added this FindEdictFieldOffsets(); } diff --git a/source/sv_phys.c b/source/sv_phys.c index 5b8c9bd..3d2b439 100644 --- a/source/sv_phys.c +++ b/source/sv_phys.c @@ -1084,6 +1084,17 @@ SV_Physics ( void ) if (pr_global_struct->force_retouch) pr_global_struct->force_retouch--; + +// 2000-01-02 EndFrame function by Maddes/FrikaC start + if (EndFrame) + { + // let the progs know that the frame has ended + pr_global_struct->self = EDICT_TO_PROG(sv.edicts); + pr_global_struct->other = EDICT_TO_PROG(sv.edicts); + pr_global_struct->time = sv.time; + PR_ExecuteProgram (EndFrame); + } +// 2000-01-02 EndFrame function by Maddes/FrikaC end } void