Skip to content

Commit

Permalink
Merge branch 'dreamstalker:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cris840 authored Jan 17, 2024
2 parents 85294e2 + 1d6c682 commit a92cf7a
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 53 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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/*
Expand All @@ -92,7 +92,7 @@ jobs:

steps:
- name: Deploying windows artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: win32

Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
14 changes: 5 additions & 9 deletions rehlds/engine/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 4 additions & 0 deletions rehlds/engine/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 8 additions & 1 deletion rehlds/engine/pr_cmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down
1 change: 1 addition & 0 deletions rehlds/engine/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 22 additions & 4 deletions rehlds/engine/sv_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
63 changes: 32 additions & 31 deletions rehlds/engine/sys_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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)
{
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);
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;
}
va_end(argptr);
}

NOXREF void Sys_SplitPath(const char *path, char *drive, char *dir, char *fname, char *ext)
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit a92cf7a

Please sign in to comment.