private void LoadObjEntry(string name) { var model = _kernel.ObjEntries.FirstOrDefault(x => x.ModelName == name); if (model == null) { return; } var internalName = "p_ex"; switch (model.ObjectType) { case Objentry.Type.ZAKO: internalName = "m_ex"; break; case Objentry.Type.PLAYER: internalName = "p_ex"; break; case Objentry.Type.NPC: internalName = "h_ex"; internalName = "n_ex"; break; case Objentry.Type.WEAPON: internalName = "w_ex"; break; case Objentry.Type.F_OBJ: internalName = "f_ex"; break; case Objentry.Type.BOSS: internalName = "b_ex"; break; } var fileName = $"obj/{model.ModelName}.mdlx"; _archiveManager.LoadArchive(fileName); AddMesh(FromMdlx(_graphics.GraphicsDevice, _archiveManager, internalName, "tim_")); }
private void LoadObjEntry(string name) { var model = _kernel.ObjEntries.FirstOrDefault(x => x.ModelName == name); if (model == null) { return; } var fileName = $"obj/{model.ModelName}.mdlx"; using var stream = _dataContent.FileOpen(fileName); var entries = Bar.Read(stream); var modelEntryName = entries.FirstOrDefault(x => x.Type == Bar.EntryType.Model)?.Name; _archiveManager.LoadArchive(entries); AddMesh(FromMdlx(_graphics.GraphicsDevice, _archiveManager, modelEntryName, "tim_")); }
public void Initialize(StateInitDesc initDesc) { Kernel = initDesc.Kernel; _archiveManager = initDesc.ArchiveManager; InputManager = initDesc.InputManager; _stateChange = initDesc.StateChange; var viewport = initDesc.GraphicsDevice.GraphicsDevice.Viewport; _shader = new KingdomShader(initDesc.ContentManager); drawing = new MonoSpriteDrawing(initDesc.GraphicsDevice.GraphicsDevice, _shader); drawing.SetProjection( viewport.Width, viewport.Height, Global.ResolutionWidth, Global.ResolutionHeight, 1.0f); if (Kernel.IsReMix) { _archiveManager.LoadArchive($"menu/{Kernel.Region}/titlejf.2ld"); } _archiveManager.LoadArchive($"menu/{Kernel.Region}/title.2ld"); _archiveManager.LoadArchive($"menu/{Kernel.Region}/save.2ld"); _isTheaterModeUnlocked = false; if (Kernel.IsReMix) { if (_isTheaterModeUnlocked) { _titleLayoutDesc = ReMixTheaterTitleLayout; } else { _titleLayoutDesc = ReMixTitleLayout; } } else if (Kernel.RegionId == Kh2.Constants.RegionFinalMix) { if (_isTheaterModeUnlocked) { _titleLayoutDesc = FinalMixTheaterTitleLayout; } else { _titleLayoutDesc = FinalMixTitleLayout; } } else { _titleLayoutDesc = VanillaTitleLayout; } var messageContext = Kernel.SystemMessageContext; _messageRenderer = new Kh2MessageRenderer(drawing, messageContext); IEnumerable <ISpriteTexture> images; (_titleLayout, images) = GetLayoutResources("titl", "titl"); layoutRendererBg = new LayoutRenderer(_titleLayout, drawing, images); layoutRendererFg = new LayoutRenderer(_titleLayout, drawing, images); layoutRendererBg.SelectedSequenceGroupIndex = _titleLayoutDesc.Copyright; _sequenceRendererMenu = new SequenceRenderer(_titleLayout.SequenceItems[0], drawing, images.First()); Log.Info($"Theater={_titleLayoutDesc.HasTheater}"); if (_titleLayoutDesc.HasTheater) { (_theaterLayout, images) = GetLayoutResources("even", "even"); layoutRendererTheater = new LayoutRenderer(_theaterLayout, drawing, images); } SetOption(0); }
public void Initialize(StateInitDesc initDesc) { _kernel = initDesc.Kernel; _content = initDesc.DataContent; _archiveManager = initDesc.ArchiveManager; Input = initDesc.Input; var viewport = initDesc.GraphicsDevice.GraphicsDevice.Viewport; _shader = new KingdomShader(initDesc.ContentManager); _drawing = new MonoSpriteDrawing(initDesc.GraphicsDevice.GraphicsDevice, _shader); _drawing.SetProjection( viewport.Width, viewport.Height, Global.ResolutionWidth, Global.ResolutionHeight, 1.0f); initDesc.GraphicsDevice.GraphicsDevice.DepthStencilState = new Microsoft.Xna.Framework.Graphics.DepthStencilState { DepthBufferEnable = false, StencilEnable = false, }; var messageContext = _kernel.SystemMessageContext; _messageRenderer = new Kh2MessageRenderer(_drawing, messageContext); _archiveManager.LoadArchive($"menu/{_kernel.Region}/camp.2ld"); (_campLayout, _textures) = GetLayoutResources("camp", "camp"); _layoutRenderer = new LayoutRenderer(_campLayout, _drawing, _textures) { SelectedSequenceGroupIndex = 0 }; SequenceFactory = new AnimatedSequenceFactory( _drawing, initDesc.Kernel.MessageProvider, _messageRenderer, _kernel.SystemMessageContext.Encoder, _campLayout.SequenceItems[1], _textures.First()); _backgroundSeq = SequenceFactory.Create(new List <AnimatedSequenceDesc> { new AnimatedSequenceDesc { SequenceIndexStart = 107, SequenceIndexLoop = 108, SequenceIndexEnd = 109, }, new AnimatedSequenceDesc { SequenceIndexStart = 110, SequenceIndexLoop = 111, SequenceIndexEnd = 112, }, new AnimatedSequenceDesc { SequenceIndexStart = 113, SequenceIndexLoop = 114, SequenceIndexEnd = 115, } }); _subMenuDescriptionSeq = SequenceFactory.Create(new List <AnimatedSequenceDesc>()); }
public void Initialize(StateInitDesc initDesc) { _kernel = initDesc.Kernel; _archiveManager = initDesc.ArchiveManager; _inputManager = initDesc.InputManager; _stateChange = initDesc.StateChange; drawing = new MonoDrawing(initDesc.GraphicsDevice.GraphicsDevice, initDesc.ContentManager); var viewport = initDesc.GraphicsDevice.GraphicsDevice.Viewport; drawing.SetProjection( viewport.Width, viewport.Height, Global.ResolutionWidth, Global.ResolutionHeight, 1.0f); cachedSurfaces = new Dictionary <string, IEnumerable <ISurface> >(); if (_kernel.IsReMix) { _archiveManager.LoadArchive($"menu/{_kernel.Region}/titlejf.2ld"); } _archiveManager.LoadArchive($"menu/{_kernel.Region}/title.2ld"); _archiveManager.LoadArchive($"menu/{_kernel.Region}/save.2ld"); _isTheaterModeUnlocked = false; if (_kernel.IsReMix) { if (_isTheaterModeUnlocked) { _titleLayout = ReMixTheaterTitleLayout; } else { _titleLayout = ReMixTitleLayout; } } else if (_kernel.RegionId == Constants.RegionFinalMix) { if (_isTheaterModeUnlocked) { _titleLayout = FinalMixTheaterTitleLayout; } else { _titleLayout = FinalMixTitleLayout; } } else { _titleLayout = VanillaTitleLayout; } layoutRendererBg = CreateLayoutRenderer("titl"); layoutRendererFg = CreateLayoutRenderer("titl"); layoutRendererBg.SelectedSequenceGroupIndex = _titleLayout.Copyright; if (_titleLayout.HasTheater) { layoutRendererTheater = CreateLayoutRenderer("even"); } SetOption(0); }