Skip to content

Commit

Permalink
tr2/spawn: fix Lara blood spawn position
Browse files Browse the repository at this point in the history
This fixes assigning a blood splat to a bone beyond Lara's data and
introduces proper random positioning for it.
  • Loading branch information
lahm86 committed Jan 11, 2025
1 parent 00aae31 commit 8494b2c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- fixed showing inventory ring up/down arrows when uncalled for (#2225)
- fixed Lara activating triggers one frame too early (#2205, regression from 0.7)
- fixed Lara never stepping backwards off a step using her right foot (#1602)
- fixed blood spawning on Lara from gunshots using incorrect positioning data (#2253)

## [0.8](https://github.com/LostArtefacts/TRX/compare/tr2-0.8...tr2-0.8) - 2025-01-01
- completed decompilation efforts – TR2X.dll is gone, Tomb2.exe no longer needed (#1694)
Expand Down
1 change: 1 addition & 0 deletions docs/tr2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ game with new enhancements and features.
- fixed rendering problems on certain Intel GPUs
- fixed bubbles spawning from flares if Lara is in shallow water
- fixed the inventory up arrow at times overlapping the health bar
- fixed blood spawning on Lara from gunshots using incorrect positioning data
- improved FMV mode behavior - stopped switching screen resolutions
- improved vertex movement when looking through water portals
- improved support for non-4:3 aspect ratios
Expand Down
3 changes: 2 additions & 1 deletion src/tr2/game/collide.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ void Collide_GetJointAbsPosition(
Matrix_RotYXZsuperpack(&mesh_rots, 0);

const int16_t *extra_rotation = item->data;
for (int32_t i = 0; i < joint; i++) {
const int32_t abs_joint = MIN(object->mesh_count, joint);
for (int32_t i = 0; i < abs_joint; i++) {
const ANIM_BONE *const bone = Object_GetBone(object, i);
if (bone->matrix_pop) {
Matrix_Pop();
Expand Down
8 changes: 6 additions & 2 deletions src/tr2/game/spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,13 @@ int16_t Spawn_GunHit(
const int32_t x, const int32_t y, const int32_t z, const int16_t speed,
const int16_t y_rot, const int16_t room_num)
{
XYZ_32 vec = {};
XYZ_32 vec = {
.x = -((Random_GetDraw() - 0x4000) << 7) / 0x7FFF,
.y = -((Random_GetDraw() - 0x4000) << 7) / 0x7FFF,
.z = -((Random_GetDraw() - 0x4000) << 7) / 0x7FFF,
};
Collide_GetJointAbsPosition(
g_LaraItem, &vec, Random_GetControl() * 25 / 0x7FFF);
g_LaraItem, &vec, Random_GetControl() * LM_NUMBER_OF / 0x7FFF);
Spawn_Blood(
vec.x, vec.y, vec.z, g_LaraItem->speed, g_LaraItem->rot.y,
g_LaraItem->room_num);
Expand Down

0 comments on commit 8494b2c

Please sign in to comment.