2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-14 07:38:04 +03:00

Clone signon data between worlds

This commit is contained in:
Garey Akhmetshin 2021-03-13 05:23:01 +05:00
parent 00cf3bef53
commit ca49b33f80
4 changed files with 27 additions and 8 deletions

View File

@ -1449,6 +1449,14 @@ bool World::AddSignonData(unsigned char type, unsigned char *data, int size)
return m_SignonData.IsOverflowed();
}
bool World::AddSignonData(unsigned char* data, int size)
{
m_SignonData.WriteBuf(data, size);
return m_SignonData.IsOverflowed();
}
int World::FindUserMsgByName(char *name)
{
for (UserMsg *pList = m_ClientUserMsgs; pList; pList = pList->next)
@ -2376,6 +2384,5 @@ delta_t *World::GetEntityDelta() const {
delta_t *World::GetWeaponDelta() const {
return Delta::m_WeaponDelta;
}
EXPOSE_INTERFACE_FN(CreateWorld, World, WORLD_INTERFACE_VERSION);
#endif // HOOK_HLTV

View File

@ -120,12 +120,15 @@ public:
EXT_FUNC bool AddResource(resource_t *resource);
EXT_FUNC void AddLightStyle(int index, char *style);
EXT_FUNC bool AddSignonData(unsigned char type, unsigned char *data, int size);
bool AddSignonData(unsigned char* data, int size);
EXT_FUNC bool AddUserMessage(int msgNumber, int size, char *name);
EXT_FUNC void AddBaselineEntity(int index, entity_state_t *ent);
EXT_FUNC void AddInstancedBaselineEntity(int index, entity_state_t *ent);
EXT_FUNC void UpdatePlayer(int playerNum, int userId, char *infostring, char *hashedcdkey);
EXT_FUNC void WriteFrame(frame_t *frame, unsigned int lastFrameSeqnr, BitBuffer *reliableStream, BitBuffer *unreliableStream, unsigned int deltaSeqNr, unsigned int clientDelta, bool addVoice);
EXT_FUNC void WriteFrame(frame_t *frame, unsigned int lastFrameSeqnr, BitBuffer *reliableStream,
BitBuffer *unreliableStream, unsigned int deltaSeqNr, unsigned int clientDelta,
bool addVoice);
EXT_FUNC void WriteNewData(BitBuffer *stream);
EXT_FUNC void WriteClientUpdate(BitBuffer *stream, int playerIndex);
EXT_FUNC void WriteMovevars(BitBuffer *stream);
@ -139,7 +142,8 @@ public:
private:
int CompressFrame(frame_t *from, BitBuffer *stream);
int ParseDeltaHeader(BitBuffer *stream, bool &remove, bool &custom, int &numbase, bool &newbl, int &newblindex, bool full, int &offset);
int ParseDeltaHeader(BitBuffer *stream, bool &remove, bool &custom, int &numbase, bool &newbl, int &newblindex,
bool full, int &offset);
void SetDirector(IDirector *director);
void SetTimeScale(float scale);
void SetGameGroupAddress(NetAddress *addr);
@ -158,7 +162,8 @@ private:
void WritePacketEntities(BitBuffer *stream, frame_t *frame, frame_t *deltaframe);
bool WriteDeltaEntities(BitBuffer *stream, frame_t *fullFrame, unsigned int deltaSeqNr, unsigned int clientDelta);
enum WorldState {
enum WorldState
{
WORLD_UNDEFINED,
WORLD_INITIALIZING,
WORLD_DISCONNECTED,
@ -188,9 +193,9 @@ private:
delta_t *GetEventDelta() const;
delta_t *GetClientDelta() const;
delta_t *GetEntityDelta() const;
delta_t *GetWeaponDelta() const;
delta_t *GetDeltaEncoder(int index, bool custom);
bool IsDeltaEncoder() const;
delta_t* GetWeaponDelta() const;
protected:
bool m_IsPaused;
@ -209,7 +214,8 @@ protected:
int m_ViewEntity;
serverinfo_t m_DetailedServerInfo;
enum {
enum
{
MAX_ENTITIES = 1380,
MAX_INSTANCED_BASELINES = 64,
MAX_FRAME_CACHE = 32,

View File

@ -89,6 +89,8 @@ EXPOSE_SINGLE_INTERFACE(Proxy, IProxy, PROXY_INTERFACE_VERSION);
#ifdef HLTV_FIXES
void Proxy::AddNextWorld()
{
BitBuffer temp_buff;
temp_buff.Resize(0x8000);
static int num_alloc = 0;
static char instance[64];
snprintf(instance, sizeof(instance), "AddNextWorld_%d", num_alloc++);
@ -99,8 +101,11 @@ void Proxy::AddNextWorld()
return;
}
m_World->WriteSigonData(&temp_buff);
nextWorld->AddSignonData(temp_buff.GetData(), temp_buff.CurrentSize());
nextWorld->RegisterListener(this);
m_Worlds.AddTail(nextWorld);
if (m_DemoClient.IsActive())
@ -1473,7 +1478,7 @@ void Proxy::ReceiveSignal(ISystemModule *module, unsigned int signal, void *data
case 6:
{
#ifdef HLTV_FIXES
if (!m_IsFinishingBroadcast && m_ClientDelay > 0.0)
if (!m_IsFinishingBroadcast && m_ClientDelay > 0.f)
{
//If we finished broadcast we need to get frames from next "World" (Next server map)
AddNextWorld();

View File

@ -144,6 +144,7 @@ public:
virtual bool AddResource(resource_t *resource) = 0;
virtual void AddLightStyle(int index, char *style) = 0;
virtual bool AddSignonData(unsigned char type, unsigned char *data, int size) = 0;
virtual bool AddSignonData(unsigned char* data, int size) = 0;
virtual bool AddUserMessage(int msgNumber, int size, char *name) = 0;
virtual void AddBaselineEntity(int index, entity_state_t *ent) = 0;
virtual void AddInstancedBaselineEntity(int index, entity_state_t *ent) = 0;