public DefaultStage(Stage stageId) { StageId = stageId; var stageInfo = StageInfo.FromStageId(stageId); if (stageInfo.MultiplayerStartPositions != null) { // For Rose and Chaotix copy 1P and 2P spawns in multiplayer. _startPositionsSingleInMultiplayer = new Pinnable <PositionStart>(new[] { stageInfo.MultiplayerStartPositions->Player1Start, stageInfo.MultiplayerStartPositions->Player2Start, stageInfo.MultiplayerStartPositions->Player1Start, stageInfo.MultiplayerStartPositions->Player2Start }); StartPositions = _startPositionsSingleInMultiplayer.Pointer; } else { if (stageInfo.StartPositions != null) { StartPositions = &stageInfo.StartPositions->SonicStart; } } if (stageInfo.MultiplayerBragPositions != null) { BragPositions = &stageInfo.EndPositions->SonicEnd; } if (stageInfo.EndPositions != null) { EndPositions = &stageInfo.EndPositions->SonicEnd; } /* Replace any nulls with defaults. */ if (StartPositions == null) { StartPositions = _defaultStartPositions.Pointer; } if (EndPositions == null) { EndPositions = _defaultEndPositions.Pointer; } if (BragPositions == null) { BragPositions = _defaultEndPositions.Pointer; } }
public DefaultStage(StageId stageId) { StageId = stageId; var stageInfo = StageInfo.FromStageId(stageId); if (stageInfo.MultiplayerStartPositions != null) { /* For Rose and Chaotix copy 1P and 2P spawns. */ _startPositionsSingleInMultiplayer = new PinnedManagedObject <PositionStart[]>(new[] { stageInfo.MultiplayerStartPositions->Player1Start, stageInfo.MultiplayerStartPositions->Player2Start, stageInfo.MultiplayerStartPositions->Player1Start, stageInfo.MultiplayerStartPositions->Player2Start }); StartPositions = (PositionStart *)_startPositionsSingleInMultiplayer.ObjectPtr; } else { if (stageInfo.StartPositions != null) { StartPositions = &stageInfo.StartPositions->SonicStart; } } if (stageInfo.MultiplayerBragPositions != null) { BragPositions = &stageInfo.EndPositions->SonicEnd; } if (stageInfo.EndPositions != null) { EndPositions = &stageInfo.EndPositions->SonicEnd; } /* Replace any nulls with defaults. */ if (StartPositions == null) { StartPositions = _defaultStartPositions.AsPointer <PositionStart>(); } if (EndPositions == null) { EndPositions = _defaultEndPositions.AsPointer <PositionEnd>(); } if (BragPositions == null) { BragPositions = _defaultEndPositions.AsPointer <PositionEnd>(); } }