mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-05-01 18:13:57 +00:00
* Add multiplayer extension * Fix animation system to work when host is outside ISLE world - Move TickHostSessions outside m_inIsleWorld gate so the host can coordinate animations from any world - Load animation catalog early in HandleCreate so the host can coordinate before entering the ISLE world - Use network-reported positions for remote player location detection instead of requiring spawned ROIs - Always erase sessions at launch — the host's job ends when the animation starts; clients play and complete independently - Replace BroadcastAnimComplete with locally-driven completion callbacks: host generates eventId at launch, clients cache completion JSON at start time, fire it when ScenePlayer finishes - Make StopAnimation only do local cleanup (stop playback, cancel own interest, reset coordinator) without destroying the session host, so other players' sessions survive world transitions - Broadcast state=0 in ResetAnimationState for full teardown paths (shutdown, reconnect, host migration) so clients aren't left with stale session state * Fix use-after-free crash in ScenePlayer when remote player disconnects mid-animation When a remote player's ROI is destroyed (disconnect, timeout, or respawn), notify all active ScenePlayer instances to null out dangling references before the ROI is freed. The animation engine already handles null ROI map entries gracefully, so playback continues for remaining participants. * Fix crash when performer's child ROIs are left dangling in ScenePlayer NotifyROIDestroyed now walks the parent chain to also invalidate child ROIs of the destroyed performer (head, limbs, etc.) that were placed into the roiMap by BuildROIMap. The ancestor walk happens once; all other fields are cleaned with simple pointer equality. * Allow spectator to play click animation during scene playback * Make PTATCAM track spectator ROI instead of camera in ScenePlayer * Only regenerate emscripten version files when git state changes Replace add_custom_target(ALL) with add_custom_command(OUTPUT) so the version script only runs when .git/HEAD or the current branch ref file changes, instead of on every build. * Fix ROI name collision causing dangling pointers in NPC locomotion roiMaps When ScenePlayer created cloned NPC ROIs for cooperative animations, it renamed them to match the original character name and added them to the ViewManager. This created a name collision: two ROIs with the same name. The original game's AppendROIToScene searches by name and stops at the first match, so if a locomotion BuildROIMap ran while the clone existed, it could capture pointers to the clone's child ROIs. When the clone was later destroyed (CleanupProps), those roiMap entries became dangling pointers, crashing in AnimateWithTransform at roi.h:151 (SetVisibility). Fix: use the alias mechanism (already supported by AnimUtils::BuildROIMap) instead of renaming clones. Also unify all ROI name generation behind a shared counter to prevent character manager key collisions.
90 lines
2.6 KiB
C++
90 lines
2.6 KiB
C++
#ifndef LEGOCACHSOUND_H
|
|
#define LEGOCACHSOUND_H
|
|
|
|
#include "decomp.h"
|
|
#include "extensions/fwd.h"
|
|
#include "lego3dsound.h"
|
|
#include "mxcore.h"
|
|
#include "mxstring.h"
|
|
#include "mxwavepresenter.h"
|
|
|
|
// VTABLE: LEGO1 0x100d4718
|
|
// VTABLE: BETA10 0x101bb6f0
|
|
// SIZE 0x88
|
|
class LegoCacheSound : public MxCore {
|
|
public:
|
|
LegoCacheSound();
|
|
LegoCacheSound(LegoCacheSound& p_sound);
|
|
~LegoCacheSound() override; // vtable+0x00
|
|
|
|
// FUNCTION: LEGO1 0x10006580
|
|
const char* ClassName() const override // vtable+0x0c
|
|
{
|
|
// not in BETA10
|
|
// STRING: LEGO1 0x100f01c4
|
|
return "LegoCacheSound";
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x10006590
|
|
MxBool IsA(const char* p_name) const override // vtable+0x10
|
|
{
|
|
return !strcmp(p_name, LegoCacheSound::ClassName()) || MxCore::IsA(p_name);
|
|
}
|
|
|
|
virtual MxResult Create(
|
|
MxWavePresenter::WaveFormat& p_pwfx,
|
|
MxString p_mediaSrcPath,
|
|
MxS32 p_volume,
|
|
MxU8* p_data,
|
|
MxU32 p_dataSize
|
|
); // vtable+0x14
|
|
virtual void Destroy(); // vtable+0x18
|
|
virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c
|
|
|
|
const MxString& GetUnknown0x48() const { return m_unk0x48; }
|
|
const MxBool GetUnknown0x58() const { return m_unk0x58; }
|
|
|
|
LegoCacheSound* Clone();
|
|
MxResult Play(const char* p_name, MxBool p_looping);
|
|
void Stop();
|
|
void FUN_10006be0();
|
|
void SetDistance(MxS32 p_min, MxS32 p_max);
|
|
void MuteSilence(MxBool p_muted);
|
|
void MuteStop(MxBool p_mute);
|
|
LegoCacheSound& operator=(LegoCacheSound& p_sound);
|
|
void CopyFrom(LegoCacheSound& p_sound);
|
|
|
|
// SYNTHETIC: LEGO1 0x10006610
|
|
// SYNTHETIC: BETA10 0x100675b0
|
|
// LegoCacheSound::`scalar deleting destructor'
|
|
|
|
private:
|
|
friend class Multiplayer::Animation::AudioPlayer;
|
|
friend class Multiplayer::NetworkManager;
|
|
|
|
void Init();
|
|
void CopyData(MxU8* p_data, MxU32 p_dataSize);
|
|
MxString GetBaseFilename(MxString& p_path);
|
|
|
|
// [library:audio] WAVE_FORMAT_PCM (audio in .SI files only used this format)
|
|
static const MxU32 g_supportedFormatTag = 1;
|
|
|
|
MxMiniaudio<ma_audio_buffer> m_buffer;
|
|
MxMiniaudio<ma_sound> m_cacheSound;
|
|
undefined m_unk0x0c[4]; // 0x0c
|
|
Lego3DSound m_sound; // 0x10
|
|
MxU8* m_data; // 0x40
|
|
MxU32 m_dataSize; // 0x44
|
|
MxString m_unk0x48; // 0x48
|
|
MxBool m_unk0x58; // 0x58
|
|
MxWavePresenter::WaveFormat m_wfx; // 0x59
|
|
MxBool m_looping; // 0x69
|
|
MxBool m_unk0x6a; // 0x6a
|
|
MxS32 m_volume; // 0x6c
|
|
MxBool m_unk0x70; // 0x70
|
|
MxString m_unk0x74; // 0x74
|
|
MxBool m_muted; // 0x84
|
|
};
|
|
|
|
#endif // LEGOCACHSOUND_H
|