-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstate.ts
137 lines (125 loc) · 2.6 KB
/
state.ts
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
133
134
135
136
137
// MISSING entries are those that aren't present in Lara's animation graph (at
// least on the levels I've tested).
// TODO(tom): move to lara.ts and rename to Lara.State
export enum State {
NONE = -1,
WALK = 0,
RUN = 1,
STOP = 2,
JUMP_FORWARD = 3,
MISSING_4 = 4,
FAST_BACK = 5,
TURN_RIGHT = 6,
TURN_LEFT = 7,
DEATH = 8,
FALL = 9,
HANG = 10,
REACH = 11,
SPLAT = 12,
SWIM_STOP = 13,
MISSING_14 = 14,
COMPRESS = 15,
BACK = 16,
SWIM = 17,
SWIM_INERTIA = 18,
HANG_UP = 19,
TURN_FAST = 20,
STEP_RIGHT = 21,
STEP_LEFT = 22,
ROLL_1 = 23,
SLIDE = 24,
JUMP_BACK = 25,
JUMP_RIGHT = 26,
JUMP_LEFT = 27,
JUMP_UP = 28,
FALL_BACK = 29,
SHIMMY_LEFT = 30,
SHIMMY_RIGHT = 31,
SLIDE_BACK = 32,
TREAD_WATER_STOP = 33,
TREAD_WATER_FORWARD = 34,
DIVE = 35,
PUSH_BLOCK = 36,
PULL_BLOCK = 37,
PUSH_READY = 38,
PICK_UP = 39,
SWITCH_DOWN = 40,
SWITCH_UP = 41,
USE_KEY = 42,
USE_PUZZLE = 43,
UNDERWATER_DEATH = 44,
ROLL_2 = 45,
SPECIAL = 46,
TREAD_WATER_BACK = 47,
TREAD_WATER_LEFT = 48,
TREAD_WATER_RIGHT = 49,
MISSING_50 = 50,
MISSING_51 = 51,
SWAN_DIVE = 52,
FAST_DIVE = 53,
HANDSTAND = 54,
WATER_OUT = 55
}
export namespace State {
export function isJumping(state: State) {
switch (state) {
case State.JUMP_UP:
case State.JUMP_FORWARD:
case State.JUMP_BACK:
case State.JUMP_LEFT:
case State.JUMP_RIGHT:
case State.REACH:
case State.SWAN_DIVE:
return true;
}
return false;
}
export function isWalking(state: State) {
switch (state) {
case State.WALK:
case State.BACK:
return true;
}
return false;
}
export function isSideStepping(state: State) {
switch (state) {
case State.STEP_RIGHT:
case State.STEP_LEFT:
return true;
}
return false;
}
export function isHanging(state: State) {
switch (state) {
case State.HANG:
case State.HANG_UP:
case State.SHIMMY_LEFT:
case State.SHIMMY_RIGHT:
case State.HANDSTAND:
case State.WATER_OUT:
return true;
}
return false;
}
export function isSwimming(state: State) {
switch (state) {
case State.SWIM:
case State.SWIM_STOP:
case State.SWIM_INERTIA:
return true;
}
return false;
}
export function isTreadingWater(state: State) {
switch (state) {
case State.TREAD_WATER_STOP:
case State.TREAD_WATER_FORWARD:
case State.TREAD_WATER_BACK:
case State.TREAD_WATER_LEFT:
case State.TREAD_WATER_RIGHT:
return true;
}
return false;
}
}