Implement hitstun and knockback.

This commit is contained in:
2026-09-13 23:01:25 +02:00
parent 811578af2f
commit 4570860d64
26 changed files with 840 additions and 246 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ pub type FGWide = fixed::FixedI128<fixed::types::extra::U32>;
/// Angle conversions for the game's Q16.16 fixed-point values.
pub trait FGi32Ext {
fn to_radians(self) -> FGi32;
fn sin_cos(self) -> (FGi32, FGi32);
fn sin_cos_rads(self) -> (FGi32, FGi32);
}
impl FGi32Ext for FGi32 {
@@ -12,7 +12,7 @@ impl FGi32Ext for FGi32 {
FGi32::from_num(FGWide::from_num(self) * FGWide::lit("0.01745329251994329576923690768489"))
}
fn sin_cos(self) -> (FGi32, FGi32) {
fn sin_cos_rads(self) -> (FGi32, FGi32) {
const PI: FGi32 = FGi32::lit("3.14159265358979323846");
const HALF_PI: FGi32 = FGi32::lit("1.57079632679489661923");
const TWO_PI: FGi32 = FGi32::lit("6.28318530717958647692");
-3
View File
@@ -130,9 +130,6 @@ impl FGSegment2d {
let t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / denom;
if s >= FGWide::ZERO && s <= FGWide::ONE && t >= FGWide::ZERO && t <= FGWide::ONE {
if self.left_normal().dot(rhs.point2() - rhs.point1()) >= FGi32::ZERO {
return None;
}
Some(FGVec2::new(
FGi32::from_num(p0_x + t * s1_x),
FGi32::from_num(p0_y + t * s1_y),