port DrawEvilLara

This commit is contained in:
rr- 2021-03-02 12:15:56 +01:00
parent 7b82150368
commit cf1c262ee7
5 changed files with 31 additions and 15 deletions

View file

@ -429,7 +429,7 @@
<rect width="12.00" height="12.00" x="364.00" y="129.00" fill="forestgreen"><title>LaraInitialiseMeshes</title></rect>
<rect width="12.00" height="12.00" x="378.00" y="129.00" fill="forestgreen"><title>InitialiseEvilLara</title></rect>
<rect width="12.00" height="12.00" x="392.00" y="129.00" fill="forestgreen"><title>ControlEvilLara</title></rect>
<rect width="12.00" height="12.00" x="406.00" y="129.00" fill="lightpink"><title>DrawEvilLara</title></rect>
<rect width="12.00" height="12.00" x="406.00" y="129.00" fill="forestgreen"><title>DrawEvilLara</title></rect>
<rect width="12.00" height="12.00" x="420.00" y="129.00" fill="forestgreen"><title>LaraSurface</title></rect>
<rect width="12.00" height="12.00" x="434.00" y="129.00" fill="forestgreen"><title>LaraAsSurfSwim</title></rect>
<rect width="12.00" height="12.00" x="448.00" y="129.00" fill="forestgreen"><title>LaraAsSurfBack</title></rect>
@ -1216,7 +1216,7 @@
<rect width="5.90" height="6.43" x="658.77" y="441.36" fill="mistyrose"><title>sub_408B2C</title></rect>
<rect width="5.90" height="6.43" x="666.67" y="441.36" fill="forestgreen"><title>ObjectCollision</title></rect>
<rect width="5.90" height="6.43" x="674.57" y="441.36" fill="forestgreen"><title>DoBloodSplat</title></rect>
<rect width="5.81" height="6.43" x="682.47" y="441.36" fill="lightpink"><title>DrawEvilLara</title></rect>
<rect width="5.81" height="6.43" x="682.47" y="441.36" fill="forestgreen"><title>DrawEvilLara</title></rect>
<rect width="5.72" height="6.43" x="690.28" y="441.36" fill="mistyrose"><title>sub_408A70</title></rect>
<rect width="5.92" height="6.22" x="609.51" y="449.79" fill="forestgreen"><title>Inv_RingMotionItemSelect</title></rect>
<rect width="5.92" height="6.22" x="609.51" y="458.01" fill="forestgreen"><title>LaraAsFastBack</title></rect>
@ -1463,10 +1463,10 @@
<rect width="-0.06" height="-0.07" x="694.51" y="536.07" fill="mistyrose"><title>sub_440EF0</title></rect>
<rect width="-0.45" height="-0.55" x="696.45" y="536.07" fill="mistyrose"><title>sub_437BC0</title></rect>
<rect width="-0.45" height="-1.52" x="696.45" y="537.52" fill="lightpink"><title>S_CDVolume</title></rect>
<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): 47.47%</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): 45.03%</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): 38.44%</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): 39.14%</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): 47.61%</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): 45.07%</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): 38.30%</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): 39.10%</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): 14.09%</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.83%</text>
</svg>

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Before After
Before After

View file

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

View file

@ -4,10 +4,6 @@
#include "game/types.h"
#include <stdint.h>
// 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();

View file

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

View file

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