From 634fd7cb7e974d25c410264bbcdc1f3c0cf2420c Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 20 Aug 2021 11:34:41 +0000 Subject: [PATCH] Try to work around some remastered-quake compat issues. Still need to deal with the string non-concat issue properly. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6028 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/world.h | 3 ++- engine/server/net_preparse.c | 8 +++++++ engine/server/pr_cmds.c | 43 ++++++++++++++++++++++++++++++++++++ engine/server/sv_phys.c | 6 ++--- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/engine/common/world.h b/engine/common/world.h index 8e34e0a76..fa4215379 100644 --- a/engine/common/world.h +++ b/engine/common/world.h @@ -108,7 +108,7 @@ typedef struct q2trace_s #define FL_PARTIALGROUND (1<<10) // not all corners are valid #define FL_WATERJUMP (1<<11) // player jumping out of water #define FL_JUMPRELEASED (1<<12) - //13 +#define FLRM_ISBOT (1<<13) #define FL_FINDABLE_NONSOLID (1<<14) //a cpqwsv feature #define FL_MOVECHAIN_ANGLE (1<<15) // hexen2 - when in a move chain, will update the angle #define FLQW_LAGGEDMOVE (1<<16) @@ -222,6 +222,7 @@ struct world_s qboolean usesolidcorpse; //to disable SOLID_CORPSE when running hexen2 due to conflict. model_t *worldmodel; unsigned int spawncount; //number of times it got restarted, so we can stop events from happening after vm restarts + qboolean remasterlogic; //workarounds needed #ifdef USEAREAGRID vec2_t gridbias; diff --git a/engine/server/net_preparse.c b/engine/server/net_preparse.c index 3895d8bc9..9cf6e44a5 100644 --- a/engine/server/net_preparse.c +++ b/engine/server/net_preparse.c @@ -601,6 +601,8 @@ static int te_515sevilhackworkaround; #define svcdp_showlmp 35 // [string] slotname [string] lmpfilename [short] x [short] y #define svcdp_hidelmp 36 // [string] slotname +#define svcrm_acheesement 52 // [string] codename + //#define TE_RAILTRAIL_NEH 15 // [vector] origin [coord] red [coord] green [coord] blue (fixme: ignored) #define TE_EXPLOSION3_NEH 16 // [vector] origin [coord] red [coord] green [coord] blue (fixme: ignored) #define TE_LIGHTNING4_NEH 17 // [string] model [entity] entity [vector] start [vector] end @@ -1138,6 +1140,10 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw) data = svcqw_updatestatlong; //ho hum... let it through (should check size later.) protocollen = 6; break; + case svcrm_acheesement: + ignoreprotocol = true; + nullterms = 1; + break; case svc_stufftext: case svc_centerprint: nullterms = 1; @@ -1395,6 +1401,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw) break; } break; + case svcrm_acheesement: case svc_updatename: case svc_stufftext: case svc_centerprint: @@ -1412,6 +1419,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw) case svc_updatename: if (bufferlen < 2) break; //don't truncate the name if the mod is sending the slot number + case svcrm_acheesement: case svc_stufftext: case svc_centerprint: case svc_cutscene: diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 557916f34..4ab379902 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -1303,6 +1303,13 @@ static progsnum_t AddProgs(const char *name) buttonfields[i].offset = -1; } + if (num == 0) + if (PR_FindGlobal(svprogfuncs, "MOVETYPE_GIB", 0, NULL) || + PR_FindGlobal(svprogfuncs, "SVC_ACHIEVEMENT", 0, NULL) || + PR_FindGlobal(svprogfuncs, "finaleFinished", 0, NULL)) + sv.world.remasterlogic = true; + + if ((f = PR_FindFunction (svprogfuncs, "VersionChat", num ))) { pr_globals = PR_globals(svprogfuncs, num); @@ -2306,6 +2313,16 @@ void Q_InitProgs(enum initprogs_e flags) #endif World_RBE_Start(&sv.world); + + if (sv.world.remasterlogic) + { + PR_EnableEBFSBuiltin("bprints", 23); + PR_EnableEBFSBuiltin("sprints", 24); + PR_EnableEBFSBuiltin("centerprints", 73); + PR_EnableEBFSBuiltin("finaleFinished", 79); + PR_EnableEBFSBuiltin("localsound_remaster", 80); + Con_Printf(CON_WARNING "Remastered quakec detected (this is not fool-proof), compat workarounds have been enabled\n"); + } } qboolean PR_QCChat(char *text, int say_type) @@ -10705,6 +10722,26 @@ static void QCBUILTIN PF_setpause(pubprogfuncs_t *prinst, struct globalvars_s *p } } +/*builtins to work around the remastered edition of quake.*/ +void PF_finaleFinished(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ //undocumented. just stub it for now. this will probably break coop games that killed shub. + G_FLOAT(OFS_RETURN) = false; +} +void PF_localsound_remaster(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ //undocumented. just stub it. +} +void PF_centerprints(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ //TODO: send the strings to the client for localisation+reordering + PF_centerprint(prinst, pr_globals); +} +void PF_sprints(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ //TODO: send the strings to the client for localisation+reordering. + PF_sprint(prinst, pr_globals); +} +void PF_bprints(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ //TODO: send the strings to the client for localisation+reordering + PF_bprint(prinst, pr_globals); +} #define STUB ,NULL,true #if defined(DEBUG) || defined(_DEBUG) @@ -10858,8 +10895,11 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs //both bprint and sprint accept different arguments in QW vs NQ/H2 {"bprint", PF_bprint, 23, 0, 23, 0, D("void(string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7, optional string s8)", "NQ: Concatenates all arguments, and prints the messsage on the console of all connected clients.")}, {"bprint", PF_bprint, 0, 23, 0, 0, D("void(float msglvl, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7)", "QW: Concatenates all string arguments, and prints the messsage on the console of only all clients who's 'msg' infokey is set lower or equal to the supplied 'msglvl' argument.")}, + {"bprints", PF_bprints, 0, 0, 0, 0, D("void(string s, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6)", "Remaster: Sends the strings to all clients, which will order them according to {#}. Also substitutes localised strings for $NAME strings.")}, {"sprint", PF_sprint, 24, 0, 24, 0, D("void(entity client, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7)", "NQ: Concatenates all string arguments, and prints the messsage on the named client's console")}, {"sprint", PF_sprint, 0, 24, 0, 0, D("void(entity client, float msglvl, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6)", "QW: Concatenates all string arguments, and prints the messsage on the named client's console, but only if that client's 'msg' infokey is set lower or equal to the supplied 'msglvl' argument.")}, + {"sprints", PF_sprints, 0, 0, 0, 0, D("void(entity client, string s, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5)", "Remaster: Sends the strings to the client, which will order according to {#}. Also substitutes localised strings for $NAME strings.")}, + #ifdef HAVE_LEGACY //these have subtly different behaviour, and are implemented using different internal builtins, which is a bit weird in the extensions file. documentation is documentation. {"dprint", PF_dprint, 25, 0, 25, 0, D("void(string s, ...)", "NQ: Prints the given message on the server's console, but only if the developer cvar is set. Arguments will be concatenated into a single message.")}, @@ -10943,6 +10983,7 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs {"cvar_set", PF_cvar_set, 72, 72, 72, 0, D("void(string cvarname, string valuetoset)", "Instantly sets a cvar to the given string value. Warning: the resulting string includes apostrophies surrounding the result. You may wish to use sprintf instead.")}, //72 {"centerprint", PF_centerprint, 73, 73, 73, 0, "void(entity ent, string text, optional string text2, optional string text3, optional string text4, optional string text5, optional string text6, optional string text7)"}, //73 + {"centerprints", PF_centerprints, 0, 0, 0, 0, D("void(entity ent, string text, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5)", "Remaster: Sends the strings to the client, which will order according to {#}. Also substitutes localised strings for $NAME strings.")}, {"ambientsound", PF_ambientsound, 74, 74, 74, 0, "void (vector pos, string samp, float vol, float atten)"}, //74 @@ -10952,6 +10993,8 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs {"setspawnparms", PF_setspawnparms, 78, 78, 78, 0, "void(entity player)"}, //78 {"logfrag", PF_logfrag, 0, 79, 0, 79, "void(entity killer, entity killee)"}, //79 + {"finaleFinished", PF_finaleFinished, 0, 0, 0, 0, D("DEP float()", "Behaviour is undocumented.")}, + {"localsound_remaster",PF_localsound_remaster,0,0, 0, 0, D("DEP void()", "Behaviour is undocumented.")}, // Tomaz - QuakeC String Manipulation Begin {"tq_zone", PF_strzone, 0, 0, 0, 79, D("DEP string(string s)",NULL), true}, //79 diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index e8f55d2e5..3c41acbcd 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -584,7 +584,7 @@ static void WPhys_AddGravity (world_t *w, wedict_t *ent, const float *gravitydir { float scale = ent->xv->gravity; if (!scale) - scale = 1.0; + scale = (ent->v->movetype == MOVETYPE_BOUNCEMISSILE)?0.5:1.0; VectorMA(ent->v->velocity, scale * movevars.gravity * host_frametime, gravitydir, ent->v->velocity); } @@ -1367,7 +1367,7 @@ static void WPhys_Physics_Toss (world_t *w, wedict_t *ent) if (ent->v->movetype != MOVETYPE_FLY && ent->v->movetype != MOVETYPE_FLY_WORLDONLY && ent->v->movetype != MOVETYPE_FLYMISSILE - && ent->v->movetype != MOVETYPE_BOUNCEMISSILE + && (ent->v->movetype != MOVETYPE_BOUNCEMISSILE || w->remasterlogic/*gib*/) && ent->v->movetype != MOVETYPE_H2SWIM) WPhys_AddGravity (w, ent, gravitydir); @@ -1421,7 +1421,7 @@ static void WPhys_Physics_Toss (world_t *w, wedict_t *ent) // else if (progstype == PROG_H2 && ent->v->solid == SOLID_PHASEH2 && ((int)((wedict_t*)trace.ent)->v->flags & (FL_MONSTER|FL_CLIENT))) // backoff = 0; else - backoff = 2; + backoff = w->remasterlogic?1.5/*gib...*/:2; } else backoff = 1;