port LaraSlideSlope

This commit is contained in:
rr- 2021-02-17 15:53:21 +01:00
parent b7efaadd5e
commit c39289ee1d
5 changed files with 60 additions and 10 deletions

View file

@ -387,7 +387,7 @@
<rect width="12.00" height="12.00" x="476.00" y="115.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="490.00" y="115.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="504.00" y="115.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="518.00" y="115.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="518.00" y="115.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="532.00" y="115.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="546.00" y="115.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="560.00" y="115.00" fill="lightpink"/>
@ -895,7 +895,7 @@
<rect width="14.75" height="15.48" x="566.91" y="305.45" fill="forestgreen"/>
<rect width="14.66" height="15.48" x="583.66" y="305.45" fill="lightpink"/>
<rect width="14.40" height="15.48" x="600.33" y="305.45" fill="lightpink"/>
<rect width="14.32" height="15.48" x="616.73" y="305.45" fill="lightpink"/>
<rect width="14.32" height="15.48" x="616.73" y="305.45" fill="forestgreen"/>
<rect width="14.32" height="15.48" x="633.04" y="305.45" fill="lightpink"/>
<rect width="14.32" height="15.48" x="649.36" y="305.45" fill="mistyrose"/>
<rect width="14.18" height="15.48" x="665.68" y="305.45" fill="lightpink"/>
@ -1403,10 +1403,10 @@
<rect width="-0.56" height="0.65" x="696.56" y="534.29" fill="mistyrose"/>
<rect width="0.16" height="-0.94" x="695.12" y="536.94" fill="mistyrose"/>
<rect width="-1.28" height="-0.94" x="697.28" y="536.94" fill="lightpink"/>
<rect width="12.00" height="12.00" x="0.00" y="564.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="570.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (count): 16.26%</text>
<rect width="12.00" height="12.00" x="0.00" y="582.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="588.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (bytesize): 8.20%</text>
<rect width="12.00" height="12.00" x="0.00" y="600.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="606.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (count): 68.05%</text>
<rect width="12.00" height="12.00" x="0.00" y="618.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="624.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (bytesize): 74.22%</text>
<rect width="12.00" height="12.00" x="0.00" y="564.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="570.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (count): 16.41%</text>
<rect width="12.00" height="12.00" x="0.00" y="582.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="588.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (bytesize): 8.35%</text>
<rect width="12.00" height="12.00" x="0.00" y="600.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="606.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (count): 67.90%</text>
<rect width="12.00" height="12.00" x="0.00" y="618.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="624.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (bytesize): 74.06%</text>
<rect width="12.00" height="12.00" x="0.00" y="636.50" fill="mistyrose"/><text alignment-baseline="central" x="17.00" y="642.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (count): 15.69%</text>
<rect width="12.00" height="12.00" x="0.00" y="654.50" fill="mistyrose"/><text alignment-baseline="central" x="17.00" y="660.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (bytesize): 17.59%</text>
</svg>

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Before After
Before After

View file

@ -390,7 +390,7 @@ LaraColRoll 0x00424E90 0x00000100 +
LaraColRoll2 0x00424F90 0x00000104 +
LaraColSwanDive 0x004250A0 0x00000089 +
LaraColFastDive 0x00425130 0x00000099 +
LaraSlideSlope 0x004251D0 0x00000176 -
LaraSlideSlope 0x004251D0 0x00000176 +
LaraHangTest 0x00425350 0x00000229 -
LaraDeflectEdgeJump 0x004255A0 0x000000E4 -
TestLaraVault 0x004256C0 0x000001C8 -

View file

@ -5,6 +5,7 @@
#include "game/effects.h"
#include "game/lara.h"
#include "game/lot.h"
#include "game/misc.h"
#include "game/shell.h"
#include "mod.h"
#include "util.h"
@ -1557,6 +1558,44 @@ void __cdecl GetLaraCollisionInfo(ITEM_INFO* item, COLL_INFO* coll)
LARA_HITE);
}
void __cdecl LaraSlideSlope(ITEM_INFO* item, COLL_INFO* coll)
{
coll->bad_pos = NO_BAD_POS;
coll->bad_neg = -512;
coll->bad_ceiling = 0;
GetLaraCollisionInfo(item, coll);
if (LaraHitCeiling(item, coll)) {
return;
}
LaraDeflectEdge(item, coll);
if (coll->mid_floor > 200) {
if (item->current_anim_state == AS_SLIDE) {
item->current_anim_state = AS_FORWARDJUMP;
item->goal_anim_state = AS_FORWARDJUMP;
item->anim_number = AA_FALLDOWN;
item->frame_number = AF_FALLDOWN;
} else {
item->current_anim_state = AS_FALLBACK;
item->goal_anim_state = AS_FALLBACK;
item->anim_number = AA_FALLBACK;
item->frame_number = AF_FALLBACK;
}
item->gravity_status = 1;
item->fall_speed = 0;
return;
}
TestLaraSlide(item, coll);
item->pos.y += coll->mid_floor;
if (ABS(coll->tilt_x) <= 2 && ABS(coll->tilt_z) <= 2) {
item->goal_anim_state = AS_STOP;
}
}
int32_t __cdecl LaraHitCeiling(ITEM_INFO* item, COLL_INFO* coll)
{
if (coll->coll_type == COLL_TOP || coll->coll_type == COLL_CLAMP) {
@ -1676,6 +1715,7 @@ void TR1MInjectLara()
INJECT(0x004232F0, LaraAsDieMidas);
INJECT(0x00423720, LaraAsSwanDive);
INJECT(0x00423750, LaraAsFastDive);
INJECT(0x004237A0, LaraAsWaterOut);
INJECT(0x004237C0, LaraColWalk);
INJECT(0x004239F0, LaraColRun);
@ -1707,6 +1747,5 @@ void TR1MInjectLara()
INJECT(0x00424F90, LaraColRoll2);
INJECT(0x004250A0, LaraColSwanDive);
INJECT(0x00425130, LaraColFastDive);
INJECT(0x004237A0, LaraAsWaterOut);
INJECT(0x004251D0, LaraSlideSlope);
}

View file

@ -13,7 +13,6 @@
#define LaraGun ((void __cdecl(*)())0x00426BD0)
#define LaraWaterCurrent ((void __cdecl(*)(COLL_INFO* coll))0x00429440)
#define LaraDeflectEdgeJump ((void __cdecl(*)(ITEM_INFO *item, COLL_INFO* coll))0x004255A0)
#define LaraSlideSlope ((void __cdecl(*)(ITEM_INFO* item, COLL_INFO* coll))0x004251D0)
#define LaraLandedBad ((int32_t __cdecl(*)(ITEM_INFO *item, COLL_INFO* coll))0x00425D70)
#define LaraHangTest ((void __cdecl(*)(ITEM_INFO *item, COLL_INFO *coll))0x00425350)
#define LaraTestHangJump ((int32_t __cdecl(*)(ITEM_INFO *item, COLL_INFO *coll))0x00425890)
@ -105,6 +104,7 @@ void __cdecl LaraColFastDive(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl LaraColJumper(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl GetLaraCollisionInfo(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl LaraSlideSlope(ITEM_INFO* item, COLL_INFO* coll);
int32_t __cdecl LaraHitCeiling(ITEM_INFO* item, COLL_INFO* coll);
int32_t __cdecl LaraDeflectEdge(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl LaraSlideEdgeJump(ITEM_INFO* item, COLL_INFO* coll);

11
src/game/misc.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef TR1MAIN_GAME_UTIL_H
#define TR1MAIN_GAME_UTIL_H
#define SQUARE(A) ((A) * (A))
#ifndef ABS
#define ABS(x) (((x) < 0) ? (-(x)) : (x))
#define MIN(x, y) ((x) <= (y) ? (x) : (y))
#define MAX(x, y) ((x) >= (y) ? (x) : (y))
#endif
#endif