Change back Camera.GetPosition argument list to avoid breaking plugins

This commit is contained in:
UnknownShadow200 2024-05-07 18:39:26 +10:00
parent d3f9c5ab84
commit 4f0b125f9b
4 changed files with 10 additions and 6 deletions

View file

@ -154,8 +154,10 @@ static Vec2 FirstPersonCamera_GetOrientation(struct LocalPlayer* p) {
return v;
}
static Vec3 FirstPersonCamera_GetPosition(struct LocalPlayer* p, float t) {
static Vec3 FirstPersonCamera_GetPosition(float t) {
struct LocalPlayer* p = Entities.CurPlayer;
struct Entity* e = &p->Base;
Vec3 camPos = Entity_GetEyePosition(e);
float yaw = e->Yaw * MATH_DEG2RAD;
PerspectiveCamera_CalcViewBobbing(p, t, 1);
@ -202,8 +204,10 @@ static float ThirdPersonCamera_GetZoom(struct LocalPlayer* p) {
return dist;
}
static Vec3 ThirdPersonCamera_GetPosition(struct LocalPlayer* p, float t) {
static Vec3 ThirdPersonCamera_GetPosition(float t) {
struct LocalPlayer* p = Entities.CurPlayer;
struct Entity* e = &p->Base;
float dist = ThirdPersonCamera_GetZoom(p);
Vec3 target, dir;
Vec2 rot;

View file

@ -51,7 +51,7 @@ struct Camera {
/* Returns the current orientation of the camera. */
Vec2 (*GetOrientation)(struct LocalPlayer* p);
/* Returns the current interpolated position of the camera. */
Vec3 (*GetPosition)(struct LocalPlayer* p, float t);
Vec3 (*GetPosition)(float t);
/* Called to update the camera's state. */
/* Typically, this is used to adjust yaw/pitch based on accumulated mouse movement. */

View file

@ -968,7 +968,7 @@ void LocalPlayers_MoveToSpawn(struct LocationUpdate* update) {
}
/* TODO: This needs to be before new map... */
Camera.CurrentPos = Camera.Active->GetPosition(Entities.CurPlayer, 0.0f);
Camera.CurrentPos = Camera.Active->GetPosition(0.0f);
}
void LocalPlayer_CalcDefaultSpawn(struct LocalPlayer* p, struct LocationUpdate* update) {

View file

@ -640,7 +640,7 @@ static void DrawSplitscreen(float delta, float t, int i, int x, int y, int w, in
Entities.CurPlayer = &LocalPlayer_Instances[i];
LocalPlayer_SetInterpPosition(Entities.CurPlayer, t);
Camera.CurrentPos = Camera.Active->GetPosition(Entities.CurPlayer, t);
Camera.CurrentPos = Camera.Active->GetPosition(t);
Game_DrawFrame(delta, t);
}
@ -684,7 +684,7 @@ static CC_INLINE void Game_RenderFrame(double delta) {
t = (float)(entTask.accumulator / entTask.interval);
LocalPlayer_SetInterpPosition(Entities.CurPlayer, t);
Camera.CurrentPos = Camera.Active->GetPosition(Entities.CurPlayer, t);
Camera.CurrentPos = Camera.Active->GetPosition(t);
/* NOTE: EnvRenderer_UpdateFog also also sets clear color */
EnvRenderer_UpdateFog();
AudioBackend_Tick();