private void RemoveCharLight(int level, int act, int typeUI) { LSPaletteData light = FindCharacterLight(level, act, typeUI); if (light != null) { CharLights.Remove(light); } }
/// <summary> /// Sets up lighting using SADX LSPalette data. /// </summary> private static void SetCharacterLight(Device d3ddevice, Vertex stageLightDirection, LSPaletteData lspalette, bool casino = false, bool icecap = false) { float dir_x; float dir_y; float dir_z; RawVector3 lightDirection; currentLight.Ambient.R = lspalette.Ambient.X; currentLight.Ambient.G = lspalette.Ambient.Y; currentLight.Ambient.B = lspalette.Ambient.Z; currentLight.Diffuse.A = 1.0f; currentLight.Diffuse.R = lspalette.Diffuse; currentLight.Diffuse.G = lspalette.Diffuse; currentLight.Diffuse.B = lspalette.Diffuse; currentLight.Specular.R = lspalette.Specular1.X; currentLight.Specular.G = lspalette.Specular1.Y; currentLight.Specular.B = lspalette.Specular1.Z; currentLight.Type = LightType.Directional; if (lspalette.Flags.HasFlag(LSPaletteData.LSPaletteFlags.UseLSLightDirection)) { lightDirection = lspalette.Direction.ToVector3(); } else { lightDirection = stageLightDirection.ToVector3(); } if (casino) { dir_x = stageLightDirection.X; dir_y = stageLightDirection.Y; dir_z = stageLightDirection.Z; currentLight.Direction.X = dir_x; currentLight.Direction.Y = dir_y; currentLight.Direction.Z = dir_z; goto skipdir; } if (!lspalette.Flags.HasFlag(LSPaletteData.LSPaletteFlags.IgnoreDirection)) { currentLight.Direction.X = lightDirection.X; currentLight.Direction.Y = lightDirection.Y; currentLight.Direction.Z = lightDirection.Z; goto skipdir; } currentLight.Direction.X = -lightDirection.X; currentLight.Direction.Y = -lightDirection.Y; currentLight.Direction.Z = -lightDirection.Z; skipdir: // Set light 0 d3ddevice.SetLight(0, ref currentLight); d3ddevice.EnableLight(0, true); // Set render states d3ddevice.SetRenderState(RenderState.Lighting, true); d3ddevice.SetRenderState(RenderState.SpecularEnable, true); d3ddevice.SetRenderState(RenderState.AlphaBlendEnable, true); d3ddevice.SetRenderState(RenderState.ShadeMode, 2); // Disable lights 1-2 and enable light 3 for (int i = 1; i < 4; i++) { if ((icecap || lspalette.Flags.HasFlag(LSPaletteData.LSPaletteFlags.OverrideLastLight) && i == 3)) { if (icecap) { currentLight.Specular.R = 0.2f; currentLight.Specular.G = 0.2f; currentLight.Specular.B = 0.2f; } currentLight.Direction.X = -lightDirection.X; currentLight.Direction.Y = -lightDirection.Y; currentLight.Direction.Z = -lightDirection.Z; d3ddevice.SetLight(3, ref currentLight); d3ddevice.EnableLight(3, true); } else { d3ddevice.EnableLight(i, false); } } }
private void SetCurrentLights() { CurrentStageLight = FindStageLight(comboBoxLevel.SelectedIndex, (int)numericUpDownAct.Value, (int)numericUpDownStageLightIndex.Value); CurrentCharLight = FindCharacterLight(comboBoxLevel.SelectedIndex, (int)numericUpDownAct.Value, comboBoxLightType.SelectedIndex); RefreshUIValues(); }