Compare commits
No commits in common. "a4711b132eae90b428f015890d2499beaeab5d93" and "5715fe4f39702208836652498a344608801f1669" have entirely different histories.
a4711b132e
...
5715fe4f39
@ -24,8 +24,12 @@ use crate::{
|
|||||||
},
|
},
|
||||||
pickup::PickupKind,
|
pickup::PickupKind,
|
||||||
player::{
|
player::{
|
||||||
DamageSource, IPlayer, NetTransform, ball::Ball, local_player::LocalPlayer,
|
DamageSource, IPlayer, NetTransform,
|
||||||
remote_player::RemotePlayer, telegrenade::Telegrenade, weapon::WeaponType,
|
ball::Ball,
|
||||||
|
local_player::LocalPlayer,
|
||||||
|
remote_player::RemotePlayer,
|
||||||
|
telegrenade::{self, Telegrenade},
|
||||||
|
weapon::WeaponType,
|
||||||
},
|
},
|
||||||
replay::{ReplayEvent, ReplayPlayback, ReplayRecorder},
|
replay::{ReplayEvent, ReplayPlayback, ReplayRecorder},
|
||||||
team_resource::TeamResource,
|
team_resource::TeamResource,
|
||||||
|
|||||||
@ -25,7 +25,6 @@ pub const ANNOUNCER_BUS: &str = "Announcer";
|
|||||||
pub struct GameSettings {
|
pub struct GameSettings {
|
||||||
pub fov: f64,
|
pub fov: f64,
|
||||||
pub default_name: String,
|
pub default_name: String,
|
||||||
pub replay_fps: u8,
|
|
||||||
pub recent_servers: Vec<RecentServer>,
|
pub recent_servers: Vec<RecentServer>,
|
||||||
pub volume: VolumeSettings,
|
pub volume: VolumeSettings,
|
||||||
pub keybinds: KeybindSettings,
|
pub keybinds: KeybindSettings,
|
||||||
@ -50,7 +49,6 @@ pub struct KeybindSettings {
|
|||||||
pub shoot: Keybind,
|
pub shoot: Keybind,
|
||||||
pub melee: Keybind,
|
pub melee: Keybind,
|
||||||
pub jump: Keybind,
|
pub jump: Keybind,
|
||||||
pub telegrenade: Keybind,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, PartialOrd)]
|
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, PartialOrd)]
|
||||||
@ -124,7 +122,6 @@ impl Default for GameSettings {
|
|||||||
Self {
|
Self {
|
||||||
fov: 90.,
|
fov: 90.,
|
||||||
default_name: "Default McGee".to_owned(),
|
default_name: "Default McGee".to_owned(),
|
||||||
replay_fps: 60,
|
|
||||||
recent_servers: Vec::new(),
|
recent_servers: Vec::new(),
|
||||||
volume: VolumeSettings {
|
volume: VolumeSettings {
|
||||||
master_volume: 100.,
|
master_volume: 100.,
|
||||||
@ -142,7 +139,6 @@ impl Default for GameSettings {
|
|||||||
shoot: Keybind::MouseButton(MouseButton::LEFT.to_godot()),
|
shoot: Keybind::MouseButton(MouseButton::LEFT.to_godot()),
|
||||||
melee: Keybind::Key(Key::F.to_godot()),
|
melee: Keybind::Key(Key::F.to_godot()),
|
||||||
jump: Keybind::Key(Key::SPACE.to_godot()),
|
jump: Keybind::Key(Key::SPACE.to_godot()),
|
||||||
telegrenade: Keybind::Key(Key::Q.to_godot()),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,7 +188,6 @@ impl GameSettingsManager {
|
|||||||
set_keybind("shoot", settings.keybinds.shoot);
|
set_keybind("shoot", settings.keybinds.shoot);
|
||||||
set_keybind("punch", settings.keybinds.melee);
|
set_keybind("punch", settings.keybinds.melee);
|
||||||
set_keybind("jump", settings.keybinds.jump);
|
set_keybind("jump", settings.keybinds.jump);
|
||||||
set_keybind("throw_telegrenade", settings.keybinds.telegrenade);
|
|
||||||
|
|
||||||
self.settings = settings;
|
self.settings = settings;
|
||||||
if let Some(mut file) = FileAccess::open("user://config.toml", ModeFlags::WRITE) {
|
if let Some(mut file) = FileAccess::open("user://config.toml", ModeFlags::WRITE) {
|
||||||
|
|||||||
@ -10,7 +10,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
game_manager::{Game, GameManager, Player},
|
game_manager::{Game, GameManager, Player},
|
||||||
game_settings::GameSettingsManager,
|
|
||||||
map::Map,
|
map::Map,
|
||||||
net::{network_manager::BallSync, util::NetVector3},
|
net::{network_manager::BallSync, util::NetVector3},
|
||||||
pickup::{PickupKind, ReplayVisibility},
|
pickup::{PickupKind, ReplayVisibility},
|
||||||
@ -412,9 +411,7 @@ impl INode for ReplayRecorder {
|
|||||||
}
|
}
|
||||||
self.time_elapsed += delta;
|
self.time_elapsed += delta;
|
||||||
|
|
||||||
let fps = GameSettingsManager::singleton().bind().settings.replay_fps;
|
if self.time_elapsed > (self.current_frame.time + (1. / 60.)) {
|
||||||
|
|
||||||
if self.time_elapsed > (self.current_frame.time + (1. / fps as f64)) {
|
|
||||||
self.replay.frames.push(self.current_frame.clone());
|
self.replay.frames.push(self.current_frame.clone());
|
||||||
self.current_frame = self.record_frame();
|
self.current_frame = self.record_frame();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,21 @@
|
|||||||
|
use std::io::Cursor;
|
||||||
|
|
||||||
use godot::{
|
use godot::{
|
||||||
classes::{Button, Camera3D, FileDialog, Label, LineEdit, OptionButton, Panel, SpinBox},
|
classes::{
|
||||||
|
Button, Camera3D, FileAccess, FileDialog, Label, LineEdit, OptionButton, Panel, SpinBox,
|
||||||
|
file_access::ModeFlags,
|
||||||
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
register::property::SimpleVar,
|
register::property::SimpleVar,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bgm::{Music, MusicManager},
|
bgm::{Music, MusicManager},
|
||||||
|
game_manager::GameManager,
|
||||||
game_settings::{GameSettingsManager, RecentServer},
|
game_settings::{GameSettingsManager, RecentServer},
|
||||||
net::network_manager::NetworkManager,
|
net::network_manager::NetworkManager,
|
||||||
popup_queue::{Popup, PopupQueue},
|
popup_queue::{Popup, PopupQueue},
|
||||||
replay::StandaloneReplayManager,
|
replay::{Replay, StandaloneReplayManager},
|
||||||
ui::credits::CreditsMenu,
|
ui::credits::CreditsMenu,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use godot::{
|
use godot::{
|
||||||
classes::{Button, HBoxContainer, IPanel, Label, Panel},
|
classes::{Button, FileDialog, HBoxContainer, IPanel, Label, Panel},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use godot::{
|
use godot::{
|
||||||
classes::{
|
classes::{
|
||||||
Button, Control, GridContainer, IPanelContainer, InputEvent, Label, LineEdit,
|
Button, Control, GridContainer, IPanelContainer, InputEvent, InputEventKey,
|
||||||
PanelContainer,
|
InputEventMouseButton, InputMap, Label, LineEdit, PanelContainer, TextureButton,
|
||||||
control::{FocusBehaviorRecursive, SizeFlags},
|
control::{FocusBehaviorRecursive, FocusMode, SizeFlags},
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -19,7 +19,6 @@ pub enum Setting {
|
|||||||
// General settings
|
// General settings
|
||||||
FoV,
|
FoV,
|
||||||
DefaultName,
|
DefaultName,
|
||||||
ReplayFPS,
|
|
||||||
|
|
||||||
// Volume settings
|
// Volume settings
|
||||||
MasterVolume,
|
MasterVolume,
|
||||||
@ -37,7 +36,6 @@ pub enum Setting {
|
|||||||
Jump,
|
Jump,
|
||||||
SelectRaygun,
|
SelectRaygun,
|
||||||
SelectShotgun,
|
SelectShotgun,
|
||||||
ThrowTelegrenade,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum SettingsTab {
|
pub enum SettingsTab {
|
||||||
@ -51,7 +49,6 @@ impl ToString for Setting {
|
|||||||
match self {
|
match self {
|
||||||
Setting::FoV => "Field of View",
|
Setting::FoV => "Field of View",
|
||||||
Setting::DefaultName => "Default Name",
|
Setting::DefaultName => "Default Name",
|
||||||
Setting::ReplayFPS => "Replay FPS",
|
|
||||||
|
|
||||||
Setting::MasterVolume => "Master volume",
|
Setting::MasterVolume => "Master volume",
|
||||||
Setting::SfxVolume => "Sfx Volume",
|
Setting::SfxVolume => "Sfx Volume",
|
||||||
@ -67,7 +64,6 @@ impl ToString for Setting {
|
|||||||
Setting::Shoot => "Shoot",
|
Setting::Shoot => "Shoot",
|
||||||
Setting::Melee => "Melee",
|
Setting::Melee => "Melee",
|
||||||
Setting::Jump => "Jump",
|
Setting::Jump => "Jump",
|
||||||
Setting::ThrowTelegrenade => "Throw Telegrenade",
|
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
@ -78,7 +74,6 @@ impl Setting {
|
|||||||
match self {
|
match self {
|
||||||
Setting::FoV => SettingsTab::General,
|
Setting::FoV => SettingsTab::General,
|
||||||
Setting::DefaultName => SettingsTab::General,
|
Setting::DefaultName => SettingsTab::General,
|
||||||
Setting::ReplayFPS => SettingsTab::General,
|
|
||||||
|
|
||||||
Setting::MasterVolume => SettingsTab::Volume,
|
Setting::MasterVolume => SettingsTab::Volume,
|
||||||
Setting::SfxVolume => SettingsTab::Volume,
|
Setting::SfxVolume => SettingsTab::Volume,
|
||||||
@ -305,9 +300,6 @@ impl SettingsPanel {
|
|||||||
(Setting::DefaultName, SettingValue::String(value)) => {
|
(Setting::DefaultName, SettingValue::String(value)) => {
|
||||||
new_settings.default_name = value.clone()
|
new_settings.default_name = value.clone()
|
||||||
}
|
}
|
||||||
(Setting::ReplayFPS, SettingValue::SliderNumber(value)) => {
|
|
||||||
new_settings.replay_fps = value.value as u8;
|
|
||||||
}
|
|
||||||
|
|
||||||
(Setting::MasterVolume, SettingValue::SliderNumber(value)) => {
|
(Setting::MasterVolume, SettingValue::SliderNumber(value)) => {
|
||||||
new_settings.volume.master_volume = value.value;
|
new_settings.volume.master_volume = value.value;
|
||||||
@ -349,9 +341,6 @@ impl SettingsPanel {
|
|||||||
(Setting::Jump, SettingValue::Keybind(keybind)) => {
|
(Setting::Jump, SettingValue::Keybind(keybind)) => {
|
||||||
new_settings.keybinds.jump = *keybind;
|
new_settings.keybinds.jump = *keybind;
|
||||||
}
|
}
|
||||||
(Setting::ThrowTelegrenade, SettingValue::Keybind(keybind)) => {
|
|
||||||
new_settings.keybinds.telegrenade = *keybind;
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,14 +373,6 @@ fn settings_from(map: &mut HashMap<Setting, SettingValue>, settings: &GameSettin
|
|||||||
Setting::DefaultName,
|
Setting::DefaultName,
|
||||||
SettingValue::String(settings.default_name.clone()),
|
SettingValue::String(settings.default_name.clone()),
|
||||||
);
|
);
|
||||||
map.insert(
|
|
||||||
Setting::ReplayFPS,
|
|
||||||
SettingValue::SliderNumber(SliderValue {
|
|
||||||
min: 1.,
|
|
||||||
max: 240.,
|
|
||||||
value: 60.,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
map.insert(
|
map.insert(
|
||||||
Setting::MasterVolume,
|
Setting::MasterVolume,
|
||||||
SettingValue::SliderNumber(SliderValue {
|
SettingValue::SliderNumber(SliderValue {
|
||||||
@ -458,8 +439,4 @@ fn settings_from(map: &mut HashMap<Setting, SettingValue>, settings: &GameSettin
|
|||||||
SettingValue::Keybind(settings.keybinds.melee),
|
SettingValue::Keybind(settings.keybinds.melee),
|
||||||
);
|
);
|
||||||
map.insert(Setting::Jump, SettingValue::Keybind(settings.keybinds.jump));
|
map.insert(Setting::Jump, SettingValue::Keybind(settings.keybinds.jump));
|
||||||
map.insert(
|
|
||||||
Setting::ThrowTelegrenade,
|
|
||||||
SettingValue::Keybind(settings.keybinds.telegrenade),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user