aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/fparkan-game/src')
-rw-r--r--apps/fparkan-game/src/mission_overlay.rs15
-rw-r--r--apps/fparkan-game/src/strategic_roster_hud.rs18
-rw-r--r--apps/fparkan-game/src/strategic_view.rs19
3 files changed, 39 insertions, 13 deletions
diff --git a/apps/fparkan-game/src/mission_overlay.rs b/apps/fparkan-game/src/mission_overlay.rs
index 1e3a7d6b..a9f1a828 100644
--- a/apps/fparkan-game/src/mission_overlay.rs
+++ b/apps/fparkan-game/src/mission_overlay.rs
@@ -281,17 +281,24 @@ impl StaticVulkanApp {
.command_view
.as_ref()
.and_then(|view| view.order_panel(&warbot_rows));
- let manual_control_enabled = selected_warbot
+ let controls = selected_warbot
.zip(self.mission_engine.as_ref().zip(self.cockpit))
- .is_some_and(|(target, (engine, hero))| {
- fparkan_runtime::can_control_warbot_remotely(engine, hero, target)
+ .map_or_else(Default::default, |(target, (engine, hero))| {
+ fparkan_assets::strategic_roster::CardControls {
+ cockpit_enabled: fparkan_runtime::can_control_warbot_remotely(
+ engine, hero, target,
+ ),
+ self_destruct_armed: fparkan_runtime::warbot_self_destruct_armed(
+ engine, target,
+ ),
+ }
});
roster.draw(
renderer,
warbot_rows,
selected_warbot,
card,
- manual_control_enabled,
+ controls,
orders,
)?;
}
diff --git a/apps/fparkan-game/src/strategic_roster_hud.rs b/apps/fparkan-game/src/strategic_roster_hud.rs
index 987ca62f..a02674a9 100644
--- a/apps/fparkan-game/src/strategic_roster_hud.rs
+++ b/apps/fparkan-game/src/strategic_roster_hud.rs
@@ -2,7 +2,9 @@ use super::{
mission_overlay::{add_overlay_sprite, overlay_texture},
DirectoryVfs, EnvironmentGpuRange, StaticPreviewScene, VulkanSmokeRenderer,
};
-use fparkan_assets::strategic_roster::{RosterImages, RosterOrder, Row, EXTENT, ORIGIN};
+use fparkan_assets::strategic_roster::{
+ CardControls, RosterImages, RosterOrder, Row, EXTENT, ORIGIN,
+};
use fparkan_assets::warbot_card::{CardLabels, RatingScale};
use fparkan_platform_winit::text::StringResources;
use fparkan_runtime::strategic_roster::WarbotRow;
@@ -17,7 +19,7 @@ pub(super) struct StrategicRosterHud {
card_labels: CardLabels,
rating_scale: RatingScale,
card: Option<WarbotStats>,
- manual_control_enabled: bool,
+ controls: CardControls,
rows: Vec<WarbotRow>,
selected: Option<ObjectHandle>,
order_labels: [String; 6],
@@ -53,7 +55,7 @@ impl StrategicRosterHud {
let [width, height] = EXTENT.map(|value| value as f32);
let range = add_overlay_sprite(
preview,
- images.paint(&[], &[], false, None)?,
+ images.paint(&[], &[], CardControls::default(), None)?,
[left, top, left + width, top + height],
[1.0; 3],
1.0,
@@ -68,7 +70,7 @@ impl StrategicRosterHud {
card_labels,
rating_scale,
card: None,
- manual_control_enabled: false,
+ controls: CardControls::default(),
rows: Vec::new(),
selected: None,
order_labels,
@@ -86,7 +88,7 @@ impl StrategicRosterHud {
rows: Vec<WarbotRow>,
selected: Option<ObjectHandle>,
card: Option<WarbotStats>,
- manual_control_enabled: bool,
+ controls: CardControls,
orders: Option<Option<RosterOrder>>,
) -> Result<(), String> {
renderer
@@ -96,7 +98,7 @@ impl StrategicRosterHud {
|| (rows == self.rows
&& selected == self.selected
&& card == self.card
- && manual_control_enabled == self.manual_control_enabled
+ && controls == self.controls
&& orders == self.orders)
{
return Ok(());
@@ -141,7 +143,7 @@ impl StrategicRosterHud {
self.images.paint(
&visible,
&lines,
- manual_control_enabled,
+ controls,
orders.map(|hovered| {
(self.order_labels.each_ref().map(String::as_str), hovered)
}),
@@ -152,7 +154,7 @@ impl StrategicRosterHud {
self.rows = rows;
self.selected = selected;
self.card = card;
- self.manual_control_enabled = manual_control_enabled;
+ self.controls = controls;
self.orders = orders;
Ok(())
}
diff --git a/apps/fparkan-game/src/strategic_view.rs b/apps/fparkan-game/src/strategic_view.rs
index e5aa3633..8787aeff 100644
--- a/apps/fparkan-game/src/strategic_view.rs
+++ b/apps/fparkan-game/src/strategic_view.rs
@@ -402,6 +402,21 @@ impl StaticVulkanApp {
}
return;
}
+ Some(ListHit::SelfDestruct) => {
+ if let Some(row) = selected {
+ let now_ms = if self.control_clock_target_ms.is_some() {
+ self.simulation_time_ms
+ } else {
+ self.simulation_elapsed
+ .saturating_add(self.simulation_last_tick.elapsed())
+ .as_millis() as u32
+ };
+ fparkan_runtime::arm_warbot_self_destruct(
+ engine, cockpit, row.handle, now_ms,
+ );
+ }
+ return;
+ }
Some(ListHit::Row(index)) => {
let row = rows[index];
if view.select_warbot(row) {
@@ -627,7 +642,9 @@ impl StaticVulkanApp {
.as_ref()
.zip(self.cockpit)
.map_or_else(Vec::new, |(engine, cockpit)| warbot_rows(engine, cockpit));
- view.refresh_warbots(&rows);
+ if let Some(row) = view.refresh_warbots(&rows) {
+ self.play_warbot_selection(row);
+ }
rows
}
}