Skip to content

Commit

Permalink
DoBoatDynamics
Browse files Browse the repository at this point in the history
  • Loading branch information
Trxyebeep committed Oct 28, 2022
1 parent 8f7322c commit 811198e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions tomb3decomp/game/boat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,31 @@ static void DoBoatShift(long item_number)
}
}

static long DoBoatDynamics(long height, long fallspeed, long* ypos)
{
if (height <= *ypos)
{
fallspeed += (height - fallspeed - *ypos) >> 3;

if (*ypos > height)
*ypos = height;
}
else
{
*ypos += fallspeed;

if (*ypos <= height)
fallspeed += 6;
else
{
*ypos = height;
fallspeed = 0;
}
}

return fallspeed;
}

void inject_boat(bool replace)
{
INJECT(0x00411FE0, InitialiseBoat, replace);
Expand All @@ -578,4 +603,5 @@ void inject_boat(bool replace)
INJECT(0x00413900, DoShift, replace);
INJECT(0x00413B80, GetCollisionAnim, replace);
INJECT(0x00413C10, DoBoatShift, replace);
INJECT(0x00413390, DoBoatDynamics, replace);
}
2 changes: 1 addition & 1 deletion tomb3decomp/global/progress.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ tomb3decomp progress.
0x00412820 BoatControl
0x004130C0 DoWake
0x00413290 + TestWaterHeight
0x00413390 DoBoatDynamics
0x00413390 + DoBoatDynamics
0x004133E0 BoatDynamics
0x00413900 + DoShift
0x00413B80 + GetCollisionAnim
Expand Down

0 comments on commit 811198e

Please sign in to comment.