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

@ -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)