public FormZoneCollisionData(UserRect activeRect, Map.ZoneColorDetection zoneColorDetection) { InitializeComponent(); Rectangle rect = activeRect.GetRectangle(); numericUpDownX.Value = rect.X; numericUpDownY.Value = rect.Y; numericUpDownW.Value = rect.Width; numericUpDownH.Value = rect.Height; switch (zoneColorDetection) { case Map.ZoneColorDetection.Flag0: radioButtonFlag0.Checked = true; break; case Map.ZoneColorDetection.Flag1: radioButtonFlag1.Checked = true; break; default: radioButtonAlways.Checked = true; break; } }
private static void ExportColorCollision(StreamWriter file, int mapIndex, Map.TypeColorDetection ColorDetection, List <Rectangle> DectectionRect, List <Map.ZoneColorDetection> colpf2DetectionFlags) { switch (ColorDetection) { case Map.TypeColorDetection.None: file.WriteLine($"{BOL}clc"); file.WriteLine($"{BOL}rts"); break; case Map.TypeColorDetection.Outside: file.WriteLine($"{BOL}jsr @+1"); file.WriteLine($"{BOL}bcs @+"); file.WriteLine($"{BOL}sec"); file.WriteLine($"{BOL}rts"); file.WriteLine($"@{BOL}clc"); file.WriteLine($"{BOL}rts"); file.WriteLine($"@{BOL}; test inside"); for (int i = 0; i < DectectionRect.Count; i++) { RectangleF rect = DectectionRect[i]; Map.ZoneColorDetection flag = colpf2DetectionFlags[i]; ExportRect(file, mapIndex, rect, flag); } file.WriteLine($"{BOL}rts"); break; case Map.TypeColorDetection.Inside: for (int i = 0; i < DectectionRect.Count; i++) { RectangleF rect = DectectionRect[i]; Map.ZoneColorDetection flag = colpf2DetectionFlags[i]; ExportRect(file, mapIndex, rect, flag); } file.WriteLine($"{BOL}rts"); break; default: file.WriteLine($"{BOL}sec"); file.WriteLine($"{BOL}rts"); break; } }
private static void ExportRect(StreamWriter file, int mapIndex, RectangleF rect, Map.ZoneColorDetection flag) { switch (flag) { case Map.ZoneColorDetection.Flag0: file.WriteLine($"{BOL}lda PlayerMap{mapIndex}LampsCounts"); file.WriteLine($"{BOL}and #CONTEXTFLAG0MASK"); file.WriteLine($"{BOL}beq @+"); break; case Map.ZoneColorDetection.Flag1: file.WriteLine($"{BOL}lda PlayerMap{mapIndex}LampsCounts"); file.WriteLine($"{BOL}and #CONTEXTFLAG1MASK"); file.WriteLine($"{BOL}beq @+"); break; } // http://retro.hansotten.nl/lee-davison-web-site/some-veryshort-code-bits/ byte xmax = (byte)(Math.Floor(rect.Right) + 48); byte xmin = (byte)(Math.Ceiling(rect.Left) + 48); byte ymax = (byte)((Math.Floor(rect.Bottom) + 13) * 2); byte ymin = (byte)((Math.Ceiling(rect.Top) + 13) * 2); file.WriteLine($"{BOL}txa"); file.WriteLine($"{BOL}clc"); file.WriteLine($"{BOL}adc #{255 - xmax}"); file.WriteLine($"{BOL}adc #{xmax - xmin + 1}"); file.WriteLine($"{BOL}bcc @+"); file.WriteLine($"{BOL};{xmin} < X < {xmax}"); file.WriteLine($"{BOL}tya"); file.WriteLine($"{BOL}clc"); file.WriteLine($"{BOL}adc #{255 - ymax}"); file.WriteLine($"{BOL}adc #{ymax - ymin + 1}"); file.WriteLine($"{BOL}bcc @+"); file.WriteLine($"{BOL};{ymin} < Y < {ymax}"); file.WriteLine($"{BOL}rts; Hit : Carry Set"); file.WriteLine($"@{BOL}; Carry Clear"); }