port LoadLaraDemoPos

This commit is contained in:
rr- 2021-02-27 21:26:54 +01:00
parent 6e5341e619
commit 795f593ab2
5 changed files with 34 additions and 8 deletions

View file

@ -172,7 +172,7 @@
<rect width="12.00" height="12.00" x="266.00" y="59.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="280.00" y="59.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="294.00" y="59.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="308.00" y="59.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="308.00" y="59.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="322.00" y="59.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="336.00" y="59.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="350.00" y="59.00" fill="lightpink"/>
@ -1078,7 +1078,7 @@
<rect width="10.01" height="10.02" x="538.87" y="513.96" fill="forestgreen"/>
<rect width="10.01" height="10.02" x="538.87" y="525.98" fill="lightpink"/>
<rect width="9.31" height="10.70" x="550.89" y="391.35" fill="mistyrose"/>
<rect width="9.31" height="10.63" x="550.89" y="404.05" fill="lightpink"/>
<rect width="9.31" height="10.63" x="550.89" y="404.05" fill="forestgreen"/>
<rect width="9.31" height="10.63" x="550.89" y="416.69" fill="lightpink"/>
<rect width="9.31" height="10.57" x="550.89" y="429.32" fill="forestgreen"/>
<rect width="9.31" height="10.57" x="550.89" y="441.89" fill="lightpink"/>
@ -1459,10 +1459,10 @@
<rect width="-0.46" height="0.42" x="695.22" y="535.58" fill="mistyrose"/>
<rect width="-0.76" height="-0.18" x="696.76" y="535.58" fill="mistyrose"/>
<rect width="-0.76" height="-1.39" x="696.76" y="537.39" 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): 34.98%</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): 35.27%</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): 51.03%</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): 48.76%</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): 35.12%</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): 35.34%</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): 50.89%</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): 48.68%</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): 13.99%</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): 15.97%</text>
</svg>

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Before After
Before After

View file

@ -219,7 +219,7 @@ CrocControl 0x00415850 0x0000030C +
# demo.cpp
StartDemo 0x00415B70 0x00000140 +
LoadLaraDemoPos 0x00415CB0 0x000000BF *
LoadLaraDemoPos 0x00415CB0 0x000000BF +
GetDemoInput 0x00415D70 0x0000002D *
# dino.cpp

View file

@ -1,5 +1,7 @@
#include "game/control.h"
#include "game/demo.h"
#include "game/game.h"
#include "game/items.h"
#include "game/setup.h"
#include "game/text.h"
#include "game/vars.h"
@ -62,7 +64,29 @@ int32_t StartDemo()
return GF_EXIT_TO_TITLE;
}
void LoadLaraDemoPos()
{
ITEM_INFO* item = LaraItem;
item->pos.x = DemoPtr[0];
item->pos.y = DemoPtr[1];
item->pos.z = DemoPtr[2];
item->pos.x_rot = DemoPtr[3];
item->pos.y_rot = DemoPtr[4];
item->pos.z_rot = DemoPtr[5];
int16_t room_num = DemoPtr[6];
DemoCount += 7;
if (item->room_number != room_num) {
ItemNewRoom(Lara.item_number, room_num);
}
FLOOR_INFO* floor =
GetFloor(item->pos.x, item->pos.y, item->pos.z, &room_num);
item->floor = GetHeight(floor, item->pos.x, item->pos.y, item->pos.z);
}
void T1MInjectGameDemo()
{
INJECT(0x00415B70, StartDemo);
INJECT(0x00415CB0, LoadLaraDemoPos);
}

View file

@ -5,10 +5,10 @@
// clang-format off
#define GetDemoInput ((void (*)())0x00415D70)
#define LoadLaraDemoPos ((void (*)())0x00415CB0)
// clang-format on
int32_t StartDemo();
void LoadLaraDemoPos();
void T1MInjectGameDemo();

View file

@ -146,6 +146,8 @@ extern char TextStrings[MAX_TEXT_STRINGS][MAX_STRING_SIZE];
#define DemoLevels ARRAY_(0x00453538, int8_t, [])
#define TitleLoaded VAR_U_(0x0045A324, int32_t)
#define DemoLevel VAR_I_(0x00453530, int32_t, 1)
#define DemoPtr VAR_U_(0x00462BFC, int32_t*)
#define DemoCount VAR_U_(0x00462C00, int32_t)
#define ChunkyFlag VAR_I_(0x00459F44, int32_t, 0)
#define HeightType VAR_I_(0x00459F48, int32_t, 0)
#define InventoryChosen VAR_I_(0x00456328, int16_t, -1)