Skip to content

Commit

Permalink
Fix velo (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaihoE authored Aug 6, 2024
1 parent 91875bb commit d0d177b
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 61 deletions.
112 changes: 56 additions & 56 deletions src/parser/src/e2e_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12078,26 +12078,26 @@ mod tests {
None,
None,
None,
Some(120.0),
Some(162.03314),
Some(7680.0),
Some(10370.121),
Some(0.0),
Some(-100.0),
Some(208.93921),
Some(119.01233),
Some(99.23767),
Some(45.89801),
Some(97.63086),
Some(-1.5),
Some(-120.0),
Some(-42.189636),
Some(-6400.0),
Some(13372.109),
Some(7616.789),
Some(6351.211),
Some(2937.4727),
Some(6248.375),
Some(-96.0),
Some(-7680.0),
Some(-2700.1367),
Some(0.0),
Some(96.0),
Some(-77.12134),
Some(6144.0),
Some(-4935.7656),
Some(0.0),
Some(0.0),
Some(-45.89801),
Some(128.0),
Some(125.5),
Some(-2937.4727),
Some(8192.0),
Some(8032.0),
])),
num_nones: 0,
},
Expand Down Expand Up @@ -14587,26 +14587,26 @@ mod tests {
None,
None,
None,
Some(-3101.442),
Some(1078.6882),
Some(-1686.4124),
Some(-2160.0315),
Some(410.87854),
Some(1091.4297),
Some(493.83606),
Some(-1015.96765),
Some(1008.6998),
Some(-873.96765),
Some(1476.535),
Some(-476.7174),
Some(-378.38812),
Some(18.015198),
Some(704.5833),
Some(268.95282),
Some(105.41089),
Some(-420.89453),
Some(1302.6844),
Some(-281.55255),
Some(-198492.28),
Some(69036.05),
Some(-107930.39),
Some(-138242.02),
Some(26296.227),
Some(69851.5),
Some(31605.508),
Some(-65021.93),
Some(64556.79),
Some(-55933.93),
Some(94498.24),
Some(-30509.914),
Some(-24216.84),
Some(1152.9727),
Some(45093.332),
Some(17212.98),
Some(6746.297),
Some(-26937.25),
Some(83371.805),
Some(-18019.363),
])),
num_nones: 0,
},
Expand Down Expand Up @@ -15486,26 +15486,26 @@ mod tests {
None,
None,
None,
Some(963.73047),
Some(2096.0728),
Some(-591.6396),
Some(-319.33887),
Some(1340.998),
Some(-364.68652),
Some(696.6249),
Some(-1647.9717),
Some(559.6625),
Some(76.8761),
Some(-2397.8823),
Some(-1245.656),
Some(-695.8641),
Some(-1024.8765),
Some(-80.58441),
Some(1028.3291),
Some(-1292.016),
Some(-238.66736),
Some(-958.20154),
Some(-2241.3218),
Some(61678.75),
Some(134148.66),
Some(-37864.934),
Some(-20437.688),
Some(85823.875),
Some(-23339.938),
Some(44583.992),
Some(-105470.19),
Some(35818.4),
Some(4920.0703),
Some(-153464.47),
Some(-79721.984),
Some(-44535.3),
Some(-65592.09),
Some(-5157.4023),
Some(65813.06),
Some(-82689.02),
Some(-15274.711),
Some(-61324.9),
Some(-143444.6),
])),
num_nones: 0,
},
Expand Down
3 changes: 2 additions & 1 deletion src/parser/src/first_pass/parser_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<'a> FirstPassParser<'a> {
FirstPassParser {
order_by_steamid: inputs.order_by_steamid,
sendtable_message: None,
needs_velocity: false,
needs_velocity: needs_velocity(&inputs.wanted_player_props),
added_temp_props: vec![],
is_multithreadable: check_multithreadability(&inputs.wanted_player_props),
stringtable_players: BTreeMap::default(),
Expand All @@ -106,6 +106,7 @@ impl<'a> FirstPassParser<'a> {
inputs.wanted_other_props.clone(),
inputs.real_name_to_og_name.clone(),
false,
&vec!["None".to_string()],
),
cls_by_id: None,
player_md: vec![],
Expand Down
4 changes: 3 additions & 1 deletion src/parser/src/first_pass/prop_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl PropController {
wanted_other_props: Vec<String>,
real_name_to_og_name: AHashMap<String, String>,
needs_velocty: bool,
wanted_events: &[String],
) -> Self {
PropController {
id: NORMAL_PROP_BASEID,
Expand All @@ -98,11 +99,12 @@ impl PropController {
name_to_special_id: AHashMap::default(),
wanted_other_props: wanted_other_props,
real_name_to_og_name: real_name_to_og_name,
event_with_velocity: false,
event_with_velocity: !wanted_events.is_empty() && needs_velocty,
path_to_name: AHashMap::default(),
needs_velocity: needs_velocty,
}
}

pub fn set_custom_propinfos(&mut self) {
let button_names = BUTTONMAP.keys();
let mut someid = BUTTONS_BASEID;
Expand Down
1 change: 1 addition & 0 deletions src/parser/src/first_pass/sendtables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ impl<'a> FirstPassParser<'a> {
self.wanted_other_props.clone(),
self.real_name_to_og_name.clone(),
needs_velocity(&self.wanted_player_props),
&self.wanted_events,
);
// Quantalized floats have their own helper struct
let mut qf_mapper = QfMapper {
Expand Down
4 changes: 2 additions & 2 deletions src/parser/src/second_pass/collect_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ impl<'a> SecondPassParser<'a> {
let y = self.velocity_from_indicies(&indicies, CoordinateAxis::Y)?;

if let (Variant::F32(x), Variant::F32(y)) = (x, y) {
return Ok(Variant::F32((f32::powi(x, 2) + f32::powi(y, 2)).sqrt() * 64.0));
return Ok(Variant::F32((f32::powi(x, 2) + f32::powi(y, 2)).sqrt()));
}
}
return Err(PropCollectionError::PlayerNotFound);
Expand Down Expand Up @@ -618,7 +618,7 @@ impl<'a> SecondPassParser<'a> {
};
if let Some(c) = col {
if let Some((Some(v1), Some(v2))) = self.index_coordinates_from_propcol(c, indicies) {
return Ok(Variant::F32(v1 - v2));
return Ok(Variant::F32((v1 * 64.0) - (v2 * 64.0)));
}
}
return Err(PropCollectionError::VelocityNotFound);
Expand Down
2 changes: 1 addition & 1 deletion src/parser/src/second_pass/parser_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl<'a> SecondPassParser<'a> {
header: None,
player_md: self.player_end_data,
game_events_counter: self.game_events_counter,
prop_info: PropController::new(vec![], vec![], AHashMap::default(), false),
prop_info: PropController::new(vec![], vec![], AHashMap::default(), false, &["none".to_string()]),
projectiles: self.projectile_records,
ptr: self.ptr,
df_per_player: self.df_per_player,
Expand Down

0 comments on commit d0d177b

Please sign in to comment.