mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Revert camera changes to fix crashing plugins
This commit is contained in:
parent
d639c66cf5
commit
018d8f8769
18
src/Camera.c
18
src/Camera.c
@ -42,15 +42,17 @@ static void PerspectiveCamera_GetProjection(struct Matrix* proj) {
|
|||||||
Gfx_CalcPerspectiveMatrix(proj, fovy, aspectRatio, (float)Game_ViewDistance);
|
Gfx_CalcPerspectiveMatrix(proj, fovy, aspectRatio, (float)Game_ViewDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PerspectiveCamera_GetView(struct LocalPlayer* p, struct Matrix* mat) {
|
static void PerspectiveCamera_GetView(struct Matrix* mat) {
|
||||||
Vec3 pos = Camera.CurrentPos;
|
Vec3 pos = Camera.CurrentPos;
|
||||||
Vec2 rot = Camera.Active->GetOrientation(p);
|
Vec2 rot = Camera.Active->GetOrientation();
|
||||||
Matrix_LookRot(mat, pos, rot);
|
Matrix_LookRot(mat, pos, rot);
|
||||||
Matrix_MulBy(mat, &Camera.TiltM);
|
Matrix_MulBy(mat, &Camera.TiltM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PerspectiveCamera_GetPickedBlock(struct LocalPlayer* p, struct RayTracer* t) {
|
static void PerspectiveCamera_GetPickedBlock(struct RayTracer* t) {
|
||||||
|
struct LocalPlayer* p = Entities.CurPlayer;
|
||||||
struct Entity* e = &p->Base;
|
struct Entity* e = &p->Base;
|
||||||
|
|
||||||
Vec3 dir = Vec3_GetDirVector(e->Yaw * MATH_DEG2RAD, e->Pitch * MATH_DEG2RAD + Camera.TiltPitch);
|
Vec3 dir = Vec3_GetDirVector(e->Yaw * MATH_DEG2RAD, e->Pitch * MATH_DEG2RAD + Camera.TiltPitch);
|
||||||
Vec3 eyePos = Entity_GetEyePosition(e);
|
Vec3 eyePos = Entity_GetEyePosition(e);
|
||||||
Picking_CalcPickedBlock(&eyePos, &dir, p->ReachDistance, t);
|
Picking_CalcPickedBlock(&eyePos, &dir, p->ReachDistance, t);
|
||||||
@ -146,8 +148,10 @@ static void PerspectiveCamera_CalcViewBobbing(struct LocalPlayer* p, float t, fl
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*---------------------------------------------------First person camera---------------------------------------------------*
|
*---------------------------------------------------First person camera---------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static Vec2 FirstPersonCamera_GetOrientation(struct LocalPlayer* p) {
|
static Vec2 FirstPersonCamera_GetOrientation(void) {
|
||||||
|
struct LocalPlayer* p = Entities.CurPlayer;
|
||||||
struct Entity* e = &p->Base;
|
struct Entity* e = &p->Base;
|
||||||
|
|
||||||
Vec2 v;
|
Vec2 v;
|
||||||
v.x = e->Yaw * MATH_DEG2RAD;
|
v.x = e->Yaw * MATH_DEG2RAD;
|
||||||
v.y = e->Pitch * MATH_DEG2RAD;
|
v.y = e->Pitch * MATH_DEG2RAD;
|
||||||
@ -185,8 +189,10 @@ static struct Camera cam_FirstPerson = {
|
|||||||
#define DEF_ZOOM 3.0f
|
#define DEF_ZOOM 3.0f
|
||||||
static float dist_third = DEF_ZOOM, dist_forward = DEF_ZOOM;
|
static float dist_third = DEF_ZOOM, dist_forward = DEF_ZOOM;
|
||||||
|
|
||||||
static Vec2 ThirdPersonCamera_GetOrientation(struct LocalPlayer* p) {
|
static Vec2 ThirdPersonCamera_GetOrientation(void) {
|
||||||
|
struct LocalPlayer* p = Entities.CurPlayer;
|
||||||
struct Entity* e = &p->Base;
|
struct Entity* e = &p->Base;
|
||||||
|
|
||||||
Vec2 v;
|
Vec2 v;
|
||||||
v.x = e->Yaw * MATH_DEG2RAD;
|
v.x = e->Yaw * MATH_DEG2RAD;
|
||||||
v.y = e->Pitch * MATH_DEG2RAD;
|
v.y = e->Pitch * MATH_DEG2RAD;
|
||||||
@ -216,7 +222,7 @@ static Vec3 ThirdPersonCamera_GetPosition(float t) {
|
|||||||
target = Entity_GetEyePosition(e);
|
target = Entity_GetEyePosition(e);
|
||||||
target.y += Camera.BobbingVer;
|
target.y += Camera.BobbingVer;
|
||||||
|
|
||||||
rot = Camera.Active->GetOrientation(p);
|
rot = Camera.Active->GetOrientation();
|
||||||
dir = Vec3_GetDirVector(rot.x, rot.y);
|
dir = Vec3_GetDirVector(rot.x, rot.y);
|
||||||
Vec3_Negate(&dir, &dir);
|
Vec3_Negate(&dir, &dir);
|
||||||
|
|
||||||
|
@ -46,10 +46,10 @@ struct Camera {
|
|||||||
/* Calculates the current projection matrix of this camera. */
|
/* Calculates the current projection matrix of this camera. */
|
||||||
void (*GetProjection)(struct Matrix* proj);
|
void (*GetProjection)(struct Matrix* proj);
|
||||||
/* Calculates the current modelview matrix of this camera. */
|
/* Calculates the current modelview matrix of this camera. */
|
||||||
void (*GetView)(struct LocalPlayer* p, struct Matrix* view);
|
void (*GetView)(struct Matrix* view);
|
||||||
|
|
||||||
/* Returns the current orientation of the camera. */
|
/* Returns the current orientation of the camera. */
|
||||||
Vec2 (*GetOrientation)(struct LocalPlayer* p);
|
Vec2 (*GetOrientation)(void);
|
||||||
/* Returns the current interpolated position of the camera. */
|
/* Returns the current interpolated position of the camera. */
|
||||||
Vec3 (*GetPosition)(float t);
|
Vec3 (*GetPosition)(float t);
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ struct Camera {
|
|||||||
void (*LoseFocus)(void);
|
void (*LoseFocus)(void);
|
||||||
|
|
||||||
/* Calculates selected block in the world, based on camera's current state */
|
/* Calculates selected block in the world, based on camera's current state */
|
||||||
void (*GetPickedBlock)(struct LocalPlayer* p, struct RayTracer* t);
|
void (*GetPickedBlock)(struct RayTracer* t);
|
||||||
/* Zooms the camera in or out when scrolling mouse wheel. */
|
/* Zooms the camera in or out when scrolling mouse wheel. */
|
||||||
cc_bool (*Zoom)(float amount);
|
cc_bool (*Zoom)(float amount);
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ void EnvRenderer_RenderSkybox(void) {
|
|||||||
/* Rotate around camera */
|
/* Rotate around camera */
|
||||||
pos = Camera.CurrentPos;
|
pos = Camera.CurrentPos;
|
||||||
Vec3_Set(Camera.CurrentPos, 0,0,0);
|
Vec3_Set(Camera.CurrentPos, 0,0,0);
|
||||||
Camera.Active->GetView(Entities.CurPlayer, &view);
|
Camera.Active->GetView(&view);
|
||||||
Matrix_MulBy(&m, &view);
|
Matrix_MulBy(&m, &view);
|
||||||
Camera.CurrentPos = pos;
|
Camera.CurrentPos = pos;
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ void Game_SetFpsLimit(int method) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateViewMatrix(void) {
|
static void UpdateViewMatrix(void) {
|
||||||
Camera.Active->GetView(Entities.CurPlayer, &Gfx.View);
|
Camera.Active->GetView(&Gfx.View);
|
||||||
FrustumCulling_CalcFrustumEquations(&Gfx.Projection, &Gfx.View);
|
FrustumCulling_CalcFrustumEquations(&Gfx.Projection, &Gfx.View);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ static CC_INLINE void Game_DrawFrame(float delta, float t) {
|
|||||||
UpdateViewMatrix();
|
UpdateViewMatrix();
|
||||||
|
|
||||||
if (!Gui_GetBlocksWorld()) {
|
if (!Gui_GetBlocksWorld()) {
|
||||||
Camera.Active->GetPickedBlock(Entities.CurPlayer, &Game_SelectedPos); /* TODO: only pick when necessary */
|
Camera.Active->GetPickedBlock(&Game_SelectedPos); /* TODO: only pick when necessary */
|
||||||
Camera_KeyLookUpdate(delta);
|
Camera_KeyLookUpdate(delta);
|
||||||
InputHandler_Tick();
|
InputHandler_Tick();
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ void Queue_Clear(struct Queue* queue) {
|
|||||||
}
|
}
|
||||||
static void Queue_Resize(struct Queue* queue) {
|
static void Queue_Resize(struct Queue* queue) {
|
||||||
cc_uint8* entries;
|
cc_uint8* entries;
|
||||||
int i, idx, capacity, headToEndSize, byteOffsetToHead;
|
int idx, capacity, headToEndSize, byteOffsetToHead;
|
||||||
|
|
||||||
if (queue->capacity >= (Int32_MaxValue / 4)) {
|
if (queue->capacity >= (Int32_MaxValue / 4)) {
|
||||||
Chat_AddRaw("&cToo many generic queue entries, clearing");
|
Chat_AddRaw("&cToo many generic queue entries, clearing");
|
||||||
Queue_Clear(queue);
|
Queue_Clear(queue);
|
||||||
|
@ -289,8 +289,6 @@ size_t cc_strlen(const char* a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* cc_strstr(const char* str, const char* substr) {
|
char* cc_strstr(const char* str, const char* substr) {
|
||||||
const char* a;
|
|
||||||
const char* b;
|
|
||||||
if (!substr[0]) return (char*)str;
|
if (!substr[0]) return (char*)str;
|
||||||
|
|
||||||
for (; *str; str++)
|
for (; *str; str++)
|
||||||
|
2
third_party/gldc/src/sh4.c
vendored
2
third_party/gldc/src/sh4.c
vendored
@ -449,7 +449,7 @@ void SceneListSubmit(Vertex* v3, int n) {
|
|||||||
*PVR_LMMODE1 = 0;
|
*PVR_LMMODE1 = 0;
|
||||||
|
|
||||||
//Set QACR registers
|
//Set QACR registers
|
||||||
QACR[1] = QACR[0] = 0x10;
|
QACR[1] = QACR[0] = 0x11;
|
||||||
|
|
||||||
#if CLIP_DEBUG
|
#if CLIP_DEBUG
|
||||||
Vertex* vertex = (Vertex*) src;
|
Vertex* vertex = (Vertex*) src;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user