Skip to content

Commit

Permalink
Merge pull request #614 from TheSerioliOfNosgoth/RelocateSavedCameras
Browse files Browse the repository at this point in the history
[STREAM]: Update RelocateSavedCameras
  • Loading branch information
AesirHod authored Jan 31, 2024
2 parents ca72838 + 3a89939 commit 1695a92
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 71 deletions.
17 changes: 17 additions & 0 deletions KAIN2/Game/MATH3D.H
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ enum MATH3D_AXIS // Hashcode: 0x37FE6D4A (dec: 939421002)
AXIS_NEG_Z = 5,
};

#define MATH3D_AddPosToPos(pos0, pos1) \
{ \
short _x0, _y0, _z0; \
short _x1, _y1, _z1; \
struct _Position* _v; \
_v = pos0; \
_x0 = _v->x; \
_y0 = _v->y; \
_z0 = _v->z; \
_x1 = (short)pos1->x; \
_y1 = (short)pos1->y; \
_z1 = (short)pos1->z; \
_v->x = _x0 + _x1; \
_v->y = _y0 + _y1; \
_v->z = _z0 + _z1; \
}

#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
Expand Down
81 changes: 10 additions & 71 deletions KAIN2/Game/STREAM.C
Original file line number Diff line number Diff line change
Expand Up @@ -2045,80 +2045,19 @@ void RelocateCameras(struct _CameraKey* cameraList, long numCameras, struct _SVe
}
}

void RelocateSavedCameras(struct Camera* camera, struct Level* level, struct _SVector* offset)
void RelocateSavedCameras(struct Camera* camera, struct Level* level, struct _SVector* offset) // Matching - 100%
{
int i;
short _x0;
short _y0;
short _z0;
short _x1;
short _y1;
short _z1;
struct _Position* _v;

if (camera->stack >= 0)
{
for (i = 0; camera->stack >= i; i++)
{
if (camera->savedMode[i] == 5 && camera->savedCinematic[i].level == level)
{
_v = &camera->savedCinematic[i].position;

_x1 = offset->x;
_y1 = offset->y;
_z1 = offset->z;

_x0 = _v->x;
_y0 = _v->y;
_z0 = _v->z;

_v->x = _x0 + _x1;
_v->y = _y0 + _y1;
_v->z = _z0 + _z1;

_v = &camera->savedCinematic[i].focusPoint;

_x0 = _v->x;
_y0 = _v->y;
_z0 = _v->z;

_x1 = offset->x;
_y1 = offset->y;
_z1 = offset->z;

_v->x = _x0 + _x1;
_v->y = _y0 + _y1;
_v->z = _z0 + _z1;

_v = &camera->savedCinematic[i].targetPos;

_x0 = _v->x;
_y0 = _v->y;
_z0 = _v->z;

_x1 = offset->x;
_y1 = offset->y;
_z1 = offset->z;

_v->x = _x0 + _x1;
_v->y = _y0 + _y1;
_v->z = _z0 + _z1;

_v = &camera->savedCinematic[i].targetFocusPoint;

_x0 = _v->x;
_y0 = _v->y;
_z0 = _v->z;

_x1 = offset->x;
_y1 = offset->y;
_z1 = offset->z;

_v->x = _x0 + _x1;
_v->y = _y0 + _y1;
_v->z = _z0 + _z1;
}
}
for (i = 0; camera->stack >= i; i++)
{
if (camera->savedMode[i] == 5 && camera->savedCinematic[i].level == level)
{
MATH3D_AddPosToPos(&camera->savedCinematic[i].position, offset);
MATH3D_AddPosToPos(&camera->savedCinematic[i].focusPoint, offset);
MATH3D_AddPosToPos(&camera->savedCinematic[i].targetPos, offset);
MATH3D_AddPosToPos(&camera->savedCinematic[i].targetFocusPoint, offset);
}
}
}

Expand Down

0 comments on commit 1695a92

Please sign in to comment.