refactor(runtime): extract local teleport and player mode
Move local teleport, player-mode, animation, shadow, and sealed-dungeon lifetimes out of GameWindow. Make player-mode entry transactional and isolate approach completions by controller lifetime and approach generation so stale callbacks cannot affect replacements. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
c557038353
commit
eeb0f6b45c
29 changed files with 3311 additions and 1073 deletions
44
src/AcDream.App/Streaming/SealedDungeonCellClassifier.cs
Normal file
44
src/AcDream.App/Streaming/SealedDungeonCellClassifier.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using DatReaderWriter;
|
||||
using DatReaderWriter.DBObjs;
|
||||
using DatReaderWriter.Enums;
|
||||
using AcDream.Content;
|
||||
|
||||
namespace AcDream.App.Streaming;
|
||||
|
||||
internal interface ISealedDungeonCellClassifier
|
||||
{
|
||||
bool IsSealedDungeon(uint cellId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classifies a server-supplied full cell ID using the EnvCell's retail
|
||||
/// <see cref="EnvCellFlags.SeenOutside"/> bit. Missing, outdoor, and structural
|
||||
/// shell IDs are never guessed to be sealed.
|
||||
/// </summary>
|
||||
internal sealed class DatSealedDungeonCellClassifier
|
||||
: ISealedDungeonCellClassifier
|
||||
{
|
||||
private readonly IDatReaderWriter _dats;
|
||||
private readonly object _datLock;
|
||||
|
||||
public DatSealedDungeonCellClassifier(
|
||||
IDatReaderWriter dats,
|
||||
object datLock)
|
||||
{
|
||||
_dats = dats ?? throw new ArgumentNullException(nameof(dats));
|
||||
_datLock = datLock ?? throw new ArgumentNullException(nameof(datLock));
|
||||
}
|
||||
|
||||
public bool IsSealedDungeon(uint cellId)
|
||||
{
|
||||
uint low = cellId & 0xFFFFu;
|
||||
if (low < 0x0100u || low >= 0xFFFEu)
|
||||
return false;
|
||||
|
||||
EnvCell? envCell;
|
||||
lock (_datLock)
|
||||
envCell = _dats.Get<EnvCell>(cellId);
|
||||
return envCell is not null
|
||||
&& !envCell.Flags.HasFlag(EnvCellFlags.SeenOutside);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue