camera: fix Lara's vision range

Resolves #2276.
This commit is contained in:
Marcin Kurczewski 2025-01-14 00:09:51 +01:00
parent dbc0cb232c
commit 13b8297621
7 changed files with 27 additions and 10 deletions

View file

@ -8,13 +8,14 @@
- changed the pause screen to wait before yielding control during fade out effect
- changed the compass and final stats to use two columns, similar to TR2 (doesn't apply to end-of-level "bare" stats)
- changed the fix for transparent eyes on wolves to use black instead of off-white (#2252)
- fixed blood spawning on Lara from gunshots using incorrect positioning data (#2253)
- fixed the upside-down camera fix to no longer limit Lara's vision (#2276, regression from 4.2)
- fixed being unable to load some old custom levels that contain certain (invalid) floor data (#2114, regression from 4.3)
- fixed a desync in the Lost Valley demo if responsive swim cancellation was enabled (#2113, regression from 4.6)
- fixed the game hanging when Lara is on fire and enters the fly cheat on the same frame as reaching water (#2116, regression from 0.8)
- fixed Lara activating triggers one frame too early (#2208, regression from 4.3)
- fixed wrong underwater caustics speed with the turbo cheat (#2231)
- fixed 1-frame UI flicker on pause screen exit confirmation
- fixed blood spawning on Lara from gunshots using incorrect positioning data (#2253)
- fixed being able to use keys and puzzle items in keyholes/slots that have already been used (#2256, regression from 4.0)
- fixed textures animating during demo fade-outs (#2217, regression from 4.0)
- fixed waterfall mist not animating during demo (#2218, regression from 3.0)

View file

@ -22,6 +22,7 @@
- fixed item counter shown even for a single medipack (#2222, regression from 0.3)
- fixed item counter always hidden in NG+, even for keys (#2223, regression from 0.3)
- fixed the passport object not being selected when exiting to title (#2192, regression from 0.8)
- fixed the upside-down camera fix to no longer limit Lara's vision (#2276, regression from 0.8)
## [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)

View file

@ -20,7 +20,6 @@ typedef struct {
int16_t actual_angle;
#endif
int16_t target_elevation;
int16_t box;
int16_t num;
int16_t last;
int16_t timer;
@ -30,6 +29,8 @@ typedef struct {
ITEM *last_item;
OBJECT_VECTOR *fixed;
int32_t debuff;
#if TR_VERSION == 1
// used for the manual camera control
int16_t additional_angle;
@ -44,8 +45,6 @@ typedef struct {
int16_t room_num;
} interp;
#else
// TODO: remove this - now stored in g_Config
int32_t is_lara_mic;
XYZ_32 mic_pos;
#endif
} CAMERA_INFO;

View file

@ -172,6 +172,7 @@ static void M_Look(const ITEM *const item)
g_Camera.target.x = old.x + (g_Camera.target.x - old.x) / g_Camera.speed;
M_Move(&ideal, g_Camera.speed);
g_Camera.debuff = 5;
}
static void M_Fixed(void)
@ -737,8 +738,15 @@ void Camera_Update(void)
M_Combat(item);
}
} else {
g_Camera.target.x = item->pos.x;
g_Camera.target.z = item->pos.z;
if (g_Camera.debuff > 0) {
const XYZ_32 old = g_Camera.target.pos;
g_Camera.target.x = (item->pos.x + old.x) / 2;
g_Camera.target.z = (item->pos.z + old.z) / 2;
g_Camera.debuff--;
} else {
g_Camera.target.x = item->pos.x;
g_Camera.target.z = item->pos.z;
}
if (g_Camera.flags == FOLLOW_CENTRE) {
const int16_t shift = (bounds->min.z + bounds->max.z) / 2;

View file

@ -70,7 +70,7 @@
#define DEATH_WAIT_MIN (2 * LOGIC_FPS)
#define MAX_HEAD_ROTATION (50 * DEG_1) // = 9100
#define MAX_HEAD_TILT_LOOK (22 * DEG_1) // = 4004
#define MIN_HEAD_TILT_LOOK (-35 * DEG_1) // = -6370
#define MIN_HEAD_TILT_LOOK (-42 * DEG_1) // = -7644
#define MAX_HEAD_TILT_CAM (85 * DEG_1) // = 15470
#define MIN_HEAD_TILT_CAM (-85 * DEG_1) // = 15470
#define HEAD_TURN (4 * DEG_1) // = 728

View file

@ -682,6 +682,7 @@ void Camera_Look(const ITEM *item)
g_Camera.target.z = old.z + (g_Camera.target.z - old.z) / g_Camera.speed;
g_Camera.target.x = old.x + (g_Camera.target.x - old.x) / g_Camera.speed;
Camera_Move(&target, g_Camera.speed);
g_Camera.debuff = 5;
}
void Camera_Fixed(void)
@ -796,8 +797,15 @@ void Camera_Update(void)
Camera_Combat(item);
}
} else {
g_Camera.target.x = item->pos.x;
g_Camera.target.z = item->pos.z;
if (g_Camera.debuff > 0) {
const XYZ_32 old = g_Camera.target.pos;
g_Camera.target.x = (item->pos.x + old.x) / 2;
g_Camera.target.z = (item->pos.z + old.z) / 2;
g_Camera.debuff--;
} else {
g_Camera.target.x = item->pos.x;
g_Camera.target.z = item->pos.z;
}
if (g_Camera.flags == CF_FOLLOW_CENTRE) {
const int32_t shift = (bounds->min.z + bounds->max.z) / 2;

View file

@ -58,7 +58,7 @@
#define HEAD_TURN (2 * DEG_1) // = 364
#define MAX_HEAD_TILT (22 * DEG_1) // = 4004
#define MIN_HEAD_TILT (-35 * DEG_1) // = -6370
#define MIN_HEAD_TILT (-42 * DEG_1) // = -7644
#define MAX_HEAD_ROTATION (44 * DEG_1) // = 8008
#define MIN_HEAD_ROTATION (-MAX_HEAD_ROTATION) // = -8008
#define HEAD_TURN_CAM (4 * DEG_1) // = 728