diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 29a64b6..d76a2c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,12 +25,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v1.1.3 - name: Build and Run unittests run: | @@ -70,7 +70,7 @@ jobs: move msvc\${{ env.buildRelease }}\director.pdb publish\debug\director.pdb - name: Deploy artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3.1.1 with: name: win32 path: publish/* @@ -92,7 +92,7 @@ jobs: steps: - name: Deploying windows artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: win32 @@ -155,7 +155,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -228,7 +228,7 @@ jobs: shell: bash - name: Deploy artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3.1.1 id: upload-job with: name: linux32 @@ -247,12 +247,12 @@ jobs: steps: - name: Deploying linux artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: linux32 - name: Deploying windows artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: win32 diff --git a/rehlds/engine/cmd.cpp b/rehlds/engine/cmd.cpp index 7dcf76c..a49df84 100644 --- a/rehlds/engine/cmd.cpp +++ b/rehlds/engine/cmd.cpp @@ -235,7 +235,8 @@ void Cbuf_Execute(void) } // execute the command line - Cmd_ExecuteString(line, src_command); + if (line[0]) + Cmd_ExecuteString(line, src_command); if (cmd_wait) { @@ -406,17 +407,12 @@ void Cmd_Exec_f(void) else { char *pszDataPtr = configContents; - while (true) + while (pszDataPtr && *pszDataPtr) { Cbuf_Execute(); // TODO: This doesn't obey the rule to first execute commands from the file, and then the others in the buffer pszDataPtr = COM_ParseLine(pszDataPtr); // TODO: COM_ParseLine can be const char* - - if (com_token[0] == 0) - { - break; - } - - Cbuf_InsertTextLines(com_token); + if (com_token[0]) + Cbuf_InsertTextLines(com_token); } } diff --git a/rehlds/engine/host.cpp b/rehlds/engine/host.cpp index 31560b7..673b329 100644 --- a/rehlds/engine/host.cpp +++ b/rehlds/engine/host.cpp @@ -1197,7 +1197,11 @@ int Host_Init(quakeparms_t *parms) else { Cvar_RegisterVariable(&suitvolume); +#ifdef REHLDS_FIXES + Cvar_RegisterVariable(&r_cachestudio); +#endif } + Cbuf_InsertText("exec valve.rc\n"); Hunk_AllocName(0, "-HOST_HUNKLEVEL-"); host_hunklevel = Hunk_LowMark(); diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index e83cbb4..dfd2846 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -1802,7 +1802,14 @@ void EXT_FUNC PF_aim_I(edict_t *ent, float speed, float *rgflReturn) bestdir[1] = dir[1]; bestdir[2] = dir[2]; bestdir[0] = dir[0]; - bestdist = sv_aim.value; + if (sv_allow_autoaim.value) + { + bestdist = sv_aim.value; + } + else + { + bestdist = 0.0f; + } for (int i = 1; i < g_psv.num_edicts; i++) { diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index eedb6f0..5fda2c1 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -283,6 +283,7 @@ extern rehlds_server_t g_rehlds_sv; extern cvar_t sv_lan; extern cvar_t sv_lan_rate; extern cvar_t sv_aim; +extern cvar_t sv_allow_autoaim; extern cvar_t sv_skycolor_r; extern cvar_t sv_skycolor_g; diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index b3779c9..6d0387d 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -114,6 +114,7 @@ int giNextUserMsg = 64; cvar_t sv_lan = { "sv_lan", "0", 0, 0.0f, NULL }; cvar_t sv_lan_rate = { "sv_lan_rate", "20000.0", 0, 0.0f, NULL }; cvar_t sv_aim = { "sv_aim", "1", FCVAR_SERVER | FCVAR_ARCHIVE , 0.0f, NULL }; +cvar_t sv_allow_autoaim = { "sv_allow_autoaim", "1", FCVAR_SERVER | FCVAR_ARCHIVE, 0.0f, NULL }; cvar_t sv_skycolor_r = { "sv_skycolor_r", "0", 0, 0.0f, NULL }; cvar_t sv_skycolor_g = { "sv_skycolor_g", "0", 0, 0.0f, NULL }; @@ -4697,11 +4698,25 @@ void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg) auto &entityState = curPack->entities[i]; if (entityState.number > MAX_CLIENTS) { - if (sv_rehlds_attachedentities_playeranimationspeed_fix.string[0] == '1' - && entityState.movetype == MOVETYPE_FOLLOW - && 1 <= entityState.aiment && entityState.aiment <= MAX_CLIENTS) + if (entityState.movetype == MOVETYPE_FOLLOW && entityState.aiment > 0) { - attachedEntCount[entityState.aiment]++; + if (sv_rehlds_attachedentities_playeranimationspeed_fix.string[0] == '1' && + entityState.aiment <= MAX_CLIENTS) + { + attachedEntCount[entityState.aiment]++; + } + + // Prevent crash "Cache_UnlinkLRU: NULL link" on client-side + // if aiment with sprite model will be to render as a studio model + if (entityState.aiment < g_psv.num_edicts) + { + edict_t *ent = &g_psv.edicts[entityState.aiment]; + if ((ent->v.modelindex >= 0 && ent->v.modelindex < MAX_MODELS) + && g_psv.models[ent->v.modelindex]->type != mod_studio) + { + entityState.aiment = 0; + } + } } // Prevent spam "Non-sprite set to glow!" in console on client-side @@ -8024,6 +8039,9 @@ void SV_Init(void) Cvar_RegisterVariable(&sv_visiblemaxplayers); Cvar_RegisterVariable(&sv_password); Cvar_RegisterVariable(&sv_aim); +#ifdef REHLDS_FIXES + Cvar_RegisterVariable(&sv_allow_autoaim); +#endif Cvar_RegisterVariable(&violence_hblood); Cvar_RegisterVariable(&violence_ablood); Cvar_RegisterVariable(&violence_hgibs); diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index 293119d..08431a4 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -1150,46 +1150,47 @@ void EXT_FUNC EngineFprintf(void *pfile, const char *szFmt, ...) void EXT_FUNC AlertMessage(ALERT_TYPE atype, const char *szFmt, ...) { + char szOut[2048]; va_list argptr; - static char szOut[1024]; - va_start(argptr, szFmt); if (atype == at_logged && g_psvs.maxclients > 1) { + va_start(argptr, szFmt); Q_vsnprintf(szOut, sizeof(szOut), szFmt, argptr); + va_end(argptr); + Log_Printf("%s", szOut); + return; } - else if (developer.value != 0.0f) - { - switch (atype) - { - case at_notice: - Q_strcpy(szOut, "NOTE: "); - break; - case at_console: - szOut[0] = 0; - break; - case at_aiconsole: - if (developer.value < 2.0f) - return; - szOut[0] = 0; - break; - case at_warning: - Q_strcpy(szOut, "WARNING: "); - break; - case at_error: - Q_strcpy(szOut, "ERROR: "); - break; - case at_logged: - break; - default: - break; - } - int iLen = Q_strlen(szOut); - Q_vsnprintf(&szOut[iLen], sizeof(szOut) - iLen, szFmt, argptr); - Con_Printf("%s", szOut); - } + + if (!developer.value) + return; + + if (atype == at_aiconsole && developer.value < 2) + return; + + va_start(argptr, szFmt); + Q_vsnprintf(szOut, sizeof(szOut), szFmt, argptr); va_end(argptr); + + switch (atype) + { + case at_notice: + Con_Printf("NOTE: %s", szOut); + break; + case at_console: + case at_aiconsole: + Con_Printf("%s", szOut); + break; + case at_warning: + Con_Printf("WARNING: %s", szOut); + break; + case at_error: + Con_Printf("ERROR: %s", szOut); + break; + default: + break; + } } NOXREF void Sys_SplitPath(const char *path, char *drive, char *dir, char *fname, char *ext) @@ -1326,7 +1327,7 @@ void Con_Printf(const char *fmt, ...) va_start(va, fmt); Q_vsnprintf(Dest, sizeof(Dest), fmt, va); va_end(va); - + g_RehldsHookchains.m_Con_Printf.callChain(Con_Printf_internal, Dest); }