fork/slippc

git clone https://git.julia.blue/fork/slippc

Patrick CrainAdded actions per minuet and action state changes per minute stats to analyzer; added total counts for stick movements and button pushes; added max GALINT stat30c55ad

0.6.0
4.1 KiB145 linesraw
1#ifndef REPLAY_H_
2#define REPLAY_H_
3
4#include <iostream>
5#include <fstream>
6
7#include "enums.h"
8#include "util.h"
9
10// Replay File (.slp) Spec: https://github.com/project-slippi/project-slippi/wiki/Replay-File-Spec
11
12const unsigned MAX_ITEMS = 1024; //Max number of items to output
13
14namespace slip {
15
16struct SlippiFrame {
17  //Parser stuff
18  bool     alive         = false;  //For checking if this frame was actually set
19
20  //Pre-frame stuff
21  int32_t  frame         = 0;
22  uint8_t  player        = 0;
23  bool     follower      = false;
24  uint32_t seed          = 0;
25  uint16_t action_pre    = 0;
26  float    pos_x_pre     = 0.0f;
27  float    pos_y_pre     = 0.0f;
28  float    face_dir_pre  = 0.0f;
29  float    joy_x         = 0.0f;
30  float    joy_y         = 0.0f;
31  float    c_x           = 0.0f;
32  float    c_y           = 0.0f;
33  float    trigger       = 0.0f;
34  uint16_t buttons       = 0;
35  float    phys_l        = 0.0f;
36  float    phys_r        = 0.0f;
37  uint8_t  ucf_x         = 0;
38  float    percent_pre   = 0.0f;
39
40  //Post-frame stuff
41  uint8_t  char_id       = 0;
42  uint16_t action_post   = 0;
43  float    pos_x_post    = 0.0f;
44  float    pos_y_post    = 0.0f;
45  float    face_dir_post = 0.0f;
46  float    percent_post  = 0.0f;
47  float    shield        = 0.0f;
48  uint8_t  hit_with      = 0;
49  uint8_t  combo         = 0;
50  uint8_t  hurt_by       = 0;
51  uint8_t  stocks        = 0;
52  float    action_fc     = 0.0f;
53  uint8_t  flags_1       = 0;
54  uint8_t  flags_2       = 0;
55  uint8_t  flags_3       = 0;
56  uint8_t  flags_4       = 0;
57  uint8_t  flags_5       = 0;
58  float    hitstun       = 0.0f;
59  bool     airborne      = false;
60  uint16_t ground_id     = 0;
61  uint8_t  jumps         = 0;
62  uint8_t  l_cancel      = 0;
63  uint8_t  hurtbox       = 0;
64  float    self_air_x    = 0;
65  float    self_air_y    = 0;
66  float    attack_x      = 0;
67  float    attack_y      = 0;
68  float    self_grd_x    = 0;
69  float    hitlag        = 0;
70};
71
72struct SlippiItemFrame {
73  int32_t  frame         = 0;
74  uint8_t  state         = 0;
75  float    face_dir      = 0;
76  float    xvel          = 0;
77  float    yvel          = 0;
78  float    xpos          = 0;
79  float    ypos          = 0;
80  uint16_t damage        = 0;
81  float    expire        = 0;
82  uint8_t  flags_1       = 0;
83  uint8_t  flags_2       = 0;
84  uint8_t  flags_3       = 0;
85  uint8_t  flags_4       = 0;
86  uint8_t  owner         = 0;
87};
88
89struct SlippiItem {
90  uint16_t         type       = 0;
91  uint32_t         spawn_id   = MAX_ITEMS+1;
92  uint32_t         num_frames = 0;
93  SlippiItemFrame* frame      = nullptr;
94};
95
96struct SlippiPlayer {
97  uint8_t      ext_char_id  = 0;
98  uint8_t      player_type  = 3;  //empty
99  uint8_t      start_stocks = 0;
100  uint8_t      end_stocks   = 0;
101  uint8_t      color        = 0;
102  uint8_t      team_id      = 0;
103  uint8_t      cpu_level    = 0;
104  uint32_t     dash_back    = 0;
105  uint32_t     shield_drop  = 0;
106  std::string  tag          = "";
107  std::string  tag_code     = "";
108  std::string  tag_css      = "";
109  SlippiFrame* frame        = nullptr;
110};
111
112struct SlippiReplay {
113  uint32_t        slippi_version_raw  = 0;
114  std::string     slippi_version      = "";
115  std::string     parser_version      = "";
116  std::string     game_start_raw      = "";
117  std::string     metadata            = "";
118  std::string     played_on           = "";
119  std::string     start_time          = "";
120  int8_t          winner_id           = -1;
121  bool            teams               = false;
122  uint16_t        stage               = 0;
123  uint32_t        seed                = 0;
124  bool            pal                 = false;
125  bool            frozen              = false;
126  uint8_t         end_type            = 0;
127  int8_t          lras                = -1;
128  int32_t         first_frame         = LOAD_FRAME;
129  int32_t         last_frame          = 0;
130  uint32_t        frame_count         = 0;
131  uint8_t         timer               = 0;
132  int8_t          items_on            = 0;
133  bool            sudden_death        = false;
134  SlippiPlayer    player[8]           = {0};
135  SlippiItem      item[MAX_ITEMS]     = {0};
136
137  void setFrames(int32_t max_frames);
138  void cleanup();
139  std::string replayAsJson(bool delta);
140};
141
142
143}
144
145#endif /* REPLAY_H_ */