private void EditWarps() { if (mm.IsDecomp) { MessageBox.Show("No cheating on decomp ROMs allowed FUNgineer", "Decomp Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } int X = picX; int Y = picY; int line = (int)Math.Floor(Y / gm.SHeight); bool isSecret = ((int)Math.Floor(X / (gm.Width / 2))) == 1; int star = (int)Math.Floor((X - (isSecret ? (gm.Width / 2) : 0)) / gm.SWidth); if (line > ld.GetLength()) { return; } try { LineDescriptionEx curld = null; do { curld = isSecret ? ld.secretDescription[line] : ld.courseDescription[line]; if (line > ld.GetLength()) { return; } line++; } while (curld == null || (curld is TextOnlyLineDescription)); if (curld is StarsLineDescription sld) { mm.WriteWarp(wd is object?wd.warp: (byte)0xa, (byte)LevelInfo.FindByEEPOffset(sld.offset).Level, wd is object?wd.area: (byte)1); } return; } catch (Exception) { } }
private void EditWarps() { int X = picX; int Y = picY; int line = (int)Math.Floor(Y / gm.SHeight); bool isSecret = ((int)Math.Floor(X / (gm.Width / 2))) == 1; int star = (int)Math.Floor((X - (isSecret ? (gm.Width / 2) : 0)) / gm.SWidth); if (line > ld.GetLength()) { return; } try { LineDescriptionEx curld = null; do { curld = isSecret ? ld.secretDescription[line] : ld.courseDescription[line]; if (line > ld.GetLength()) { return; } line++; } while (curld == null || (curld is TextOnlyLineDescription)); if (curld is StarsLineDescription sld) { mm.WriteWarp(wd.warp, (byte)LevelInfo.FindByEEPOffset(sld.offset).Level, wd.area); } return; } catch (Exception) { } }
virtual public IEnumerator <Action> GetEnumerator() { yield return(new StarLayoutInitAction()); for (int line = 0; line < ld.courseDescription.Count; line++) { var descr = ld.courseDescription[line]; StarsLineDescription sld = descr as StarsLineDescription; if (sld == null) { continue; } byte oldStarByte = oldStars[sld.offset]; byte newStarByte = stars[sld.offset]; if (oldStarByte != newStarByte) { byte diffbyteFromOld = (byte)(((oldStarByte) ^ (newStarByte)) & newStarByte); yield return(new LastHighlight(line, diffbyteFromOld, false, sld.starMask)); } if ((stars[sld.highlightOffset] & sld.highlightStarMask) != 0) { yield return(new TextHighlightAction(line, false, sld.text)); } } for (int line = 0; line < ld.secretDescription.Count; line++) { var descr = ld.secretDescription[line]; StarsLineDescription sld = descr as StarsLineDescription; if (sld == null) { continue; } byte oldStarByte = oldStars[sld.offset]; byte newStarByte = stars[sld.offset]; if (oldStarByte != newStarByte) { byte diffbyteFromOld = (byte)(((oldStarByte) ^ (newStarByte)) & newStarByte); yield return(new LastHighlight(line, diffbyteFromOld, true, sld.starMask)); } if ((stars[sld.highlightOffset] & sld.highlightStarMask) != 0) { yield return(new TextHighlightAction(line, true, sld.text)); } } yield return(new LastStarHighlightAction()); int starCount = 0; for (int line = 0; line < ld.courseDescription.Count; line++) { var descr = ld.courseDescription[line]; StarsLineDescription sld = descr as StarsLineDescription; if (sld == null) { continue; } byte oldStarByte = oldStars[sld.offset]; byte newStarByte = stars[sld.offset]; starCount += MemoryManager.countStars((byte)(newStarByte & sld.starMask), ld.starsShown); yield return(new LineDrawAction(line, newStarByte, MemoryManager.countStars((byte)(newStarByte & sld.starMask), ld.starsShown) - MemoryManager.countStars((byte)(oldStarByte & sld.starMask), ld.starsShown), false, sld.starMask)); } for (int line = 0; line < ld.secretDescription.Count; line++) { var descr = ld.secretDescription[line]; StarsLineDescription sld = descr as StarsLineDescription; if (sld == null) { continue; } byte oldStarByte = oldStars[sld.offset]; byte newStarByte = stars[sld.offset]; starCount += MemoryManager.countStars((byte)(newStarByte & sld.starMask), ld.starsShown); yield return(new LineDrawAction(line, newStarByte, MemoryManager.countStars((byte)(newStarByte & sld.starMask), ld.starsShown) - MemoryManager.countStars((byte)(oldStarByte & sld.starMask), ld.starsShown), true, sld.starMask)); } yield return(new StarLayoutFiniAction(ld.GetLength())); yield return(new StarTextLineDrawAction()); yield return(new StringLineDrawAction(starCount.ToString().PadLeft(3) + "/" + ld.starAmount.PadRight(3))); yield return(new RedsSecretsDrawAction(reds, totalReds, secrets, totalSecrets, activePanels, totalPanels)); }