From 8987e6b3e581d902dbb66f90d4d84404a8b3fad2 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 10 Jun 2020 20:43:09 +1000 Subject: [PATCH] Remove unused Matrix_Orthographic method --- src/Game.c | 18 +++++++++--------- src/Graphics.c | 4 ++-- src/LWidgets.c | 2 +- src/Vectors.c | 6 +----- src/Vectors.h | 3 +-- src/Window.c | 2 +- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/Game.c b/src/Game.c index ac7045b23..b555e200b 100644 --- a/src/Game.c +++ b/src/Game.c @@ -55,8 +55,8 @@ cc_bool Game_ViewBobbing, Game_HideGui; cc_bool Game_BreakableLiquids, Game_ScreenshotRequested; float Game_RawHotbarScale, Game_RawChatScale, Game_RawInventoryScale; -static struct ScheduledTask Game_Tasks[6]; -static int Game_TasksCount, entTaskI; +static struct ScheduledTask tasks[6]; +static int tasksCount, entTaskI; static char usernameBuffer[FILENAME_SIZE]; static char mppassBuffer[STRING_SIZE]; @@ -79,11 +79,11 @@ int ScheduledTask_Add(double interval, ScheduledTaskCallback callback) { task.Interval = interval; task.Callback = callback; - if (Game_TasksCount == Array_Elems(Game_Tasks)) { + if (tasksCount == Array_Elems(tasks)) { Logger_Abort("ScheduledTask_Add - hit max count"); } - Game_Tasks[Game_TasksCount++] = task; - return Game_TasksCount - 1; + tasks[tasksCount++] = task; + return tasksCount - 1; } @@ -522,15 +522,15 @@ static void PerformScheduledTasks(double time) { struct ScheduledTask task; int i; - for (i = 0; i < Game_TasksCount; i++) { - task = Game_Tasks[i]; + for (i = 0; i < tasksCount; i++) { + task = tasks[i]; task.Accumulator += time; while (task.Accumulator >= task.Interval) { task.Callback(&task); task.Accumulator -= task.Interval; } - Game_Tasks[i] = task; + tasks[i] = task; } } @@ -598,7 +598,7 @@ static void Game_RenderFrame(double delta) { } PerformScheduledTasks(delta); - entTask = Game_Tasks[entTaskI]; + entTask = tasks[entTaskI]; t = (float)(entTask.Accumulator / entTask.Interval); LocalPlayer_SetInterpPosition(t); diff --git a/src/Graphics.c b/src/Graphics.c index fb68e3c2a..4968ea705 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -878,7 +878,7 @@ void Gfx_LoadIdentityMatrix(MatrixType type) { #define d3d9_zN -10000.0f #define d3d9_zF 10000.0f void Gfx_CalcOrthoMatrix(float width, float height, struct Matrix* matrix) { - Matrix_OrthographicOffCenter(matrix, 0.0f, width, height, 0.0f, d3d9_zN, d3d9_zF); + Matrix_Orthographic(matrix, 0.0f, width, 0.0f, height, d3d9_zN, d3d9_zF); matrix->Row2.Z = 1.0f / (d3d9_zN - d3d9_zF); matrix->Row3.Z = d3d9_zN / (d3d9_zN - d3d9_zF); } @@ -1212,7 +1212,7 @@ void Gfx_SetDepthWrite(cc_bool enabled) { glDepthMask(enabled); } void Gfx_SetDepthTest(cc_bool enabled) { gl_Toggle(GL_DEPTH_TEST); } void Gfx_CalcOrthoMatrix(float width, float height, struct Matrix* matrix) { - Matrix_OrthographicOffCenter(matrix, 0.0f, width, height, 0.0f, -10000.0f, 10000.0f); + Matrix_Orthographic(matrix, 0.0f, width, 0.0f, height, -10000.0f, 10000.0f); } void Gfx_CalcPerspectiveMatrix(float fov, float aspect, float zNear, float zFar, struct Matrix* matrix) { Matrix_PerspectiveFieldOfView(matrix, fov, aspect, zNear, zFar); diff --git a/src/LWidgets.c b/src/LWidgets.c index a49695964..04da9b65a 100644 --- a/src/LWidgets.c +++ b/src/LWidgets.c @@ -314,8 +314,8 @@ static void LInput_TickCaret(void* widget) { cc_bool caretShow; Rect2D r; - elapsed = (int)(DateTime_CurrentUTC_MS() - caretStart); if (!caretStart) return; + elapsed = (int)(DateTime_CurrentUTC_MS() - caretStart); caretShow = (elapsed % 1000) < 500; if (caretShow == lastCaretShow) return; diff --git a/src/Vectors.c b/src/Vectors.c index 06520117d..74a1f66f7 100644 --- a/src/Vectors.c +++ b/src/Vectors.c @@ -166,11 +166,7 @@ void Matrix_Mul(struct Matrix* result, const struct Matrix* left, const struct M result->Row3.W = (((lM41 * rM14) + (lM42 * rM24)) + (lM43 * rM34)) + (lM44 * rM44); } -void Matrix_Orthographic(struct Matrix* result, float width, float height, float zNear, float zFar) { - Matrix_OrthographicOffCenter(result, -width * 0.5f, width * 0.5f, -height * 0.5f, height * 0.5f, zNear, zFar); -} - -void Matrix_OrthographicOffCenter(struct Matrix* result, float left, float right, float bottom, float top, float zNear, float zFar) { +void Matrix_Orthographic(struct Matrix* result, float left, float right, float top, float bottom, float zNear, float zFar) { /* Transposed, source https://msdn.microsoft.com/en-us/library/dd373965(v=vs.85).aspx */ *result = Matrix_Identity; diff --git a/src/Vectors.h b/src/Vectors.h index 105917256..83041a8c0 100644 --- a/src/Vectors.h +++ b/src/Vectors.h @@ -121,8 +121,7 @@ CC_API void Matrix_Scale(struct Matrix* result, float x, float y, float z); /* NOTE: result can be the same pointer as left or right. */ CC_API void Matrix_Mul(struct Matrix* result, const struct Matrix* left, const struct Matrix* right); -void Matrix_Orthographic(struct Matrix* result, float width, float height, float zNear, float zFar); -void Matrix_OrthographicOffCenter(struct Matrix* result, float left, float right, float bottom, float top, float zNear, float zFar); +void Matrix_Orthographic(struct Matrix* result, float left, float right, float top, float bottom, float zNear, float zFar); void Matrix_PerspectiveFieldOfView(struct Matrix* result, float fovy, float aspect, float zNear, float zFar); void Matrix_PerspectiveOffCenter(struct Matrix* result, float left, float right, float bottom, float top, float zNear, float zFar); void Matrix_LookRot(struct Matrix* result, Vec3 pos, Vec2 rot); diff --git a/src/Window.c b/src/Window.c index 07fdc4686..3e0d9b6e0 100644 --- a/src/Window.c +++ b/src/Window.c @@ -3667,7 +3667,7 @@ static const JNINativeMethod methods[18] = { void Window_Init(void) { JNIEnv* env; - /* TODO: ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN, 0); */ + /* TODO: ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN, 0); */ JavaGetCurrentEnv(env); JavaRegisterNatives(env, methods);