Skip to content

Commit

Permalink
Merge branch 'master' into featureful
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Oct 17, 2024
2 parents f3a3b87 + 13086d3 commit 4bef5b1
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cl_dll/input_goldsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ void GoldSourceInput::IN_Init (void)
{
ignoreNextDelta = false;
m_filter = gEngfuncs.pfnRegisterVariable ( "m_filter","0", FCVAR_ARCHIVE );
sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting.
sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE | FCVAR_FILTERSTUFFTEXT ); // user mouse sensitivity setting.

in_joystick = gEngfuncs.pfnRegisterVariable ( "joystick","0", FCVAR_ARCHIVE );
joy_name = gEngfuncs.pfnRegisterVariable ( "joyname", "joystick", 0 );
Expand Down
2 changes: 1 addition & 1 deletion cl_dll/input_xash3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void FWGSInput::IN_Shutdown( void )
// Register cvars and reset data
void FWGSInput::IN_Init( void )
{
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE );
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE | FCVAR_FILTERSTUFFTEXT );
in_joystick = gEngfuncs.pfnRegisterVariable( "joystick", "0", FCVAR_ARCHIVE );
cl_laddermode = gEngfuncs.pfnRegisterVariable( "cl_laddermode", "2", FCVAR_ARCHIVE );
ac_forwardmove = ac_sidemove = rel_yaw = rel_pitch = 0;
Expand Down
2 changes: 1 addition & 1 deletion cl_dll/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ void V_Init( void )
v_centerspeed = gEngfuncs.pfnRegisterVariable( "v_centerspeed","500", 0 );

cl_bobcycle = gEngfuncs.pfnRegisterVariable( "cl_bobcycle","0.8", 0 );// best default for my experimental gun wag (sjb)
cl_bob = gEngfuncs.pfnRegisterVariable( "cl_bob","0.01", 0 );// best default for my experimental gun wag (sjb)
cl_bob = gEngfuncs.pfnRegisterVariable( "cl_bob","0.01", FCVAR_ARCHIVE );// best default for my experimental gun wag (sjb)
cl_bobup = gEngfuncs.pfnRegisterVariable( "cl_bobup","0.5", 0 );
cl_waterdist = gEngfuncs.pfnRegisterVariable( "cl_waterdist","4", 0 );
cl_chasedist = gEngfuncs.pfnRegisterVariable( "cl_chasedist","112", 0 );
Expand Down
4 changes: 4 additions & 0 deletions common/cvardef.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar
#define FCVAR_PRIVILEGED (1<<10) // Not queryable/settable by unprivileged sources
#define FCVAR_FILTERSTUFFTEXT (1<<11) // Not queryable/settable if unprivileged and filterstufftext is enabled
#define FCVAR_FILTERCHARS (1<<12) // This cvar's string will be filtered for 'bad' characters (e.g. ';', '\n')
#define FCVAR_NOBADPATHS (1<<13) // This cvar's string cannot contain file paths that are above the current directory

typedef struct cvar_s
{
Expand Down
11 changes: 6 additions & 5 deletions dlls/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,11 +804,6 @@ int CHalfLifeMultiplay::IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKi
//=========================================================
void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
{
DeathNotice( pVictim, pKiller, pInflictor );

pVictim->m_iDeaths += 1;

FireTargets( "game_playerdie", pVictim, pVictim );
CBasePlayer *peKiller = NULL;
CBaseEntity *ktmp = CBaseEntity::Instance( pKiller );
if( ktmp && (ktmp->Classify() == CLASS_PLAYER ) )
Expand All @@ -824,6 +819,12 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
}
}

DeathNotice( pVictim, pKiller, pInflictor );

pVictim->m_iDeaths += 1;

FireTargets( "game_playerdie", pVictim, pVictim );

if( pVictim->pev == pKiller )
{
// killed self
Expand Down
59 changes: 56 additions & 3 deletions dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3631,7 +3631,12 @@ CBaseEntity* SelectRandomSpawnPoint( CBaseEntity* pPlayer, const char* spawnPoin

edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
{
CBaseEntity *pSpot = NULL;
CBaseEntity *pSpot;
edict_t *player;

int nNumRandomSpawnsToTry = 10;

player = pPlayer->edict();

// choose a info_player_deathmatch point
if( g_pGameRules->IsCoOp() )
Expand All @@ -3642,9 +3647,57 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
}
if( g_pGameRules->IsDeathmatch() )
{
pSpot = SelectRandomSpawnPoint(pPlayer, "info_player_deathmatch");
if( pSpot )
if( !g_pLastSpawn )
{
nNumRandomSpawnsToTry = 0;
CBaseEntity* pEnt = 0;

while( ( pEnt = UTIL_FindEntityByClassname( pEnt, "info_player_deathmatch" )))
nNumRandomSpawnsToTry++;
}

pSpot = g_pLastSpawn;
// Randomize the start spot
for( int i = RANDOM_LONG( 1, nNumRandomSpawnsToTry - 1 ); i > 0; i-- )
pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" );
if( FNullEnt( pSpot ) ) // skip over the null point
pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" );

CBaseEntity *pFirstSpot = pSpot;

do
{
if( pSpot )
{
// check if pSpot is valid
if( IsSpawnPointValid( pPlayer, pSpot ) )
{
if( pSpot->pev->origin == Vector( 0, 0, 0 ) )
{
pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" );
continue;
}

// if so, go to pSpot
goto ReturnSpot;
}
}
// increment pSpot
pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" );
} while( pSpot != pFirstSpot ); // loop if we're not back to the start

// we haven't found a place to spawn yet, so kill any guy at the first spawn point and spawn there
if( !FNullEnt( pSpot ) )
{
CBaseEntity *ent = NULL;
while( ( ent = UTIL_FindEntityInSphere( ent, pSpot->pev->origin, 128 ) ) != NULL )
{
// if ent is a client, kill em (unless they are ourselves)
if( ent->IsPlayer() && !(ent->edict() == player) )
ent->TakeDamage( VARS( INDEXENT( 0 ) ), VARS( INDEXENT( 0 ) ), 300, DMG_GENERIC );
}
goto ReturnSpot;
}
}

// If startspot is set, (re)spawn there.
Expand Down
2 changes: 1 addition & 1 deletion dlls/rpg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ int CRpg::GetItemInfo( ItemInfo *p )
p->iSlot = 3;
p->iPosition = 0;
p->iId = WEAPON_RPG;
p->iFlags = ITEM_FLAG_NOCHOICE;
p->iFlags = ITEM_FLAG_NOAUTOSWITCHTO;
p->iWeight = RPG_WEIGHT;
p->pszAmmoEntity = "ammo_rpgclip";
if( bIsMultiplayer() )
Expand Down
2 changes: 1 addition & 1 deletion dlls/singleplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ BOOL HLGetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerWeapon *pCurrentWeapon

if( pCheck )
{
if( !FBitSet( pCheck->iFlags(), ITEM_FLAG_NOCHOICE ))
if( !FBitSet( pCheck->iFlags(), ITEM_FLAG_NOAUTOSWITCHTO ))
{
if( pCheck->iWeight() > -1 && pCheck->iWeight() == currentWeight && pCheck != pCurrentWeapon )
{
Expand Down
2 changes: 1 addition & 1 deletion dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void DeactivateSatchels( CBasePlayer *pOwner );
#define ITEM_FLAG_NOAUTOSWITCHEMPTY 4
#define ITEM_FLAG_LIMITINWORLD 8
#define ITEM_FLAG_EXHAUSTIBLE 16 // A player can totally exhaust their ammo supply and lose this weapon
#define ITEM_FLAG_NOCHOICE 32
#define ITEM_FLAG_NOAUTOSWITCHTO 32

#define WEAPON_IS_ONTARGET 0x40

Expand Down
26 changes: 18 additions & 8 deletions pm_shared/pm_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,10 @@ int PM_FlyMove( void )

// modify original_velocity so it parallels all of the clip planes
//
if( pmove->movetype == MOVETYPE_WALK && ( ( pmove->onground == -1 ) || ( pmove->friction != 1 ) ) ) // relfect player velocity
// reflect player velocity
// Only give this a try for first impact plane because you can get yourself stuck in an acute corner by jumping in place
// and pressing forward and nobody was really using this bounce/reflection feature anyway...
if( numplanes == 1 && pmove->movetype == MOVETYPE_WALK && ( ( pmove->onground == -1 ) || ( pmove->friction != 1 )))
{
for( i = 0; i < numplanes; i++ )
{
Expand Down Expand Up @@ -2897,6 +2900,15 @@ void PM_CheckParamters( void )
pmove->maxspeed = Q_min( maxspeed, pmove->maxspeed );
}

// Slow down, I'm pulling it! (a box maybe) but only when I'm standing on ground
//
// JoshA: Moved this to CheckParamters rather than working on the velocity,
// as otherwise it affects every integration step incorrectly.
if( ( pmove->onground != -1 ) && ( pmove->cmd.buttons & IN_USE ))
{
pmove->maxspeed *= 1.0f / 3.0f;
}

if( ( spd != 0.0f ) && ( spd > pmove->maxspeed ) )
{
float fRatio = pmove->maxspeed / spd;
Expand Down Expand Up @@ -3017,7 +3029,11 @@ void PM_PlayerMove( qboolean server )
{
if( PM_CheckStuck() )
{
return; // Can't move, we're stuck
// Let the user try to duck to get unstuck
PM_Duck();

if( PM_CheckStuck() )
return; // Can't move, we're stuck
}
}

Expand Down Expand Up @@ -3063,12 +3079,6 @@ void PM_PlayerMove( qboolean server )
}
}

// Slow down, I'm pulling it! (a box maybe) but only when I'm standing on ground
if( ( pmove->onground != -1 ) && ( pmove->cmd.buttons & IN_USE ) )
{
VectorScale( pmove->velocity, 0.3, pmove->velocity );
}

// Handle movement
switch( pmove->movetype )
{
Expand Down

0 comments on commit 4bef5b1

Please sign in to comment.