inject: increase Scion collision radius (#1383)

Adds the ability to adjust the centre point and collision radius of
meshes, and applied this to the Scion object in the Great Pyramid to
allow it to be more easily shot with the shotgun.

Resolves #1381.
This commit is contained in:
lahm86 2024-06-13 16:22:49 +01:00 committed by GitHub
parent 3886f56bdc
commit 012fd9b180
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 31 additions and 2 deletions

View file

@ -9,6 +9,7 @@
- fixed looking forward too far causing an upside down camera frame (#1338) - fixed looking forward too far causing an upside down camera frame (#1338)
- fixed the enemy bear behavior in demo mode (#1370, regression since 2.16) - fixed the enemy bear behavior in demo mode (#1370, regression since 2.16)
- fixed the FPS counter overlapping the healthbar in demo mode (#1369) - fixed the FPS counter overlapping the healthbar in demo mode (#1369)
- fixed the Scion being extremely difficult to shoot with the shotgun (#1381)
## [4.1.2](https://github.com/LostArtefacts/TR1X/compare/4.1.1...4.1.2) - 2024-04-28 ## [4.1.2](https://github.com/LostArtefacts/TR1X/compare/4.1.1...4.1.2) - 2024-04-28
- fixed pictures display time (#1349, regression from 4.1) - fixed pictures display time (#1349, regression from 4.1)

View file

@ -1417,4 +1417,13 @@ provided with the game achieves.
jumping, if that option is enabled. jumping, if that option is enabled.
</td> </td>
</tr> </tr>
<tr valign="top">
<td>
<code>scion_collision.bin</code>
</td>
<td>
Increases the collision radius on the (targetable) Scion such that it can
be shot with the shotgun.
</td>
</tr>
</table> </table>

View file

@ -322,6 +322,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
- fixed Lara not saying "no" when using the Scion incorrectly - fixed Lara not saying "no" when using the Scion incorrectly
- fixed flickering in bats' death animations and rapid shooting if Lara continues to fire when they are killed - fixed flickering in bats' death animations and rapid shooting if Lara continues to fire when they are killed
- fixed looking forward too far causing an upside down camera frame - fixed looking forward too far causing an upside down camera frame
- fixed the Scion being extremely difficult to shoot with the shotgun
#### Cheats #### Cheats
- added a fly cheat - added a fly cheat

View file

@ -426,6 +426,7 @@
"injections": [ "injections": [
"data/injections/pyramid_fd.bin", "data/injections/pyramid_fd.bin",
"data/injections/pyramid_textures.bin", "data/injections/pyramid_textures.bin",
"data/injections/scion_collision.bin",
], ],
"sequence": [ "sequence": [
{"type": "loading_screen", "picture_path": "data/images/atlantis.webp", "display_time": 5}, {"type": "loading_screen", "picture_path": "data/images/atlantis.webp", "display_time": 5},

Binary file not shown.

View file

@ -18,7 +18,7 @@
#include <stddef.h> #include <stddef.h>
#define INJECTION_MAGIC MKTAG('T', '1', 'M', 'J') #define INJECTION_MAGIC MKTAG('T', '1', 'M', 'J')
#define INJECTION_CURRENT_VERSION 5 #define INJECTION_CURRENT_VERSION 6
typedef enum INJECTION_VERSION { typedef enum INJECTION_VERSION {
INJ_VERSION_1 = 1, INJ_VERSION_1 = 1,
@ -26,6 +26,7 @@ typedef enum INJECTION_VERSION {
INJ_VERSION_3 = 3, INJ_VERSION_3 = 3,
INJ_VERSION_4 = 4, INJ_VERSION_4 = 4,
INJ_VERSION_5 = 5, INJ_VERSION_5 = 5,
INJ_VERSION_6 = 6,
} INJECTION_VERSION; } INJECTION_VERSION;
typedef enum INJECTION_TYPE { typedef enum INJECTION_TYPE {
@ -75,6 +76,8 @@ typedef struct VERTEX_EDIT {
typedef struct MESH_EDIT { typedef struct MESH_EDIT {
GAME_OBJECT_ID object_id; GAME_OBJECT_ID object_id;
int16_t mesh_index; int16_t mesh_index;
XYZ_16 centre_shift;
int32_t radius_shift;
int32_t face_edit_count; int32_t face_edit_count;
int32_t vertex_edit_count; int32_t vertex_edit_count;
FACE_EDIT *face_edits; FACE_EDIT *face_edits;
@ -880,6 +883,13 @@ static void Inject_MeshEdits(INJECTION *injection, uint8_t *palette_map)
File_Read(&mesh_edit->object_id, sizeof(int32_t), 1, fp); File_Read(&mesh_edit->object_id, sizeof(int32_t), 1, fp);
File_Read(&mesh_edit->mesh_index, sizeof(int16_t), 1, fp); File_Read(&mesh_edit->mesh_index, sizeof(int16_t), 1, fp);
if (injection->version >= INJ_VERSION_6) {
File_Read(&mesh_edit->centre_shift.x, sizeof(int16_t), 1, fp);
File_Read(&mesh_edit->centre_shift.y, sizeof(int16_t), 1, fp);
File_Read(&mesh_edit->centre_shift.z, sizeof(int16_t), 1, fp);
File_Read(&mesh_edit->radius_shift, sizeof(int32_t), 1, fp);
}
File_Read(&mesh_edit->face_edit_count, sizeof(int32_t), 1, fp); File_Read(&mesh_edit->face_edit_count, sizeof(int32_t), 1, fp);
mesh_edit->face_edits = mesh_edit->face_edits =
Memory_Alloc(sizeof(FACE_EDIT) * mesh_edit->face_edit_count); Memory_Alloc(sizeof(FACE_EDIT) * mesh_edit->face_edit_count);
@ -932,7 +942,14 @@ static void Inject_ApplyMeshEdit(MESH_EDIT *mesh_edit, uint8_t *palette_map)
int16_t **mesh = &g_Meshes[object.mesh_index]; int16_t **mesh = &g_Meshes[object.mesh_index];
int16_t *data_ptr = *(mesh + mesh_edit->mesh_index); int16_t *data_ptr = *(mesh + mesh_edit->mesh_index);
data_ptr += 5; // Skip centre and collision radius
*data_ptr++ += mesh_edit->centre_shift.x;
*data_ptr++ += mesh_edit->centre_shift.y;
*data_ptr++ += mesh_edit->centre_shift.z;
int32_t *radius = (int32_t *)data_ptr;
*radius += mesh_edit->radius_shift;
data_ptr += 2;
int vertex_count = *data_ptr++; int vertex_count = *data_ptr++;
for (int i = 0; i < mesh_edit->vertex_edit_count; i++) { for (int i = 0; i < mesh_edit->vertex_edit_count; i++) {