From cec3f90f3cbb849c6444e09d9aadbcd74052ac6f Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Tue, 10 Dec 2024 15:30:52 -0600 Subject: [PATCH] Added Into the Deep field --- lib/pages/field_planner.rb | 4 +- lib/simulator/field.rb | 138 +++++++++++++++++++++++++++++++++++- lib/simulator/simulation.rb | 2 +- 3 files changed, 138 insertions(+), 6 deletions(-) diff --git a/lib/pages/field_planner.rb b/lib/pages/field_planner.rb index 0da8884..3711976 100644 --- a/lib/pages/field_planner.rb +++ b/lib/pages/field_planner.rb @@ -38,7 +38,7 @@ module TAC refresh_panel end - list_box items: ["CENTERSTAGE", "Power Play", "Freight Frenzy", "Ultimate Goal", "Skystone"], width: 200, height: 1.0 do |item| + list_box items: ["Into the Deep", "CENTERSTAGE", "Power Play", "Freight Frenzy", "Ultimate Goal", "Skystone"], width: 200, height: 1.0 do |item| season = item.downcase.gsub(" ", "_").to_sym @field = TAC::Simulator::Field.new(container: @field_container, season: season, simulation: nil) end @@ -68,7 +68,7 @@ module TAC end end - @field = TAC::Simulator::Field.new(container: @field_container, season: :centerstage, simulation: nil) + @field = TAC::Simulator::Field.new(container: @field_container, season: :into_the_deep, simulation: nil) @nodes ||= [] @unit = :inches @total_distance = 0 diff --git a/lib/simulator/field.rb b/lib/simulator/field.rb index 48b900c..4dbfa42 100644 --- a/lib/simulator/field.rb +++ b/lib/simulator/field.rb @@ -336,9 +336,7 @@ module TAC end end - ########################### - ### --- CENTERSTAGE --- ### - ########################### + def draw_field_centerstage # Corner TAPE 2.times do |i| @@ -441,6 +439,140 @@ module TAC end + ############################# + ### --- Into the Deep --- ### + ############################# + def draw_field_into_the_deep + # Observation and net zones + 2.times do |i| + Gosu.rotate(i * 180.0, 72, 72) do + Gosu.draw_quad( + 24 - 2, 0, i.odd? ? @red : @blue, + 24, 0, i.odd? ? @red : @blue, + 0, 24 - 2, i.odd? ? @red : @blue, + 0, 24, i.odd? ? @red : @blue, + @z + ) + + Gosu.draw_rect( + 12, 144 - 24, + 2, 24, + i.odd? ? @red : @blue, + @z + ) + + Gosu.draw_quad( + 12, 144 - 24, i.odd? ? @red : @blue, + 14, 144 - 24, i.odd? ? @red : @blue, + 0, 144 - 36, i.odd? ? @red : @blue, + 0, 144 - 38, i.odd? ? @red : @blue, + @z + ) + end + end + + faint_white = Gosu::Color.rgb(240, 240, 240) + + # spike marks, white + 3.times do |i| + Gosu.draw_rect( + 48 - 3.5, 22 - i * 10, + 3.5, 2, + faint_white, + @z + ) + end + #spike marks, red + 3.times do |i| + Gosu.draw_rect( + (144 - 48), 22 - i * 10, + 3.5, 2, + @red, + @z + ) + end + # spike marks, blue + 3.times do |i| + Gosu.draw_rect( + 48 - 3.5, 144 - 24 + i * 10, + 3.5, 2, + @blue, + @z + ) + end + # spike marks, yellow + 3.times do |i| + Gosu.draw_rect( + (144 - 48), 144 - 24 + i * 10, + 3.5, 2, + faint_white, + @z + ) + end + + # Accent Zone Triangle TAPE + 2.times do |i| + Gosu.rotate(i * 180.0, 72, 72) do + Gosu.draw_quad( + 48, 48, faint_white, + 72, 48 - 10, faint_white, + 72, 49 - 10, faint_white, + 50, 48, faint_white, + @z + ) + + Gosu.draw_quad( + 96, 48, faint_white, + 72, 48 - 10, faint_white, + 72, 49 - 10, faint_white, + 94, 48, faint_white, + @z + ) + end + end + + # submersible + bar_gray = 0xff_656565 #Gosu::Color.rgb(50, 50, 50) + + 2.times do |i| + # left and right edges of submersible + Gosu.draw_rect( + 72 - 24 + i * 46, 72 - 24, + 2, 48, + bar_gray, + @z + ) + + # top and bottom edges of submersible + Gosu.draw_rect( + 72 - 24, 72 - 15 + i * 28, + 48, 2, + bar_gray, + @z + ) + + # alliance rungs of submersible + Gosu.draw_rect( + 72 - 24 + i * 46, 72 - 13, + 2, 26, + i.even? ? @blue : @red, + @z + ) + end + + # alliance bar bars + 2.times do |i| + 3.times do |x| + Gosu.draw_rect( + 72 - 21.5 + x * 21, 72 - 15 + i * 28, + 1, 2, + i.even? ? @blue : @red, + @z + ) + end + end + end + def draw_tile_box(color) Gosu.draw_rect(0, 0, 24, 2, color, @z) Gosu.draw_rect(22, 2, 2, 22, color, @z) diff --git a/lib/simulator/simulation.rb b/lib/simulator/simulation.rb index 820d580..6536a80 100644 --- a/lib/simulator/simulation.rb +++ b/lib/simulator/simulation.rb @@ -8,7 +8,7 @@ module TAC @field_container = field_container @robots = [] - @field = Field.new(simulation: self, season: :centerstage, container: @field_container) + @field = Field.new(simulation: self, season: :into_the_deep, container: @field_container) @show_paths = false @last_milliseconds = Gosu.milliseconds