private void AddNewHitPrim(ParamData.AtkParam.Hit hit, ParamData.AtkParam.DummyPolySource dmyFilter, bool visible = false, bool dontUpdate = false) { if (!HitPrims.ContainsKey(hit)) { HitPrims.Add(hit, new List <IDbgPrim>()); } if (!HitFilters.ContainsKey(hit)) { HitFilters.Add(hit, dmyFilter); } else { HitFilters[hit] = dmyFilter; } if (hit.IsCapsule) { HitPrims[hit].Add(new DbgPrimWireCapsule(hit.GetColor()) { EnableDraw = visible, Category = DbgPrimCategory.DummyPolyHelper, //OverrideColor = hit.GetColor(), }); } else { if (DummyPolyByRefID.ContainsKey(hit.DmyPoly1)) { foreach (var dmy in DummyPolyByRefID[hit.DmyPoly1]) { HitPrims[hit].Add(new DbgPrimWireSphere(new Transform(Matrix.CreateScale(hit.Radius) * dmy.ReferenceMatrix), Color.White) { EnableDraw = visible, Category = DbgPrimCategory.DummyPolyHelper, OverrideColor = hit.GetColor(), }); } } } lock (_lock_everything_monkaS) { if (visible && !VisibleHitsToHideForHideAll.Contains(hit)) { VisibleHitsToHideForHideAll.Enqueue(hit); } if (!dontUpdate) { UpdateHitPrim(hit); } } }
public void ShowAttackOnDummyPoly(ParamData.AtkParam atk, int dummyPolyID) { if (!DummyPolyByRefID.ContainsKey(dummyPolyID)) { return; } foreach (var dmy in DummyPolyByRefID[dummyPolyID]) { dmy.ShowAttack = atk; if (!CurrentShowAttackQueueForClearAll.Contains(dmy)) { CurrentShowAttackQueueForClearAll.Enqueue(dmy); } } }
public void SpawnBulletOnDummyPoly(int bulletID, int dummyPolyID) { if (!DummyPolyByRefID.ContainsKey(dummyPolyID)) { return; } foreach (var dmy in DummyPolyByRefID[dummyPolyID]) { dmy.BulletSpawnIDs.Add(bulletID); if (!CurrentBulletSpawnQueueForClearAll.Contains(dmy)) { CurrentBulletSpawnQueueForClearAll.Enqueue(dmy); } } }
//public ParamData.AtkParam.DummyPolySource defaultDummyPolySource = ParamData.AtkParam.DummyPolySource.Body; public void SpawnSFXOnDummyPoly(int sfxID, int dummyPolyID) { if (!DummyPolyByRefID.ContainsKey(dummyPolyID)) { return; } foreach (var dmy in DummyPolyByRefID[dummyPolyID]) { dmy.SFXSpawnIDs.Add(sfxID); if (!CurrentSFXSpawnQueueForClearAll.Contains(dmy)) { CurrentSFXSpawnQueueForClearAll.Enqueue(dmy); } } }
public void SpawnMiscOnDummyPoly(string misc, int dummyPolyID) { if (!DummyPolyByRefID.ContainsKey(dummyPolyID)) { return; } for (int i = 0; i < DummyPolyByRefID[dummyPolyID].Count; i++) { if (dummyPolyID == 200 && i > 0) { misc = ""; } DummyPolyByRefID[dummyPolyID][i].MiscSpawnTexts.Add(misc); if (!CurrentMiscSpawnQueueForClearAll.Contains(DummyPolyByRefID[dummyPolyID][i])) { CurrentMiscSpawnQueueForClearAll.Enqueue(DummyPolyByRefID[dummyPolyID][i]); } } }
public void SetAttackVisibility(ParamData.AtkParam atk, bool visible, ParamData.AtkParam.DummyPolySource dmyFilter) { bool isFirstValidDmyPoly = true; for (int i = 0; i < atk.Hits.Length; i++) { int dmyPoly1 = atk.Hits[i].GetFilteredDmyPoly1(dmyFilter); if (dmyPoly1 == -1) { continue; } if (visible && isFirstValidDmyPoly && dmyPoly1 != -1 && DummyPolyByRefID.ContainsKey(dmyPoly1)) { ShowAttackOnDummyPoly(atk, dmyPoly1); isFirstValidDmyPoly = false; } SetHitVisibility(atk.Hits[i], visible, dmyFilter); } }
private void UpdateHitPrim(ParamData.AtkParam.Hit hit) { lock (_lock_everything_monkaS) { int dmyPoly1 = hit.DmyPoly1; int dmyPoly2 = hit.DmyPoly2; var filter = ParamData.AtkParam.DummyPolySource.Body; if (HitFilters.ContainsKey(hit)) { dmyPoly1 = hit.GetFilteredDmyPoly1(HitFilters[hit]); dmyPoly2 = hit.GetFilteredDmyPoly2(HitFilters[hit]); filter = HitFilters[hit]; } if (hit.IsCapsule) { if (DummyPolyByRefID.ContainsKey(dmyPoly1) && DummyPolyByRefID.ContainsKey(dmyPoly2)) { Vector3 pointA = Vector3.Transform(Vector3.Zero, DummyPolyByRefID[dmyPoly1][0].CurrentMatrix); Vector3 pointB = Vector3.Transform(Vector3.Zero, DummyPolyByRefID[dmyPoly2][0].CurrentMatrix); ((DbgPrimWireCapsule)HitPrims[hit][0]).UpdateCapsuleEndPoints(pointA, pointB, hit.Radius); } else { ((DbgPrimWireCapsule)HitPrims[hit][0]).UpdateCapsuleEndPoints(Vector3.Zero, Vector3.Zero, hit.Radius); } } else { if (dmyPoly1 == -1 || hit.Radius == 0) { for (int i = 0; i < HitPrims[hit].Count; i++) { HitPrims[hit][i].Transform = new Transform(Matrix.CreateScale(hit.Radius)); } } else if (DummyPolyByRefID.ContainsKey(dmyPoly1)) { if (DummyPolyByRefID[dmyPoly1].Count != HitPrims[hit].Count) { AddNewHitPrim(hit, filter, false, dontUpdate: true); } for (int i = 0; i < Math.Min(HitPrims[hit].Count, DummyPolyByRefID[dmyPoly1].Count); i++) { Matrix m = DummyPolyByRefID[dmyPoly1][i].CurrentMatrix; Quaternion q = Quaternion.CreateFromRotationMatrix(m); Matrix rm = Matrix.CreateFromQuaternion(q); Matrix tm = Matrix.CreateTranslation(Vector3.Transform(Vector3.Zero, m)); HitPrims[hit][i].Transform = new Transform(Matrix.CreateScale(hit.Radius) * rm * tm); } } else { for (int i = 0; i < HitPrims[hit].Count; i++) { HitPrims[hit][i].Transform = new Transform(Matrix.CreateScale(hit.Radius)); } } } } }