Compare commits

..

4 commits

5 changed files with 82 additions and 52 deletions

View file

@ -14,7 +14,7 @@
- sound: phone
msg: Dialing...
- goto: travel
- "[Cancel]":
- "[Hang up]":
- goto: EXIT
# ---------------------------------------------------------

View file

@ -399,7 +399,7 @@ actor 1000 20 300 monolith
density 300
rotationx 90
wants maxrotation 0.01
wants lookat cultasteroid
wants lookat hideout
angularmomentum 0.0 0.0 0.01
thrust 0 0 0 30 1
collider mesh
@ -411,7 +411,7 @@ actor 10000 2000 -3500 monolith
density 300
rotationx 90
wants maxrotation 0.01
wants lookat cultasteroid
wants lookat hideout
angularmomentum 0.0 0.0 0.01
thrust 0 0 0 30 1
collider mesh
@ -423,7 +423,7 @@ actor -8000 -1000 -100 monolith
density 300
rotationx 90
wants maxrotation 0.01
wants lookat cultasteroid
wants lookat hideout
angularmomentum 0.0 0.0 0.01
thrust 0 0 0 30 1
collider mesh

View file

@ -45,7 +45,7 @@ pub const DASHBOARD_DEF: &[(Dashboard, &str)] = &[
// Player avatars: [(Avatar, model name, scale, in-game name)]
pub const PLAYER_AR_AVATARS: &[(Avatar, &str, f32, &str)] = &[
(Avatar::None, "", 1.0, "No Avatar"),
(Avatar::None, "", 1.0, "Off"),
(Avatar::ChefHat, "suit_ar_chefhat", 1.0, "Chef Hat"),
(Avatar::Hoodie, "suit_ar_hoodie", 1.0, "Hoodie"),
(Avatar::HoodieUp, "suit_ar_hoodie_up", 1.0, "Hoodie Up"),
@ -65,7 +65,7 @@ pub const PLAYER_AR_AVATARS: &[(Avatar, &str, f32, &str)] = &[
pub const POINTERS: &[(Pointer, Option<&str>, &str)] = &[
(Pointer::None, None, "Off"),
(Pointer::Tri, Some("sprites/pointer_tri.png"), "Default"),
(Pointer::Tri, Some("sprites/pointer_tri.png"), "On"),
(Pointer::Dot, Some("sprites/pointer_dot.png"), "Dot"),
];

View file

@ -64,26 +64,36 @@ pub enum DeathScreenEvent {
Hide,
}
pub const MENUDEF: &[(&str, MenuAction)] = &[
("✆ Phone", MenuAction::PhoneCall),
("✯ Map\n", MenuAction::ToggleMap),
("", MenuAction::ToggleAR),
("", MenuAction::ChangeARAvatar),
("", MenuAction::ChangePointer),
("", MenuAction::ModLightAmp),
("", MenuAction::ModFlashlightPower),
("", MenuAction::ModThrusterBoost),
("", MenuAction::ModReactor),
("", MenuAction::ToggleSound),
("", MenuAction::ToggleMusic),
("", MenuAction::ToggleCamera),
("", MenuAction::ToggleShadows),
("Fullscreen [F11]", MenuAction::ToggleFullscreen),
("⚠ FACTORY RESET ⚠", MenuAction::ResetSettings),
("⚠ Take Off Helmet ⚠", MenuAction::Restart),
("Quit", MenuAction::Quit),
pub const MENUDEF: &[(&str, MenuAction, MenuType)] = &[
("✆ Phone", MenuAction::PhoneCall, MenuType::Always),
("✯ Map\n", MenuAction::ToggleMap, MenuType::Always),
("", MenuAction::ToggleAR, MenuType::Always),
("", MenuAction::ChangeARAvatar, MenuType::AROnly),
("", MenuAction::ChangePointer, MenuType::AROnly),
("", MenuAction::ModLightAmp, MenuType::AROnly),
("", MenuAction::ModFlashlightPower, MenuType::Always),
("", MenuAction::ModThrusterBoost, MenuType::SuitOnly),
("", MenuAction::ModReactor, MenuType::SuitOnly),
("", MenuAction::ToggleSound, MenuType::Always),
("", MenuAction::ToggleMusic, MenuType::Always),
//("", MenuAction::ToggleCamera),
("", MenuAction::ToggleShadows, MenuType::Always),
//("Fullscreen [F11]", MenuAction::ToggleFullscreen),
(
"⚠ FACTORY RESET ⚠",
MenuAction::ResetSettings,
MenuType::Always,
),
("⚠ Take Off Helmet ⚠", MenuAction::Restart, MenuType::Always),
("Quit", MenuAction::Quit, MenuType::Always),
];
pub enum MenuType {
Always,
AROnly,
SuitOnly,
}
#[derive(Component)]
pub enum MenuAction {
ToggleMap,
@ -195,7 +205,7 @@ pub fn setup(
let sections: Vec<TextSection> = Vec::from_iter(
MENUDEF
.iter()
.map(|(label, _)| TextSection::new(label.to_string() + "\n", style_menu.clone())),
.map(|(label, _, _)| TextSection::new(label.to_string() + "\n", style_menu.clone())),
);
commands.spawn((
@ -452,6 +462,7 @@ pub fn update_menu(
),
>,
mut q_vis: Query<&mut Visibility, With<menu::MenuElement>>,
q_bike: Query<&actor::PlayerDrivesThis>,
id2pos: Res<game::Id2Pos>,
achievement_tracker: Res<var::AchievementTracker>,
menustate: Res<MenuState>,
@ -461,9 +472,6 @@ pub fn update_menu(
for mut vis in &mut q_vis {
*vis = bool2vis(settings.menu_active);
}
fn bool2string(boolean: bool) -> String {
if boolean { "On" } else { "Off" }.to_string()
}
// Footer
if let (Ok(mut text), Some(player_pos), Some(jupiter_pos)) = (
@ -507,10 +515,18 @@ pub fn update_menu(
// Menu
if let Ok(mut text) = q_text.get_single_mut() {
for i in 0..text.sections.len() {
let active = match MENUDEF[i].2 {
MenuType::SuitOnly => q_bike.is_empty(),
MenuType::AROnly => settings.hud_active,
_ => true,
};
if menustate.cursor == i {
text.sections[i].style.color = settings.hud_color_subtitles;
text.sections[i].style.color = settings.hud_color_menu_selected;
} else if active {
text.sections[i].style.color = settings.hud_color_menu_active;
} else {
text.sections[i].style.color = settings.hud_color;
text.sections[i].style.color = settings.hud_color_menu_inactive;
}
match MENUDEF[i].1 {
@ -523,7 +539,7 @@ pub fn update_menu(
} else {
&settings.noise_cancellation_modes[0].0
};
text.sections[i].value = format!("\nNoise Cancellation: {noisecancel}\n");
text.sections[i].value = format!("\nSound: {noisecancel}\n");
}
MenuAction::ToggleMusic => {
let station =
@ -532,59 +548,63 @@ pub fn update_menu(
} else {
&settings.radio_modes[0]
};
text.sections[i].value = format!("Speakers: {station}\n");
text.sections[i].value = format!("Stereo: {station}\n");
}
MenuAction::ToggleAR => {
let onoff = bool2string(settings.hud_active);
let p = if settings.hud_active {
actor::POWER_DRAIN_AR
} else {
0.0
};
let w = if p > 0.0 {
format!(" ({p}W)")
format!("{p}W")
} else {
String::from("")
String::from("Off")
};
text.sections[i].value = format!("Augmented Reality: {onoff}{w} [TAB]\n");
text.sections[i].value = format!("Augmented Reality: {w}\n");
}
MenuAction::ModLightAmp => {
let p = actor::POWER_DRAIN_LIGHTAMP[prefs.light_amp];
text.sections[i].value = format!("\nLight Amplification: {p}W\n");
let w = if p > 0.0 {
format!("{p}W")
} else {
String::from("Off")
};
text.sections[i].value = format!("Night Vision: {w}\n");
}
MenuAction::ModFlashlightPower => {
let p = actor::POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power];
text.sections[i].value = format!("Flashlight Power: {p}W\n");
text.sections[i].value = format!("Flashlight: {p}W\n");
}
MenuAction::ModThrusterBoost => {
let state = match prefs.thruster_boost {
0 => "For braking",
1 => "Always",
0 => " (when slowing)",
1 => " (always)",
2 => "Off",
_ => "ERROR",
};
let p = actor::POWER_DRAIN_THRUSTER[prefs.thruster_boost];
let w = if p > 0.0 {
format!(" ({p}W)")
format!(" {p}W")
} else {
String::from("")
};
text.sections[i].value = format!("Thruster Boost: {state}{w}\n");
text.sections[i].value = format!("Nitro: {w}{state}\n");
}
MenuAction::ModReactor => {
let state = match settings.reactor_state {
0 => "Off",
1 => "On",
2 => "OVERLOAD",
1 => "",
2 => "OVERLOAD",
_ => "ERROR",
};
let p = actor::POWER_GAIN_REACTOR[settings.reactor_state];
let w = if p > 0.0 {
format!(" (+{p}W)")
format!("+{p}W")
} else {
String::from("")
};
text.sections[i].value = format!("Reactor: {state}{w}\n");
text.sections[i].value = format!("Reactor: {w}{state}\n");
}
MenuAction::ChangeARAvatar => {
if let Some(ava) = hud::PLAYER_AR_AVATARS.get(settings.ar_avatar) {
@ -609,8 +629,12 @@ pub fn update_menu(
text.sections[i].value = format!("\nCamera: {onoff} [C]\n");
}
MenuAction::ToggleShadows => {
let onoff = if settings.shadows_sun { "High" } else { "Low" };
text.sections[i].value = format!("Shadows: {onoff}\n");
let onoff = if settings.shadows_sun {
"On"
} else {
"Simplified"
};
text.sections[i].value = format!("\nShadows: {onoff}\n");
}
_ => {}
}

View file

@ -80,6 +80,9 @@ pub struct Settings {
pub hud_color_deathpoem: Color,
pub hud_color_achievement: Color,
pub hud_color_achievement_header: Color,
pub hud_color_menu_active: Color,
pub hud_color_menu_inactive: Color,
pub hud_color_menu_selected: Color,
pub hud_color_achievement_accomplished: Color,
pub hud_color_death: Color,
pub hud_color_death_achievements: Color,
@ -176,10 +179,10 @@ impl Default for Settings {
mute_sfx: false,
noise_cancellation_mode: 0,
noise_cancellation_modes: vec![
("Off".to_string(), 1.0),
("33%".to_string(), 0.66),
("66%".to_string(), 0.33),
("100%".to_string(), 0.0),
("On".to_string(), 1.0),
("66%".to_string(), 0.66),
("33%".to_string(), 0.33),
("Off".to_string(), 0.0),
],
radio_mode: 1,
radio_modes: vec![
@ -225,6 +228,9 @@ impl Default for Settings {
hud_color_achievement: Srgba::hex(COLOR_DIM).unwrap().into(),
hud_color_achievement_accomplished: Srgba::hex(COLOR_SUCCESS).unwrap().into(),
hud_color_achievement_header: Srgba::hex(COLOR_PRIMARY).unwrap().into(),
hud_color_menu_active: Srgba::hex(COLOR_PRIMARY).unwrap().into(),
hud_color_menu_inactive: Srgba::hex(COLOR_DIM).unwrap().into(),
hud_color_menu_selected: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_death: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_death_achievements: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_keybindings: Srgba::hex(COLOR_DIM).unwrap().into(),