mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +00:00
Tweaked net ID file management
Should now be easier to stub network entity functions for Raze.
This commit is contained in:
parent
8d0d130dc9
commit
38f14ccd56
3 changed files with 87 additions and 71 deletions
|
@ -218,8 +218,6 @@ CCMD (dumpclasses)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
#include "d_net.h"
|
||||
|
||||
void DObject::InPlaceConstructor (void *mem)
|
||||
{
|
||||
new ((EInPlace *)mem) DObject;
|
||||
|
@ -319,7 +317,7 @@ void DObject::Release()
|
|||
|
||||
void DObject::Destroy ()
|
||||
{
|
||||
NetworkEntityManager::RemoveNetworkEntity(this);
|
||||
RemoveFromNetwork();
|
||||
|
||||
// We cannot call the VM during shutdown because all the needed data has been or is in the process of being deleted.
|
||||
if (PClass::bVMOperational)
|
||||
|
@ -596,74 +594,6 @@ void DObject::CheckIfSerialized () const
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DObject::SetNetworkID(const uint32_t id)
|
||||
{
|
||||
if (!IsNetworked())
|
||||
{
|
||||
ObjectFlags |= OF_Networked;
|
||||
_networkID = id;
|
||||
}
|
||||
}
|
||||
|
||||
void DObject::ClearNetworkID()
|
||||
{
|
||||
ObjectFlags &= ~OF_Networked;
|
||||
_networkID = NetworkEntityManager::WorldNetID;
|
||||
}
|
||||
|
||||
void DObject::EnableNetworking(const bool enable)
|
||||
{
|
||||
if (enable)
|
||||
NetworkEntityManager::AddNetworkEntity(this);
|
||||
else
|
||||
NetworkEntityManager::RemoveNetworkEntity(this);
|
||||
}
|
||||
|
||||
static unsigned int GetNetworkID(DObject* const self)
|
||||
{
|
||||
return self->GetNetworkID();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DObject, GetNetworkID, GetNetworkID)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
|
||||
ACTION_RETURN_INT(self->GetNetworkID());
|
||||
}
|
||||
|
||||
static void EnableNetworking(DObject* const self, const bool enable)
|
||||
{
|
||||
self->EnableNetworking(enable);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DObject, EnableNetworking, EnableNetworking)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
PARAM_BOOL(enable);
|
||||
|
||||
self->EnableNetworking(enable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DObject* GetNetworkEntity(const unsigned int id)
|
||||
{
|
||||
return NetworkEntityManager::GetNetworkEntity(id);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DObject, GetNetworkEntity, GetNetworkEntity)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_UINT(id);
|
||||
|
||||
ACTION_RETURN_OBJECT(NetworkEntityManager::GetNetworkEntity(id));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DObject, MSTime)
|
||||
{
|
||||
ACTION_RETURN_INT((uint32_t)I_msTime());
|
||||
|
|
|
@ -361,6 +361,7 @@ public:
|
|||
inline uint32_t GetNetworkID() const { return _networkID; }
|
||||
void SetNetworkID(const uint32_t id);
|
||||
void ClearNetworkID();
|
||||
void RemoveFromNetwork();
|
||||
virtual void EnableNetworking(const bool enable);
|
||||
};
|
||||
|
||||
|
|
|
@ -2965,6 +2965,12 @@ int Net_GetLatency(int *ld, int *ad)
|
|||
return severity;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void NetworkEntityManager::InitializeNetworkEntities()
|
||||
{
|
||||
if (!s_netEntities.Size())
|
||||
|
@ -3048,6 +3054,85 @@ DObject* NetworkEntityManager::GetNetworkEntity(const uint32_t id)
|
|||
return s_netEntities[id];
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DObject::SetNetworkID(const uint32_t id)
|
||||
{
|
||||
if (!IsNetworked())
|
||||
{
|
||||
ObjectFlags |= OF_Networked;
|
||||
_networkID = id;
|
||||
}
|
||||
}
|
||||
|
||||
void DObject::ClearNetworkID()
|
||||
{
|
||||
ObjectFlags &= ~OF_Networked;
|
||||
_networkID = NetworkEntityManager::WorldNetID;
|
||||
}
|
||||
|
||||
void DObject::EnableNetworking(const bool enable)
|
||||
{
|
||||
if (enable)
|
||||
NetworkEntityManager::AddNetworkEntity(this);
|
||||
else
|
||||
NetworkEntityManager::RemoveNetworkEntity(this);
|
||||
}
|
||||
|
||||
void DObject::RemoveFromNetwork()
|
||||
{
|
||||
NetworkEntityManager::RemoveNetworkEntity(this);
|
||||
}
|
||||
|
||||
static unsigned int GetNetworkID(DObject* const self)
|
||||
{
|
||||
return self->GetNetworkID();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DObject, GetNetworkID, GetNetworkID)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
|
||||
ACTION_RETURN_INT(self->GetNetworkID());
|
||||
}
|
||||
|
||||
static void EnableNetworking(DObject* const self, const bool enable)
|
||||
{
|
||||
self->EnableNetworking(enable);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DObject, EnableNetworking, EnableNetworking)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
PARAM_BOOL(enable);
|
||||
|
||||
self->EnableNetworking(enable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DObject* GetNetworkEntity(const unsigned int id)
|
||||
{
|
||||
return NetworkEntityManager::GetNetworkEntity(id);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DObject, GetNetworkEntity, GetNetworkEntity)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_UINT(id);
|
||||
|
||||
ACTION_RETURN_OBJECT(NetworkEntityManager::GetNetworkEntity(id));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
// [RH] List "ping" times
|
||||
CCMD (pings)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue