port LaraAsBack

This commit is contained in:
rr- 2021-02-13 14:58:49 +01:00
parent 45ae550bf0
commit 00808faf5a
4 changed files with 34 additions and 7 deletions

View file

@ -333,7 +333,7 @@
<rect width="12" height="12" x="434" y="84" fill="forestgreen"/> <rect width="12" height="12" x="434" y="84" fill="forestgreen"/>
<rect width="12" height="12" x="448" y="84" fill="forestgreen"/> <rect width="12" height="12" x="448" y="84" fill="forestgreen"/>
<rect width="12" height="12" x="462" y="84" fill="forestgreen"/> <rect width="12" height="12" x="462" y="84" fill="forestgreen"/>
<rect width="12" height="12" x="476" y="84" fill="lightpink"/> <rect width="12" height="12" x="476" y="84" fill="forestgreen"/>
<rect width="12" height="12" x="490" y="84" fill="lightpink"/> <rect width="12" height="12" x="490" y="84" fill="lightpink"/>
<rect width="12" height="12" x="504" y="84" fill="lightpink"/> <rect width="12" height="12" x="504" y="84" fill="lightpink"/>
<rect width="12" height="12" x="518" y="84" fill="lightpink"/> <rect width="12" height="12" x="518" y="84" fill="lightpink"/>
@ -700,10 +700,10 @@
<rect width="12" height="12" x="672" y="182" fill="mistyrose"/> <rect width="12" height="12" x="672" y="182" fill="mistyrose"/>
<rect width="12" height="12" x="686" y="182" fill="mistyrose"/> <rect width="12" height="12" x="686" y="182" fill="mistyrose"/>
<rect width="12" height="12" x="0" y="196" fill="lightpink"/> <rect width="12" height="12" x="0" y="196" fill="lightpink"/>
<rect width="12" height="12" x="0" y="224.5" fill="forestgreen"/><text alignment-baseline="central" x="17" y="230.5" style="font-family: sans-serif; font-size: 15px">Functions decompiled (count): 5.42%</text> <rect width="12" height="12" x="0" y="224.5" fill="forestgreen"/><text alignment-baseline="central" x="17" y="230.5" style="font-family: sans-serif; font-size: 15px">Functions decompiled (count): 5.56%</text>
<rect width="12" height="12" x="0" y="242.5" fill="forestgreen"/><text alignment-baseline="central" x="17" y="248.5" style="font-family: sans-serif; font-size: 15px">Functions decompiled (bytesize): 3.23%</text> <rect width="12" height="12" x="0" y="242.5" fill="forestgreen"/><text alignment-baseline="central" x="17" y="248.5" style="font-family: sans-serif; font-size: 15px">Functions decompiled (bytesize): 3.28%</text>
<rect width="12" height="12" x="0" y="260.5" fill="lightpink"/><text alignment-baseline="central" x="17" y="266.5" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (count): 75.32%</text> <rect width="12" height="12" x="0" y="260.5" fill="lightpink"/><text alignment-baseline="central" x="17" y="266.5" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (count): 75.18%</text>
<rect width="12" height="12" x="0" y="278.5" fill="lightpink"/><text alignment-baseline="central" x="17" y="284.5" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (bytesize): 76.74%</text> <rect width="12" height="12" x="0" y="278.5" fill="lightpink"/><text alignment-baseline="central" x="17" y="284.5" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (bytesize): 76.69%</text>
<rect width="12" height="12" x="0" y="296.5" fill="mistyrose"/><text alignment-baseline="central" x="17" y="302.5" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (count): 19.26%</text> <rect width="12" height="12" x="0" y="296.5" fill="mistyrose"/><text alignment-baseline="central" x="17" y="302.5" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (count): 19.26%</text>
<rect width="12" height="12" x="0" y="314.5" fill="mistyrose"/><text alignment-baseline="central" x="17" y="320.5" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (bytesize): 20.03%</text> <rect width="12" height="12" x="0" y="314.5" fill="mistyrose"/><text alignment-baseline="central" x="17" y="320.5" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (bytesize): 20.03%</text>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Before After
Before After

View file

@ -337,7 +337,7 @@ LaraAsFastFall 0x00422B90 0x00000040 +
LaraAsHang 0x00422BD0 0x00000049 + LaraAsHang 0x00422BD0 0x00000049 +
LaraAsReach 0x00422C20 0x0000001C + LaraAsReach 0x00422C20 0x0000001C +
LaraAsCompress 0x00422C40 0x0000026D + LaraAsCompress 0x00422C40 0x0000026D +
LaraAsBack 0x00422EB0 0x0000007D - LaraAsBack 0x00422EB0 0x0000007D +
LaraAsFastTurn 0x00422F30 0x0000004B - LaraAsFastTurn 0x00422F30 0x0000004B -
LaraAsStepRight 0x00422F80 0x00000073 - LaraAsStepRight 0x00422F80 0x00000073 -
LaraAsStepLeft 0x00423000 0x00000073 - LaraAsStepLeft 0x00423000 0x00000073 -

View file

@ -333,6 +333,32 @@ void __cdecl LaraAsCompress(ITEM_INFO* item, COLL_INFO* coll)
item->goal_anim_state = AS_FASTFALL; item->goal_anim_state = AS_FASTFALL;
} }
void __cdecl LaraAsBack(ITEM_INFO* item, COLL_INFO* coll)
{
if (item->hit_points <= 0) {
item->goal_anim_state = AS_STOP;
return;
}
if ((Input & IN_BACK) && (Input & IN_SLOW)) {
item->goal_anim_state = AS_BACK;
} else {
item->goal_anim_state = AS_STOP;
}
if (Input & IN_LEFT) {
Lara.turn_rate -= LARA_TURN_RATE;
if (Lara.turn_rate < -LARA_SLOW_TURN) {
Lara.turn_rate = -LARA_SLOW_TURN;
}
} else if (Input & IN_RIGHT) {
Lara.turn_rate += LARA_TURN_RATE;
if (Lara.turn_rate > LARA_SLOW_TURN) {
Lara.turn_rate = LARA_SLOW_TURN;
}
}
}
int16_t __cdecl LaraFloorFront(ITEM_INFO* item, PHD_ANGLE ang, int32_t dist) int16_t __cdecl LaraFloorFront(ITEM_INFO* item, PHD_ANGLE ang, int32_t dist)
{ {
int32_t x = item->pos.x + ((phd_sin(ang) * dist) >> W2V_SHIFT); int32_t x = item->pos.x + ((phd_sin(ang) * dist) >> W2V_SHIFT);
@ -359,4 +385,5 @@ void TR1MInjectLara()
INJECT(0x00422BD0, LaraAsHang); INJECT(0x00422BD0, LaraAsHang);
INJECT(0x00422C20, LaraAsReach); INJECT(0x00422C20, LaraAsReach);
INJECT(0x00422C40, LaraAsCompress); INJECT(0x00422C40, LaraAsCompress);
INJECT(0x00422EB0, LaraAsBack);
} }

View file

@ -7,7 +7,6 @@
// clang-format off // clang-format off
#define InitialiseLaraInventory ((void __cdecl(*)(int level_id))0x00428170) #define InitialiseLaraInventory ((void __cdecl(*)(int level_id))0x00428170)
#define LaraControl ((void __cdecl(*)(int16_t item_num))0x00427850) #define LaraControl ((void __cdecl(*)(int16_t item_num))0x00427850)
#define LaraAsBack ((void __cdecl(*)(ITEM_INFO*, COLL_INFO*))0x00422EB0)
// clang-format on // clang-format on
void __cdecl InitialiseLara(); void __cdecl InitialiseLara();
@ -26,6 +25,7 @@ void __cdecl LaraAsReach(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl LaraAsSplat(ITEM_INFO* item, COLL_INFO* coll); void __cdecl LaraAsSplat(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl LaraAsLand(ITEM_INFO* item, COLL_INFO* coll); void __cdecl LaraAsLand(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl LaraAsCompress(ITEM_INFO* item, COLL_INFO* coll); void __cdecl LaraAsCompress(ITEM_INFO* item, COLL_INFO* coll);
void __cdecl LaraAsBack(ITEM_INFO* item, COLL_INFO* coll);
int16_t __cdecl LaraFloorFront(ITEM_INFO* item, PHD_ANGLE ang, int32_t dist); int16_t __cdecl LaraFloorFront(ITEM_INFO* item, PHD_ANGLE ang, int32_t dist);
void __cdecl UseItem(__int16 object_num); void __cdecl UseItem(__int16 object_num);