mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 03:55:19 -04:00
for c port fix /tp crash, hotbar scroll not working, projection matrix being stuffed, entity movement looking laggy
This commit is contained in:
parent
102b9f8925
commit
bff9d3586a
@ -228,5 +228,10 @@ namespace OpenTK {
|
|||||||
return Row0 == other.Row0 && Row1 == other.Row1 &&
|
return Row0 == other.Row0 && Row1 == other.Row1 &&
|
||||||
Row2 == other.Row2 && Row3 == other.Row3;
|
Row2 == other.Row2 && Row3 == other.Row3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return string.Format("Row0={0},\r\n Row1={1},\r\n Row2={2},\r\n Row3={3}]", Row0, Row1, Row2, Row3);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ const UInt8* ShadowMode_Names[SHADOW_MODE_COUNT] = { "None", "SnapToBlock", "Cir
|
|||||||
*-----------------------------------------------------LocationUpdate------------------------------------------------------*
|
*-----------------------------------------------------LocationUpdate------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
Real32 LocationUpdate_Clamp(Real32 degrees) {
|
Real32 LocationUpdate_Clamp(Real32 degrees) {
|
||||||
|
if (degrees == MATH_POS_INF) return MATH_POS_INF;
|
||||||
degrees = Math_ModF(degrees, 360.0f);
|
degrees = Math_ModF(degrees, 360.0f);
|
||||||
if (degrees < 0) degrees += 360.0f;
|
if (degrees < 0) degrees += 360.0f;
|
||||||
return degrees;
|
return degrees;
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
IGameComponent Game_Components[26];
|
IGameComponent Game_Components[26];
|
||||||
Int32 Game_ComponentsCount;
|
Int32 Game_ComponentsCount;
|
||||||
ScheduledTask Game_Tasks[6];
|
ScheduledTask Game_Tasks[6];
|
||||||
Int32 Game_TasksCount;
|
Int32 Game_TasksCount, entTaskI;
|
||||||
|
|
||||||
UInt8 Game_UsernameBuffer[String_BufferSize(STRING_SIZE)];
|
UInt8 Game_UsernameBuffer[String_BufferSize(STRING_SIZE)];
|
||||||
extern String Game_Username = String_FromEmptyArray(Game_UsernameBuffer);
|
extern String Game_Username = String_FromEmptyArray(Game_UsernameBuffer);
|
||||||
@ -61,13 +61,13 @@ void Game_AddComponent(IGameComponent* comp) {
|
|||||||
Game_Components[Game_ComponentsCount++] = *comp;
|
Game_Components[Game_ComponentsCount++] = *comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduledTask ScheduledTask_Add(Real64 interval, ScheduledTaskCallback callback) {
|
Int32 ScheduledTask_Add(Real64 interval, ScheduledTaskCallback callback) {
|
||||||
ScheduledTask task = { 0.0, interval, callback };
|
ScheduledTask task = { 0.0, interval, callback };
|
||||||
if (Game_TasksCount == Array_Elems(Game_Tasks)) {
|
if (Game_TasksCount == Array_Elems(Game_Tasks)) {
|
||||||
ErrorHandler_Fail("ScheduledTask_Add - hit max count");
|
ErrorHandler_Fail("ScheduledTask_Add - hit max count");
|
||||||
}
|
}
|
||||||
Game_Tasks[Game_TasksCount++] = task;
|
Game_Tasks[Game_TasksCount++] = task;
|
||||||
return task;
|
return Game_TasksCount - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -390,14 +390,13 @@ void Game_LoadGuiOptions(void) {
|
|||||||
/* TODO: Handle Arial font not working */
|
/* TODO: Handle Arial font not working */
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduledTask entTask;
|
|
||||||
void Game_InitScheduledTasks(void) {
|
void Game_InitScheduledTasks(void) {
|
||||||
#define GAME_DEF_TICKS (1.0 / 20)
|
#define GAME_DEF_TICKS (1.0 / 20)
|
||||||
#define GAME_NET_TICKS (1.0 / 60)
|
#define GAME_NET_TICKS (1.0 / 60)
|
||||||
|
|
||||||
ScheduledTask_Add(30, AsyncDownloader_PurgeOldEntriesTask);
|
ScheduledTask_Add(30, AsyncDownloader_PurgeOldEntriesTask);
|
||||||
ScheduledTask_Add(GAME_NET_TICKS, ServerConnection_Tick);
|
ScheduledTask_Add(GAME_NET_TICKS, ServerConnection_Tick);
|
||||||
entTask = ScheduledTask_Add(GAME_DEF_TICKS, Entities_Tick);
|
entTaskI = ScheduledTask_Add(GAME_DEF_TICKS, Entities_Tick);
|
||||||
|
|
||||||
ScheduledTask_Add(GAME_DEF_TICKS, Particles_Tick);
|
ScheduledTask_Add(GAME_DEF_TICKS, Particles_Tick);
|
||||||
ScheduledTask_Add(GAME_DEF_TICKS, Animations_Tick);
|
ScheduledTask_Add(GAME_DEF_TICKS, Animations_Tick);
|
||||||
@ -672,6 +671,7 @@ void Game_RenderFrame(Real64 delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Game_DoScheduledTasks(delta);
|
Game_DoScheduledTasks(delta);
|
||||||
|
ScheduledTask entTask = Game_Tasks[entTaskI];
|
||||||
Real32 t = (Real32)(entTask.Accumulator / entTask.Interval);
|
Real32 t = (Real32)(entTask.Accumulator / entTask.Interval);
|
||||||
LocalPlayer_SetInterpPosition(t);
|
LocalPlayer_SetInterpPosition(t);
|
||||||
|
|
||||||
|
@ -35,5 +35,5 @@ typedef struct ScheduledTask_ {
|
|||||||
} ScheduledTask;
|
} ScheduledTask;
|
||||||
|
|
||||||
typedef void (*ScheduledTaskCallback)(ScheduledTask* task);
|
typedef void (*ScheduledTaskCallback)(ScheduledTask* task);
|
||||||
ScheduledTask ScheduledTask_Add(Real64 interval, ScheduledTaskCallback callback);
|
Int32 ScheduledTask_Add(Real64 interval, ScheduledTaskCallback callback);
|
||||||
#endif
|
#endif
|
@ -257,6 +257,7 @@ void Matrix_PerspectiveFieldOfView(Matrix* result, Real32 fovy, Real32 aspect, R
|
|||||||
void Matrix_PerspectiveOffCenter(Matrix* result, Real32 left, Real32 right, Real32 bottom, Real32 top, Real32 zNear, Real32 zFar) {
|
void Matrix_PerspectiveOffCenter(Matrix* result, Real32 left, Real32 right, Real32 bottom, Real32 top, Real32 zNear, Real32 zFar) {
|
||||||
/* Transposed, source https://msdn.microsoft.com/en-us/library/dd373537(v=vs.85).aspx */
|
/* Transposed, source https://msdn.microsoft.com/en-us/library/dd373537(v=vs.85).aspx */
|
||||||
*result = Matrix_Identity;
|
*result = Matrix_Identity;
|
||||||
|
result->Row3.W = 0.0f;
|
||||||
|
|
||||||
result->Row0.X = (2.0f * zNear) / (right - left);
|
result->Row0.X = (2.0f * zNear) / (right - left);
|
||||||
result->Row1.Y = (2.0f * zNear) / (top - bottom);
|
result->Row1.Y = (2.0f * zNear) / (top - bottom);
|
||||||
|
@ -293,7 +293,7 @@ LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPAR
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
wheel_delta = HIWORD(wParam) / (Real32)WHEEL_DELTA;
|
wheel_delta = ((short)HIWORD(wParam)) / (Real32)WHEEL_DELTA;
|
||||||
Mouse_SetWheel(Mouse_Wheel + wheel_delta);
|
Mouse_SetWheel(Mouse_Wheel + wheel_delta);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user