-
Notifications
You must be signed in to change notification settings - Fork 0
/
movement_visual.h
82 lines (60 loc) · 1.8 KB
/
movement_visual.h
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
#pragma once
#include "common.h"
#include "visit_struct.h"
// @ForwardDeclare
typedef u32 Pid;
typedef u32 Transaction_Id;
enum class Linear_Move_Type
{
NONE = 0,
PUSHED = 1,
PULLED = 2,
};
enum class Move_Type
{
LINEAR = 0,
TELEPORT = 1,
STATIONARY = 2,
};
struct Visual_Interpolation
{
Move_Type move_type;
Linear_Move_Type linear_move_type;
// Linear_Move_Type just_completed_linear_move_type;
Vector3 visual_start;
Vector3 visual_end;
f32 start_time = -1.0;
f32 duration = 0;
f32 elapsed = 0;
Transaction_Id transaction_id = 0;
// bool is_falling;
Vector3 teleport_direction;
Pid sync_id = 0;
Vector3 velocity;
Vector3 old_velocity;
// f32 speed_scale; // 1.0
f32 teleport_pre_time;
f32 teleport_post_time;
bool has_teleported = false;
// Pid moving_onto_id;
// bool caused_by_timed_event; // false
bool done = false;
// bool strong_push; // false
// i32 transaction_hold_z_index;
};
VISITABLE_STRUCT(Visual_Interpolation,
move_type,
linear_move_type,
visual_start, visual_end,
start_time, duration, elapsed,
transaction_id, sync_id,
velocity,
teleport_direction, has_teleported,
done);
struct Entity;
struct Entity_Manager;
#include "source_location.h"
void reset(Visual_Interpolation *v, Source_Location loc = Source_Location::current());
void add_visual_interpolation(Entity *e, Vector3 old_position, Vector3 new_position, Move_Type move_type, f32 duration,
Transaction_Id transaction_id, Source_Location loc = Source_Location::current());
void update_entities_visual_interpolation(Entity_Manager *manager, f32 dt);