The audio thread will now self-pump every 5 ms in case the rendering loop
takes too much time before waking up the audio thread, causing audio
starvation.
This is what was causing audio stutters/cuts during world loading.
I had the issue constantly the first time I pressed start to get the game
menu.
To avoid issues, the first wakeup of the audio thread is behind a `primed`
flag and will wait unconditionnally for the rendering loop to wake us up.
This is to make sure the game has initialized properly and avoid a crash
on boot.
The resolved replacement id (which can exceed 255) rode a single
per-player seqToPlay slot, written at enqueue but consumed
asynchronously on the audio thread; back-to-back starts and
priority-queue promotions clobbered it. sSeqFlags[0x6F] was also indexed
by raw id, reading out of bounds past the authentic range.
- func_800F9280 resolves the replacement and packs the full 16-bit id
into the 0x82/0x85 play command; the handler reads opArgs & 0xFFFF.
Audio_QueueSeqCmd no longer pre-writes the shared slot.
- SyncInitSeqPlayerInternal uses the command-carried id and bounds-checks
it against the calloc'd sequence map (+0xF headroom for reserved-range
skips).
- Route sSeqFlags reads through a bounded Audio_GetSeqFlags helper.
- Warn and skip gracefully past the 16-bit id limit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
We now have both tower collapse corrected, and other potential softlocks and bugs that would occur from weird network timing causing an UNSET of values in the game with these fixes.
* Fix bari's biris not respecting the seeded option
* Randomize Peehat Larvas
* Refactor `IsEnemyAllowedToSpawn`
* Fix the issue where some enemies spawn above the ceiling
* Partially fix twisted hallway issue
* Prevent Baris from spawning Baris
Crowd Control passed actor params 0 for EN_WF, so EnWf_Init treated
switchFlag 0 and killed the actor when scene switch 0 was set. Match
vanilla EnEncount1 Wolfos spawns: (0xFF << 8) | 0x00
Also prevent crowd control effects from triggering when link is not in controllable state