Skip to content

Commit

Permalink
interpolation: correct camera room number
Browse files Browse the repository at this point in the history
This fixes some black screen moments by simplifying the room number on
the camera. This is always standardized when Room_GetFloor is called
against the actual camera position, so we needn't track it.

Resolves LostArtefacts#1240.
Resolves LostArtefacts#1241.
Resolves LostArtefacts#1243.
  • Loading branch information
lahm86 committed Apr 2, 2024
1 parent fb52d1a commit 869e7eb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/game/game/game_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void Game_DrawScene(bool draw_overlay)
Camera_Apply();

if (g_Objects[O_LARA].loaded) {
Room_DrawAllRooms(g_Camera.interp.result.room_num);
Room_DrawAllRooms(g_Camera.interp.room_num);
if (draw_overlay) {
Overlay_DrawGameInfo();
} else {
Expand Down
5 changes: 2 additions & 3 deletions src/game/interpolation.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ void Interpolation_Commit(void)
INTERPOLATE(&g_Camera, target.y, ratio, 512);
INTERPOLATE(&g_Camera, target.z, ratio, 512);

g_Camera.interp.result.room_num = g_Camera.interp.prev.room_num;
g_Camera.interp.room_num = g_Camera.pos.room_number;
Room_GetFloor(
g_Camera.interp.result.pos.x,
g_Camera.interp.result.pos.y + g_Camera.interp.result.shift,
g_Camera.interp.result.pos.z, &g_Camera.interp.result.room_num);
g_Camera.interp.result.pos.z, &g_Camera.interp.room_num);
}

INTERPOLATE_ROT(&g_Lara.left_arm, rot.x, ratio, PHD_45);
Expand Down Expand Up @@ -146,7 +146,6 @@ void Interpolation_Remember(void)
REMEMBER(&g_Camera, target.x);
REMEMBER(&g_Camera, target.y);
REMEMBER(&g_Camera, target.z);
g_Camera.interp.prev.room_num = g_Camera.pos.room_number;
}

REMEMBER(&g_Lara.left_arm, rot.x);
Expand Down
2 changes: 1 addition & 1 deletion src/global/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1856,8 +1856,8 @@ typedef struct CAMERA_INFO {
XYZ_32 target;
XYZ_32 pos;
int32_t shift;
int16_t room_num;
} result, prev;
int16_t room_num;
} interp;
} CAMERA_INFO;

Expand Down

0 comments on commit 869e7eb

Please sign in to comment.