-
Notifications
You must be signed in to change notification settings - Fork 9
/
transpose.rs
132 lines (116 loc) · 2.89 KB
/
transpose.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// This file is auto-generated by `gen/scripts/frames`. Do not edit.
//! Single-frame representation using normal structs.
//!
//! Transposing frame data is fairly slow. Work with Arrow arrays when possible.
use crate::game::Port;
#[derive(PartialEq, Debug)]
pub struct Data {
pub pre: Pre,
pub post: Post,
}
#[derive(PartialEq, Debug)]
pub struct PortData {
pub port: Port,
pub leader: Data,
pub follower: Option<Data>,
}
#[derive(PartialEq, Debug)]
pub struct Frame {
pub id: i32,
pub ports: Vec<PortData>,
pub start: Option<Start>,
pub end: Option<End>,
pub items: Option<Vec<Item>>,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct End {
pub latest_finalized_frame: Option<i32>,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct Item {
pub r#type: u16,
pub state: u8,
pub direction: f32,
pub velocity: Velocity,
pub position: Position,
pub damage: u16,
pub timer: f32,
pub id: u32,
pub misc: Option<ItemMisc>,
pub owner: Option<i8>,
pub instance_id: Option<u16>,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct ItemMisc(pub u8, pub u8, pub u8, pub u8);
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct Position {
pub x: f32,
pub y: f32,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct Post {
pub character: u8,
pub state: u16,
pub position: Position,
pub direction: f32,
pub percent: f32,
pub shield: f32,
pub last_attack_landed: u8,
pub combo_count: u8,
pub last_hit_by: u8,
pub stocks: u8,
pub state_age: Option<f32>,
pub state_flags: Option<StateFlags>,
pub misc_as: Option<f32>,
pub airborne: Option<u8>,
pub ground: Option<u16>,
pub jumps: Option<u8>,
pub l_cancel: Option<u8>,
pub hurtbox_state: Option<u8>,
pub velocities: Option<Velocities>,
pub hitlag: Option<f32>,
pub animation_index: Option<u32>,
pub last_hit_by_instance: Option<u16>,
pub instance_id: Option<u16>,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct Pre {
pub random_seed: u32,
pub state: u16,
pub position: Position,
pub direction: f32,
pub joystick: Position,
pub cstick: Position,
pub triggers: f32,
pub buttons: u32,
pub buttons_physical: u16,
pub triggers_physical: TriggersPhysical,
pub raw_analog_x: Option<i8>,
pub percent: Option<f32>,
pub raw_analog_y: Option<i8>,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct Start {
pub random_seed: u32,
pub scene_frame_counter: Option<u32>,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct StateFlags(pub u8, pub u8, pub u8, pub u8, pub u8);
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct TriggersPhysical {
pub l: f32,
pub r: f32,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct Velocities {
pub self_x_air: f32,
pub self_y: f32,
pub knockback_x: f32,
pub knockback_y: f32,
pub self_x_ground: f32,
}
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub struct Velocity {
pub x: f32,
pub y: f32,
}