aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/hero_look.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/fparkan-runtime/src/hero_look.rs')
-rw-r--r--crates/fparkan-runtime/src/hero_look.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/fparkan-runtime/src/hero_look.rs b/crates/fparkan-runtime/src/hero_look.rs
index d671f2b7..2e923d20 100644
--- a/crates/fparkan-runtime/src/hero_look.rs
+++ b/crates/fparkan-runtime/src/hero_look.rs
@@ -16,11 +16,19 @@ pub(super) struct HeroLook {
impl HeroLook {
pub(super) fn load(vfs: &dyn Vfs) -> Self {
+ Self::load_profile(vfs, b"hero.tbl", "CICLS_UNKNOWN", "MCMD_ANGLE_Z")
+ }
+
+ pub(super) fn load_fixed_turret(vfs: &dyn Vfs) -> Self {
+ Self::load_profile(vfs, b"m1.tbl", "CICLS_TURRET", "MCMD_ANGLE_X")
+ }
+
+ fn load_profile(vfs: &dyn Vfs, table_name: &[u8], yaw_class: &str, yaw_command: &str) -> Self {
let read = |name: &[u8]| {
let path = normalize_relative(name, PathPolicy::StrictLegacy).ok()?;
vfs.read(&path).ok()
};
- let table_bytes = read(b"hero.tbl");
+ let table_bytes = read(table_name);
let settings_bytes = read(b"Iron_3D.ini");
let table = String::from_utf8_lossy(table_bytes.as_deref().unwrap_or_default());
let settings = String::from_utf8_lossy(settings_bytes.as_deref().unwrap_or_default());
@@ -29,8 +37,8 @@ impl HeroLook {
&table,
"SCAN_NULL",
"SCAN_MOUSE_X",
- "CICLS_UNKNOWN",
- "MCMD_ANGLE_Z",
+ yaw_class,
+ yaw_command,
"MAN_WRAP",
)
.unwrap_or(0.15),