From 0f82ebde4a1b80853c3b8f9b161042c8c7365fc1 Mon Sep 17 00:00:00 2001 From: skyjake Date: Fri, 6 Aug 2004 20:41:30 +0000 Subject: [PATCH] Fixed ticcmd handling, removed non-smooth camera --- doomsday/Include/r_main.h | 1 - doomsday/Src/dd_loop.c | 8 +++++++- doomsday/Src/net_main.c | 29 +++++++---------------------- doomsday/Src/r_main.c | 28 ++++++++++++---------------- 4 files changed, 26 insertions(+), 40 deletions(-) diff --git a/doomsday/Include/r_main.h b/doomsday/Include/r_main.h index c7ed1e5486..84a17033fa 100644 --- a/doomsday/Include/r_main.h +++ b/doomsday/Include/r_main.h @@ -31,7 +31,6 @@ extern ddplayer_t *viewplayer; extern angle_t clipangle; extern fixed_t finetangent[FINEANGLES / 2]; -extern int rend_camera_smooth; extern float frameTimePos; // 0...1: fractional part for sharp game tics extern boolean resyncFrameTimePos; extern int loadInStartupMode; diff --git a/doomsday/Src/dd_loop.c b/doomsday/Src/dd_loop.c index a189353a0d..eaf2c2b43e 100644 --- a/doomsday/Src/dd_loop.c +++ b/doomsday/Src/dd_loop.c @@ -257,7 +257,7 @@ void DD_Ticker(timespan_t time) else Sv_Ticker( /* time */ ); - // This is needed by rend_camera_smooth. It needs to know + // This is needed by camera smoothing. It needs to know // when the world tic has occured so the next sharp // position can be processed. @@ -375,4 +375,10 @@ void DD_RunTics(void) // Various global variables are used for counting time. DD_AdvanceTime(ticLength); } + + // Clients send commands periodically, not on every frame. + if(!isClient) + { + Net_SendCommands(); + } } diff --git a/doomsday/Src/net_main.c b/doomsday/Src/net_main.c index af71d87e44..1dc153f1a1 100644 --- a/doomsday/Src/net_main.c +++ b/doomsday/Src/net_main.c @@ -372,10 +372,7 @@ void Net_SendCommands(void) // Therefore they need to send a combination of all the cmds built // during the wait period. - if(isClient) - cmd = clients[consoleplayer].aggregateCmd; - else - cmd = clients[consoleplayer].lastCmd; + cmd = clients[consoleplayer].aggregateCmd; // The game will pack the commands into a buffer. The returned // pointer points to a buffer that contains its size and the @@ -388,12 +385,9 @@ void Net_SendCommands(void) // Send the packet to the server, i.e. player zero. Net_SendBuffer(0, isClient ? 0 : SPF_REBOUND); - if(isClient) - { - // Clients will begin composing a new aggregate now that this - // one has been sent. - memset(cmd, 0, TICCMD_SIZE); - } + // Clients will begin composing a new aggregate now that this + // one has been sent. + memset(cmd, 0, TICCMD_SIZE); } /* @@ -523,18 +517,9 @@ void Net_BuildLocalCommands(timespan_t time) gx.BuildTicCmd(cmd, time); } - if(!isClient) - { - // Clients don't send commands too often (will be called from - // Cl_Ticker). - Net_SendCommands(); - } - else - { - // Be sure to merge each built command into the aggregate that - // will be sent periodically to the server. - gx.MergeTicCmd(clients[consoleplayer].aggregateCmd, cmd); - } + // Be sure to merge each built command into the aggregate that + // will be sent periodically to the server. + gx.MergeTicCmd(clients[consoleplayer].aggregateCmd, cmd); } //=========================================================================== diff --git a/doomsday/Src/r_main.c b/doomsday/Src/r_main.c index e2ad3d2f5b..af35139ac6 100644 --- a/doomsday/Src/r_main.c +++ b/doomsday/Src/r_main.c @@ -53,7 +53,6 @@ int viewangleoffset = 0; int validcount = 1; // increment every time a check is made int framecount; // just for profiling purposes int rend_info_tris = 0; -int rend_camera_smooth = true; // smoothed by default fixed_t viewx, viewy, viewz; float viewfrontvec[3], viewupvec[3], viewsidevec[3]; fixed_t viewxOffset = 0, viewyOffset = 0, viewzOffset = 0; @@ -77,6 +76,8 @@ int loadInStartupMode = true; // PRIVATE DATA DEFINITIONS ------------------------------------------------ +static int rend_camera_smooth = true; // smoothed by default + // These are used when camera smoothing is disabled. static angle_t frozenAngle = 0; static float frozenPitch = 0; @@ -104,8 +105,8 @@ void R_Register(void) C_VAR_BYTE("rend-info-frametime", &showFrameTimePos, 0, 0, 1, "1=Print frame time offsets."); - C_VAR_INT("rend-camera-smooth", &rend_camera_smooth, 0, 0, 1, - "1=Filter camera movement between game tics."); + C_VAR_INT("rend-camera-smooth", &rend_camera_smooth, CVF_HIDE, 0, 1, + "1=Filter camera movement between game tics (OBSOLETE)."); C_VAR_INT("bsp-build", &bspBuild, 0, 0, 1, "1=Build GL nodes when loading a map."); @@ -225,7 +226,7 @@ void R_Shutdown(void) //=========================================================================== void R_ResetViewer(void) { - resetNextViewer = true; + resetNextViewer = 1; } //=========================================================================== @@ -307,6 +308,9 @@ void R_NewSharpWorld(void) if(!viewplayer) return; + if(resetNextViewer) + resetNextViewer = 2; + R_GetSharpView(&sharpView, viewplayer); // Update the camera angles that will be used when the camera is @@ -369,21 +373,13 @@ void R_SetupFrame(ddplayer_t *player) viewplayer = player; R_GetSharpView(&sharpView, viewplayer); - // Camera smoothing is only enabled if the frame rate is above 35. - if(!rend_camera_smooth || resetNextViewer) + if(resetNextViewer) { - // Synchronize view angles to game updates. - if(resetNextViewer) - { - frozenAngle = sharpView.angle; - frozenPitch = sharpView.pitch; - } - - resetNextViewer = false; + // Keep reseting until a new sharp world has arrived. + if(resetNextViewer > 1) + resetNextViewer = 0; // Just view from the sharp position. - sharpView.angle = frozenAngle; - sharpView.pitch = frozenPitch; R_SetViewPos(&sharpView); memcpy(&lastSharpView[0], &sharpView, sizeof(sharpView));