From 43a85fb24f9ddbe5f9fd0389e25fc529f93c207f Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 21 Apr 2022 03:25:24 +0300 Subject: [PATCH] added PR_PatchRereleaseBuiltins for Quake 2021 rerelease update 1, and removed the relevant centerprint, bprint, and sprint entries from pr_builtins[]. cherry-picked from the original patch for vkQuake by Andrei Drexler --- Quake/pr_cmds.c | 3 --- Quake/pr_edict.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Quake/pr_cmds.c b/Quake/pr_cmds.c index 8bb86770..e202b05f 100644 --- a/Quake/pr_cmds.c +++ b/Quake/pr_cmds.c @@ -1814,9 +1814,6 @@ static builtin_t pr_builtin[] = PF_Fixme, // void draw_worldtext (string s, vector origin, float size, float lifetime, float depthtest) = #87 PF_Fixme, // void draw_sphere (vector origin, float radius, float colormap, float lifetime, float depthtest) = #88 PF_Fixme, // void draw_cylinder (vector origin, float halfHeight, float radius, float colormap, float lifetime, float depthtest) = #89 - PF_centerprint , // #90 - PF_bprint, - PF_sprint, }; builtin_t *pr_builtins = pr_builtin; diff --git a/Quake/pr_edict.c b/Quake/pr_edict.c index 1ce58f18..e42b1fa8 100644 --- a/Quake/pr_edict.c +++ b/Quake/pr_edict.c @@ -1073,6 +1073,27 @@ static int PR_FindSupportedEffects (void) } +/* +=============== +PR_PatchRereleaseBuiltins + +Quake 2021 release update 1 adds bprint/sprint/centerprint builtins with new id's +(see https://steamcommunity.com/games/2310/announcements/detail/2943653788150871156) +This function patches them back to use the old indices +=============== +*/ +static void PR_PatchRereleaseBuiltins (void) +{ + dfunction_t *f; + if ((f = ED_FindFunction ("centerprint")) != NULL && f->first_statement == -90) + f->first_statement = -73; + if ((f = ED_FindFunction ("bprint")) != NULL && f->first_statement == -91) + f->first_statement = -23; + if ((f = ED_FindFunction ("sprint")) != NULL && f->first_statement == -92) + f->first_statement = -24; +} + + /* =============== PR_LoadProgs @@ -1178,6 +1199,7 @@ void PR_LoadProgs (void) pr_edict_size += sizeof(void *) - 1; pr_edict_size &= ~(sizeof(void *) - 1); + PR_PatchRereleaseBuiltins (); pr_effects_mask = PR_FindSupportedEffects (); }