diff --git a/docs/progress.svg b/docs/progress.svg
index 21af5b213..b46417479 100644
--- a/docs/progress.svg
+++ b/docs/progress.svg
@@ -429,7 +429,7 @@
LaraInitialiseMeshes
InitialiseEvilLara
ControlEvilLara
-DrawEvilLara
+DrawEvilLara
LaraSurface
LaraAsSurfSwim
LaraAsSurfBack
@@ -1216,7 +1216,7 @@
sub_408B2C
ObjectCollision
DoBloodSplat
-DrawEvilLara
+DrawEvilLara
sub_408A70
Inv_RingMotionItemSelect
LaraAsFastBack
@@ -1463,10 +1463,10 @@
sub_440EF0
sub_437BC0
S_CDVolume
-Functions decompiled (count): 47.47%
-Functions decompiled (bytesize): 45.03%
-Functions not decompiled, but with known names (count): 38.44%
-Functions not decompiled, but with known names (bytesize): 39.14%
+Functions decompiled (count): 47.61%
+Functions decompiled (bytesize): 45.07%
+Functions not decompiled, but with known names (count): 38.30%
+Functions not decompiled, but with known names (bytesize): 39.10%
Functions not decompiled, with unknown names (count): 14.09%
Functions not decompiled, with unknown names (bytesize): 15.83%
diff --git a/docs/progress.txt b/docs/progress.txt
index 2c57edab1..f3ea67936 100644
--- a/docs/progress.txt
+++ b/docs/progress.txt
@@ -600,7 +600,7 @@ InitialiseLaraInventory 0x00428170 0x000001C8 +
LaraInitialiseMeshes 0x00428340 0x000000DD +
InitialiseEvilLara 0x00428420 0x00000025 +
ControlEvilLara 0x00428450 0x00000221 +
-DrawEvilLara 0x00428680 0x00000058 *
+DrawEvilLara 0x00428680 0x00000058 +
# larasurf.cpp
LaraSurface 0x004286E0 0x000001B2 +
diff --git a/src/game/lara.h b/src/game/lara.h
index 5f1f46343..920480dd4 100644
--- a/src/game/lara.h
+++ b/src/game/lara.h
@@ -4,10 +4,6 @@
#include "game/types.h"
#include
-// clang-format off
-#define DrawEvilLara ((void (*)(ITEM_INFO *lara_item))0x00428680)
-// clang-format on
-
void LaraControl(int16_t item_num);
void LaraSwapMeshExtra();
void AnimateLara(ITEM_INFO* item);
@@ -191,6 +187,7 @@ void AnimatePistols(int32_t weapon_type);
void InitialiseEvilLara(int16_t item_num);
void ControlEvilLara(int16_t item_num);
+void DrawEvilLara(ITEM_INFO* item);
#ifdef T1M_FEAT_GAMEPLAY
void LookLeftRight();
diff --git a/src/game/laramisc.c b/src/game/laramisc.c
index d83729620..b937ff4dc 100644
--- a/src/game/laramisc.c
+++ b/src/game/laramisc.c
@@ -1,6 +1,7 @@
#include "3dsystem/phd_math.h"
#include "game/collide.h"
#include "game/control.h"
+#include "game/draw.h"
#include "game/effects.h"
#include "game/inv.h"
#include "game/items.h"
@@ -209,7 +210,7 @@ void LaraSwapMeshExtra()
if (!Objects[O_LARA_EXTRA].loaded) {
return;
}
- for (int i = 0; i < 15; i++) {
+ for (int i = 0; i < LM_NUMBER_OF; i++) {
Lara.mesh_ptrs[i] = Meshes[Objects[O_LARA_EXTRA].mesh_index + i];
}
}
@@ -525,7 +526,7 @@ void LaraInitialiseMeshes(int32_t level_num)
START_INFO* start = &SaveGame[0].start[level_num];
if (start->costume) {
- for (int i = 0; i < 15; i++) {
+ for (int i = 0; i < LM_NUMBER_OF; i++) {
int32_t use_orig_mesh = i == LM_HEAD;
Lara.mesh_ptrs[i] = Meshes
[Objects[use_orig_mesh ? O_LARA : O_LARA_EXTRA].mesh_index + i];
@@ -533,7 +534,7 @@ void LaraInitialiseMeshes(int32_t level_num)
return;
}
- for (int i = 0; i < 15; i++) {
+ for (int i = 0; i < LM_NUMBER_OF; i++) {
Lara.mesh_ptrs[i] = Meshes[Objects[O_LARA].mesh_index + i];
}
@@ -736,6 +737,22 @@ void ControlEvilLara(int16_t item_num)
}
}
+void DrawEvilLara(ITEM_INFO* item)
+{
+ int16_t* old_mesh_ptrs[LM_NUMBER_OF];
+
+ for (int i = 0; i < LM_NUMBER_OF; i++) {
+ old_mesh_ptrs[i] = Lara.mesh_ptrs[i];
+ Lara.mesh_ptrs[i] = Meshes[Objects[O_EVIL_LARA].mesh_index + i];
+ }
+
+ DrawLara(item);
+
+ for (int i = 0; i < LM_NUMBER_OF; i++) {
+ Lara.mesh_ptrs[i] = old_mesh_ptrs[i];
+ }
+}
+
void (*LaraControlRoutines[])(ITEM_INFO* item, COLL_INFO* coll) = {
LaraAsWalk, LaraAsRun, LaraAsStop, LaraAsForwardJump,
LaraAsPose, LaraAsFastBack, LaraAsTurnR, LaraAsTurnL,
@@ -783,4 +800,5 @@ void T1MInjectGameLaraMisc()
INJECT(0x00428340, LaraInitialiseMeshes);
INJECT(0x00428420, InitialiseEvilLara);
INJECT(0x00428450, ControlEvilLara);
+ INJECT(0x00428680, DrawEvilLara);
}
diff --git a/src/game/types.h b/src/game/types.h
index b142a6712..40748c61a 100644
--- a/src/game/types.h
+++ b/src/game/types.h
@@ -423,6 +423,7 @@ typedef enum {
LM_LARM_L = 12,
LM_HAND_L = 13,
LM_HEAD = 14,
+ LM_NUMBER_OF = 15,
} LARA_MESHES;
typedef enum {
@@ -959,7 +960,7 @@ typedef struct {
/* 001A */ int16_t spaz_effect_count;
/* 001C */ FX_INFO* spaz_effect;
/* 0020 */ int32_t mesh_effects;
- /* 0024 */ int16_t* mesh_ptrs[15];
+ /* 0024 */ int16_t* mesh_ptrs[LM_NUMBER_OF];
/* 0060 */ ITEM_INFO* target;
/* 0064 */ PHD_ANGLE target_angles[2];
/* 0068 */ int16_t turn_rate;