This commit is contained in:
Rachael Alexanderson 2024-04-20 19:14:04 -04:00
parent accab2aa6a
commit df3b193250
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
6 changed files with 41 additions and 7 deletions

View file

@ -749,9 +749,8 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx)
{ {
auto sfxp = sfxdata.data(); auto sfxp = sfxdata.data();
int32_t dmxlen = LittleLong(((int32_t *)sfxp)[1]); int32_t dmxlen = LittleLong(((int32_t *)sfxp)[1]);
// If the sound is voc, use the custom loader. // If the sound is voc, use the custom loader.
if (memcmp (sfxp, "Creative Voice File", 19) == 0) if (size > 19 && memcmp (sfxp, "Creative Voice File", 19) == 0)
{ {
sfx->data = GSnd->LoadSoundVoc(sfxp, size); sfx->data = GSnd->LoadSoundVoc(sfxp, size);
} }

View file

@ -132,7 +132,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
// On Linux this is important because its file system is case sensitive, // On Linux this is important because its file system is case sensitive,
// but even on Windows the Unicode normalization is destructive // but even on Windows the Unicode normalization is destructive
// for some characters and cannot be used for file names. // for some characters and cannot be used for file names.
// Examples for this are the Turkish 'i's or the German ß. // Examples for this are the Turkish 'i's or the German ß.
SystemFilePath[count] = stringpool->Strdup(entry.FilePathRel.c_str()); SystemFilePath[count] = stringpool->Strdup(entry.FilePathRel.c_str());
// for internal access we use the normalized form of the relative path. // for internal access we use the normalized form of the relative path.
// this is fine because the paths that get compared against this will also be normalized. // this is fine because the paths that get compared against this will also be normalized.

View file

@ -317,6 +317,8 @@ void DObject::Release()
void DObject::Destroy () void DObject::Destroy ()
{ {
RemoveFromNetwork();
// We cannot call the VM during shutdown because all the needed data has been or is in the process of being deleted. // 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) if (PClass::bVMOperational)
{ {
@ -569,8 +571,15 @@ void DObject::Serialize(FSerializer &arc)
SerializeFlag("justspawned", OF_JustSpawned); SerializeFlag("justspawned", OF_JustSpawned);
SerializeFlag("spawned", OF_Spawned); SerializeFlag("spawned", OF_Spawned);
SerializeFlag("networked", OF_Networked);
ObjectFlags |= OF_SerialSuccess; ObjectFlags |= OF_SerialSuccess;
if (arc.isReading() && (ObjectFlags & OF_Networked))
{
ClearNetworkID();
EnableNetworking(true);
}
} }
void DObject::CheckIfSerialized () const void DObject::CheckIfSerialized () const
@ -585,7 +594,6 @@ void DObject::CheckIfSerialized () const
} }
} }
DEFINE_ACTION_FUNCTION(DObject, MSTime) DEFINE_ACTION_FUNCTION(DObject, MSTime)
{ {
ACTION_RETURN_INT((uint32_t)I_msTime()); ACTION_RETURN_INT((uint32_t)I_msTime());

View file

@ -351,6 +351,18 @@ protected:
friend T* Create(Args&&... args); friend T* Create(Args&&... args);
friend class JitCompiler; friend class JitCompiler;
private:
// This is intentionally left unserialized.
uint32_t _networkID;
public:
inline bool IsNetworked() const { return (ObjectFlags & OF_Networked); }
inline uint32_t GetNetworkID() const { return _networkID; }
void SetNetworkID(const uint32_t id);
void ClearNetworkID();
void RemoveFromNetwork();
virtual void EnableNetworking(const bool enable);
}; };
// This is the only method aside from calling CreateNew that should be used for creating DObjects // This is the only method aside from calling CreateNew that should be used for creating DObjects

View file

@ -26,6 +26,7 @@ enum EObjectFlags
OF_Transient = 1 << 11, // Object should not be archived (references to it will be nulled on disk) OF_Transient = 1 << 11, // Object should not be archived (references to it will be nulled on disk)
OF_Spawned = 1 << 12, // Thinker was spawned at all (some thinkers get deleted before spawning) OF_Spawned = 1 << 12, // Thinker was spawned at all (some thinkers get deleted before spawning)
OF_Released = 1 << 13, // Object was released from the GC system and should not be processed by GC function OF_Released = 1 << 13, // Object was released from the GC system and should not be processed by GC function
OF_Networked = 1 << 14, // Object has a unique network identifier that makes it synchronizable between all clients.
}; };
template<class T> class TObjPtr; template<class T> class TObjPtr;

View file

@ -1,4 +1,3 @@
#include "common/engine/palettecontainer.h"
#include "name.h" #include "name.h"
#include "dobject.h" #include "dobject.h"
@ -6,3 +5,18 @@ bool ShouldAllowGameSpecificVirtual(FName name, unsigned index, PType* arg, PTyp
{ {
return false; return false;
} }
void DObject::EnableNetworking(const bool enable)
{
return;
}
void DObject::RemoveFromNetwork(void)
{
return;
}
void DObject::ClearNetworkID()
{
return;
}