summaryrefslogtreecommitdiff
path: root/cheat/internal_rewrite/prediction.hpp
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
committerboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
commit3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch)
tree26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /cheat/internal_rewrite/prediction.hpp
parente4729e4393d90271a3814c7a79950a660c48325a (diff)
cleaned up
in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever. i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64
Diffstat (limited to 'cheat/internal_rewrite/prediction.hpp')
-rw-r--r--cheat/internal_rewrite/prediction.hpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/cheat/internal_rewrite/prediction.hpp b/cheat/internal_rewrite/prediction.hpp
new file mode 100644
index 0000000..d6adb44
--- /dev/null
+++ b/cheat/internal_rewrite/prediction.hpp
@@ -0,0 +1,95 @@
+#pragma once
+#include "vector.hpp"
+#include "util.hpp"
+
+#include <array>
+#include <deque>
+
+class user_cmd_t;
+class c_base_player;
+
+NAMESPACE_REGION( features )
+
+class c_prediction
+{
+ user_cmd_t* m_ucmd{ };
+ int m_predicted_flags{ };
+
+ float m_old_time;
+ float m_old_frametime;
+ int m_old_tickcount;
+
+ int m_prediction_seed;
+ int m_prediction_player;
+
+ struct player_data_t {
+ struct lag_velocity_record_t {
+ vec3_t m_velocity;
+ int m_tick;
+ };
+
+ void update( int ent_index );
+
+ float m_simtime{ };
+ int m_last_choke{ };
+ vec3_t m_angles{ };
+ vec3_t m_velocity{ };
+ vec3_t m_old_velocity{ };
+ vec3_t m_position{ };
+ vec3_t m_movement{ };
+ bool m_valid{ };
+ bool m_breaking_lc{ };
+
+ std::deque< lag_velocity_record_t > m_records{ };
+ };
+
+ std::array< player_data_t, 65 > m_players;
+
+ void run( user_cmd_t* ucmd );
+public:
+ // You should be using the un-predicted velocity for fake-walk.
+ vec3_t m_velocity{ };
+
+ // void local_pred( user_cmd_t* );
+
+ void run_command( user_cmd_t *cmd );
+
+ int get_predicted_flags( ) const {
+ return m_predicted_flags;
+ }
+
+ bool is_breaking_lc( int ent ) const {
+ return m_players[ ent ].m_breaking_lc;
+ }
+
+ inline player_data_t get_player_data( int ent_index ) {
+ return m_players[ ent_index ];
+ }
+
+ player_data_t m_player;
+
+ //gamemovement functions
+ vec3_t full_walk_move( c_base_player*, int );
+ void check_jump_button( c_base_player*, vec3_t&, vec3_t& );
+ void start_gravity( c_base_player*, vec3_t&, vec3_t& );
+ void finish_gravity( c_base_player*, vec3_t&, vec3_t& );
+ void friction( c_base_player*, vec3_t&, vec3_t& );
+ void air_move( c_base_player*, vec3_t&, vec3_t&, vec3_t&, vec3_t& );
+ void air_accelerate( c_base_player*, vec3_t&, vec3_t&, vec3_t&, float );
+ // void walk_move( c_base_player*, vec3_t&, vec3_t& );
+ bool categorize_position( c_base_player*, vec3_t&, vec3_t& );
+ void check_velocity( c_base_player*, vec3_t&, vec3_t& );
+ void try_player_move( c_base_player*, vec3_t&, vec3_t& );
+
+ void frame_stage_notify( );
+ vec3_t aimware_extrapolate( c_base_player* ent, vec3_t origin, vec3_t& velocity );
+ void predict_player( c_base_player* player );
+ int get_predicted_choke( int );
+ vec3_t extrapolate_player( c_base_player*, int );
+ void trace_player_bbox( c_base_player*, const vec3_t& start, const vec3_t& end, CGameTrace* pm );
+ void try_touch_ground( c_base_player*, const vec3_t& start, const vec3_t& end, const vec3_t& mins, const vec3_t& maxs, CGameTrace* pm );
+ void try_touch_ground_in_quadrants( c_base_player*, const vec3_t& start, const vec3_t& end, CGameTrace* pm );
+
+};
+
+END_REGION