Skip to content

Commit a48c553

Browse files
author
Niko
committed
JumpAndFriction cleaning progress
1 parent cda2d73 commit a48c553

File tree

1 file changed

+64
-24
lines changed

1 file changed

+64
-24
lines changed

decompile/General/Vehicle/TEST_VehPhysGeneral_JumpAndFriction.c

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ void FUN_80060630(struct Thread* t, struct Driver* d)
8686
uVar14 = 0;
8787
iVar9 = 0;
8888

89-
if ((d->actionsFlagSet & 1) == 0) {
89+
if ((d->actionsFlagSet & 1) == 0)
90+
{
9091
CHECK_FOR_ANY_JUMP:
9192
// If you want to fire a weapon
9293
if (((d->actionsFlagSet & 0x8000) != 0) &&
@@ -97,23 +98,44 @@ void FUN_80060630(struct Thread* t, struct Driver* d)
9798
// Remove the request to fire a weapon, since we will use it now
9899
d->actionsFlagSet &= ~(0x8000);
99100

100-
if ((*(short *)(uVar12 + 0x3f4) != 0) && (*(short *)(uVar12 + 0x3f2) == 0)) {
101-
*(unsigned short *)(uVar12 + 0x3f6) = 0xa0;
102-
iVar9 = *(short *)(uVar12 + 0x418) * 9;
103-
if (iVar9 < 0) {
101+
// if coyoteTimerMS has not expired, and cooldownMS is over
102+
if ((d->jump_CoyoteTimerMS != 0) && (d->jump_CooldownMS == 0))
103+
{
104+
// driver is now forced to jump
105+
d->jump_ForcedMS = 0xa0;
106+
107+
iVar9 = d->const_JumpForce * 9;
108+
109+
if (iVar9 < 0) {
104110
iVar9 = iVar9 + 3;
105111
}
106112
d->jump_InitialVelY = (short)(iVar9 >> 2);
107-
DECOMP_OtherFX_Play_Echo(9,1,*(unsigned short *)(uVar12 + 0x2ca) & 1);
108-
d->jump_unknown = 0x180;
113+
114+
// spring weapon sound
115+
OtherFX_Play_Echo(9, 1, d->actionsFlagSet & 0x10000);
116+
117+
d->jump_unknown = 0x180;
109118
goto PROCESS_JUMP;
110119
}
111-
*(unsigned short *)(uVar12 + 0x3c) = 0;
120+
d->noItemTimer = 0;
112121
}
113-
if (*(char *)(uVar12 + 0x366) == '\0') {
114-
if (((*(short *)(uVar12 + 0x3f4) == 0) || (*(short *)(uVar12 + 0x3f0) == 0)) ||
115-
(*(short *)(uVar12 + 0x3f2) != 0)) {
116-
if ((d->actionsFlagSet & 1) != 0) {
122+
123+
// if not being forced to jump (turtles), this should cause the tiny jumps on top of walls.
124+
if (d->forcedJump_trampoline == 0)
125+
{
126+
if (
127+
// if driver left quadblock more than 0.16s ago
128+
(d->jump_CoyoteTimerMS == 0) ||
129+
130+
// if haven't jumped in last 10 frames
131+
(d->jump_TenBuffer == 0) ||
132+
133+
// jump_CooldownMS not over (so can't jump again)
134+
(d->jump_CooldownMS != 0)
135+
)
136+
{
137+
if ((d->actionsFlagSet & 1) != 0)
138+
{
117139
if ((*(int *)(uVar12 + 0x350) != 0) &&
118140
(iVar9 = (int)*(char *)(*(int *)(uVar12 + 0x350) + 0x3b), iVar9 != 0)) {
119141
iVar13 = (int)d->speedApprox;
@@ -133,14 +155,30 @@ void FUN_80060630(struct Thread* t, struct Driver* d)
133155
}
134156
goto NOT_JUMPING;
135157
}
136-
*(unsigned short *)(uVar12 + 0x3f6) = 0xa0;
137-
*(short *)(uVar12 + 0x554) = *(short *)(uVar12 + 0x554) + 1;
138-
*(unsigned short *)(uVar12 + 0x3f8) = *(unsigned short *)(uVar12 + 0x418);
139-
DECOMP_OtherFX_Play_Echo(8,1,*(unsigned short *)(uVar12 + 0x2ca) & 1);
158+
159+
// force driver to jump
160+
d->jump_ForcedMS = 0xa0;
161+
162+
// increment jump counter
163+
d->numberOfJumps++;
164+
165+
d->jump_InitialVelY = d->const_JumpForce;
166+
167+
// play jump sound
168+
DECOMP_OtherFX_Play_Echo(8, 1, d->actionsFlagSet & 0x10000);
140169
}
141-
else {
142-
if ((d->jump_ForcedMS == 0) ||
143-
(d->jump_InitialVelY == *(short *)(uVar12 + 0x418))) {
170+
171+
// if being forced to jump (by turtles)
172+
else
173+
{
174+
// if first frame (basically)
175+
if (
176+
// if not currently airborne from forced jump
177+
(d->jump_ForcedMS == 0) ||
178+
179+
// if jump_InitialVelY was just now set to const_jump
180+
(d->jump_InitialVelY == d->const_JumpForce))
181+
{
144182
DECOMP_OtherFX_Play(0x7e,1);
145183
}
146184
*(unsigned short *)(uVar12 + 0x3f6) = 0xa0;
@@ -154,10 +192,12 @@ void FUN_80060630(struct Thread* t, struct Driver* d)
154192
*(char *)(uVar12 + 0x366) = 0;
155193
}
156194
}
195+
196+
// ((d->actionsFlagSet & 1) == 1)
157197
else {
158-
if (((*(unsigned int *)(uVar12 + 0xbc) & 3) == 0) || (d->baseSpeed < 1)) {
198+
if (((d->stepFlagSet & 3) == 0) || (d->baseSpeed < 1)) {
159199
if (d->baseSpeed != 0) {
160-
if ((((*(unsigned int *)(*(int *)(uVar12 + 0x358) + 4) & 4) == 0) ||
200+
if ((((d->terrainMeta1->flags & 4) == 0) ||
161201
(d->baseSpeed < 1)) || (-1 < d->speedApprox)) {
162202
iVar8 = (int)d->speedApprox;
163203
iVar13 = iVar8;
@@ -169,11 +209,11 @@ void FUN_80060630(struct Thread* t, struct Driver* d)
169209
}
170210
param_1 = (int)*(short *)(uVar12 + 0x428);
171211
iVar9 = param_1 + ((int)*(char *)(uVar12 + 0x33) << 5) / 5;
172-
if ((*(unsigned int *)(uVar12 + 0xbc) & 3) == 0) {
212+
if ((d->stepFlagSet & 3) == 0) {
173213
if ((*(short *)(uVar12 + 0x3e2) != 0) && (0 < d->baseSpeed)) {
174-
iVar9 = (int)*(short *)(uVar12 + 0x42a);
214+
iVar9 = d->const_Accel_Reserves;
175215
}
176-
param_1 = *(int *)(*(int *)(uVar12 + 0x358) + 0xc);
216+
param_1 = d->terrainMeta1->slowUntilSpeed;
177217
if ((param_1 != 0x100) && ((d->actionsFlagSet & 0x800000) == 0)) {
178218
iVar9 = param_1 * iVar9 >> 8;
179219
}

0 commit comments

Comments
 (0)