Skip to content

Commit

Permalink
Merge pull request #4 from iznogod/dev
Browse files Browse the repository at this point in the history
Compatibility with JH
  • Loading branch information
ibuddieat authored Aug 20, 2024
2 parents d895ddb + 6abc553 commit 9c764b8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
10 changes: 8 additions & 2 deletions code/doit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,25 @@ if [ "$1" == "clean" ]; then
rm bin -rf
exit 1
else
if [ "$1" == "nomysql" ] || [ "$2" == "nomysql" ] || [ "$3" == "nomysql" ]; then
if [ "$1" == "nomysql" ] || [ "$2" == "nomysql" ] || [ "$3" == "nomysql" ] || [ "$4" == "nomysql" ]; then
mysql_link=""
mysql_variant=0
fi

if [ "$1" == "nospeex" ] || [ "$2" == "nospeex" ] || [ "$3" == "nospeex" ]; then
if [ "$1" == "nospeex" ] || [ "$2" == "nospeex" ] || [ "$3" == "nospeex" ] || [ "$4" == "nospeex" ]; then
speex_link=""
sed -i "/#define COMPILE_CUSTOM_VOICE 1/c\#define COMPILE_CUSTOM_VOICE 0" config.hpp
else
speex_link="-lspeex"
sed -i "/#define COMPILE_CUSTOM_VOICE 0/c\#define COMPILE_CUSTOM_VOICE 1" config.hpp
fi

if [ "$1" == "unsafe" ] || [ "$2" == "unsafe" ] || [ "$3" == "unsafe" ] || [ "$4" == "unsafe" ]; then
sed -i "/#define ENABLE_UNSAFE 0/c\#define ENABLE_UNSAFE 1" config.hpp
else
sed -i "/#define ENABLE_UNSAFE 1/c\#define ENABLE_UNSAFE 0" config.hpp
fi

if [ "$1" == "debug" ] || [ "$2" == "debug" ] || [ "$3" == "debug" ]; then
debug="-g -ggdb -O0"
else
Expand Down
12 changes: 12 additions & 0 deletions code/gsc_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ extern customPlayerState_t customPlayerState[MAX_CLIENTS];
extern customStringIndex_t custom_scr_const;
extern dvar_t *g_antilag;
extern dvar_t *sv_maxclients;
extern dvar_t *g_forceSnaps;
extern dvar_t *g_forceRate;

void gsc_player_getprotocol(scr_entref_t ref)
{
Expand Down Expand Up @@ -815,6 +817,16 @@ void gsc_player_processclientuserinfochange(scr_entref_t ref)

ClientUserinfoChanged(id);

client_t *cl = &svs.clients[ref.entnum];
if( g_forceSnaps->current.integer > 0 )
{
cl->snapshotMsec = 1000 / g_forceSnaps->current.integer;
}
if( g_forceRate->current.integer > 0 )
{
cl->rate = g_forceRate->current.integer;
}

stackPushBool(qtrue);
}

Expand Down
13 changes: 10 additions & 3 deletions code/jump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern dvar_t *jump_stepSize;
extern dvar_t *jump_slowdownEnable;
extern dvar_t *jump_ladderPushVel;
extern dvar_t *jump_spreadAdd;
extern dvar_t *g_resetSlide;

#define JUMP_LAND_SLOWDOWN_TIME 1800

Expand Down Expand Up @@ -149,7 +150,10 @@ void Jump_Start(pmove_t *pm, pml_t *pml, float height)
ps->jumpTime = pm->cmd.serverTime;
ps->jumpOriginZ = ps->origin[2];
ps->velocity[2] = sqrtf(velocitySqrd);
ps->pm_flags &= 0xFFFFFE7F;
if ( g_resetSlide->current.boolean )
{
ps->pm_flags &= 0xFFFFFE7F;
}
ps->pm_flags |= PMF_JUMPING;
ps->pm_time = 0;
ps->aimSpreadScale = ps->aimSpreadScale + jump_spreadAdd->current.decimal;
Expand Down Expand Up @@ -247,9 +251,12 @@ qboolean Jump_Check(pmove_t *pm, pml_t *pml)
{
return qfalse;
}
if ( ps->pm_flags & 0x400 )
if ( g_resetSlide->current.boolean )
{
return qfalse;
if ( ps->pm_flags & 0x400 )
{
return qfalse;
}
}
if ( ps->pm_flags & 4 )
{
Expand Down
13 changes: 13 additions & 0 deletions code/libcod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ dvar_t *g_playerCollisionEjectDamageAllowed;
dvar_t *g_playerCollisionEjectDuration;
dvar_t *g_playerEject;
dvar_t *g_resetSlide;
dvar_t *g_forceSnaps;
dvar_t *g_forceRate;
dvar_t *g_safePrecache;
dvar_t *g_spawnMapTurrets;
dvar_t *g_spawnMapWeapons;
Expand Down Expand Up @@ -393,6 +395,8 @@ void common_init_complete_print(const char *format, ...)
g_playerCollisionEjectDuration = Dvar_RegisterInt("g_playerCollisionEjectDuration", 300, 50, 1000, DVAR_ARCHIVE);
g_playerEject = Dvar_RegisterBool("g_playerEject", qtrue, DVAR_ARCHIVE);
g_resetSlide = Dvar_RegisterBool("g_resetSlide", qfalse, DVAR_ARCHIVE);
g_forceSnaps = Dvar_RegisterInt("g_forceSnaps", 0, 0, 30, DVAR_ARCHIVE);
g_forceRate = Dvar_RegisterInt("g_forceRate", 0, 0, 25000, DVAR_ARCHIVE);
g_spawnMapTurrets = Dvar_RegisterBool("g_spawnMapTurrets", qtrue, DVAR_ARCHIVE);
g_spawnMapWeapons = Dvar_RegisterBool("g_spawnMapWeapons", qtrue, DVAR_ARCHIVE);
g_triggerMode = Dvar_RegisterInt("g_triggerMode", 1, 0, 2, DVAR_ARCHIVE);
Expand Down Expand Up @@ -1672,6 +1676,15 @@ void hook_ClientUserinfoChanged(int clientNum)

short ret = Scr_ExecEntThread(&g_entities[clientNum], codecallback_userinfochanged, 0);
Scr_FreeThread(ret);
client_t *cl = &svs.clients[clientNum];
if( g_forceSnaps->current.integer > 0 )
{
cl->snapshotMsec = 1000 / g_forceSnaps->current.integer;
}
if( g_forceRate->current.integer > 0 )
{
cl->rate = g_forceRate->current.integer;
}
}

void custom_DeathmatchScoreboardMessage(gentity_t *ent)
Expand Down

0 comments on commit 9c764b8

Please sign in to comment.