1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

A lot of minor edits/fixes

This commit is contained in:
GAMMACASE
2023-07-26 14:11:11 +03:00
committed by Nicholas Hastings
parent 6a703f7fd0
commit a8c0e4f903
9 changed files with 64 additions and 34 deletions

View File

@ -26,6 +26,7 @@
#include "tier1/utlstring.h"
#include "tier1/bufferstring.h"
#include <steam/steamclientpublic.h>
#include "playerslot.h"
//-----------------------------------------------------------------------------
// forward declarations
@ -111,25 +112,6 @@ struct bbox_t
Vector maxs;
};
struct CPlayerSlot
{
CPlayerSlot( int slot )
{
_slot = slot;
}
int Get() const
{
return _slot;
}
bool operator==( const CPlayerSlot &other ) const { return other._slot == _slot; }
bool operator!=( const CPlayerSlot &other ) const { return other._slot != _slot; }
private:
int _slot;
};
struct CEntityIndex
{
CEntityIndex( int index )
@ -556,7 +538,7 @@ public:
// Client is going active
// If bLoadGame is true, don't spawn the player because its state is already setup.
virtual void ClientActive( CPlayerSlot slot, bool /*bLoadGame??*/, const char */*pszName??*/, int ) = 0;
virtual void ClientActive( CPlayerSlot slot, bool /*bLoadGame??*/, const char * /*pszName??*/, int ) = 0;
virtual void ClientFullyConnect( CPlayerSlot slot ) = 0;

View File

@ -770,7 +770,7 @@ public:
virtual void GetSearchPathsForPathID( const char*, GetSearchPathTypes_t, CUtlVector<CUtlString> & ) = 0;
virtual void MarkCorrupt( bool, const char* ) = 0;
virtual void MarkContentCorrupt( bool bMissingFilesOnly, const char* pFile ) = 0;
};
//-----------------------------------------------------------------------------

View File

@ -45,8 +45,8 @@ public:
virtual void DispatchConCommand( ConCommandHandle cmd, const CCommandContext &ctx, const CCommand &args ) = 0;
// Install a global change callback (to be called when any convar changes)
virtual void InstallGlobalChangeCallback( FnChangeCallback_t callback ) = 0;
virtual void RemoveGlobalChangeCallback( FnChangeCallback_t callback ) = 0;
virtual void InstallGlobalChangeCallback( FnChangeCallbackGlobal_t callback ) = 0;
virtual void RemoveGlobalChangeCallback( FnChangeCallbackGlobal_t callback ) = 0;
virtual void CallGlobalChangeCallbacks( ConVarRefAbstract *var, CSplitScreenSlot nSlot, const char *pOldString, float flOldValue ) = 0;
// Reverts cvars which contain a specific flag
@ -79,7 +79,7 @@ public:
// Register, unregister commands
virtual ConCommandHandle RegisterConCommand( ConCommand *pCmd, int64 nAdditionalFlags = 0 ) = 0;
virtual void UnregisterConCommand( ConCommandHandle handle ) = 0;
virtual ConCommand* GetCommand( ConCommandHandle handle ) = 0;
virtual ConCommand* GetCommand( ConCommandHandle handle ) = 0;
virtual void QueueThreadSetValue( ConVarRefAbstract *ref, CSplitScreenSlot nSlot, CVValue_t *value ) = 0;
};

View File

@ -14,6 +14,7 @@
#include "inetchannelinfo.h"
#include "tier1/bitbuf.h"
#include "tier1/netadr.h"
#include "tier1/utldelegate.h"
#include <eiface.h>
class IDemoRecorderBase;

31
public/playerslot.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef PLAYERSLOT_H
#define PLAYERSLOT_H
#if _WIN32
#pragma once
#endif
class CPlayerSlot
{
public:
CPlayerSlot(int slot) : m_Data(slot)
{
}
int Get() const
{
return m_Data;
}
bool operator==(const CPlayerSlot &other) const {
return other.m_Data == m_Data;
}
bool operator!=(const CPlayerSlot &other) const {
return other.m_Data != m_Data;
}
private:
int m_Data;
};
#endif // PLAYERSLOT_H

View File

@ -599,7 +599,7 @@ protected:
inline Type operator++( Type &a, int ) { Type t = a; ++a; return t; } \
inline Type operator--( Type &a, int ) { Type t = a; --a; return t; }
#define MAX_SPLITSCREEN_CLIENT_BITS 2
#define MAX_SPLITSCREEN_CLIENT_BITS 0
// this should == MAX_JOYSTICKS in InputEnums.h
#define MAX_SPLITSCREEN_CLIENTS ( 1 << MAX_SPLITSCREEN_CLIENT_BITS ) // 4

View File

@ -67,11 +67,11 @@ public:
public:
DLL_CLASS_IMPORT const char *AppendConcat(int, const char * const *, const int *, bool bIgnoreAlignment = false);
DLL_CLASS_IMPORT const char *AppendConcat(const char *, const char *, ...);
DLL_CLASS_IMPORT const char *AppendConcatV(const char *, const char *, char *, bool bIgnoreAlignment = false);
DLL_CLASS_IMPORT const char *AppendConcatV(const char *, const char *, va_list, bool bIgnoreAlignment = false);
DLL_CLASS_IMPORT const char *Concat(const char *, const char *, ...);
DLL_CLASS_IMPORT int AppendFormat(const char *pFormat, ...);
DLL_CLASS_IMPORT int AppendFormatV(const char *pFormat, char *pData);
DLL_CLASS_IMPORT int AppendFormatV(const char *pFormat, va_list pData);
DLL_CLASS_IMPORT const char *AppendRepeat(char cChar, int nChars, bool bIgnoreAlignment = false);
@ -188,6 +188,13 @@ public:
DLL_CLASS_IMPORT const char *TruncateAt(const char *pStr, bool bIgnoreAlignment = false);
DLL_CLASS_IMPORT int UnicodeCaseConvert(int, EStringConvertErrorPolicy eErrorPolicy);
// Casts to CBufferStringGrowable. Very dirty solution until someone figures out the sane one.
template<size_t MAX_SIZE = 8, bool AllowHeapAllocation = true, typename T = CBufferStringGrowable<MAX_SIZE, AllowHeapAllocation>>
T *ToGrowable()
{
return (T *)this;
}
};
template<size_t MAX_SIZE, bool AllowHeapAllocation = true>

View File

@ -21,6 +21,7 @@
#include "tier1/utlstring.h"
#include "Color.h"
#include "mathlib/vector4d.h"
#include "playerslot.h"
#ifdef _WIN32
#define FORCEINLINE_CVAR FORCEINLINE
@ -66,18 +67,25 @@ private:
class CCommandContext
{
CCommandContext(int nTarget)
public:
CCommandContext(CommandTarget_t nTarget, CPlayerSlot nSlot) :
m_nTarget(nTarget), m_nPlayerSlot(nSlot)
{
m_nTarget = nTarget;
}
int Get() const
CommandTarget_t GetTarget() const
{
return m_nTarget;
}
CPlayerSlot GetPlayerSlot() const
{
return m_nPlayerSlot;
}
private:
int m_nTarget;
CommandTarget_t m_nTarget;
CPlayerSlot m_nPlayerSlot;
};
class ALIGN8 ConCommandHandle
@ -169,6 +177,7 @@ struct CSplitScreenSlot
enum EConVarType : short
{
EConVarType_Invalid = -1,
EConVarType_Bool,
EConVarType_Int16,
EConVarType_UInt16,
@ -353,7 +362,7 @@ inline const char **CCommand::ArgV() const
inline const char *CCommand::ArgS() const
{
return m_nArgv0Size ? *(const char **)(m_ArgSBuffer.Base() + m_nArgv0Size) : "";
return m_nArgv0Size ? (m_ArgSBuffer.Base() + m_nArgv0Size) : "";
}
inline const char *CCommand::GetCommandString() const

View File

@ -30,7 +30,7 @@
#define FOR_EACH_MAP_FAST( mapName, iteratorName ) \
for ( int iteratorName = 0; iteratorName < mapName.MaxElement(); ++iteratorName ) if ( !mapName.IsValidIndex( iteratorName ) ) continue; else
template <typename K, typename T, typename I = unsigned short>
template <typename K, typename T, typename I = short unsigned int, typename LF = bool (*)(const K&, const K&)>
class CUtlMap
{
public:
@ -40,7 +40,7 @@ public:
// Less func typedef
// Returns true if the first parameter is "less" than the second
typedef bool (*LessFunc_t)( const KeyType_t &, const KeyType_t & );
typedef LF LessFunc_t;
// constructor, destructor
// Left at growSize = 0, the memory will first allocate 1 element and double in size