diff --git a/docs/progress.svg b/docs/progress.svg
index 83f2e63ed..1438dad2e 100644
--- a/docs/progress.svg
+++ b/docs/progress.svg
@@ -172,7 +172,7 @@
-
+
@@ -1078,7 +1078,7 @@
-
+
@@ -1459,10 +1459,10 @@
-Functions decompiled (count): 34.98%
-Functions decompiled (bytesize): 35.27%
-Functions not decompiled, but with known names (count): 51.03%
-Functions not decompiled, but with known names (bytesize): 48.76%
+Functions decompiled (count): 35.12%
+Functions decompiled (bytesize): 35.34%
+Functions not decompiled, but with known names (count): 50.89%
+Functions not decompiled, but with known names (bytesize): 48.68%
Functions not decompiled, with unknown names (count): 13.99%
Functions not decompiled, with unknown names (bytesize): 15.97%
diff --git a/docs/progress.txt b/docs/progress.txt
index 7856fad70..0da1e2491 100644
--- a/docs/progress.txt
+++ b/docs/progress.txt
@@ -219,7 +219,7 @@ CrocControl 0x00415850 0x0000030C +
# demo.cpp
StartDemo 0x00415B70 0x00000140 +
-LoadLaraDemoPos 0x00415CB0 0x000000BF *
+LoadLaraDemoPos 0x00415CB0 0x000000BF +
GetDemoInput 0x00415D70 0x0000002D *
# dino.cpp
diff --git a/src/game/demo.c b/src/game/demo.c
index b2b1553db..0486f4837 100644
--- a/src/game/demo.c
+++ b/src/game/demo.c
@@ -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);
}
diff --git a/src/game/demo.h b/src/game/demo.h
index e31105082..e9d797464 100644
--- a/src/game/demo.h
+++ b/src/game/demo.h
@@ -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();
diff --git a/src/game/vars.h b/src/game/vars.h
index 8ec82aaa8..57c142bc5 100644
--- a/src/game/vars.h
+++ b/src/game/vars.h
@@ -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)