From 25c8151fd67745d7fa5d4c5547114595a8a488b6 Mon Sep 17 00:00:00 2001 From: SpiralP Date: Fri, 11 Oct 2024 18:53:22 -0700 Subject: [PATCH] upgrade classicube-sys, deps --- Cargo.lock | 141 ++++++++++------------ Cargo.toml | 2 +- flake.nix | 2 +- src/chat/commands/helpers.rs | 12 +- src/chat/commands/local.rs | 6 +- src/chat/hidden_communication/encoding.rs | 2 +- src/entity_manager/entity.rs | 42 ++++--- src/entity_manager/render_model_hook.rs | 12 +- src/helpers.rs | 2 +- src/player/helpers.rs | 2 +- 10 files changed, 106 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c321410..f823202 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] @@ -154,9 +154,9 @@ checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cc" -version = "1.1.24" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ "jobserver", "libc", @@ -266,8 +266,8 @@ dependencies = [ [[package]] name = "classicube-helpers" -version = "2.0.0+classicube.1.3.6" -source = "git+https://github.com/SpiralP/rust-classicube-helpers.git#cd23fc4f97de0df256da79138f97326007a1ed66" +version = "3.0.0+classicube.1.3.7" +source = "git+https://github.com/SpiralP/rust-classicube-helpers.git#0624402a63305dfad0a6ec6624e10e5db3cfd861" dependencies = [ "async-dispatcher", "classicube-sys", @@ -281,9 +281,9 @@ dependencies = [ [[package]] name = "classicube-sys" -version = "3.0.5+classicube.1.3.6" +version = "4.0.0+classicube.1.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eccbe102aeca95b74a03fc37ac82c18be15f1d6470a5b932b9f1243d9e16bf2" +checksum = "9037ddc8af229511e09e4abe6ac21b9235514cfd93d30ff1138301b6b9a2a1d8" dependencies = [ "bindgen", "cc", @@ -465,9 +465,9 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -480,9 +480,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -490,15 +490,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -507,15 +507,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -524,15 +524,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-timer" @@ -542,9 +542,9 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -571,9 +571,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" @@ -602,9 +602,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" [[package]] name = "heck" @@ -742,9 +742,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", @@ -752,9 +752,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "itertools" @@ -782,9 +782,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1029,21 +1029,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" @@ -1148,18 +1145,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", @@ -1184,12 +1181,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "portable-atomic" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" - [[package]] name = "powerfmt" version = "0.2.0" @@ -1217,9 +1208,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -1418,9 +1409,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" dependencies = [ "once_cell", "rustls-pki-types", @@ -1472,9 +1463,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ "windows-sys 0.59.0", ] @@ -1959,9 +1950,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" @@ -2030,9 +2021,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -2041,9 +2032,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -2056,9 +2047,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -2068,9 +2059,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2078,9 +2069,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -2091,15 +2082,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index dab55fa..a52b567 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ clap = { git = "https://github.com/SpiralP/rust-clap-classicube.git", features = "derive", ] } classicube-helpers = { git = "https://github.com/SpiralP/rust-classicube-helpers.git" } -classicube-sys = "3" +classicube-sys = "4" deunicode = "1" dirs = "5" error-chain = "0.12" diff --git a/flake.nix b/flake.nix index 74aaecc..338491f 100644 --- a/flake.nix +++ b/flake.nix @@ -81,7 +81,7 @@ outputHashes = { "async-dispatcher-0.1.0" = "sha256-rqpQ176/PnI9vvPrwQvK3GJbryjb3hHkb+o1RyCZ3Vg="; "clap-4.2.7" = "sha256-PccqMT2KltTC2gVL9/xfCNFOAu3+6ash9HqM/TkpgmU="; - "classicube-helpers-2.0.0+classicube.1.3.6" = "sha256-NgpBwlYCJyBV+oKyVyU5ueI9AubEZ0tsrsH+eQFF3Xk="; + "classicube-helpers-3.0.0+classicube.1.3.7" = "sha256-3hWKS6NmAH0x+SOi/nBKJLIQi/3ilG7WSRrPvF++wGE="; }; }; diff --git a/src/chat/commands/helpers.rs b/src/chat/commands/helpers.rs index ca2065c..2006b36 100644 --- a/src/chat/commands/helpers.rs +++ b/src/chat/commands/helpers.rs @@ -13,9 +13,9 @@ pub fn move_entity(entity: &mut CefEntity, player: &PlayerSnapshot) { let dir = Vec3::get_dir_vector(player.Yaw.to_radians(), player.Pitch.to_radians()); entity.entity.Position.set( - player.eye_position.X + dir.X, - player.eye_position.Y + dir.Y, - player.eye_position.Z + dir.Z, + player.eye_position.x + dir.x, + player.eye_position.y + dir.y, + player.eye_position.z + dir.z, ); // turn it to face the player @@ -42,7 +42,7 @@ pub fn get_camera_trace() -> Option { local_player.ReachDistance = old_reach_distance; // debug!("{:#?}", ray_tracer); - if ray_tracer.Valid == 0 { + if ray_tracer.valid == 0 { None } else { Some(ray_tracer) @@ -118,8 +118,8 @@ pub fn get_click_coords( let up = up.normalize(); let right = -left; - let width = entity_scale.X * (entity_size.0 as f32); - let height = entity_scale.Y * (entity_size.1 as f32); + let width = entity_scale.x * (entity_size.0 as f32); + let height = entity_scale.y * (entity_size.1 as f32); let top_left = screen_pos - 0.5 * right * width + up * height; diff --git a/src/chat/commands/local.rs b/src/chat/commands/local.rs index ebe598b..be60f96 100644 --- a/src/chat/commands/local.rs +++ b/src/chat/commands/local.rs @@ -75,7 +75,7 @@ pub async fn run(player: PlayerSnapshot, commands: Commands) -> Result<()> { let trace = get_camera_trace().chain_err(|| "no picked block")?; // the block's hit face - let (mult, yaw) = match trace.Closest as FACE_CONSTS { + let (mult, yaw) = match trace.closest as FACE_CONSTS { FACE_CONSTS_FACE_XMIN => (Vec3::new(-0.01, 0.0, 0.0), 270.0), FACE_CONSTS_FACE_XMAX => (Vec3::new(1.01, 0.0, 1.0), 90.0), FACE_CONSTS_FACE_ZMIN => (Vec3::new(1.0, 0.0, -0.01), 0.0), @@ -99,9 +99,9 @@ pub async fn run(player: PlayerSnapshot, commands: Commands) -> Result<()> { // let position = position - Vec3::new(0.5, 0.0, 0.5); let maybe_name = name.map(|name| format!(" -n {name}")).unwrap_or_default(); - let Vec3 { X, Y, Z } = position; + let Vec3 { x, y, z } = position; let pitch = 0.0; - Chat::send(format!("cef at{maybe_name} {X} {Y} {Z} {yaw} {pitch}")); + Chat::send(format!("cef at{maybe_name} {x} {y} {z} {yaw} {pitch}")); } Commands::Devtools { name } => { diff --git a/src/chat/hidden_communication/encoding.rs b/src/chat/hidden_communication/encoding.rs index 38239e2..8dd2f40 100644 --- a/src/chat/hidden_communication/encoding.rs +++ b/src/chat/hidden_communication/encoding.rs @@ -67,7 +67,7 @@ pub fn create_message() -> Message { let size = entity.get_size(); let scale = entity.get_scale(); let rotation = (e.RotX, e.RotY); - let position = (e.Position.X, e.Position.Y, e.Position.Z); + let position = (e.Position.x, e.Position.y, e.Position.z); let background_color = entity.background_color; LightEntity { diff --git a/src/entity_manager/entity.rs b/src/entity_manager/entity.rs index c6eda7f..036f398 100644 --- a/src/entity_manager/entity.rs +++ b/src/entity_manager/entity.rs @@ -61,7 +61,7 @@ impl CefEntity { SetLocation: Some(Self::set_location), GetCol: Some(Self::get_col), RenderModel: Some(Self::c_render_model), - RenderName: Some(Self::render_name), + ShouldRenderName: Some(Self::should_render_name), }); let mut pixels: Vec = @@ -98,7 +98,7 @@ impl CefEntity { this } - extern "C" fn tick(_entity: *mut Entity, _delta: f64) {} + extern "C" fn tick(_entity: *mut Entity, _delta: f32) {} extern "C" fn despawn(_entity: *mut Entity) {} @@ -108,11 +108,13 @@ impl CefEntity { PACKEDCOL_WHITE } - extern "C" fn c_render_model(_entity: *mut Entity, _delta_time: f64, _t: f32) { + extern "C" fn c_render_model(_entity: *mut Entity, _delta_time: f32, _t: f32) { // we use the render_model function below directly instead } - extern "C" fn render_name(_entity: *mut Entity) {} + extern "C" fn should_render_name(_entity: *mut Entity) -> u8 { + 0 + } fn register_entity(&mut self) { let CefEntity { @@ -143,23 +145,23 @@ impl CefEntity { // used in CefModel::draw entity.NameTex = Texture { ID: entity.TextureId, - X: -(DEFAULT_MODEL_WIDTH as cc_int16 / 2), - Y: -(DEFAULT_MODEL_HEIGHT as cc_int16), - Width: DEFAULT_MODEL_WIDTH as _, - Height: DEFAULT_MODEL_HEIGHT as _, + x: -(DEFAULT_MODEL_WIDTH as cc_int16 / 2), + y: -(DEFAULT_MODEL_HEIGHT as cc_int16), + width: DEFAULT_MODEL_WIDTH as _, + height: DEFAULT_MODEL_HEIGHT as _, uv: TextureRec { - U1: 0.0, - V1: 0.0, - U2: 1.0, - V2: 1.0, + u1: 0.0, + v1: 0.0, + u2: 1.0, + v2: 1.0, }, }; } pub fn update_texture(&mut self, mut part: Bitmap) { // update uv's - self.entity.NameTex.uv.U2 = part.width as f32 / TEXTURE_WIDTH as f32; - self.entity.NameTex.uv.V2 = part.height as f32 / TEXTURE_HEIGHT as f32; + self.entity.NameTex.uv.u2 = part.width as f32 / TEXTURE_WIDTH as f32; + self.entity.NameTex.uv.v2 = part.height as f32 / TEXTURE_HEIGHT as f32; unsafe { Gfx_UpdateTexturePart(self.texture.resource_id, 0, 0, &mut part, 0); @@ -184,20 +186,20 @@ impl CefEntity { pub fn get_scale(&self) -> f32 { let CefEntity { entity, .. } = self; - entity.ModelScale.X + entity.ModelScale.x } pub fn set_size(&mut self, width: u16, height: u16) { let CefEntity { entity, .. } = self; - entity.NameTex.X = -c_short::try_from(width / 2).unwrap(); - entity.NameTex.Y = -c_short::try_from(height).unwrap(); - entity.NameTex.Width = width; - entity.NameTex.Height = height; + entity.NameTex.x = -c_short::try_from(width / 2).unwrap(); + entity.NameTex.y = -c_short::try_from(height).unwrap(); + entity.NameTex.width = width; + entity.NameTex.height = height; } pub fn get_size(&self) -> (u16, u16) { let CefEntity { entity, .. } = self; - (entity.NameTex.Width, entity.NameTex.Height) + (entity.NameTex.width, entity.NameTex.height) } } diff --git a/src/entity_manager/render_model_hook.rs b/src/entity_manager/render_model_hook.rs index 8aae85c..fe6744a 100644 --- a/src/entity_manager/render_model_hook.rs +++ b/src/entity_manager/render_model_hook.rs @@ -1,15 +1,11 @@ -use std::{ - cell::Cell, - os::raw::{c_double, c_float}, -}; +use std::cell::Cell; use classicube_sys::{Entities, Entity, EntityVTABLE, ENTITIES_SELF_ID}; use super::ENTITIES; thread_local!( - static ORIGINAL_FN: Cell> = - Cell::new(None); + static ORIGINAL_FN: Cell> = Cell::new(None); ); thread_local!( @@ -17,7 +13,7 @@ thread_local!( ); /// This is called when `LocalPlayer_RenderModel` is called. -extern "C" fn hook(local_player_entity: *mut Entity, delta: c_double, t: c_float) { +extern "C" fn hook(local_player_entity: *mut Entity, delta: f32, t: f32) { ORIGINAL_FN.with(|cell| { if let Some(f) = cell.get() { unsafe { @@ -49,7 +45,7 @@ pub fn initialize() { SetLocation: v_table.SetLocation, GetCol: v_table.GetCol, RenderModel: v_table.RenderModel, - RenderName: v_table.RenderName, + ShouldRenderName: v_table.ShouldRenderName, }; new_v_table.RenderModel = Some(hook); diff --git a/src/helpers.rs b/src/helpers.rs index efabbfd..b61fec1 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -4,7 +4,7 @@ use classicube_sys::Vec3; use ncollide3d::na::Vector3; pub fn vec3_to_vector3(v: &Vec3) -> Vector3 { - Vector3::new(v.X, v.Y, v.Z) + Vector3::new(v.x, v.y, v.z) } // fn vector3_to_vec3(v: &Vector3) -> Vec3 { diff --git a/src/player/helpers.rs b/src/player/helpers.rs index 19993f3..8f04077 100644 --- a/src/player/helpers.rs +++ b/src/player/helpers.rs @@ -43,7 +43,7 @@ fn compute_real_volume(entity: &CefEntity) -> Option<(f32, VolumeMode)> { }; let my_pos = vec3_to_vector3(&position); - let my_forward = vec3_to_vector3(&Vec3::get_dir_vector(orientation.X, 0.0)); + let my_forward = vec3_to_vector3(&Vec3::get_dir_vector(orientation.x, 0.0)); let ent_pos = vec3_to_vector3(&entity.entity.Position);